authentication.c \
lpconfig.c \
chat.c \
-- general_state.c \
sipsetup.c \
siplogin.c \
address.c \
**/
struct _LinphoneCall;
typedef struct _LinphoneCall LinphoneCall;
- enum _LinphoneCallState;
+
+ typedef enum _LinphoneCallState{
+ LinphoneCallIdle,
+ LinphoneCallIncomingReceived,
+ LinphoneCallOutgoingInit,
+ LinphoneCallOutgoingProgress,
+ LinphoneCallOutgoingRinging,
+ LinphoneCallOutgoingEarlyMedia,
+ LinphoneCallConnected,
+ LinphoneCallStreamsRunning,
+ LinphoneCallPausing,
+ LinphoneCallPaused,
+ LinphoneCallResuming,
+ LinphoneCallRefered,
+ LinphoneCallError,
+ LinphoneCallEnd,
+ LinphoneCallPausedByRemote
+ } LinphoneCallState;
+
enum _LinphoneCallState linphone_call_get_state(const LinphoneCall *call);
bool_t linphone_call_asked_to_autoanswer(LinphoneCall *call);
LinphoneCallLog *linphone_call_get_call_log(const LinphoneCall *call);
const char *linphone_call_get_refer_to(const LinphoneCall *call);
bool_t linphone_call_has_transfer_pending(const LinphoneCall *call);
+ int linphone_call_get_duration(const LinphoneCall *call);
void *linphone_call_get_user_pointer(LinphoneCall *call);
void linphone_call_set_user_pointer(LinphoneCall *call, void *user_pointer);
void linphone_chat_room_set_user_data(LinphoneChatRoom *cr, void * ud);
void * linphone_chat_room_get_user_data(LinphoneChatRoom *cr);
- typedef enum _LinphoneCallState{
- LinphoneCallIdle,
- LinphoneCallIncomingReceived,
- LinphoneCallOutgoingInit,
- LinphoneCallOutgoingProgress,
- LinphoneCallOutgoingRinging,
- LinphoneCallOutgoingEarlyMedia,
- LinphoneCallConnected,
- LinphoneCallStreamsRunning,
- LinphoneCallPausing,
- LinphoneCallPaused,
- LinphoneCallResuming,
- LinphoneCallRefered,
- LinphoneCallError,
- LinphoneCallEnd,
- } LinphoneCallState;
-
typedef enum _LinphoneGlobalState{
LinphoneGlobalOff,
LinphoneGlobalStartup,
/**Call state notification callback prototype*/
typedef void (*LinphoneCallStateCb)(struct _LinphoneCore *lc, LinphoneCall *call, LinphoneCallState cstate, const char *message);
/**Registration state notification callback prototype*/
-typedef void (*LinphoneRegistrationStateCb)(struct _LinphoneCore *lc, LinphoneProxyConfig *cfg, LinphoneCallState cstate, const char *message);
+typedef void (*LinphoneRegistrationStateCb)(struct _LinphoneCore *lc, LinphoneProxyConfig *cfg, LinphoneRegistrationState cstate, const char *message);
/** Callback prototype */
typedef void (*ShowInterfaceCb)(struct _LinphoneCore *lc);
/** Callback prototype */
int linphone_core_pause_call(LinphoneCore *lc, LinphoneCall *call);
+ int linphone_core_pause_all_calls(LinphoneCore *lc);
+
int linphone_core_resume_call(LinphoneCore *lc, LinphoneCall *call);
LinphoneCall *linphone_core_get_call_by_remote_address(LinphoneCore *lc, const char *remote_address);
/* Set static picture to be used when "Static picture" is the video device */
int linphone_core_set_static_picture(LinphoneCore *lc, const char *path);
+ /* Set and get frame rate for static picture */
+ int linphone_core_set_static_picture_fps(LinphoneCore *lc, float fps);
+ float linphone_core_get_static_picture_fps(LinphoneCore *lc);
+
/*function to be used for eventually setting window decorations (icons, title...)*/
unsigned long linphone_core_get_native_video_window_id(const LinphoneCore *lc);
vTable.display_status = displayStatusCb;
vTable.display_message = displayMessageCb;
vTable.display_warning = displayMessageCb;
-- vTable.general_state = generalStateChange;
++ vTable.global_state_changed = globalStateChange;
++ vTable.registration_state_changed = registrationState;
++ vTable.call_state_changed = callState;
listernerClass = (jclass)env->NewGlobalRef(env->GetObjectClass( alistener));
/*displayStatus(LinphoneCore lc,String message);*/
displayStatusId = env->GetMethodID(listernerClass,"displayStatus","(Lorg/linphone/core/LinphoneCore;Ljava/lang/String;)V");
/*void generalState(LinphoneCore lc,int state); */
-- generalStateId = env->GetMethodID(listernerClass,"generalState","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneCore$GeneralState;Ljava/lang/String;)V");
++ globalStateId = env->GetMethodID(listernerClass,"globalState","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneCore$GlobalState;Ljava/lang/String;)V");
++ globalStateClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneCore$GlobalState"));
++ globalStateFromIntId = env->GetStaticMethodID(globalStateClass,"fromInt","(I)Lorg/linphone/core/LinphoneCore$GlobalState;");
++ /*registrationState(LinphoneCore lc, LinphoneProxyConfig cfg, LinphoneCore.RegistrationState cstate, String smessage);*/
++ registrationStateId = env->GetMethodID(listernerClass,"registrationState","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneProxyConfig;Lorg/linphone/core/LinphoneCore$RegistrationState;Ljava/lang/String;)V");
++ registrationStateClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneCore$RegistrationState"));
++ registrationStateFromIntId = env->GetStaticMethodID(registrationStateClass,"fromInt","(I)Lorg/linphone/core/LinphoneCore$RegistrationState;");
++ /*callState(LinphoneCore lc, LinphoneCall call, LinphoneCall.State cstate,String message);*/
++ callStateId = env->GetMethodID(listernerClass,"callState","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneCall;Lorg/linphone/core/LinphoneCall$State;Ljava/lang/String;)V");
++ callStateClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneCall$State"));
++ callStateFromIntId = env->GetStaticMethodID(callStateClass,"fromInt","(I)Lorg/linphone/core/LinphoneCall$State;");
++
++ proxyClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneProxyConfigImpl"));
++ proxyCtrId = env->GetMethodID(proxyClass,"<init>", "(J)V");
++
++ callClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneCallImpl"));
++ callCtrId = env->GetMethodID(callClass,"<init>", "(J)V");
-- generalStateClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneCore$GeneralState"));
-- generalStateFromIntId = env->GetStaticMethodID(generalStateClass,"fromInt","(I)Lorg/linphone/core/LinphoneCore$GeneralState;");
}
~LinphoneCoreData() {
jobject userdata;
jclass listernerClass;
-- jclass generalStateClass;
jmethodID displayStatusId;
-- jmethodID generalStateId;
-- jmethodID generalStateFromIntId;
++
++ jclass globalStateClass;
++ jmethodID globalStateId;
++ jmethodID globalStateFromIntId;
++
++ jclass registrationStateClass;
++ jmethodID registrationStateId;
++ jmethodID registrationStateFromIntId;
++
++ jclass callStateClass;
++ jmethodID callStateId;
++ jmethodID callStateFromIntId;
++
++ jclass proxyClass;
++ jmethodID proxyCtrId;
++
++ jclass callClass;
++ jmethodID callCtrId;
++
LinphoneCoreVTable vTable;
static void showInterfaceCb(LinphoneCore *lc) {
static void authInfoRequested(LinphoneCore *lc, const char *realm, const char *username) {
}
-- static void generalStateChange(LinphoneCore *lc, LinphoneGeneralState *gstate) {
++ static void globalStateChange(LinphoneCore *lc, LinphoneGlobalState gstate,const char* message) {
++ JNIEnv *env = 0;
++ jint result = jvm->AttachCurrentThread(&env,NULL);
++ if (result != 0) {
++ ms_error("cannot attach VM\n");
++ return;
++ }
++ LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_get_user_data(lc);
++ env->CallVoidMethod(lcData->listener
++ ,lcData->globalStateId
++ ,lcData->core
++ ,env->CallStaticObjectMethod(lcData->globalStateClass,lcData->globalStateFromIntId,gstate),
++ message ? env->NewStringUTF(message) : NULL);
++ }
++ static void registerStateChange(LinphoneCore *lc, LinphoneProxyConfig proxy,LinphoneRegistrationState state,const char* message) {
JNIEnv *env = 0;
jint result = jvm->AttachCurrentThread(&env,NULL);
if (result != 0) {
}
LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_get_user_data(lc);
env->CallVoidMethod(lcData->listener
-- ,lcData->generalStateId
++ ,lcData->registrationStateId
,lcData->core
-- ,env->CallStaticObjectMethod(lcData->generalStateClass,lcData->generalStateFromIntId,gstate->new_state),
-- gstate->message ? env->NewStringUTF(gstate->message) : NULL);
++ ,env->NewObject(proxyClass,proxyCtrId,proxy)
++ ,env->CallStaticObjectMethod(lcData->registrationStateClass,lcData->registrationStateFromIntId,state),
++ message ? env->NewStringUTF(message) : NULL);
}
++ static void callStateChange(LinphoneCore *lc, LinphoneCall call,LinphoneCallState *state,const char* message) {
++ JNIEnv *env = 0;
++ jint result = jvm->AttachCurrentThread(&env,NULL);
++ if (result != 0) {
++ ms_error("cannot attach VM\n");
++ return;
++ }
++ LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_get_user_data(lc);
++ env->CallVoidMethod(lcData->listener
++ ,lcData->callStateId
++ ,lcData->core
++ ,env->NewObject(callClass,callCtrId,call)
++ ,env->CallStaticObjectMethod(lcData->callStateClass,lcData->callStateFromIntId,state),
++ message ? env->NewStringUTF(message) : NULL);
++ }
++
};
extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_newLinphoneCore(JNIEnv* env
,jlong lc) {
linphone_core_iterate((LinphoneCore*)lc);
}
--extern "C" void Java_org_linphone_core_LinphoneCoreImpl_invite( JNIEnv* env
++extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_invite( JNIEnv* env
,jobject thiz
,jlong lc
,jstring juri) {
const char* uri = env->GetStringUTFChars(juri, NULL);
-- linphone_core_invite((LinphoneCore*)lc,uri);
++ LinphoneCall lCall = linphone_core_invite((LinphoneCore*)lc,uri);
env->ReleaseStringUTFChars(juri, uri);
++ return (jlong)lCall;
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_inviteAddress( JNIEnv* env
,jobject thiz
,jlong lc
,jlong to) {
-- linphone_core_invite_address((LinphoneCore*)lc,(LinphoneAddress*)to);
++ return (jlong) linphone_core_invite_address((LinphoneCore*)lc,(LinphoneAddress*)to);
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_terminateCall( JNIEnv* env
,jobject thiz
-- ,jlong lc) {
-- linphone_core_terminate_call((LinphoneCore*)lc,NULL);
++ ,jlong lc
++ ,jlong call) {
++ linphone_core_terminate_call((LinphoneCore*)lc,(LinphoneCall*)call);
}
extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_getRemoteAddress( JNIEnv* env
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_acceptCall( JNIEnv* env
,jobject thiz
-- ,jlong lc) {
++ ,jlong lc
++ ,jlong call) {
-- linphone_core_accept_call((LinphoneCore*)lc,NULL);
++ linphone_core_accept_call((LinphoneCore*)lc,(LinphoneCall*)call);
}
extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_getCallLog( JNIEnv* env
env->ReleaseStringUTFChars(jprefix, prefix);
}
++
//Auth Info
extern "C" jlong Java_org_linphone_core_LinphoneAuthInfoImpl_newLinphoneAuthInfo(JNIEnv* env
ms_free(value);
return jvalue;
}
++//LinphoneCall
++extern "C" void Java_org_linphone_core_LinphoneCallImpl_ref(JNIEnv* env
++ ,jobject thiz
++ ,jlong ptr) {
++ linphone_call_ref((LinphoneCall*)ptr);
++}
++
++extern "C" void Java_org_linphone_core_LinphoneCallImpl_unref(JNIEnv* env
++ ,jobject thiz
++ ,jlong ptr) {
++ linphone_call_unref((LinphoneCall*)ptr);
++}
++
++extern "C" jlong Java_org_linphone_core_LinphoneCallImpl_getCallLog( JNIEnv* env
++ ,jobject thiz
++ ,jlong ptr) {
++ return (jlong)linphone_call_get_call_log((LinphoneCall*)ptr);
++}
++
++extern "C" jboolean Java_org_linphone_core_LinphoneCallImpl_isIncoming( JNIEnv* env
++ ,jobject thiz
++ ,jlong ptr) {
++ return linphone_call_get_dir((LinphoneCall*)ptr)==LinphoneCallIncoming?JNI_TRUE:JNI_FALSE;
++}
++
++extern "C" jlong Java_org_linphone_core_LinphoneCallImpl_getRemoteAddress( JNIEnv* env
++ ,jobject thiz
++ ,jlong ptr) {
++ return (jlong)linphone_call_get_remote_address((LinphoneCall*)ptr);
++}
++
++extern "C" jint Java_org_linphone_core_LinphoneCallImpl_getState( JNIEnv* env
++ ,jobject thiz
++ ,jlong ptr) {
++ return (jint)linphone_call_get_state((LinphoneCall*)ptr);
++}
++
++
++
++
import java.util.Vector;
-
-
-
public interface LinphoneCore {
/*
* linphone core states
*/
- static public class GeneralState {
+ static public class GlobalState {
static private Vector values = new Vector();
- /* states for GSTATE_GROUP_POWER */
- static public GeneralState GSTATE_POWER_OFF = new GeneralState(0,"GSTATE_POWER_OFF"); /* initial state */
- static public GeneralState GSTATE_POWER_STARTUP = new GeneralState(1,"GSTATE_POWER_STARTUP");
- static public GeneralState GSTATE_POWER_ON = new GeneralState(2,"GSTATE_POWER_ON");
- static public GeneralState GSTATE_POWER_SHUTDOWN = new GeneralState(3,"GSTATE_POWER_SHUTDOWN");
- /* states for GSTATE_GROUP_REG */
- static public GeneralState GSTATE_REG_NONE = new GeneralState(10,"GSTATE_REG_NONE"); /* initial state */
- static public GeneralState GSTATE_REG_OK = new GeneralState(11,"GSTATE_REG_OK");
- static public GeneralState GSTATE_REG_FAILED = new GeneralState(12,"GSTATE_REG_FAILED");
- static public GeneralState GSTATE_REG_PENDING = new GeneralState(13,"GSTATE_REG_PENDING");
- /* states for GSTATE_GROUP_CALL */
- static public GeneralState GSTATE_CALL_IDLE = new GeneralState(20,"GSTATE_CALL_IDLE"); /* initial state */
- static public GeneralState GSTATE_CALL_OUT_INVITE = new GeneralState(21,"GSTATE_CALL_OUT_INVITE");
- static public GeneralState GSTATE_CALL_OUT_CONNECTED = new GeneralState(22,"GSTATE_CALL_OUT_CONNECTED");
- static public GeneralState GSTATE_CALL_IN_INVITE = new GeneralState(23,"GSTATE_CALL_IN_INVITE");
- static public GeneralState GSTATE_CALL_IN_CONNECTED = new GeneralState(24,"GSTATE_CALL_IN_CONNECTED");
- static public GeneralState GSTATE_CALL_END = new GeneralState(25,"GSTATE_CALL_END");
- static public GeneralState GSTATE_CALL_ERROR = new GeneralState(26,"GSTATE_CALL_ERROR");
- static public GeneralState GSTATE_INVALID = new GeneralState(27,"GSTATE_INVALID");
- static public GeneralState GSTATE_CALL_OUT_RINGING = new GeneralState(28,"GSTATE_CALL_OUT_RINGING");
+
+ static public GlobalState GlobalOff = new GlobalState(0,"GlobalOff");
+ static public GlobalState GlobalStartup = new GlobalState(1,"GlobalStartup");
+ static public GlobalState GlobalOn = new GlobalState(2,"GlobalOn");
+ static public GlobalState GlobalShutdown = new GlobalState(3,"GlobalShutdown");
+
private final int mValue;
private final String mStringValue;
- private GeneralState(int value,String stringValue) {
+ private GlobalState(int value,String stringValue) {
mValue = value;
values.addElement(this);
mStringValue=stringValue;
}
- public static GeneralState fromInt(int value) {
+ public static GlobalState fromInt(int value) {
for (int i=0; i<values.size();i++) {
- GeneralState state = (GeneralState) values.elementAt(i);
+ GlobalState state = (GlobalState) values.elementAt(i);
if (state.mValue == value) return state;
}
throw new RuntimeException("state not found ["+value+"]");
return mStringValue;
}
}
+ static public class RegistrationState {
+ static private Vector values = new Vector();
+ static public RegistrationState RegistrationNone = new RegistrationState(0,"RegistrationNone");
+ static public RegistrationState RegistrationProgress = new RegistrationState(1,"RegistrationProgress");
+ static public RegistrationState RegistrationOk = new RegistrationState(2,"RegistrationOk");
+ static public RegistrationState RegistrationCleared = new RegistrationState(3,"RegistrationCleared");
+ static public RegistrationState RegistrationFailed = new RegistrationState(4,"RegistrationFailed");
+ private final int mValue;
+ private final String mStringValue;
+
+ private RegistrationState(int value,String stringValue) {
+ mValue = value;
+ values.addElement(this);
+ mStringValue=stringValue;
+ }
+ public static RegistrationState fromInt(int value) {
+ for (int i=0; i<values.size();i++) {
+ RegistrationState state = (RegistrationState) values.elementAt(i);
+ if (state.mValue == value) return state;
+ }
+ throw new RuntimeException("state not found ["+value+"]");
+ }
+ public String toString() {
+ return mStringValue;
+ }
+ }
static public class Transport {
public final static Transport udp =new Transport("udp");
public final static Transport tcp =new Transport("tcp");
* Starts a call given a destination. Internally calls interpretUrl() then invite(LinphoneAddress).
* @param uri
*/
- public void invite(String destination)throws LinphoneCoreException;
+ public LinphoneCall invite(String destination)throws LinphoneCoreException;
- public void invite(LinphoneAddress to)throws LinphoneCoreException;
+ public LinphoneCall invite(LinphoneAddress to)throws LinphoneCoreException;
+
+ public void terminateCall(LinphoneCall aCall);
+ /**
+ * Returns The LinphoneCall the current call if one is in call
+ *
+ **/
+ public LinphoneCall getCurrentCall();
- public void terminateCall();
/**
* get the remote address in case of in/out call
* @return null if no call engaged yet
* this method.
* @throws LinphoneCoreException
*/
- public void acceptCall() throws LinphoneCoreException;
+ public void acceptCall(LinphoneCall aCall) throws LinphoneCoreException;
/**
public boolean isEchoCancellationEnabled();
public void setSignalingTransport(Transport aTransport);
+
+ public void enableSpeaker(boolean value);
+
+ public boolean isSpeakerEnabled();
}