From 6249c08862ef4699faf93733fbb4054cc331801f Mon Sep 17 00:00:00 2001 From: Guillaume BIENKOWSKI Date: Tue, 31 Mar 2015 10:54:04 +0200 Subject: [PATCH] Save primary contact when changed --- coreapi/linphonecore.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 7e606bd5f..93cf6dc01 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -1761,12 +1761,21 @@ int linphone_core_set_primary_contact(LinphoneCore *lc, const char *contact) { LinphoneAddress *ctt; + if( lc->sip_conf.contact != NULL && strcmp(lc->sip_conf.contact, contact) == 0){ + /* changing for the same contact: no need to do anything */ + return 0; + } + if ((ctt=linphone_address_new(contact))==0) { ms_error("Bad contact url: %s",contact); return -1; } + if (lc->sip_conf.contact!=NULL) ms_free(lc->sip_conf.contact); lc->sip_conf.contact=ms_strdup(contact); + lp_config_set_string(lc->config, "sip", "contact", lc->sip_conf.contact); + + /* clean the guessed contact, we have to regenerate it */ if (lc->sip_conf.guessed_contact!=NULL){ ms_free(lc->sip_conf.guessed_contact); lc->sip_conf.guessed_contact=NULL;