diff options
author | Benny Prijono <bennylp@teluu.com> | 2007-06-27 13:01:59 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2007-06-27 13:01:59 +0000 |
commit | dc88226fa06a68d43dfcd716fc50635c0eddf535 (patch) | |
tree | 0b195386b8391d32a928fc23c55ed43f29965b59 /pjsip/src/pjsua-lib/pjsua_pres.c | |
parent | 95c98b95136c97f511beed1636379b909b3181d0 (diff) |
Ticket #347: Assertion failure when handling incoming presence subscription with Expires=0
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@1396 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip/src/pjsua-lib/pjsua_pres.c')
-rw-r--r-- | pjsip/src/pjsua-lib/pjsua_pres.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/pjsip/src/pjsua-lib/pjsua_pres.c b/pjsip/src/pjsua-lib/pjsua_pres.c index df9918fd..070c6f00 100644 --- a/pjsip/src/pjsua-lib/pjsua_pres.c +++ b/pjsip/src/pjsua-lib/pjsua_pres.c @@ -456,6 +456,8 @@ static pj_bool_t pres_on_rx_request(pjsip_rx_data *rdata) pjsip_tx_data *tdata; pjsip_pres_status pres_status; pjsip_dialog *dlg; + pjsip_expires_hdr *expires_hdr; + pjsip_evsub_state ev_state; pj_status_t status; if (pjsip_method_cmp(req_method, &pjsip_subscribe_method) != 0) @@ -558,9 +560,19 @@ static pj_bool_t pres_on_rx_request(pjsip_rx_data *rdata) pjsip_pres_set_status(sub, &pres_status); + /* Check expires value. If it's zero, send our presense state but + * set subscription state to TERMINATED. + */ + expires_hdr=(pjsip_expires_hdr*) + pjsip_msg_find_hdr(rdata->msg_info.msg, PJSIP_H_EXPIRES, NULL); + + if (expires_hdr && expires_hdr->ivalue == 0) + ev_state = PJSIP_EVSUB_STATE_TERMINATED; + else + ev_state = PJSIP_EVSUB_STATE_ACTIVE; + /* Create and send the first NOTIFY to active subscription: */ - status = pjsip_pres_notify( sub, PJSIP_EVSUB_STATE_ACTIVE, NULL, - NULL, &tdata); + status = pjsip_pres_notify( sub, ev_state, NULL, NULL, &tdata); if (status == PJ_SUCCESS) { pjsua_process_msg_data(tdata, NULL); status = pjsip_pres_send_request( sub, tdata); |