]> sjero.net Git - linphone/commitdiff
Function linphone_core_find_call_from_uri().
authorGuillaume Beraudo <guillaume.beraudo@linphone.org>
Fri, 30 Sep 2011 10:18:16 +0000 (12:18 +0200)
committerGuillaume Beraudo <guillaume.beraudo@linphone.org>
Fri, 30 Sep 2011 10:18:16 +0000 (12:18 +0200)
coreapi/linphonecore.c
coreapi/linphonecore.h
coreapi/linphonecore_jni.cc
coreapi/sal_eXosip2.c
java/common/org/linphone/core/LinphoneCore.java

index a22959a180558ae130da1bf5b6176f88451004af..cce64048ee8d1facb5b68b6073c8f10cc13e502d 100644 (file)
@@ -4328,3 +4328,22 @@ void linphone_core_set_zrtp_secrets_file(LinphoneCore *lc, const char* file){
        }
        lc->zrtp_secrets_cache=file ? ms_strdup(file) : NULL;
 }
+
+//                             if (stringUri.equals(call.getRemoteAddress().asStringUriOnly())) {
+const LinphoneCall* linphone_core_find_call_from_uri(LinphoneCore *lc, const char *uri) {
+       if (uri == NULL) return NULL;
+       MSList *calls=lc->calls;
+       while(calls) {
+               const LinphoneCall *c=(LinphoneCall*)calls->data;
+               calls=calls->next;
+               const LinphoneAddress *address = linphone_call_get_remote_address(c);
+               char *current_uri=linphone_address_as_string_uri_only(address);
+               if (strcmp(uri,current_uri)==0) {
+                       ms_free(current_uri);
+                       return c;
+               } else {
+                       ms_free(current_uri);
+               }
+       }
+       return NULL;
+}
index bdd6b06d64ea429ec99b50cfb0f1e32dfc3e7b7f..368746cda3cb783126fef2ea3f6eea0dd5f2e4a9 100644 (file)
@@ -1017,6 +1017,8 @@ bool_t linphone_call_are_all_streams_encrypted(LinphoneCall *call);
 const char* linphone_call_get_authentication_token(LinphoneCall *call);
 bool_t linphone_call_get_authentication_token_verified(LinphoneCall *call);
 
+const LinphoneCall* linphone_core_find_call_from_uri(LinphoneCore *lc, const char *uri);
+
 int linphone_core_add_to_conference(LinphoneCore *lc, LinphoneCall *call);
 int linphone_core_add_all_to_conference(LinphoneCore *lc);
 int linphone_core_remove_from_conference(LinphoneCore *lc, LinphoneCall *call);
index cc15d5d44440fcdd4fffe41f88d205fd8336c008..b6c7ca47cac4ab8736b54d80049f873083ffd85a 100644 (file)
@@ -1420,6 +1420,14 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setZrtpSecretsCache(JNIE
        }
 }
 
+extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_findCallFromUri(JNIEnv *env,jobject thiz,jlong pCore, jstring jUri) {
+       const char* cUri=env->GetStringUTFChars(jUri, NULL);
+       const LinphoneCall *call=linphone_core_find_call_from_uri((LinphoneCore *) pCore,cUri);
+       env->ReleaseStringUTFChars(jUri, cUri);
+       return (jlong) call;
+}
+
+
 extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_setVideoDevice(JNIEnv *env,jobject thiz,jlong pCore,jint id) {
        LinphoneCore* lc = (LinphoneCore *) pCore;
        const char** devices = linphone_core_get_video_devices(lc);
index 8486d7e96f38c605be3bcf71a262caf36469220a..5b9500509538313bbd43750521ac442cf2bb97bc 100644 (file)
@@ -761,7 +761,7 @@ int sal_call_refer_with_replaces(SalOp *h, SalOp *other_call_h){
 }
 
 SalOp *sal_call_get_replaces(SalOp *h){
-       if (h->replaces!=NULL){
+       if (h!=NULL && h->replaces!=NULL){
                int cid;
                eXosip_lock();
                cid=eXosip_call_find_by_replaces(h->replaces);
index 14ffb29a6b708146a4811582c4c8ea3b446f6538..aef993ea055ca9d2c9f501582851c6094d3a99ff 100644 (file)
@@ -619,4 +619,6 @@ public interface LinphoneCore {
 
        void transferCall(LinphoneCall call, String referTo);
        void transferCallToAnother(LinphoneCall callToTransfer, LinphoneCall destination);
+
+       LinphoneCall findCallFromUri(String uri);
 }