[asterisk-commits] mmichelson: branch mmichelson/digit_manipulation r196071 - in /team/mmichelso...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu May 21 15:41:48 CDT 2009


Author: mmichelson
Date: Thu May 21 15:41:45 2009
New Revision: 196071

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=196071
Log:
Add necessary channel locking when getting macro names.


Modified:
    team/mmichelson/digit_manipulation/apps/app_dial.c
    team/mmichelson/digit_manipulation/apps/app_directed_pickup.c
    team/mmichelson/digit_manipulation/main/features.c

Modified: team/mmichelson/digit_manipulation/apps/app_dial.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/mmichelson/digit_manipulation/apps/app_dial.c?view=diff&rev=196071&r1=196070&r2=196071
==============================================================================
--- team/mmichelson/digit_manipulation/apps/app_dial.c (original)
+++ team/mmichelson/digit_manipulation/apps/app_dial.c Thu May 21 15:41:45 2009
@@ -936,8 +936,10 @@
 					ast_verb(3, "%s answered %s\n", c->name, in->name);
 					if (!single && !ast_test_flag64(peerflags, OPT_IGNORE_CONNECTEDLINE)) {
 						if (o->connected.id.number) {
+							ast_channel_lock(in);
 							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_channel_unlock(in);
 							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);
@@ -995,8 +997,10 @@
 						ast_verb(3, "%s answered %s\n", c->name, in->name);
 						if (!single && !ast_test_flag64(peerflags, OPT_IGNORE_CONNECTEDLINE)) {
 							if (o->connected.id.number) {
+								ast_channel_lock(in);
 								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_channel_unlock(in);
 								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);
@@ -1093,8 +1097,10 @@
 						ast_party_connected_line_set(&o->connected, &connected);
 						ast_party_connected_line_free(&connected);
 					} else {
+						ast_channel_lock(in);
 						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_channel_unlock(in);
 						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", c->name, in->name);
 						if (!ast_strlen_zero(macro)) {
@@ -1233,8 +1239,10 @@
 					ast_verb(3, "%s requested special control %d, passing it to %s\n", in->name, f->subclass, outgoing->chan->name);
 					ast_indicate_data(outgoing->chan, f->subclass, f->data.ptr, f->datalen);
 				} else if (f->subclass == AST_CONTROL_CONNECTED_LINE) {
+					ast_channel_lock(in);
 					ast_copy_string(macro, S_OR(pbx_builtin_getvar_helper(in, "CONNECTED_LINE_CALLEE_SEND_MACRO"), ""), sizeof(macro));
 					ast_copy_string(macro_args, S_OR(pbx_builtin_getvar_helper(in, "CONNECTED_LINE_CALLEE_SEND_MACRO_ARGS"), ""), sizeof(macro_args));
+					ast_channel_unlock(in);
 					ast_log(LOG_NOTICE, "macro is %s and args is %s\n", macro, macro_args);
 					if (!ast_strlen_zero(macro)) {
 						ast_connected_line_parse_data(f->data.ptr, f->datalen, &outgoing->chan->connected);

Modified: team/mmichelson/digit_manipulation/apps/app_directed_pickup.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/mmichelson/digit_manipulation/apps/app_directed_pickup.c?view=diff&rev=196071&r1=196070&r2=196071
==============================================================================
--- team/mmichelson/digit_manipulation/apps/app_directed_pickup.c (original)
+++ team/mmichelson/digit_manipulation/apps/app_directed_pickup.c Thu May 21 15:41:45 2009
@@ -93,10 +93,15 @@
 {
 	int res = 0;
 	struct ast_party_connected_line connected_caller;
-	const char * const macro = ast_strdupa(S_OR(pbx_builtin_getvar_helper(target, "CONNECTED_LINE_CALLEE_SEND_MACRO"), ""));
-	const char * const macro_args = ast_strdupa(S_OR(pbx_builtin_getvar_helper(target, "CONNECTED_LINE_CALLEE_SEND_MACRO_ARGS"), ""));
+	const char * macro;
+	const char * macro_args;
 
 	ast_debug(1, "Call pickup on '%s' by '%s'\n", target->name, chan->name);
+
+	ast_channel_lock(target);
+	macro = ast_strdupa(S_OR(pbx_builtin_getvar_helper(target, "CONNECTED_LINE_CALLEE_SEND_MACRO"), ""));
+	macro_args = ast_strdupa(S_OR(pbx_builtin_getvar_helper(target, "CONNECTED_LINE_CALLEE_SEND_MACRO_ARGS"), ""));
+	ast_channel_unlock(target);
 
 	connected_caller = target->connected;
 	ast_party_connected_line_init(&target->connected);

Modified: team/mmichelson/digit_manipulation/main/features.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/mmichelson/digit_manipulation/main/features.c?view=diff&rev=196071&r1=196070&r2=196071
==============================================================================
--- team/mmichelson/digit_manipulation/main/features.c (original)
+++ team/mmichelson/digit_manipulation/main/features.c Thu May 21 15:41:45 2009
@@ -2715,8 +2715,10 @@
 				ast_indicate(other, f->subclass);
 				break;
 			case AST_CONTROL_CONNECTED_LINE:
+				ast_channel_lock(who);
 				ast_copy_string(macro, S_OR(pbx_builtin_getvar_helper(who, who == chan ? "CONNECTED_LINE_CALLEE_SEND_MACRO" : "CONNECTED_LINE_CALLER_SEND_MACRO"), ""), sizeof(macro));
 				ast_copy_string(macro_args, S_OR(pbx_builtin_getvar_helper(who, who == chan ? "CONNECTED_LINE_CALLEE_SEND_MACRO_ARGS " : "CONNECTED_LINE_CALLER_SEND_MACRO_ARGS"), ""), sizeof(macro_args));
+				ast_channel_unlock(who);
 				if (!ast_strlen_zero(macro)) {
 					ast_connected_line_parse_data(f->data.ptr, f->datalen, &other->connected);
 					ast_app_run_macro(who, other, macro, macro_args);
@@ -4511,10 +4513,10 @@
 		return -1;
 	}
 
+	ast_channel_lock_both(cur, chan);
+
 	macro = ast_strdupa(S_OR(pbx_builtin_getvar_helper(cur, "CONNECTED_LINE_CALLEE_SEND_MACRO"), ""));
 	macro_args = ast_strdupa(S_OR(pbx_builtin_getvar_helper(cur, "CONNECTED_LINE_CALLEE_SEND_MACRO_ARGS"), ""));
-
-	ast_channel_lock_both(cur, chan);
 
 	cur_name = ast_strdupa(cur->name);
 	chan_name = ast_strdupa(chan->name);




More information about the asterisk-commits mailing list