From eed32ea7a9329e785509eaf56251a9b44d21df5c Mon Sep 17 00:00:00 2001 From: Benny Prijono Date: Wed, 10 Feb 2010 14:24:48 +0000 Subject: 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: http://svn.pjsip.org/repos/pjproject/trunk@3096 74dad513-b988-da41-8d7b-12977e46ad98 --- pjsip/src/pjsua-lib/pjsua_pres.c | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) (limited to 'pjsip/src/pjsua-lib/pjsua_pres.c') diff --git a/pjsip/src/pjsua-lib/pjsua_pres.c b/pjsip/src/pjsua-lib/pjsua_pres.c index e74ee406..620c7cd7 100644 --- a/pjsip/src/pjsua-lib/pjsua_pres.c +++ b/pjsip/src/pjsua-lib/pjsua_pres.c @@ -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); } -- cgit v1.2.3