summaryrefslogtreecommitdiff
path: root/pjsip
diff options
context:
space:
mode:
authorNanang Izzuddin <nanang@teluu.com>2014-10-27 07:36:08 +0000
committerNanang Izzuddin <nanang@teluu.com>2014-10-27 07:36:08 +0000
commit215516db90564f0f40675d7e8b0bdeead4866022 (patch)
treed3396a638aaad80894d9f0936194d5277eb46c55 /pjsip
parentf190165c8f0660bb483d007996021f029b9931cb (diff)
Fix #1801:
- put error check in re-registration attempt in pjsua_acc_modify(), - updated pjsua_acc_modify() docs about its behavior regarding unregistration and re-registration. git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@4955 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip')
-rw-r--r--pjsip/include/pjsua-lib/pjsua.h17
-rw-r--r--pjsip/src/pjsua-lib/pjsua_acc.c24
2 files changed, 35 insertions, 6 deletions
diff --git a/pjsip/include/pjsua-lib/pjsua.h b/pjsip/include/pjsua-lib/pjsua.h
index 1d9594c3..4d5fa69a 100644
--- a/pjsip/include/pjsua-lib/pjsua.h
+++ b/pjsip/include/pjsua-lib/pjsua.h
@@ -3644,8 +3644,21 @@ PJ_DECL(pj_status_t) pjsua_acc_get_config(pjsua_acc_id acc_id,
/**
- * Modify account information.
- *
+ * Modify account configuration setting. This function may trigger
+ * unregistration (of old account setting) and re-registration (of the new
+ * account setting), e.g: changing account ID, credential, registar, or
+ * proxy setting.
+ *
+ * Note:
+ * - when the new config triggers unregistration, the pjsua callback
+ * on_reg_state()/on_reg_state2() for the unregistration will not be called
+ * and any failure in the unregistration will be ignored, so if application
+ * needs to be sure about the unregistration status, it should unregister
+ * manually and wait for the callback before calling this function
+ * - when the new config triggers re-registration and the re-registration
+ * fails, the account setting will not be reverted back to the old setting
+ * and the account will be in unregistered state.
+ *
* @param acc_id Id of the account to be modified.
* @param acc_cfg New account configuration.
*
diff --git a/pjsip/src/pjsua-lib/pjsua_acc.c b/pjsip/src/pjsua-lib/pjsua_acc.c
index ac4cb303..8e49c8ba 100644
--- a/pjsip/src/pjsua-lib/pjsua_acc.c
+++ b/pjsip/src/pjsua-lib/pjsua_acc.c
@@ -1333,7 +1333,13 @@ PJ_DEF(pj_status_t) pjsua_acc_modify( pjsua_acc_id acc_id,
/* Unregister first */
if (unreg_first) {
- pjsua_acc_set_registration(acc->index, PJ_FALSE);
+ status = pjsua_acc_set_registration(acc->index, PJ_FALSE);
+ if (status != PJ_SUCCESS) {
+ pjsua_perror(THIS_FILE, "Ignored failure in unregistering the "
+ "old account setting in modifying account", status);
+ /* Not really sure if we should return error */
+ status = PJ_SUCCESS;
+ }
if (acc->regc != NULL) {
pjsip_regc_destroy(acc->regc);
acc->regc = NULL;
@@ -1350,13 +1356,23 @@ PJ_DEF(pj_status_t) pjsua_acc_modify( pjsua_acc_id acc_id,
/* Update registration */
if (update_reg) {
/* If accounts has registration enabled, start registration */
- if (acc->cfg.reg_uri.slen)
- pjsua_acc_set_registration(acc->index, PJ_TRUE);
+ if (acc->cfg.reg_uri.slen) {
+ status = pjsua_acc_set_registration(acc->index, PJ_TRUE);
+ if (status != PJ_SUCCESS) {
+ pjsua_perror(THIS_FILE, "Failed to register with new account "
+ "setting in modifying account", status);
+ goto on_return;
+ }
+ }
}
/* Update MWI subscription */
if (update_mwi) {
- pjsua_start_mwi(acc_id, PJ_TRUE);
+ status = pjsua_start_mwi(acc_id, PJ_TRUE);
+ if (status != PJ_SUCCESS) {
+ pjsua_perror(THIS_FILE, "Failed in starting MWI subscription for "
+ "new account setting in modifying account", status);
+ }
}
on_return: