[asterisk-commits] mnicholson: branch 1.8 r282639 - /branches/1.8/channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Aug 18 08:10:45 CDT 2010


Author: mnicholson
Date: Wed Aug 18 08:10:39 2010
New Revision: 282639

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=282639
Log:
Properly handle 200 and unknown responses conatined in NOTIFY requests received in response to REFER requests.

This patch fixes the way asterisk handles NOTIFY requests received in response to REFER requests.  These changes to NOTIFY handler were first introduced in r217482.  This new change properly handles the 200 response by queueing an AST_TRANSFER_SUCCESS control frame and also prevents that control frame from being queued when provisional and unknown responses are received.

(issue #17486)
Reported by: davidw
Tested by: mnicholson

(issue #12713)
Reported by: davidw

Review: https://reviewboard.asterisk.org/r/860/

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=282639&r1=282638&r2=282639
==============================================================================
--- branches/1.8/channels/chan_sip.c (original)
+++ branches/1.8/channels/chan_sip.c Wed Aug 18 08:10:39 2010
@@ -20333,18 +20333,8 @@
 		*sep++ = '\0';			/* Response string */
 		respcode = atoi(code);
 		switch (respcode) {
-		case 100:	/* Trying: */
-		case 101:	/* dialog establishment */
-			/* Don't do anything yet */
-			success = -1;	/* Wait */
-			break;
-		case 183:	/* Ringing: */
-			/* Don't do anything yet */
-			success = -1;	/* Wait */
-			break;
 		case 200:	/* OK: The new call is up, hangup this call */
 			/* Hangup the call that we are replacing */
-			success = -1;	/* Wait */
 			break;
 		case 301: /* Moved permenantly */
 		case 302: /* Moved temporarily */
@@ -20352,12 +20342,23 @@
 			success = FALSE;
 			break;
 		case 503:	/* Service Unavailable: The new call failed */
-				/* Cancel transfer, continue the call */
-			success = FALSE;
-			break;
 		case 603:	/* Declined: Not accepted */
 				/* Cancel transfer, continue the current call */
 			success = FALSE;
+			break;
+		case 0:		/* Parse error */
+				/* Cancel transfer, continue the current call */
+			ast_log(LOG_NOTICE, "Error parsing sipfrag in NOTIFY in response to REFER.\n");
+			success = FALSE;
+			break;
+		default:
+			if (respcode < 200) {
+				/* ignore provisional responses */
+				success = -1;
+			} else {
+				ast_log(LOG_NOTICE, "Got unknown code '%d' in NOTIFY in response to REFER.\n", respcode);
+				success = FALSE;
+			}
 			break;
 		}
 		if (success == FALSE) {




More information about the asterisk-commits mailing list