diff options
author | Liong Sauw Ming <ming@teluu.com> | 2012-11-26 02:54:17 +0000 |
---|---|---|
committer | Liong Sauw Ming <ming@teluu.com> | 2012-11-26 02:54:17 +0000 |
commit | 58a16c263a03ff494f9befa7c579d28a71abef53 (patch) | |
tree | 664e5e9621d608e6c361513af0a268ea75a77cc5 | |
parent | 4829490aa8a2c178a8dba4933a0056c8c8e80499 (diff) |
Fixes #1596: Fix handling of incoming UPDATE request
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@4301 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r-- | pjsip/src/pjsip-ua/sip_inv.c | 28 |
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 643ec706..6a608673 100644 --- a/pjsip/src/pjsip-ua/sip_inv.c +++ b/pjsip/src/pjsip-ua/sip_inv.c @@ -2957,8 +2957,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); @@ -2967,18 +2975,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 */ |