[asterisk-commits] trunk - r7392 /trunk/res/res_features.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Dec 8 12:19:00 CST 2005


Author: twisted
Date: Thu Dec  8 12:18:59 2005
New Revision: 7392

URL: http://svn.digium.com/view/asterisk?rev=7392&view=rev
Log:
Allow retrieval of generated filename from one touch monitor feature.
Adds new variable TOUCH_MONITOR_OUTPUT to both legs on completion.


Modified:
    trunk/res/res_features.c

Modified: trunk/res/res_features.c
URL: http://svn.digium.com/view/asterisk/trunk/res/res_features.c?rev=7392&r1=7391&r2=7392&view=diff
==============================================================================
--- trunk/res/res_features.c (original)
+++ trunk/res/res_features.c Thu Dec  8 12:18:59 2005
@@ -442,7 +442,7 @@
 
 static int builtin_automonitor(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, char *code, int sense)
 {
-	char *caller_chan_id = NULL, *callee_chan_id = NULL, *args = NULL;
+	char *caller_chan_id = NULL, *callee_chan_id = NULL, *args = NULL, *touch_filename = NULL;
 	int x = 0;
 	size_t len;
 	struct ast_channel *caller_chan = NULL, *callee_chan = NULL;
@@ -498,17 +498,21 @@
 
 		if (!touch_monitor)
 			touch_monitor = pbx_builtin_getvar_helper(callee_chan, "TOUCH_MONITOR");
-		
+	
 		if (touch_monitor) {
 			len = strlen(touch_monitor) + 50;
 			args = alloca(len);
-			snprintf(args, len, "%s|auto-%ld-%s|m", (touch_format) ? touch_format : "wav", time(NULL), touch_monitor);
+			touch_filename = alloca(len);
+			snprintf(touch_filename, len, "auto-%ld-%s", time(NULL), touch_monitor);
+			snprintf(args, len, "%s|%s|m", (touch_format) ? touch_format : "wav", touch_filename);
 		} else {
 			caller_chan_id = ast_strdupa(caller_chan->cid.cid_num ? caller_chan->cid.cid_num : caller_chan->name);
 			callee_chan_id = ast_strdupa(callee_chan->cid.cid_num ? callee_chan->cid.cid_num : callee_chan->name);
 			len = strlen(caller_chan_id) + strlen(callee_chan_id) + 50;
 			args = alloca(len);
-			snprintf(args, len, "%s|auto-%ld-%s-%s|m", (touch_format) ? touch_format : "wav", time(NULL), caller_chan_id, callee_chan_id);
+			touch_filename = alloca(len);
+			snprintf(touch_filename, len, "auto-%ld-%s-%s", time(NULL), caller_chan_id, callee_chan_id);
+			snprintf(args, len, "%s|%s|m", (touch_format) ? touch_format : "wav", touch_filename);
 		}
 
 		for( x = 0; x < strlen(args); x++)
@@ -519,7 +523,9 @@
 			ast_verbose(VERBOSE_PREFIX_3 "User hit '%s' to record call. filename: %s\n", code, args);
 
 		pbx_exec(callee_chan, monitor_app, args, 1);
-		
+		pbx_builtin_setvar_helper(callee_chan, "TOUCH_MONITOR_OUTPUT", touch_filename);
+		pbx_builtin_setvar_helper(caller_chan, "TOUCH_MONITOR_OUTPUT", touch_filename);
+	
 		return FEATURE_RETURN_SUCCESS;
 	}
 	



More information about the asterisk-commits mailing list