Ticket #995: Send un-PUBLISH when pjsua_acc_set_registration(FALSE) is called (thanks Johan Lantz for the suggestion)
- in this implementation, when pjsua_acc_set_registration(FALSE) is called, the un-REGISTER request will be sent immediately after un-PUBLISH, unlike the process during shutdown where the un-REGISTER request will be sent only after un-PUBLISH transaction is complete git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@3096 74dad513-b988-da41-8d7b-12977e46ad98
This commit is contained in:
parent
990f6e9989
commit
166d502e3a
|
@ -443,6 +443,11 @@ pj_status_t pjsua_pres_init_acc(int acc_id);
|
|||
*/
|
||||
pj_status_t pjsua_pres_init_publish_acc(int acc_id);
|
||||
|
||||
/**
|
||||
* Send un-PUBLISH
|
||||
*/
|
||||
void pjsua_pres_unpublish(pjsua_acc *acc);
|
||||
|
||||
/**
|
||||
* Terminate server subscription for the account
|
||||
*/
|
||||
|
|
|
@ -1264,6 +1264,9 @@ PJ_DEF(pj_status_t) pjsua_acc_set_registration( pjsua_acc_id acc_id,
|
|||
status = PJ_EINVALIDOP;
|
||||
goto on_return;
|
||||
}
|
||||
|
||||
pjsua_pres_unpublish(&pjsua_var.acc[acc_id]);
|
||||
|
||||
status = pjsip_regc_unregister(pjsua_var.acc[acc_id].regc, &tdata);
|
||||
}
|
||||
|
||||
|
|
|
@ -1275,11 +1275,29 @@ pj_status_t pjsua_pres_init_acc(int acc_id)
|
|||
}
|
||||
|
||||
|
||||
/* Unpublish presence publication */
|
||||
void pjsua_pres_unpublish(pjsua_acc *acc)
|
||||
{
|
||||
if (acc->publish_sess) {
|
||||
pjsua_acc_config *acc_cfg = &acc->cfg;
|
||||
|
||||
acc->online_status = PJ_FALSE;
|
||||
send_publish(acc->index, PJ_FALSE);
|
||||
/* By ticket #364, don't destroy the session yet (let the callback
|
||||
destroy it)
|
||||
if (acc->publish_sess) {
|
||||
pjsip_publishc_destroy(acc->publish_sess);
|
||||
acc->publish_sess = NULL;
|
||||
}
|
||||
*/
|
||||
acc_cfg->publish_enabled = PJ_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/* Terminate server subscription for the account */
|
||||
void pjsua_pres_delete_acc(int acc_id)
|
||||
{
|
||||
pjsua_acc *acc = &pjsua_var.acc[acc_id];
|
||||
pjsua_acc_config *acc_cfg = &pjsua_var.acc[acc_id].cfg;
|
||||
pjsua_srv_pres *uapres;
|
||||
|
||||
uapres = pjsua_var.acc[acc_id].pres_srv_list.next;
|
||||
|
@ -1314,18 +1332,7 @@ void pjsua_pres_delete_acc(int acc_id)
|
|||
pj_list_init(&acc->pres_srv_list);
|
||||
|
||||
/* Terminate presence publication, if any */
|
||||
if (acc->publish_sess) {
|
||||
acc->online_status = PJ_FALSE;
|
||||
send_publish(acc_id, PJ_FALSE);
|
||||
/* By ticket #364, don't destroy the session yet (let the callback
|
||||
destroy it)
|
||||
if (acc->publish_sess) {
|
||||
pjsip_publishc_destroy(acc->publish_sess);
|
||||
acc->publish_sess = NULL;
|
||||
}
|
||||
*/
|
||||
acc_cfg->publish_enabled = PJ_FALSE;
|
||||
}
|
||||
pjsua_pres_unpublish(acc);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue