summaryrefslogtreecommitdiff
path: root/pjsip/src/pjsip-ua/sip_inv.c
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2006-09-25 13:40:12 +0000
committerBenny Prijono <bennylp@teluu.com>2006-09-25 13:40:12 +0000
commitcf3c435e0093cf2f1fb8add2298ee468f8c6afc5 (patch)
tree93bbdb60b762ce015dc8f55147eed38bb034d1ca /pjsip/src/pjsip-ua/sip_inv.c
parente3f862fca94af0cb4812796055b18d2ba107b613 (diff)
Tests with other user agents revealed some bugs which
have been fixed below: - some UAs sends "telephone-event/8000/1" instead of "telephone-event/8000", which caused SDP negotiation to fail. Fixed in sdp_neg.c. - codec name was (incorrectly) compared case-sensitively, causing negotiation to fail. Fixed in sdp_neg.c. - Also improved error reporting in SDP negotiation by introducing few more error codes. - Added Warning header in Not Acceptable response sent by pjsip_inv_session when SDP negotiation fails. - PJSUA-LIB will try to negotiate both SDPs before sending 100 response. - Fixed bug in iLBC codec when setting the mode to 30. Also: - Echo cancellation by default is disabled now since it doesn't seem to work. Further investigation needed. git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@738 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip/src/pjsip-ua/sip_inv.c')
-rw-r--r--pjsip/src/pjsip-ua/sip_inv.c32
1 files changed, 30 insertions, 2 deletions
diff --git a/pjsip/src/pjsip-ua/sip_inv.c b/pjsip/src/pjsip-ua/sip_inv.c
index e363eb90..97507458 100644
--- a/pjsip/src/pjsip-ua/sip_inv.c
+++ b/pjsip/src/pjsip-ua/sip_inv.c
@@ -614,7 +614,6 @@ PJ_DEF(pj_status_t) pjsip_inv_verify_request(pjsip_rx_data *rdata,
/* Incompatible media */
code = PJSIP_SC_NOT_ACCEPTABLE_HERE;
- status = PJSIP_ERRNO_FROM_SIP_STATUS(code);
if (p_tdata) {
pjsip_accept_hdr *acc;
@@ -2414,9 +2413,38 @@ static void inv_on_state_confirmed( pjsip_inv_session *inv, pjsip_event *e)
/* Process SDP in the answer */
status = process_answer(inv, 200, tdata, NULL);
- if (status != PJ_SUCCESS)
+
+ if (status != PJ_SUCCESS) {
+ /*
+ * SDP negotiation has failed.
+ */
+ pj_status_t rc;
+ pj_str_t reason;
+
+ /* Delete the 2xx answer */
+ pjsip_tx_data_dec_ref(tdata);
+
+ /* Create 500 response */
+ reason = pj_str("SDP negotiation failed");
+ rc = pjsip_dlg_create_response(dlg, rdata, 500, &reason,
+ &tdata);
+ if (rc == PJ_SUCCESS) {
+ pjsip_warning_hdr *w;
+ const pj_str_t *endpt_name;
+
+ endpt_name = pjsip_endpt_name(dlg->endpt);
+ w = pjsip_warning_hdr_create_from_status(tdata->pool,
+ endpt_name,
+ status);
+ if (w)
+ pjsip_msg_add_hdr(tdata->msg, (pjsip_hdr*)w);
+
+ pjsip_inv_send_msg(inv, tdata);
+ }
return;
+ }
+ /* Send 2xx regardless of the status of negotiation */
status = pjsip_inv_send_msg(inv, tdata);
}