diff options
author | Nanang Izzuddin <nanang@teluu.com> | 2012-05-17 08:04:58 +0000 |
---|---|---|
committer | Nanang Izzuddin <nanang@teluu.com> | 2012-05-17 08:04:58 +0000 |
commit | f6002b63eb3f61b5624519b944c9d59585b08ecb (patch) | |
tree | c01c5f787c3e2234906c87f6979fc1b150ba475e /pjsip | |
parent | 1822736dddc222b7474a069d5b50ca80a3b2fad2 (diff) |
Fix #1505: pjsua_acc_modify() performs unregistration first when account id, registrar, or forced contact is modified.
git-svn-id: http://svn.pjsip.org/repos/pjproject/branches/1.x@4127 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip')
-rw-r--r-- | pjsip/src/pjsua-lib/pjsua_acc.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/pjsip/src/pjsua-lib/pjsua_acc.c b/pjsip/src/pjsua-lib/pjsua_acc.c index 441e0825..6888e3fd 100644 --- a/pjsip/src/pjsua-lib/pjsua_acc.c +++ b/pjsip/src/pjsua-lib/pjsua_acc.c @@ -650,6 +650,7 @@ PJ_DEF(pj_status_t) pjsua_acc_modify( pjsua_acc_id acc_id, pjsip_route_hdr local_route; pj_str_t acc_proxy[PJSUA_ACC_MAX_PROXIES]; pj_bool_t update_reg = PJ_FALSE; + pj_bool_t unreg_first = PJ_FALSE; pj_status_t status = PJ_SUCCESS; PJ_ASSERT_RETURN(acc_id>=0 && acc_id<(int)PJ_ARRAY_SIZE(pjsua_var.acc), @@ -774,6 +775,7 @@ PJ_DEF(pj_status_t) pjsua_acc_modify( pjsua_acc_id acc_id, pj_strdup_with_null(acc->pool, &acc->srv_domain, &id_sip_uri->host); acc->srv_port = 0; update_reg = PJ_TRUE; + unreg_first = PJ_TRUE; } /* User data */ @@ -828,6 +830,7 @@ PJ_DEF(pj_status_t) pjsua_acc_modify( pjsua_acc_id acc_id, pj_strdup_with_null(acc->pool, &acc->cfg.force_contact, &cfg->force_contact); update_reg = PJ_TRUE; + unreg_first = PJ_TRUE; } /* Contact param */ @@ -1072,6 +1075,7 @@ PJ_DEF(pj_status_t) pjsua_acc_modify( pjsua_acc_id acc_id, pj_bzero(&acc->cfg.reg_uri, sizeof(acc->cfg.reg_uri)); } update_reg = PJ_TRUE; + unreg_first = PJ_TRUE; } /* SIP outbound setting */ @@ -1082,6 +1086,16 @@ PJ_DEF(pj_status_t) pjsua_acc_modify( pjsua_acc_id acc_id, update_reg = PJ_TRUE; } + /* Unregister first */ + if (unreg_first) { + pjsua_acc_set_registration(acc->index, PJ_FALSE); + if (acc->regc != NULL) { + pjsip_regc_destroy(acc->regc); + acc->regc = NULL; + acc->contact.slen = 0; + } + } + /* Update registration */ if (update_reg) { /* If accounts has registration enabled, start registration */ |