[Asterisk-Dev] Asterisk make clean and make looping??

Chih-Wei Huang cwhuang at citron.com.tw
Wed Nov 2 02:06:13 MST 2005


I'm trying the new application MixMonitor in 1.2-beta2.
Unfortunately, it didn't work as I expected.

My dialplan is like this:

[macro-checkrec]
;
;   ${ARG1} - Caller
;   ${ARG2} - Callee
;
exten => s,1,Set(RECFILE=${ARG1}-${ARG2}_${UNIQUEID})
exten => s,2,MixMonitor(${RECFILE},b)


The console shown the following error messages:

Nov  2 16:26:36 WARNING[22223]: file.c:978 ast_writefile: No such format '1'
Nov  2 16:26:36 ERROR[22223]: app_mixmonitor.c:163 mixmonitor_thread: 
Cannot open /var/spool/asterisk/monitor/900-995_1130919996.1


I traced app_mixmonitor.c and found the reason.
In mixmonitor_thread,

if ((ext = strchr(mixmonitor->filename, '.'))) {
           *(ext++) = '\0';

that is, it consider the string after . of filename
to be an ext. In my above case, it is "1", which won't work surely.
However, it's not my intention to use "xxxx.1" as the filename.
It comes from ${UNIQUEID}, which is generated from Asterisk.
Sadly...

My suggestion:

* Find the last occurrence of '.' in filename instead of the first one.
That is, simply replace strchr by strrchr.
Then I can workaround by MixMonitor(${RECFILE}.wav,b)
This is the simplest solution, but it doesn't work if people
use a filename containing '.' without specifying an ext explicitly
(like my original dialplan)

* (Better solution) Let people specify the ext by another argument,
instead of part of the first argument(filename).
That is, change the syntax to

MixMonitor(<file>[|<ext>[|<options>[|<command>]]])

Since MixMonitor is a very new application, it won't affect too many
people. I hope.


BTW, I'm curious why ${UNIQUEID} contains a dot.
It usually causes troubles. Doesn't it?
How about change it to _ (underline)?


-- 
    ~     Chih-Wei Huang (cwhuang at citron.com.tw)
   'v'    CTO, Citron Network Inc. ( http://www.citron.com.tw/ )
  // \\   GnuGK Project : http://www.gnugk.org/    (Developer)
/(   )\  HomePage      : http://www.linux.org.tw/~cwhuang/
  ^`~'^



More information about the asterisk-dev mailing list