summaryrefslogtreecommitdiff
path: root/pjsip
diff options
context:
space:
mode:
authorLiong Sauw Ming <ming@teluu.com>2013-02-27 12:12:59 +0000
committerLiong Sauw Ming <ming@teluu.com>2013-02-27 12:12:59 +0000
commit303982942237d3c7dec81eaccbb8eb5611d4688a (patch)
tree526ad0f3bcbecbfb662e983b20541f7dfc0dab96 /pjsip
parent50d738c48bfe91bf0b8eee1334228131dc5779c5 (diff)
Re #1596: Backported to 1.x
git-svn-id: http://svn.pjsip.org/repos/pjproject/branches/1.x@4396 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip')
-rw-r--r--pjsip/src/pjsip-ua/sip_inv.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/pjsip/src/pjsip-ua/sip_inv.c b/pjsip/src/pjsip-ua/sip_inv.c
index 6f71fa1c..6e4ad195 100644
--- a/pjsip/src/pjsip-ua/sip_inv.c
+++ b/pjsip/src/pjsip-ua/sip_inv.c
@@ -2854,8 +2854,16 @@ static void inv_respond_incoming_update(pjsip_inv_session *inv,
neg_state = pjmedia_sdp_neg_get_state(inv->neg);
+ /* If UPDATE doesn't contain SDP, just respond with 200/OK.
+ * This is a valid scenario according to session-timer draft.
+ */
+ if (rdata->msg_info.msg->body == NULL) {
+
+ status = pjsip_dlg_create_response(inv->dlg, rdata,
+ 200, NULL, &tdata);
+ }
/* Send 491 if we receive UPDATE while we're waiting for an answer */
- if (neg_state == PJMEDIA_SDP_NEG_STATE_LOCAL_OFFER) {
+ else if (neg_state == PJMEDIA_SDP_NEG_STATE_LOCAL_OFFER) {
status = pjsip_dlg_create_response(inv->dlg, rdata,
PJSIP_SC_REQUEST_PENDING, NULL,
&tdata);
@@ -2864,18 +2872,18 @@ static void inv_respond_incoming_update(pjsip_inv_session *inv,
* receive UPDATE while we haven't sent answer.
*/
else if (neg_state == PJMEDIA_SDP_NEG_STATE_REMOTE_OFFER ||
- neg_state == PJMEDIA_SDP_NEG_STATE_WAIT_NEGO) {
- status = pjsip_dlg_create_response(inv->dlg, rdata,
+ neg_state == PJMEDIA_SDP_NEG_STATE_WAIT_NEGO)
+ {
+ pjsip_retry_after_hdr *ra_hdr;
+ int val;
+
+ status = pjsip_dlg_create_response(inv->dlg, rdata,
PJSIP_SC_INTERNAL_SERVER_ERROR,
NULL, &tdata);
- /* If UPDATE doesn't contain SDP, just respond with 200/OK.
- * This is a valid scenario according to session-timer draft.
- */
- } else if (rdata->msg_info.msg->body == NULL) {
-
- status = pjsip_dlg_create_response(inv->dlg, rdata,
- 200, NULL, &tdata);
+ val = (pj_rand() % 10);
+ ra_hdr = pjsip_retry_after_hdr_create(tdata->pool, val);
+ pjsip_msg_add_hdr(tdata->msg, (pjsip_hdr*)ra_hdr);
} else {
/* We receive new offer from remote */