[asterisk-dev] I want to make my first patch but have run into a problem and don't know how to progress.
John Kiniston
johnkiniston at gmail.com
Thu Oct 6 12:52:36 CDT 2016
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.
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.
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.
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_
features.c and with a few minor changes it almost works.
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.
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?
[Oct 5 14:22:10] VERBOSE[31617][C-00000001] bridge_builtin_features.c:
AutoMonitor used to stop recording call.
[Oct 5 14:22:10] VERBOSE[31617][C-00000001] bridge_builtin_features.c:
AutoMonitor Executing: /usr/sbin/postautomon
[Oct 5 14:22:10] VERBOSE[31617][C-00000001] bridge_builtin_features.c:
AutoMonitor arguments are: johnkiniston at gmail.com
[Oct 5 14:22:10] DEBUG[31617][C-00000001] bridge_builtin_features.c:
monitor executing /usr/sbin/postautomon "auto-1475702524-5205457285-
5205457285-in.(null)" "auto-1475702524-5205457285-5205457285-out.(null)"
"auto-1475702524-5205457285-5205457285.(null)" johnkiniston at gmail.com &
--- bridges/bridge_builtin_
features.c 2016-10-05 13:54:28.293213700 -0700
+++ /home/johnk/stock/asterisk-13.11.2/bridges/bridge_builtin_features.c
2016-09-09 09:14:37.000000000 -0700
@@ -135,48 +135,6 @@
ast_bridge_channel_queue_playfile(bridge_channel, NULL,
stop_message, NULL);
ast_bridge_channel_write_playfile(bridge_channel, NULL,
stop_message, NULL);
}
- char tmp[1024];
- char tmp2[1024];
- int delfiles = 0;
- const char *execute, *execute_args, *fname;
- RAII_VAR(char *, touch_format, NULL, ast_free);
- RAII_VAR(char *, touch_monitor, NULL, ast_free);
- RAII_VAR(char *, touch_monitor_prefix, NULL, ast_free);
- set_touch_variables(bridge_channel->chan, 0, &touch_format,
&touch_monitor, &touch_monitor_prefix);
- /*
- I dont' think this works:
- set_touch_variables(bridge_channel->chan, 0, &touch_format,
&touch_monitor, &touch_monitor_prefix);
- This doesn't seem to work either:
- set_touch_variables(peer_chan, 0, &touch_format, &touch_monitor,
&touch_monitor_prefix);
- */
- /* Set the execute application */
- execute = pbx_builtin_getvar_helper(peer_chan, "MONITOR_EXEC");
- fname = pbx_builtin_getvar_helper(peer_chan,
"TOUCH_MONITOR_OUTPUT");
- ast_verb(4, "AutoMonitor Executing: %s\n", execute);
- if (ast_strlen_zero(execute)) {
- #ifdef HAVE_SOXMIX
- execute = "nice -n 19 soxmix";
- ast_verb(4, "AutoMonitor Executing soxmix.\n");
- #else
- execute = "nice -n 19 sox -m";
- ast_verb(4, "AutoMonitor Executing sox.\n");
- #endif
- delfiles = 1;
- }
- execute_args = pbx_builtin_getvar_helper(peer_chan,
"MONITOR_EXEC_ARGS");
- ast_verb(4, "AutoMonitor arguments are: %s\n",execute_args );
- if (ast_strlen_zero(execute_args)) {
- execute_args = "";
- }
- snprintf(tmp, sizeof(tmp), "%s \"%s-in.%s\" \"%s-out.%s\" \"%s.%s\"
%s &",
- execute, fname, touch_format, fname, touch_format, fname,
touch_format,execute_args);
- if (delfiles) {
- snprintf(tmp2,sizeof(tmp2), "( %s& rm -f \"%s-\"* ) &",tmp,
fname); /* remove legs when done mixing */
- ast_copy_string(tmp, tmp2, sizeof(tmp));
- }
- ast_debug(1,"monitor executing %s\n",tmp);
- if (ast_safe_system(tmp) == -1)
- ast_log(LOG_WARNING, "Execute of %s failed.\n",tmp);
}
--
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.
---Heinlein
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20161006/899c28f2/attachment.html>
More information about the asterisk-dev
mailing list