[asterisk-commits] jrose: trunk r396498 - in /trunk: channels/chan_sip.c main/pbx.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Aug 9 12:28:18 CDT 2013


Author: jrose
Date: Fri Aug  9 12:28:15 2013
New Revision: 396498

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=396498
Log:
pbx: Make originate threads indicate dial status when synchronous

This makes it so that we can detect failures to originate as with
earlier versions of Asterisk, which restores the Asterisk 11 behavior
for the originate manager action. This was causing the ACL tests for
SIP and IAX2 to fail since those tests expected originate failures
when ACLs would cause rejections. Also, this patch fixes crashes in
chan_sip when ACLs rejected peers during registration verification.

(closes issue ASTERISK-22212)
Reported by: Matt Jordan
Review: https://reviewboard.asterisk.org/r/2753/

Modified:
    trunk/channels/chan_sip.c
    trunk/main/pbx.c

Modified: trunk/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_sip.c?view=diff&rev=396498&r1=396497&r2=396498
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Fri Aug  9 12:28:15 2013
@@ -17345,7 +17345,7 @@
 			break;
 		}
 
-		if (peer->endpoint) {
+		if (peer && peer->endpoint) {
 			ast_endpoint_blob_publish(peer->endpoint, ast_endpoint_state_type(), blob);
 		}
 	}

Modified: trunk/main/pbx.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/pbx.c?view=diff&rev=396498&r1=396497&r2=396498
==============================================================================
--- trunk/main/pbx.c (original)
+++ trunk/main/pbx.c Fri Aug  9 12:28:15 2013
@@ -9776,6 +9776,8 @@
 	char exten[AST_MAX_EXTENSION];
 	/*! \brief Dialplan priority */
 	int priority;
+	/*! \brief Result of the dial operation when dialed is set */
+	int dial_res;
 	/*! \brief Set when dialing is completed */
 	unsigned int dialed:1;
 	/*! \brief Set when execution is completed */
@@ -9806,6 +9808,7 @@
 	/* Notify anyone interested that dialing is complete */
 	ast_mutex_lock(&outgoing->lock);
 	res = ast_dial_run(outgoing->dial, NULL, 0);
+	outgoing->dial_res = res;
 	outgoing->dialed = 1;
 	ast_cond_signal(&outgoing->cond);
 	ast_mutex_unlock(&outgoing->lock);
@@ -9978,6 +9981,11 @@
 		}
 		while (!outgoing->dialed) {
 			ast_cond_wait(&outgoing->cond, &outgoing->lock);
+
+			if (outgoing->dial_res != AST_DIAL_RESULT_ANSWERED) {
+				/* The dial operation failed. */
+				return -1;
+			}
 		}
 		if (channel && *channel) {
 			ast_channel_lock(*channel);




More information about the asterisk-commits mailing list