[asterisk-commits] mnicholson: branch 1.8 r281874 - /branches/1.8/channels/chan_sip.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Aug 11 16:11:58 CDT 2010
Author: mnicholson
Date: Wed Aug 11 16:11:54 2010
New Revision: 281874
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=281874
Log:
handle all possible responses to REFER requests
(closes issue #17486)
Reported by: davidw
Patches:
Issue17486-counterbid.diff.txt uploaded by davidw (license 780)
Tested by: davidw
Review: https://reviewboard.asterisk.org/r/837/
Modified:
branches/1.8/channels/chan_sip.c
Modified: branches/1.8/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/channels/chan_sip.c?view=diff&rev=281874&r1=281873&r2=281874
==============================================================================
--- branches/1.8/channels/chan_sip.c (original)
+++ branches/1.8/channels/chan_sip.c Wed Aug 11 16:11:54 2010
@@ -19207,6 +19207,23 @@
ast_queue_control_data(p->owner, AST_CONTROL_TRANSFER, &message, sizeof(message));
}
break;
+ default:
+ /* We should treat unrecognized 9xx as 900. 400 is actually
+ specified as a possible response, but any 4-6xx is
+ theoretically possible. */
+
+ if (resp < 299) { /* 1xx cases don't get here */
+ ast_log(LOG_WARNING, "SIP transfer to %s had unxpected 2xx response (%d), confusion is possible. \n", p->refer->refer_to, resp);
+ } else {
+ ast_log(LOG_WARNING, "SIP transfer to %s with response (%d). \n", p->refer->refer_to, resp);
+ }
+
+ p->refer->status = REFER_FAILED;
+ pvt_set_needdestroy(p, "received failure response");
+ if (p->owner) {
+ ast_queue_control_data(p->owner, AST_CONTROL_TRANSFER, &message, sizeof(message));
+ }
+ break;
}
}
@@ -19523,6 +19540,8 @@
need to hang around for something more "definitive" */
if (resp != 100)
handle_response_peerpoke(p, resp, req);
+ } else if (sipmethod == SIP_REFER && resp >= 200) {
+ handle_response_refer(p, resp, rest, req, seqno);
} else if (sipmethod == SIP_PUBLISH) {
/* SIP PUBLISH transcends this morass of doodoo and instead
* we just always call the response handler. Good gravy!
@@ -19559,18 +19578,12 @@
ast_clear_flag(&p->flags[1], SIP_PAGE2_DIALOG_ESTABLISHED);
}
break;
- case 202: /* Transfer accepted */
- if (sipmethod == SIP_REFER)
- handle_response_refer(p, resp, rest, req, seqno);
- break;
case 401: /* Not www-authorized on SIP method */
case 407: /* Proxy auth required */
if (sipmethod == SIP_INVITE)
handle_response_invite(p, resp, rest, req, seqno);
else if (sipmethod == SIP_NOTIFY)
handle_response_notify(p, resp, rest, req, seqno);
- else if (sipmethod == SIP_REFER)
- handle_response_refer(p, resp, rest, req, seqno);
else if (sipmethod == SIP_SUBSCRIBE)
handle_response_subscribe(p, resp, rest, req, seqno);
else if (p->registry && sipmethod == SIP_REGISTER)
@@ -19643,8 +19656,6 @@
case 481: /* Call leg does not exist */
if (sipmethod == SIP_INVITE) {
handle_response_invite(p, resp, rest, req, seqno);
- } else if (sipmethod == SIP_REFER) {
- handle_response_refer(p, resp, rest, req, seqno);
} else if (sipmethod == SIP_SUBSCRIBE) {
handle_response_subscribe(p, resp, rest, req, seqno);
} else if (sipmethod == SIP_BYE) {
@@ -19686,16 +19697,9 @@
}
if (sipmethod == SIP_INVITE)
handle_response_invite(p, resp, rest, req, seqno);
- else if (sipmethod == SIP_REFER)
- handle_response_refer(p, resp, rest, req, seqno);
else
ast_log(LOG_WARNING, "Host '%s' does not implement '%s'\n", ast_sockaddr_stringify(&p->sa), msg);
break;
- case 603: /* Declined transfer */
- if (sipmethod == SIP_REFER) {
- handle_response_refer(p, resp, rest, req, seqno);
- break;
- }
/* Fallthrough */
default:
if ((resp >= 300) && (resp < 700)) {
@@ -19738,10 +19742,7 @@
case 410: /* Gone */
case 400: /* Bad Request */
case 500: /* Server error */
- if (sipmethod == SIP_REFER) {
- handle_response_refer(p, resp, rest, req, seqno);
- break;
- } else if (sipmethod == SIP_SUBSCRIBE) {
+ if (sipmethod == SIP_SUBSCRIBE) {
handle_response_subscribe(p, resp, rest, req, seqno);
break;
}
@@ -19839,15 +19840,9 @@
;
}
break;
- case 202: /* Transfer accepted */
- if (sipmethod == SIP_REFER)
- handle_response_refer(p, resp, rest, req, seqno);
- break;
case 401: /* www-auth */
case 407:
- if (sipmethod == SIP_REFER)
- handle_response_refer(p, resp, rest, req, seqno);
- else if (sipmethod == SIP_INVITE)
+ if (sipmethod == SIP_INVITE)
handle_response_invite(p, resp, rest, req, seqno);
else if (sipmethod == SIP_BYE) {
if (p->authtries == MAX_AUTHTRIES || do_proxy_auth(p, req, resp, sipmethod, 0)) {
@@ -19869,15 +19864,7 @@
case 501: /* Not Implemented */
if (sipmethod == SIP_INVITE)
handle_response_invite(p, resp, rest, req, seqno);
- else if (sipmethod == SIP_REFER)
- handle_response_refer(p, resp, rest, req, seqno);
break;
- case 603: /* Declined transfer */
- if (sipmethod == SIP_REFER) {
- handle_response_refer(p, resp, rest, req, seqno);
- break;
- }
- /* Fallthrough */
default: /* Errors without handlers */
if ((resp >= 100) && (resp < 200)) {
if (sipmethod == SIP_INVITE) { /* re-invite */
More information about the asterisk-commits
mailing list