[asterisk-commits] jrose: trunk r399554 - in /trunk: ./ main/dial.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Sep 20 17:06:11 CDT 2013


Author: jrose
Date: Fri Sep 20 17:06:07 2013
New Revision: 399554

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=399554
Log:
originate/call forwarding: Fix a crash when forwarding a call from originate

(closes issue ASTERISK-22487)
Reported by: David M. Lee
Review: https://reviewboard.asterisk.org/r/2868/
........

Merged revisions 399553 from http://svn.asterisk.org/svn/asterisk/branches/12

Modified:
    trunk/   (props changed)
    trunk/main/dial.c

Propchange: trunk/
------------------------------------------------------------------------------
--- branch-12-merged (original)
+++ branch-12-merged Fri Sep 20 17:06:07 2013
@@ -1,1 +1,1 @@
-/branches/12:1-398558,398560-398577,398579-399100,399136,399146,399160,399197,399207,399225,399237,399247,399257,399268,399283,399294,399339,399365,399376,399404,399458,399501,399514,399531
+/branches/12:1-398558,398560-398577,398579-399100,399136,399146,399160,399197,399207,399225,399237,399247,399257,399268,399283,399294,399339,399365,399376,399404,399458,399501,399514,399531,399553

Modified: trunk/main/dial.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/dial.c?view=diff&rev=399554&r1=399553&r2=399554
==============================================================================
--- trunk/main/dial.c (original)
+++ trunk/main/dial.c Fri Sep 20 17:06:07 2013
@@ -398,6 +398,15 @@
 		*stuff++ = '\0';
 		tech = tmp;
 		device = stuff;
+	} else {
+		const char *forward_context;
+		char destination[AST_MAX_CONTEXT + AST_MAX_EXTENSION + 1];
+
+		ast_channel_lock(original);
+		forward_context = pbx_builtin_getvar_helper(original, "FORWARD_CONTEXT");
+		snprintf(destination, sizeof(destination), "%s@%s", tmp, S_OR(forward_context, ast_channel_context(original)));
+		ast_channel_unlock(original);
+		device = ast_strdupa(destination);
 	}
 
 	/* Drop old destination information */
@@ -409,11 +418,13 @@
 	channel->device = ast_strdup(device);
 	AST_LIST_UNLOCK(&dial->channels);
 
+
+	/* Drop the original channel */
+	ast_hangup(original);
+	channel->owner = NULL;
+
 	/* Finally give it a go... send it out into the world */
 	begin_dial_channel(channel, chan, chan ? 0 : 1);
-
-	/* Drop the original channel */
-	ast_hangup(original);
 
 	return 0;
 }




More information about the asterisk-commits mailing list