test outgoing calls

This commit is contained in:
Jehan Monnier 2010-01-27 17:49:01 +01:00
parent 135fac65cf
commit b99a653219
3 changed files with 37 additions and 27 deletions

View file

@ -24,30 +24,37 @@ public interface LinphoneCore {
/*
* linphone core states
*/
interface GeneralState {
public enum GeneralState {
/* states for GSTATE_GROUP_POWER */
static int GSTATE_POWER_OFF =0; /* initial state */
static int GSTATE_POWER_STARTUP=1;
static int GSTATE_POWER_ON=2;
static int GSTATE_POWER_SHUTDOWN=3;
GSTATE_POWER_OFF(0), /* initial state */
GSTATE_POWER_STARTUP(1),
GSTATE_POWER_ON(2),
GSTATE_POWER_SHUTDOWN(3),
/* states for GSTATE_GROUP_REG */
static int GSTATE_REG_NONE=10; /* initial state */
static int GSTATE_REG_OK=11;
static int GSTATE_REG_FAILED=12;
GSTATE_REG_NONE(10), /* initial state */
GSTATE_REG_OK(11),
GSTATE_REG_FAILED(12),
/* states for GSTATE_GROUP_CALL */
static int GSTATE_CALL_IDLE=20; /* initial state */
static int GSTATE_CALL_OUT_INVITE=21;
static int GSTATE_CALL_OUT_CONNECTED=22;
static int GSTATE_CALL_IN_INVITE=23;
static int GSTATE_CALL_IN_CONNECTED=24;
static int GSTATE_CALL_END=25;
static int GSTATE_CALL_ERROR=26;
static int GSTATE_INVALID=27;
/**
* get new state {@link: }
*/
public int getNewState();
}
GSTATE_CALL_IDLE(20), /* initial state */
GSTATE_CALL_OUT_INVITE(21),
GSTATE_CALL_OUT_CONNECTED(22),
GSTATE_CALL_IN_INVITE(23),
GSTATE_CALL_IN_CONNECTED(24),
GSTATE_CALL_END(25),
GSTATE_CALL_ERROR(26),
GSTATE_INVALID(27);
private final int mValue;
GeneralState(int value) {
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);
public void invite(String url);
public void invite(String uri);
public void iterate();
}

View file

@ -31,6 +31,7 @@ class LinphoneCoreImpl implements LinphoneCore {
private native void setDefaultProxyConfig(long nativePtr,long proxyCfgNativePtr);
private native int addProxyConfig(long nativePtr,long proxyCfgNativePtr);
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 {
mListener=listener;
nativePtr = newLinphoneCore(listener,userConfig.getCanonicalPath(),factoryConfig.getCanonicalPath(),userdata);
@ -48,8 +49,8 @@ class LinphoneCoreImpl implements LinphoneCore {
throw new RuntimeException("not implemenetd yet");
}
public void invite(String url) {
throw new RuntimeException("not implemenetd yet");
public void invite(String uri) {
invite(nativePtr,uri);
}
public void iterate() {

View file

@ -36,14 +36,16 @@ public interface LinphoneCoreListener {
public void authInfoRequested(LinphoneCore lc,String realm,String username);
/**< Callback that notifies various events with human readable text.
* @return */
public void displayStatus(LinphoneCore lc,String message);;
public void displayStatus(LinphoneCore lc,String message);
/**< Callback to display a message to the user
* @return */
public void displayMessage(LinphoneCore lc,String message);
/** Callback to display a warning to the user
* @return */
public void displayWarning(LinphoneCore lc,String message);
/**< State notification callback
* @return */
/** State notification callback
* @param state LinphoneCore.GeneralState
* @return
* */
public void generalState(LinphoneCore lc,LinphoneCore.GeneralState state);
}