summaryrefslogtreecommitdiff
path: root/pjsip
diff options
context:
space:
mode:
authorNanang Izzuddin <nanang@teluu.com>2012-05-17 08:35:51 +0000
committerNanang Izzuddin <nanang@teluu.com>2012-05-17 08:35:51 +0000
commit0949cd759f5e4848f692a21d3b04f75f84ba6e24 (patch)
treec495d485dccbe3f9c3def130532b24b2343bf802 /pjsip
parent13a34ab336d0c21b8c054db2a0ed0626182c5837 (diff)
Re #1509: backported r4122-r4129.
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@4130 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip')
-rw-r--r--pjsip/src/pjsua-lib/pjsua_acc.c14
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 e609fe7d..9cdbe953 100644
--- a/pjsip/src/pjsua-lib/pjsua_acc.c
+++ b/pjsip/src/pjsua-lib/pjsua_acc.c
@@ -675,6 +675,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),
@@ -802,6 +803,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 */
@@ -856,6 +858,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 */
@@ -1100,6 +1103,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 */
@@ -1110,6 +1114,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 */