<div dir="ltr"><div>I got all fired up on getting up to date
with the current LTS version of Asterisk while at Astricon and I'd like
to make my first patch.<br><br>I want to modify
bridge_builtin_features.c to honor the"MONITOR_EXEC" and
"MONITOR_EXEC_ARGS" variables like Monitor() does so that my one touch
recordings using automon get post processed. <br><br>I'm no C programmer but I took a class at the local community college uh I guess it's been two decades ago now so forgive me.<br><br>I
found the code in res/res_monitor.c that handles setting the execute
application and running it and I've copied what looked like the part I
needed into bridges/bridge_builtin_<div><wbr>features.c and with a few minor changes it almost works.<br><br></div>The
part where it's breaking down is getting the format of the recorded
file which I think should be touch_format I'm getting (null) so I reckon
set_touch_variables doesn't do what I hoped it did.<br><br></div>Would someone please help me get the file-name extension or point me in a better direction if this doesn't look like a good idea?<br><div><br>[Oct 5 14:22:10] VERBOSE[31617][C-00000001] bridge_builtin_features.c: AutoMonitor used to stop recording call.<br>[Oct 5 14:22:10] VERBOSE[31617][C-00000001] bridge_builtin_features.c: AutoMonitor Executing: /usr/sbin/postautomon<br>[Oct 5 14:22:10] VERBOSE[31617][C-00000001] bridge_builtin_features.c: AutoMonitor arguments are: <a target="_blank" href="mailto:johnkiniston@gmail.com">johnkiniston@gmail.com</a><br>[Oct
5 14:22:10] DEBUG[31617][C-00000001] bridge_builtin_features.c: monitor
executing /usr/sbin/postautomon "auto-1475702524-5205457285-<div><wbr>5205457285-in.(null)" "auto-1475702524-5205457285-<wbr>5205457285-out.(null)" "auto-1475702524-5205457285-<wbr>5205457285.(null)" <a target="_blank" href="mailto:johnkiniston@gmail.com">johnkiniston@gmail.com</a> &<br><br><br></div><br>--- bridges/bridge_builtin_<div><wbr>features.c 2016-10-05 13:54:28.293213700 -0700<br>+++ /home/johnk/stock/asterisk-13.<wbr>11.2/bridges/bridge_builtin_<wbr>features.c 2016-09-09 09:14:37.000000000 -0700<br>@@ -135,48 +135,6 @@<br> ast_bridge_channel_queue_<wbr>playfile(bridge_channel, NULL, stop_message, NULL);<br> ast_bridge_channel_write_<wbr>playfile(bridge_channel, NULL, stop_message, NULL);<br> }<br>- char tmp[1024];<br>- char tmp2[1024];<br>- int delfiles = 0;<br>- const char *execute, *execute_args, *fname;<br>- RAII_VAR(char *, touch_format, NULL, ast_free);<br>- RAII_VAR(char *, touch_monitor, NULL, ast_free);<br>- RAII_VAR(char *, touch_monitor_prefix, NULL, ast_free);<br>- set_touch_variables(bridge_<wbr>channel->chan, 0, &touch_format, &touch_monitor, &touch_monitor_prefix);<br>- /*<br>- I dont' think this works:<br>- set_touch_variables(bridge_<wbr>channel->chan, 0, &touch_format, &touch_monitor, &touch_monitor_prefix);<br>- This doesn't seem to work either:<br>- set_touch_variables(peer_chan, 0, &touch_format, &touch_monitor, &touch_monitor_prefix);<br>- */<br>- /* Set the execute application */<br>- execute = pbx_builtin_getvar_helper(<wbr>peer_chan, "MONITOR_EXEC");<br>- fname = pbx_builtin_getvar_helper(<wbr>peer_chan, "TOUCH_MONITOR_OUTPUT");<br>- ast_verb(4, "AutoMonitor Executing: %s\n", execute);<br>- if (ast_strlen_zero(execute)) {<br>- #ifdef HAVE_SOXMIX<br>- execute = "nice -n 19 soxmix";<br>- ast_verb(4, "AutoMonitor Executing soxmix.\n");<br>- #else<br>- execute = "nice -n 19 sox -m";<br>- ast_verb(4, "AutoMonitor Executing sox.\n");<br>- #endif<br>- delfiles = 1;<br>- }<br>- execute_args = pbx_builtin_getvar_helper(<wbr>peer_chan, "MONITOR_EXEC_ARGS");<br>- ast_verb(4, "AutoMonitor arguments are: %s\n",execute_args );<br>- if (ast_strlen_zero(execute_args)<wbr>) {<br>- execute_args = "";<br>- }<br>- snprintf(tmp, sizeof(tmp), "%s \"%s-in.%s\" \"%s-out.%s\" \"%s.%s\" %s &",<br>- execute, fname, touch_format, fname, touch_format, fname, touch_format,execute_args);<br>- if (delfiles) {<br>- snprintf(tmp2,sizeof(tmp2), "( %s& rm -f \"%s-\"* ) &",tmp, fname); /* remove legs when done mixing */<br>- ast_copy_string(tmp, tmp2, sizeof(tmp));<br>- }<br>- ast_debug(1,"monitor executing %s\n",tmp);<br>- if (ast_safe_system(tmp) == -1)<br>- ast_log(LOG_WARNING, "Execute of %s failed.\n",tmp);<br>}</div><br clear="all"><br>-- <br><div class="gmail_signature">A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects.<br>---Heinlein</div>
</div></div>