[asterisk-commits] rmudgett: branch rmudgett/cel_accountcode r416658 - /team/rmudgett/cel_accoun...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jun 18 17:40:33 CDT 2014


Author: rmudgett
Date: Wed Jun 18 17:40:26 2014
New Revision: 416658

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=416658
Log:
accountcode propagation: Fix local channel accountcode propagation with the CHANNEL function.

* Fix CHANNEL function accountcode/peeraccount crossover propagation to
the other local channel.

Modified:
    team/rmudgett/cel_accountcode/main/core_unreal.c

Modified: team/rmudgett/cel_accountcode/main/core_unreal.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/cel_accountcode/main/core_unreal.c?view=diff&rev=416658&r1=416657&r2=416658
==============================================================================
--- team/rmudgett/cel_accountcode/main/core_unreal.c (original)
+++ team/rmudgett/cel_accountcode/main/core_unreal.c Wed Jun 18 17:40:26 2014
@@ -101,6 +101,7 @@
 	struct ast_unreal_pvt *p;
 	struct ast_channel *otherchan = NULL;
 	ast_chan_write_info_t *write_info;
+	char *info_data;
 
 	if (option != AST_OPTION_CHANNEL_WRITE) {
 		return -1;
@@ -113,10 +114,19 @@
 		return -1;
 	}
 
-	if (!strcmp(write_info->function, "CHANNEL")
-		&& !strncasecmp(write_info->data, "hangup_handler_", 15)) {
-		/* Block CHANNEL(hangup_handler_xxx) writes to the other unreal channel. */
-		return 0;
+	info_data = write_info->data;
+	if (!strcmp(write_info->function, "CHANNEL")) {
+		if (!strncasecmp(info_data, "hangup_handler_", 15)) {
+			/* Block CHANNEL(hangup_handler_xxx) writes to the other unreal channel. */
+			return 0;
+		}
+
+		/* Crossover the accountcode and peeraccount to cross the unreal bridge. */
+		if (!strcasecmp(info_data, "accountcode")) {
+			info_data = "peeraccount";
+		} else if (!strcasecmp(info_data, "peeraccount")) {
+			info_data = "accountcode";
+		}
 	}
 
 	/* get the tech pvt */
@@ -141,7 +151,7 @@
 	ao2_unlock(p);
 
 	ast_channel_lock(otherchan);
-	res = write_info->write_fn(otherchan, write_info->function, write_info->data, write_info->value);
+	res = write_info->write_fn(otherchan, write_info->function, info_data, write_info->value);
 	ast_channel_unlock(otherchan);
 
 setoption_cleanup:
@@ -654,13 +664,13 @@
 
 	ast_party_dialed_copy(ast_channel_dialed(semi2), ast_channel_dialed(semi1));
 
-	/* Crossover the CallerID and conected-line to cross the local bridge. */
+	/* Crossover the CallerID and conected-line to cross the unreal bridge. */
 	ast_connected_line_copy_to_caller(ast_channel_caller(semi2), ast_channel_connected(semi1));
 	ast_connected_line_copy_from_caller(ast_channel_connected(semi2), ast_channel_caller(semi1));
 
 	ast_channel_language_set(semi2, ast_channel_language(semi1));
 
-	/* Crossover the accountcode and peeraccount to cross the local bridge. */
+	/* Crossover the accountcode and peeraccount to cross the unreal bridge. */
 	ast_channel_accountcode_set(semi2, ast_channel_peeraccount(semi1));
 	ast_channel_peeraccount_set(semi2, ast_channel_accountcode(semi1));
 




More information about the asterisk-commits mailing list