+ patch for res_monitor, which adds system command execution possibility after channel record. It can help with queue monitoring things (sending recorded files to e-mail, for example), because CW's Queue() function can not continue dialplan after hangup channel (there is no options), or i just do not know something :)

This commit is contained in:
X400 2011-01-19 10:12:30 +00:00 committed by Thomas Klausner
parent 7491669a5d
commit 3aa0357db5
2 changed files with 55 additions and 1 deletions

View file

@ -1,4 +1,4 @@
$NetBSD: distinfo,v 1.4 2010/09/12 00:15:30 x400 Exp $
$NetBSD: distinfo,v 1.5 2011/01/19 10:12:30 x400 Exp $
SHA1 (callweaver-1.2.1.tgz) = f84cc3575879a89fa602e45978272bc522177ed1
RMD160 (callweaver-1.2.1.tgz) = 89f94fdca876e9126732e3e725a4ab30fdc272fc
@ -7,3 +7,4 @@ SHA1 (patch-aa) = 661b7565ab9de1e9c10ba69bb5fe03a186b847c8
SHA1 (patch-ab) = a827290d6055b8e2660429991cf4c5d70aedf29f
SHA1 (patch-ac) = 7524d64116941f8ae86f4b0fe9ae7cdc8833517e
SHA1 (patch-ad) = 8be584c01144aaa7366c268cdf2c7faba2b287ae
SHA1 (patch-ae) = b947e17a739d33dc067239f673506456d70c76e5

View file

@ -0,0 +1,53 @@
$NetBSD: patch-ae,v 1.1 2011/01/19 10:12:30 x400 Exp $
--- res/res_monitor.c.orig 2008-11-18 16:45:50.000000000 +0300
+++ res/res_monitor.c
@@ -57,7 +57,7 @@
static void *monitor_app;
static const char *monitor_name = "Monitor";
static const char *monitor_synopsis = "Monitor a channel";
-static const char *monitor_syntax = "Monitor([file_format[:urlbase]][, [fname_base][, [options]]])";
+static const char *monitor_syntax = "Monitor([file_format[:urlbase]][, [fname_base][, [options][, [syscmd]]]])";
static const char *monitor_descrip =
"Used to start monitoring a channel. The channel's input and output\n"
"voice packets are logged to files until the channel hangs up or\n"
@@ -78,6 +78,7 @@
" administrator interface\n"
"\n"
" b - Don't begin recording unless a call is bridged to another channel\n"
+" syscmd optional, if set, monitor will execute system command after recording.\n"
"\nReturns -1 if monitor files can't be opened or if the channel is already\n"
"monitored, otherwise 0.\n"
;
@@ -230,6 +231,7 @@
{
char *execute;
char *execute_args;
+ char *syscmdfl;
int explicit_file_type;
int delfiles = 0;
@@ -321,6 +323,14 @@
cw_log(LOG_WARNING, "Execute of %s failed.\n",tmp);
}
+ syscmdfl = pbx_builtin_getvar_helper(chan, "AUTO_MONITOR_SYSCMD");
+ if (syscmdfl != NULL && syscmdfl[0] != '\0')
+ {
+ cw_log(LOG_DEBUG,"monitor executing %s\n",syscmdfl);
+ if (cw_safe_system(syscmdfl) == -1)
+ cw_log(LOG_WARNING, "Execute of %s failed.\n",syscmdfl);
+ }
+
free(chan->monitor->format);
free(chan->monitor);
chan->monitor = NULL;
@@ -375,6 +385,8 @@
int waitforbridge = 0;
int res = 0;
+ pbx_builtin_setvar_helper(chan, "AUTO_MONITOR_SYSCMD", (argc > 3 ? argv[3] : ""));
+
if (argc > 2) {
for (; argv[2][0]; argv[2]++) {
switch (argv[2][0]) {