diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index e52bef3f7..e52fff00e 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -1671,9 +1671,10 @@ static void apply_user_agent(LinphoneCore *lc){ * * @ingroup misc **/ -void linphone_core_set_user_agent(const char *name, const char *ver){ +void linphone_core_set_user_agent(LinphoneCore *lc, const char *name, const char *ver){ strncpy(_ua_name,name,sizeof(_ua_name)-1); strncpy(_ua_version,ver,sizeof(_ua_version)); + apply_user_agent(lc); } const char *linphone_core_get_user_agent_name(void){ diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 17234a600..f1a9174c8 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -901,8 +901,6 @@ typedef void * (*LinphoneWaitingCallback)(struct _LinphoneCore *lc, void *contex void linphone_core_enable_logs(FILE *file); void linphone_core_enable_logs_with_cb(OrtpLogFunc logfunc); void linphone_core_disable_logs(void); -/*sets the user-agent string in sip messages, must be set before linphone_core_new() or linphone_core_init() */ -void linphone_core_set_user_agent(const char *ua_name, const char *version); const char *linphone_core_get_version(void); const char *linphone_core_get_user_agent_name(void); const char *linphone_core_get_user_agent_version(void); @@ -932,6 +930,9 @@ const char* linphone_core_get_device_identifier(const LinphoneCore *lc); #endif +/*sets the user-agent string in sip messages, ideally called just after linphone_core_new() or linphone_core_init() */ +void linphone_core_set_user_agent(LinphoneCore *lc, const char *ua_name, const char *version); + LinphoneAddress * linphone_core_interpret_url(LinphoneCore *lc, const char *url); LinphoneCall * linphone_core_invite(LinphoneCore *lc, const char *url); diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 99d46fb18..06188f411 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -2141,7 +2141,7 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_tunnelEnable(JNIEnv *env extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setUserAgent(JNIEnv *env,jobject thiz,jlong pCore, jstring name, jstring version){ const char* cname=env->GetStringUTFChars(name, NULL); const char* cversion=env->GetStringUTFChars(version, NULL); - linphone_core_set_user_agent(cname,cversion); + linphone_core_set_user_agent((LinphoneCore *)pCore,cname,cversion); env->ReleaseStringUTFChars(name, cname); env->ReleaseStringUTFChars(version, cversion); } diff --git a/gtk/main.c b/gtk/main.c index b773a5b7f..48bf27a08 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -239,8 +239,8 @@ static void linphone_gtk_init_liblinphone(const char *config_file, vtable.call_encryption_changed=linphone_gtk_call_encryption_changed; vtable.transfer_state_changed=linphone_gtk_transfer_state_changed; - linphone_core_set_user_agent("Linphone", LINPHONE_VERSION); the_core=linphone_core_new(&vtable,config_file,factory_config_file,NULL); + linphone_core_set_user_agent(the_core,"Linphone", LINPHONE_VERSION); linphone_core_set_waiting_callback(the_core,linphone_gtk_wait,NULL); linphone_core_set_zrtp_secrets_file(the_core,secrets_file); g_free(secrets_file);