diff options
author | Nanang Izzuddin <nanang@teluu.com> | 2012-06-19 14:35:18 +0000 |
---|---|---|
committer | Nanang Izzuddin <nanang@teluu.com> | 2012-06-19 14:35:18 +0000 |
commit | 253bf3c598087e7d4b11d0c0cb3940551becfcdc (patch) | |
tree | 34f5715a8756dee38c175264d58bd618c38bc4c1 /pjsip/src/pjsua-lib/pjsua_acc.c | |
parent | 4e48275b5dc67bce49f48c1f683dd3a8f3def8d5 (diff) |
Close #1540:
- added pjsua_acc_config.mwi_expires, also compile-time macro PJSIP_MWI_DEFAULT_EXPIRES
- updated pjsua_acc_modify() to update MWI subscription when mwi_expires & mwi_enabled of pjsua_acc_config is modified
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@4172 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip/src/pjsua-lib/pjsua_acc.c')
-rw-r--r-- | pjsip/src/pjsua-lib/pjsua_acc.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/pjsip/src/pjsua-lib/pjsua_acc.c b/pjsip/src/pjsua-lib/pjsua_acc.c index d475f826..65e52640 100644 --- a/pjsip/src/pjsua-lib/pjsua_acc.c +++ b/pjsip/src/pjsua-lib/pjsua_acc.c @@ -469,7 +469,7 @@ PJ_DEF(pj_status_t) pjsua_acc_add( const pjsua_acc_config *cfg, } else { /* Otherwise subscribe to MWI, if it's enabled */ if (pjsua_var.acc[id].cfg.mwi_enabled) - pjsua_start_mwi(&pjsua_var.acc[id]); + pjsua_start_mwi(id, PJ_TRUE); } pj_log_pop_indent(); @@ -679,6 +679,7 @@ PJ_DEF(pj_status_t) pjsua_acc_modify( pjsua_acc_id acc_id, pj_str_t acc_proxy[PJSUA_ACC_MAX_PROXIES]; pj_bool_t update_reg = PJ_FALSE; pj_bool_t unreg_first = PJ_FALSE; + pj_bool_t update_mwi = PJ_FALSE; pj_status_t status = PJ_SUCCESS; PJ_ASSERT_RETURN(acc_id>=0 && acc_id<(int)PJ_ARRAY_SIZE(pjsua_var.acc), @@ -838,7 +839,14 @@ PJ_DEF(pj_status_t) pjsua_acc_modify( pjsua_acc_id acc_id, } /* MWI */ - acc->cfg.mwi_enabled = cfg->mwi_enabled; + if (acc->cfg.mwi_enabled != cfg->mwi_enabled) { + acc->cfg.mwi_enabled = cfg->mwi_enabled; + update_mwi = PJ_TRUE; + } + if (acc->cfg.mwi_expires != cfg->mwi_expires && cfg->mwi_expires > 0) { + acc->cfg.mwi_expires = cfg->mwi_expires; + update_mwi = PJ_TRUE; + } /* PIDF tuple ID */ if (pj_strcmp(&acc->cfg.pidf_tuple_id, &cfg->pidf_tuple_id)) @@ -1132,11 +1140,11 @@ PJ_DEF(pj_status_t) pjsua_acc_modify( pjsua_acc_id acc_id, /* If accounts has registration enabled, start registration */ if (acc->cfg.reg_uri.slen) pjsua_acc_set_registration(acc->index, PJ_TRUE); - else { - /* Otherwise subscribe to MWI, if it's enabled */ - if (acc->cfg.mwi_enabled) - pjsua_start_mwi(acc); - } + } + + /* Update MWI subscription */ + if (update_mwi) { + pjsua_start_mwi(acc_id, PJ_TRUE); } /* Video settings */ @@ -1875,7 +1883,7 @@ static void regc_cb(struct pjsip_regc_cbparam *param) /* Subscribe to MWI, if it's enabled */ if (acc->cfg.mwi_enabled) - pjsua_start_mwi(acc); + pjsua_start_mwi(acc->index, PJ_FALSE); } } else { |