Changeset 4955


Ignore:
Timestamp:
Oct 27, 2014 7:36:08 AM (10 years ago)
Author:
nanang
Message:

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.
Location:
pjproject/trunk/pjsip
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h

    r4929 r4955  
    36453645 
    36463646/** 
    3647  * Modify account information. 
    3648  * 
     3647 * Modify account configuration setting. This function may trigger 
     3648 * unregistration (of old account setting) and re-registration (of the new 
     3649 * account setting), e.g: changing account ID, credential, registar, or 
     3650 * proxy setting. 
     3651 * 
     3652 * Note: 
     3653 * - when the new config triggers unregistration, the pjsua callback 
     3654 *   on_reg_state()/on_reg_state2() for the unregistration will not be called 
     3655 *   and any failure in the unregistration will be ignored, so if application 
     3656 *   needs to be sure about the unregistration status, it should unregister 
     3657 *   manually and wait for the callback before calling this function 
     3658 * - when the new config triggers re-registration and the re-registration 
     3659 *   fails, the account setting will not be reverted back to the old setting 
     3660 *   and the account will be in unregistered state. 
     3661 *  
    36493662 * @param acc_id        Id of the account to be modified. 
    36503663 * @param acc_cfg       New account configuration. 
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_acc.c

    r4947 r4955  
    13341334    /* Unregister first */ 
    13351335    if (unreg_first) { 
    1336         pjsua_acc_set_registration(acc->index, PJ_FALSE); 
     1336        status = pjsua_acc_set_registration(acc->index, PJ_FALSE); 
     1337        if (status != PJ_SUCCESS) { 
     1338            pjsua_perror(THIS_FILE, "Ignored failure in unregistering the " 
     1339                         "old account setting in modifying account", status); 
     1340            /* Not really sure if we should return error */ 
     1341            status = PJ_SUCCESS; 
     1342        } 
    13371343        if (acc->regc != NULL) { 
    13381344            pjsip_regc_destroy(acc->regc); 
     
    13511357    if (update_reg) { 
    13521358        /* If accounts has registration enabled, start registration */ 
    1353         if (acc->cfg.reg_uri.slen) 
    1354             pjsua_acc_set_registration(acc->index, PJ_TRUE); 
     1359        if (acc->cfg.reg_uri.slen) { 
     1360            status = pjsua_acc_set_registration(acc->index, PJ_TRUE); 
     1361            if (status != PJ_SUCCESS) { 
     1362                pjsua_perror(THIS_FILE, "Failed to register with new account " 
     1363                             "setting in modifying account", status); 
     1364                goto on_return; 
     1365            } 
     1366        } 
    13551367    } 
    13561368 
    13571369    /* Update MWI subscription */ 
    13581370    if (update_mwi) { 
    1359         pjsua_start_mwi(acc_id, PJ_TRUE); 
     1371        status = pjsua_start_mwi(acc_id, PJ_TRUE); 
     1372        if (status != PJ_SUCCESS) { 
     1373            pjsua_perror(THIS_FILE, "Failed in starting MWI subscription for " 
     1374                         "new account setting in modifying account", status); 
     1375        } 
    13601376    } 
    13611377 
Note: See TracChangeset for help on using the changeset viewer.