[asterisk-users] Executing Script after MixMonitor is called

Satish Barot satish4asterisk at gmail.com
Fri Jul 5 00:29:43 CDT 2013


On Fri, Jul 5, 2013 at 1:45 AM, Gopalakrishnan N <
gopalakrishnan.an at gmail.com> wrote:

> exten => _4X.,1,Set(START_TIME=${STRFTIME(${EPOCH},,%Y-%m-%d_%H:%M:%S)})
> exten => _4X.,n,Set(MIXMONITOR_FILENAME=${EXTEN}-${START_TIME}-OUT)
> ;exten =>
> _4X.,n,MixMonitor(IND_PRI/${CDR(accountcode)}/OUT/${STRFTIME(${EPOCH},,%Y-%m)}/${STRFTIME(${EPOCH},,%d)}/${MIXMONITOR_FILENAME}.wav,m,/root/flac.sh
> ${MIXMONITOR_FILENAME}.wav)
> exten =>
> _4X.,n,MixMonitor(IND_PRI/${CDR(accountcode)}/OUT/${STRFTIME(${EPOCH},,%Y-%m)}/${STRFTIME(${EPOCH},,%d)}/${MIXMONITOR_FILENAME}.wav,b,/root/flac.sh
> ${MIXMONITOR_FILENAME}.wav)
> exten =>
> _4X.,n,Set(CDR(userfield)=IND_PRI/${CDR(accountcode)}/OUT/${STRFTIME(${EPOCH},,%Y-%m)}/${STRFTIME(${EPOCH},,%d)}/${MIXMONITOR_FILENAME})
> exten => _4X.,n,Dial(SIP/${EXTEN},30)
> exten => _4X.,n,Hangup
>
> Regards
> On 4 Jul 2013 11:18, "Satish Barot" <satish4asterisk at gmail.com> wrote:
>
>> On Thu, Jul 4, 2013 at 1:30 AM, Gopalakrishnan N <
>> gopalakrishnan.an at gmail.com> wrote:
>>
>>> I tried with hangup cause but my script is not executed... also I tried
>>> the same script with mix monitor itself no sucess.
>>>
>>> The script what I have is, am converting wav file to flac format..
>>> On 11 Jun 2013 11:17, "Satish Barot" <satish4asterisk at gmail.com> wrote:
>>>
>>>> And yes if you want to use System application in your dialplan then
>>>> have System in your h extension
>>>>
>>>> System(/PathToSox/sox -r 8000 -c 1 /PathToWavFile/filename.wav /PathToMp3FileToBE Stored/filename.mp3)
>>>>
>>>> On Tue, Jun 11, 2013 at 10:38 AM, Satish Barot <
>>>> satish4asterisk at gmail.com> wrote:
>>>>
>>>>> Hi Gopamkrishnan,
>>>>>
>>>>> Check the 'command' argument for Mixmonitor. Mixmonitor itself has a
>>>>> facility to execute a command when recording is over.
>>>>>
>>>>> *In my case, 'wav2mp3' is a script which gets executed and converts recorded wav audio file to mp3. I pass ${FILENAME} as an argument to my script.*
>>>>>
>>>>> *You should have something like *MixMonitor(filename.wav,m,/PathToYourScript/YourScriptName^filename.wav) in your dialplan.
>>>>>
>>>>> Hope this helps.
>>>>>
>>>>> --Satish Barot
>>>>>
>>>>> Ahmedabad, India
>>>>>
>>>>>
>>>>> On Tue, Jun 11, 2013 at 9:31 AM, Gopalakrishnan N <
>>>>> gopalakrishnan.an at gmail.com> wrote:
>>>>>
>>>>>> Hi Satish,
>>>>>>
>>>>>> I tried with sox, without any parameter, just sox filename.wav to
>>>>>> filename.mp3, in linux shell prompt... the file is been converted...
>>>>>>
>>>>>> Now If i want to run that command using dialplan,
>>>>>>
>>>>>> MixMonitor(filename.wav,m)
>>>>>> Monitor_Exec(sox filename.wav filename.mp3)
>>>>>>
>>>>>> Or to use System command?
>>>>>>
>>>>>> Regards..
>>>>>>
>>>>>>
>>>>>> On Fri, Jan 27, 2012 at 11:29 AM, Satish Barot <
>>>>>> satish4asterisk at gmail.com> wrote:
>>>>>>
>>>>>>> This is how I use a wav to mp3 script on Mixmonitor in my dialplan
>>>>>>> (Asterisk 1.8.7.0).
>>>>>>> ...
>>>>>>> same => n,MixMonitor(${FILENAME},W(4),/var/spool/asterisk/wav2mp3
>>>>>>> ^{FILENAME})
>>>>>>> ...
>>>>>>> and my script is...
>>>>>>>
>>>>>>> #!/bin/bash
>>>>>>>
>>>>>>> WAV="/var/spool/asterisk/monitor/$1"
>>>>>>> MP3=$(echo $1 | sed 's/\.wav$/.mp3/')
>>>>>>> MP3DEST="/var/spool/asterisk/mp3/$MP3"
>>>>>>> /usr/bin/lame "${WAV}" "${MP3DEST}" --silent -b 16 -s 9.6 -m m
>>>>>>> --bitwidth 8 --lowpass 9.6 --resample 8 --lowpass-width 1
>>>>>>>
>>>>>>> --SATISH BAROT
>>>>>>> Ahmedabad,India.
>>>>>>>
>>>>>>>
>>>>>>> On Wed, Jan 25, 2012 at 8:59 PM, Faraj Khasib <
>>>>>>> fkhasib at iconnecths.com> wrote:
>>>>>>>
>>>>>>>> Hello Guys,
>>>>>>>> I am trying to convert files that are .wac to mp3 after mixmonitor
>>>>>>>> command is called but it doesnt execute the command, I tried the command in
>>>>>>>> terminal it worked, any help please ... below is my dial plan
>>>>>>>> exten=6500,n,Set(MIXMONITOR_EXEC=&& nice -n 19 /usr/local/bin/lame
>>>>>>>> -b 8 -t -F -m m --bitwidth 8 --quiet
>>>>>>>> "/var/spool/asterisk/monitor/${CALLFILENAME}.wav"
>>>>>>>> "/var/spool/asterisk/monitor/${CALLFILENAME}.mp3" && rm -f
>>>>>>>> "/var/spool/asterisk/monitor/${CALLFILENAME}.wav")
>>>>>>>> exten=6500,n,MixMonitor(${CALLFILENAME}.wav,b)
>>>>>>>>
>>>>>>>>
>>>
>> Show your latest dialplan and script.
>>
>> --Satish Barot
>> Ahmedabad, India
>>
>>
>>
Some observations,
(1) You are missing ^ in command in Mixmonitor.In your case, It should be
something like
MixMonitor(IND_PRI/${CDR(accountcode)}/OUT/${STRFTIME(${EPOCH},,%Y-%m)}/${STRFTIME(${EPOCH},,%d)}/${MIXMONITOR_FILENAME}.wav,m,/root/flac.sh
^${MIXMONITOR_FILENAME}.wav)
(2) You are passing just file name as a parameter in your script and not a
full path for file. (Do you handle full path in a script?)

--Satish Barot
Ahmedabad, India
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20130705/d33eb632/attachment.htm>


More information about the asterisk-users mailing list