[asterisk-commits] mmichelson: branch mmichelson/digit_manipulation r195838 - /team/mmichelson/d...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed May 20 17:51:03 CDT 2009


Author: mmichelson
Date: Wed May 20 17:51:00 2009
New Revision: 195838

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=195838
Log:
Commit digit manipulation changes for app_queue.

It sure is a lot easier once you have a template you can copy/paste
from!


Modified:
    team/mmichelson/digit_manipulation/apps/app_queue.c

Modified: team/mmichelson/digit_manipulation/apps/app_queue.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/mmichelson/digit_manipulation/apps/app_queue.c?view=diff&rev=195838&r1=195837&r2=195838
==============================================================================
--- team/mmichelson/digit_manipulation/apps/app_queue.c (original)
+++ team/mmichelson/digit_manipulation/apps/app_queue.c Wed May 20 17:51:00 2009
@@ -2871,6 +2871,8 @@
 #endif
 	struct ast_party_connected_line connected_caller;
 	char *inchan_name;
+	char macro[AST_MAX_CONTEXT];
+	char macro_args[512]; /*XXX Big enough? */
 
 	ast_party_connected_line_init(&connected_caller);
 
@@ -2939,7 +2941,16 @@
 					ast_verb(3, "%s answered %s\n", ochan_name, inchan_name);
 					if (update_connectedline) {
 						if (o->connected.id.number) {
-							ast_channel_update_connected_line(in, &o->connected);
+							ast_copy_string(macro, S_OR(pbx_builtin_getvar_helper(in, "CONNECTED_LINE_CALLER_SEND_MACRO"), ""), sizeof(macro));
+							ast_copy_string(macro_args, S_OR(pbx_builtin_getvar_helper(in, "CONNECTED_LINE_CALLER_SEND_MACRO_ARGS"), ""), sizeof(macro_args));
+							ast_log(LOG_NOTICE, "macro is %s and args is %s\n", macro, macro_args);
+							if (!ast_strlen_zero(macro)) {
+								ast_party_connected_line_copy(&in->connected, &o->connected);
+								ast_app_run_macro(o->chan, in, macro, macro_args);
+								ast_channel_update_connected_line(in, &in->connected);
+							} else {
+								ast_channel_update_connected_line(in, &o->connected);
+							}
 						} else if (o->update_connectedline) {
 							ast_channel_lock(o->chan);
 							ast_connected_line_copy_from_caller(&connected_caller, &o->chan->cid);
@@ -3039,7 +3050,16 @@
 								ast_verb(3, "%s answered %s\n", ochan_name, inchan_name);
 								if (update_connectedline) {
 									if (o->connected.id.number) {
-										ast_channel_update_connected_line(in, &o->connected);
+										ast_copy_string(macro, S_OR(pbx_builtin_getvar_helper(in, "CONNECTED_LINE_CALLER_SEND_MACRO"), ""), sizeof(macro));
+										ast_copy_string(macro_args, S_OR(pbx_builtin_getvar_helper(in, "CONNECTED_LINE_CALLER_SEND_MACRO_ARGS"), ""), sizeof(macro_args));
+										ast_log(LOG_NOTICE, "macro is %s and args is %s\n", macro, macro_args);
+										if (!ast_strlen_zero(macro)) {
+											ast_party_connected_line_copy(&in->connected, &o->connected);
+											ast_app_run_macro(o->chan, in, macro, macro_args);
+											ast_channel_update_connected_line(in, &in->connected);
+										} else {
+											ast_channel_update_connected_line(in, &o->connected);
+										}
 									} else if (o->update_connectedline) {
 										ast_channel_lock(o->chan);
 										ast_connected_line_copy_from_caller(&connected_caller, &o->chan->cid);
@@ -3099,8 +3119,17 @@
 								ast_party_connected_line_set(&o->connected, &connected);
 								ast_party_connected_line_free(&connected);
 							} else {
-								ast_verb(3, "%s connected line has changed, passing it to %s\n", ochan_name, inchan_name);
-								ast_indicate_data(in, AST_CONTROL_CONNECTED_LINE, f->data.ptr, f->datalen);
+								ast_copy_string(macro, S_OR(pbx_builtin_getvar_helper(in, "CONNECTED_LINE_CALLER_SEND_MACRO"), ""), sizeof(macro));
+								ast_copy_string(macro_args, S_OR(pbx_builtin_getvar_helper(in, "CONNECTED_LINE_CALLER_SEND_MACRO_ARGS"), ""), sizeof(macro_args));
+								ast_log(LOG_NOTICE, "macro is %s and args is %s\n", macro, macro_args);
+								ast_verb(3, "%s connected line has changed, passing it to %s\n", o->chan->name, in->name);
+								if (!ast_strlen_zero(macro)) {
+									ast_connected_line_parse_data(f->data.ptr, f->datalen, &in->connected);
+									ast_app_run_macro(o->chan, in, macro, macro_args);
+									ast_channel_update_connected_line(in, &in->connected);
+								} else {
+									ast_indicate_data(in, AST_CONTROL_CONNECTED_LINE, f->data.ptr, f->datalen);
+								}
 							}
 							break;
 						case AST_CONTROL_REDIRECTING:




More information about the asterisk-commits mailing list