[svn-commits] mmichelson: branch mmichelson/digit_manipulation r196110 - /team/mmichelson/d...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu May 21 17:15:06 CDT 2009


Author: mmichelson
Date: Thu May 21 17:13:11 2009
New Revision: 196110

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=196110
Log:
Dialing API changes.


Modified:
    team/mmichelson/digit_manipulation/main/dial.c

Modified: team/mmichelson/digit_manipulation/main/dial.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/mmichelson/digit_manipulation/main/dial.c?view=diff&rev=196110&r1=196109&r2=196110
==============================================================================
--- team/mmichelson/digit_manipulation/main/dial.c (original)
+++ team/mmichelson/digit_manipulation/main/dial.c Thu May 21 17:13:11 2009
@@ -37,6 +37,7 @@
 #include "asterisk/dial.h"
 #include "asterisk/pbx.h"
 #include "asterisk/musiconhold.h"
+#include "asterisk/app.h"
 
 /*! \brief Main dialing structure. Contains global options, channels being dialed, and more! */
 struct ast_dial {
@@ -388,6 +389,8 @@
 /*! \brief Helper function that handles control frames WITH owner */
 static void handle_frame(struct ast_dial *dial, struct ast_dial_channel *channel, struct ast_frame *fr, struct ast_channel *chan)
 {
+	const char *macro;
+	const char *macro_args;
 	if (fr->frametype == AST_FRAME_CONTROL) {
 		switch (fr->subclass) {
 		case AST_CONTROL_ANSWER:
@@ -430,7 +433,17 @@
 			break;
 		case AST_CONTROL_CONNECTED_LINE:
 			ast_verb(3, "%s connected line has changed, passing it to %s\n", channel->owner->name, chan->name);
-			ast_indicate_data(chan, AST_CONTROL_CONNECTED_LINE, fr->data.ptr, fr->datalen);
+			ast_channel_lock(chan);
+			macro = ast_strdupa(S_OR(pbx_builtin_getvar_helper(chan, "CONNECTED_LINE_CALLER_SEND_MACRO"), ""));
+			macro_args = ast_strdupa(S_OR(pbx_builtin_getvar_helper(chan, "CONNECTED_LINE_CALLER_SEND_MACRO_ARGS"), ""));
+			ast_channel_unlock(chan);
+			if (!ast_strlen_zero(macro)) {
+				ast_connected_line_parse_data(fr->data.ptr, fr->datalen, &chan->connected);
+				ast_app_run_macro(channel->owner, chan, macro, macro_args);
+				ast_channel_update_connected_line(chan, &chan->connected);
+			} else {
+				ast_indicate_data(chan, AST_CONTROL_CONNECTED_LINE, fr->data.ptr, fr->datalen);
+			}
 			break;
 		case AST_CONTROL_REDIRECTING:
 			ast_verb(3, "%s redirecting info has changed, passing it to %s\n", channel->owner->name, chan->name);




More information about the svn-commits mailing list