diff --git a/configure.ac b/configure.ac index 8dbf90482..235fb79b1 100644 --- a/configure.ac +++ b/configure.ac @@ -1,8 +1,6 @@ dnl Process this file with autoconf to produce a configure script. -dnl Keep this line, it is parsed by Android Makefile -LINPHONE_VERSION=3.5.2 -AC_INIT([linphone],[$LINPHONE_VERSION],[linphone-developers@nongnu.org]) +AC_INIT([linphone],[3.5.2],[linphone-developers@nongnu.org]) AC_CANONICAL_SYSTEM AC_CONFIG_SRCDIR([coreapi/linphonecore.c]) diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 81044fff5..a269bc476 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -474,6 +474,8 @@ const char *linphone_proxy_config_get_addr(const LinphoneProxyConfig *obj); int linphone_proxy_config_get_expires(const LinphoneProxyConfig *obj); bool_t linphone_proxy_config_register_enabled(const LinphoneProxyConfig *obj); void linphone_proxy_config_refresh_register(LinphoneProxyConfig *obj); +const char *linphone_proxy_config_get_contact_parameters(const LinphoneProxyConfig *obj); +void linphone_proxy_config_set_contact_parameters(LinphoneProxyConfig *obj, const char *contact_params); struct _LinphoneCore * linphone_proxy_config_get_core(const LinphoneProxyConfig *obj); bool_t linphone_proxy_config_get_dial_escape_plus(const LinphoneProxyConfig *cfg); diff --git a/coreapi/private.h b/coreapi/private.h index 1ab7a6a7d..bc035f215 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -270,6 +270,7 @@ struct _LinphoneProxyConfig char *reg_identity; char *reg_route; char *realm; + char *contact_params; int expires; int reg_time; SalOp *op; diff --git a/coreapi/proxy.c b/coreapi/proxy.c index 1676e0918..8e066ea33 100644 --- a/coreapi/proxy.c +++ b/coreapi/proxy.c @@ -256,9 +256,10 @@ static char *guess_contact_for_register(LinphoneProxyConfig *obj){ if (proxy==NULL) return NULL; host=linphone_address_get_domain (proxy); if (host!=NULL){ - LinphoneAddress *contact; char localip[LINPHONE_IPADDR_SIZE]; + char *tmp; LCSipTransports tr; + LinphoneAddress *contact; linphone_core_get_local_ip(obj->lc,host,localip); contact=linphone_address_new(obj->reg_identity); @@ -274,8 +275,12 @@ static char *guess_contact_for_register(LinphoneProxyConfig *obj){ sal_address_set_param(contact,"transport","tls"); } } - ret=linphone_address_as_string(contact); + tmp=linphone_address_as_string_uri_only(contact); + if (obj->contact_params) + ret=ms_strdup_printf("<%s;%s>",tmp,obj->contact_params); + else ret=ms_strdup_printf("<%s>",tmp); linphone_address_destroy(contact); + ms_free(tmp); } linphone_address_destroy (proxy); return ret; @@ -511,6 +516,31 @@ bool_t linphone_proxy_config_register_enabled(const LinphoneProxyConfig *obj){ return obj->reg_sendregister; } +/** + * Set optional contact parameters that will be added to the contact information sent in the registration. + * @param obj the proxy config object + * @param contact_params a string contaning the additional parameters in text form, like "myparam=something;myparam2=something_else" + * + * The main use case for this function is provide the proxy additional information regarding the user agent, like for example unique identifier or apple push id. + * As an example, the contact address in the SIP register sent will look like . +**/ +void linphone_proxy_config_set_contact_parameters(LinphoneProxyConfig *obj, const char *contact_params){ + if (obj->contact_params) { + ms_free(obj->contact_params); + obj->contact_params=NULL; + } + if (contact_params){ + obj->contact_params=ms_strdup(contact_params); + } +} + +/** + * Returns previously set contact parameters. +**/ +const char *linphone_proxy_config_get_contact_parameters(const LinphoneProxyConfig *obj){ + return obj->contact_params; +} + struct _LinphoneCore * linphone_proxy_config_get_core(const LinphoneProxyConfig *obj){ return obj->lc; }