diff options
author | Liong Sauw Ming <ming@teluu.com> | 2013-02-27 10:41:22 +0000 |
---|---|---|
committer | Liong Sauw Ming <ming@teluu.com> | 2013-02-27 10:41:22 +0000 |
commit | a4693fb2dea21f4ca9ceb0fffd232188ea707a79 (patch) | |
tree | 21c9e487180338790892190b431619a2ca2728c1 | |
parent | e0b9872e5b72532014d4f2fd8116662cc92fdf64 (diff) |
Re #1560: Backported to 1.x
git-svn-id: http://svn.pjsip.org/repos/pjproject/branches/1.x@4388 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r-- | pjsip/src/pjsip-ua/sip_timer.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/pjsip/src/pjsip-ua/sip_timer.c b/pjsip/src/pjsip-ua/sip_timer.c index 17c83c24..dee41155 100644 --- a/pjsip/src/pjsip-ua/sip_timer.c +++ b/pjsip/src/pjsip-ua/sip_timer.c @@ -1030,6 +1030,33 @@ PJ_DEF(pj_status_t) pjsip_timer_update_resp(pjsip_inv_session *inv, if (inv->timer && inv->timer->active) { /* Add Session-Expires header and start the timer */ add_timer_headers(inv, tdata, PJ_TRUE, PJ_FALSE); + + /* Add 'timer' to Require header (see ticket #1560). */ + if (inv->timer->refresher == TR_UAC) { + pjsip_require_hdr *req_hdr; + pj_bool_t req_hdr_has_timer = PJ_FALSE; + + req_hdr = (pjsip_require_hdr*) + pjsip_msg_find_hdr(tdata->msg, PJSIP_H_REQUIRE, + NULL); + if (req_hdr == NULL) { + req_hdr = pjsip_require_hdr_create(tdata->pool); + PJ_ASSERT_RETURN(req_hdr, PJ_ENOMEM); + pjsip_msg_add_hdr(tdata->msg, (pjsip_hdr*)req_hdr); + } else { + unsigned i; + for (i = 0; i < req_hdr->count; ++i) { + if (pj_stricmp(&req_hdr->values[i], &STR_TIMER)) { + req_hdr_has_timer = PJ_TRUE; + break; + } + } + } + if (!req_hdr_has_timer) + req_hdr->values[req_hdr->count++] = STR_TIMER; + } + + /* Finally, start timer. */ start_timer(inv); } } |