test outgoing calls
This commit is contained in:
parent
63a6a2715d
commit
a5a1673ff9
5 changed files with 63 additions and 40 deletions
|
@ -22,9 +22,11 @@ video_jitt_comp=60
|
||||||
nortp_timeout=30
|
nortp_timeout=30
|
||||||
|
|
||||||
[sound]
|
[sound]
|
||||||
playback_dev_id=AU: Audio Unit
|
playback_dev_id=ANDROID SND: Android Sound card
|
||||||
ringer_dev_id=AU: Audio Unit
|
ringer_dev_id=ANDROID SND: Android Sound card
|
||||||
capture_dev_id=AU: Audio Unit
|
capture_dev_id=ANDROID SND: Android Sound card
|
||||||
|
remote_ring=/data/data/org.linphone/files/ringback.wav
|
||||||
|
local_ring=/data/data/org.linphone/files/oldphone_mono.wav
|
||||||
|
|
||||||
[audio_codec_0]
|
[audio_codec_0]
|
||||||
mime=speex
|
mime=speex
|
||||||
|
@ -39,7 +41,7 @@ enabled=0
|
||||||
[audio_codec_2]
|
[audio_codec_2]
|
||||||
mime=speex
|
mime=speex
|
||||||
rate=8000
|
rate=8000
|
||||||
enabled=0
|
enabled=1
|
||||||
|
|
||||||
[audio_codec_3]
|
[audio_codec_3]
|
||||||
mime=GSM
|
mime=GSM
|
||||||
|
@ -54,7 +56,7 @@ enabled=0
|
||||||
[audio_codec_5]
|
[audio_codec_5]
|
||||||
mime=GSM
|
mime=GSM
|
||||||
rate=8000
|
rate=8000
|
||||||
enabled=0
|
enabled=1
|
||||||
|
|
||||||
[audio_codec_6]
|
[audio_codec_6]
|
||||||
mime=PCMU
|
mime=PCMU
|
||||||
|
|
|
@ -26,7 +26,8 @@ public class Linphone extends Activity implements LinphoneCoreListener {
|
||||||
/** Called when the activity is first created. */
|
/** Called when the activity is first created. */
|
||||||
private static String LINPHONE_FACTORY_RC = "/data/data/org.linphone/files/linphonerc";
|
private static String LINPHONE_FACTORY_RC = "/data/data/org.linphone/files/linphonerc";
|
||||||
private static String LINPHONE_RC = "/data/data/org.linphone/files/.linphonerc";
|
private static String LINPHONE_RC = "/data/data/org.linphone/files/.linphonerc";
|
||||||
private static String RINGBACK_SND = "/data/data/org.linphone/files/oldphone_mono.wav";
|
private static String RING_SND = "/data/data/org.linphone/files/oldphone_mono.wav";
|
||||||
|
private static String RINGBACK_SND = "/data/data/org.linphone/files/ringback.wav";
|
||||||
|
|
||||||
private LinphoneCore mLinphoneCore;
|
private LinphoneCore mLinphoneCore;
|
||||||
private LinphoneProxyConfig mProxyConfig;
|
private LinphoneProxyConfig mProxyConfig;
|
||||||
|
@ -62,13 +63,17 @@ public class Linphone extends Activity implements LinphoneCoreListener {
|
||||||
|
|
||||||
};
|
};
|
||||||
mTimer.scheduleAtFixedRate(lTask, 0, 100);
|
mTimer.scheduleAtFixedRate(lTask, 0, 100);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(TAG,"Cannot start linphone",e);
|
Log.e(TAG,"Cannot start linphone",e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public void copyAssetsFromPackage() throws IOException {
|
public void copyAssetsFromPackage() throws IOException {
|
||||||
copyIfNotExist(R.raw.oldphone_mono,RINGBACK_SND);
|
copyIfNotExist(R.raw.oldphone_mono,RING_SND);
|
||||||
|
copyIfNotExist(R.raw.ringback,RINGBACK_SND);
|
||||||
copyIfNotExist(R.raw.linphonerc,LINPHONE_FACTORY_RC);
|
copyIfNotExist(R.raw.linphonerc,LINPHONE_FACTORY_RC);
|
||||||
}
|
}
|
||||||
private void copyIfNotExist(int ressourceId,String target) throws IOException {
|
private void copyIfNotExist(int ressourceId,String target) throws IOException {
|
||||||
|
@ -100,15 +105,21 @@ public class Linphone extends Activity implements LinphoneCoreListener {
|
||||||
|
|
||||||
}
|
}
|
||||||
public void displayStatus(LinphoneCore lc, String message) {
|
public void displayStatus(LinphoneCore lc, String message) {
|
||||||
// TODO Auto-generated method stub
|
Log.i(TAG, message);
|
||||||
|
|
||||||
}
|
}
|
||||||
public void displayWarning(LinphoneCore lc, String message) {
|
public void displayWarning(LinphoneCore lc, String message) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
public void generalState(LinphoneCore lc, GeneralState state) {
|
public void generalState(LinphoneCore lc, LinphoneCore.GeneralState state) {
|
||||||
// TODO Auto-generated method stub
|
Log.i(TAG, "new state ["+state+"]");
|
||||||
|
|
||||||
|
switch(state) {
|
||||||
|
case GSTATE_REG_OK: {
|
||||||
|
mLinphoneCore.invite("simon.morlat");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public void inviteReceived(LinphoneCore lc, String from) {
|
public void inviteReceived(LinphoneCore lc, String from) {
|
||||||
|
|
|
@ -24,30 +24,37 @@ public interface LinphoneCore {
|
||||||
/*
|
/*
|
||||||
* linphone core states
|
* linphone core states
|
||||||
*/
|
*/
|
||||||
interface GeneralState {
|
public enum GeneralState {
|
||||||
/* states for GSTATE_GROUP_POWER */
|
/* states for GSTATE_GROUP_POWER */
|
||||||
static int GSTATE_POWER_OFF =0; /* initial state */
|
GSTATE_POWER_OFF(0), /* initial state */
|
||||||
static int GSTATE_POWER_STARTUP=1;
|
GSTATE_POWER_STARTUP(1),
|
||||||
static int GSTATE_POWER_ON=2;
|
GSTATE_POWER_ON(2),
|
||||||
static int GSTATE_POWER_SHUTDOWN=3;
|
GSTATE_POWER_SHUTDOWN(3),
|
||||||
/* states for GSTATE_GROUP_REG */
|
/* states for GSTATE_GROUP_REG */
|
||||||
static int GSTATE_REG_NONE=10; /* initial state */
|
GSTATE_REG_NONE(10), /* initial state */
|
||||||
static int GSTATE_REG_OK=11;
|
GSTATE_REG_OK(11),
|
||||||
static int GSTATE_REG_FAILED=12;
|
GSTATE_REG_FAILED(12),
|
||||||
/* states for GSTATE_GROUP_CALL */
|
/* states for GSTATE_GROUP_CALL */
|
||||||
static int GSTATE_CALL_IDLE=20; /* initial state */
|
GSTATE_CALL_IDLE(20), /* initial state */
|
||||||
static int GSTATE_CALL_OUT_INVITE=21;
|
GSTATE_CALL_OUT_INVITE(21),
|
||||||
static int GSTATE_CALL_OUT_CONNECTED=22;
|
GSTATE_CALL_OUT_CONNECTED(22),
|
||||||
static int GSTATE_CALL_IN_INVITE=23;
|
GSTATE_CALL_IN_INVITE(23),
|
||||||
static int GSTATE_CALL_IN_CONNECTED=24;
|
GSTATE_CALL_IN_CONNECTED(24),
|
||||||
static int GSTATE_CALL_END=25;
|
GSTATE_CALL_END(25),
|
||||||
static int GSTATE_CALL_ERROR=26;
|
GSTATE_CALL_ERROR(26),
|
||||||
static int GSTATE_INVALID=27;
|
GSTATE_INVALID(27);
|
||||||
/**
|
private final int mValue;
|
||||||
* get new state {@link: }
|
|
||||||
*/
|
GeneralState(int value) {
|
||||||
public int getNewState();
|
mValue = value;
|
||||||
}
|
}
|
||||||
|
public static GeneralState fromInt(int value) {
|
||||||
|
for (GeneralState state: GeneralState.values()) {
|
||||||
|
if (state.mValue == value) return state;
|
||||||
|
}
|
||||||
|
throw new RuntimeException("sate not found ["+value+"]");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -69,7 +76,7 @@ public interface LinphoneCore {
|
||||||
|
|
||||||
void addAuthInfo(LinphoneAuthInfo info);
|
void addAuthInfo(LinphoneAuthInfo info);
|
||||||
|
|
||||||
public void invite(String url);
|
public void invite(String uri);
|
||||||
|
|
||||||
public void iterate();
|
public void iterate();
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@ class LinphoneCoreImpl implements LinphoneCore {
|
||||||
private native void setDefaultProxyConfig(long nativePtr,long proxyCfgNativePtr);
|
private native void setDefaultProxyConfig(long nativePtr,long proxyCfgNativePtr);
|
||||||
private native int addProxyConfig(long nativePtr,long proxyCfgNativePtr);
|
private native int addProxyConfig(long nativePtr,long proxyCfgNativePtr);
|
||||||
private native void addAuthInfo(long nativePtr,long authInfoNativePtr);
|
private native void addAuthInfo(long nativePtr,long authInfoNativePtr);
|
||||||
|
private native void invite(long nativePtr,String uri);
|
||||||
LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException {
|
LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException {
|
||||||
mListener=listener;
|
mListener=listener;
|
||||||
nativePtr = newLinphoneCore(listener,userConfig.getCanonicalPath(),factoryConfig.getCanonicalPath(),userdata);
|
nativePtr = newLinphoneCore(listener,userConfig.getCanonicalPath(),factoryConfig.getCanonicalPath(),userdata);
|
||||||
|
@ -48,8 +49,8 @@ class LinphoneCoreImpl implements LinphoneCore {
|
||||||
throw new RuntimeException("not implemenetd yet");
|
throw new RuntimeException("not implemenetd yet");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void invite(String url) {
|
public void invite(String uri) {
|
||||||
throw new RuntimeException("not implemenetd yet");
|
invite(nativePtr,uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void iterate() {
|
public void iterate() {
|
||||||
|
|
|
@ -36,14 +36,16 @@ public interface LinphoneCoreListener {
|
||||||
public void authInfoRequested(LinphoneCore lc,String realm,String username);
|
public void authInfoRequested(LinphoneCore lc,String realm,String username);
|
||||||
/**< Callback that notifies various events with human readable text.
|
/**< Callback that notifies various events with human readable text.
|
||||||
* @return */
|
* @return */
|
||||||
public void displayStatus(LinphoneCore lc,String message);;
|
public void displayStatus(LinphoneCore lc,String message);
|
||||||
/**< Callback to display a message to the user
|
/**< Callback to display a message to the user
|
||||||
* @return */
|
* @return */
|
||||||
public void displayMessage(LinphoneCore lc,String message);
|
public void displayMessage(LinphoneCore lc,String message);
|
||||||
/** Callback to display a warning to the user
|
/** Callback to display a warning to the user
|
||||||
* @return */
|
* @return */
|
||||||
public void displayWarning(LinphoneCore lc,String message);
|
public void displayWarning(LinphoneCore lc,String message);
|
||||||
/**< State notification callback
|
/** State notification callback
|
||||||
* @return */
|
* @param state LinphoneCore.GeneralState
|
||||||
|
* @return
|
||||||
|
* */
|
||||||
public void generalState(LinphoneCore lc,LinphoneCore.GeneralState state);
|
public void generalState(LinphoneCore lc,LinphoneCore.GeneralState state);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue