[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Linphone-developers] Android dev
From: |
Benoit Jouanigo |
Subject: |
[Linphone-developers] Android dev |
Date: |
Tue, 2 Jun 2015 17:45:20 +0200 |
Hi
I follow source code of linphone to create my application and I need your help.
Currently I create a instance of LinphoneCore by calling at
LinphoneCoreFactory.instance().createLinphoneCore(this, context);
After that I call my method « registration » for add registration information
to connect on my SIP server.
Then I start the main loop with method startLibLinphone(Context c)
But when I launch my application, linphone doesn’t register with the server, do
you know why?
This is my code in case it could be usefull:
protected LinphoneManager(Context context) {
mContext = context;
try {
mLc = LinphoneCoreFactory.instance().createLinphoneCore(this, context);
registration("address@hidden", "password");
} catch (LinphoneCoreException lce) {
Log.e(TAG, "Impossible to create LinphoneCore: ", lce);
}
}
public synchronized static final LinphoneManager createAndStart(Context
context) {
if (instance != null) {
Log.e(TAG, "Linphone Manager is already initialized");
return null;
}
instance = new LinphoneManager(context);
instance.startLibLinphone(context);
return instance;
}
public static synchronized final LinphoneManager getInstance() {
if (instance != null) {
return instance;
}
return null;
}
public static synchronized final LinphoneCore getLc() {
return getInstance().mLc;
}
private synchronized void startLibLinphone(Context c) {
try {
boolean isDebugLogEnabled = true;
LinphoneCoreFactory.instance().setDebugMode(isDebugLogEnabled,
"LibLinphone");
} catch (Exception lce) {
Log.e(TAG, "Cannot start LibLinphone", lce);
}
TimerTask lTask = new TimerTask() {
@Override
public void run() {
UIThreadDispatcher.dispatch(new Runnable() {
@Override
public void run() {
if (mLc != null) {
mLc.iterate();
}
}
});
}
};
mTimer = new Timer("Linphone scheduler");
mTimer.schedule(lTask, 0, 20);
}
public void registration(String sipAddress, String password) {
try {
LinphoneCoreFactory lcFactory = LinphoneCoreFactory.instance();
LinphoneAddress address = lcFactory.createLinphoneAddress(sipAddress);
String username = address.getUserName();
String domain = address.getDomain();
if (password != null) {
mLc.addAuthInfo(lcFactory.createAuthInfo(username, password, null,
domain));
}
LinphoneProxyConfig proxyCfg = mLc.createProxyConfig(sipAddress,
domain, null, true);
proxyCfg.setExpires(2000);
mLc.addProxyConfig(proxyCfg);
mLc.setDefaultProxyConfig(proxyCfg);
} catch (LinphoneCoreException lce) {}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Linphone-developers] Android dev,
Benoit Jouanigo <=