Start & stop call recording to voicemal

I’m using the macro: recordtovm. This script allows me to listen to recorded phone calls from my phone instead of through the web interface. It can be viewed by going to: http://www.linuxquestions.org/questions/linux-software-2/asterisk-want-to-listen-to-recorded-call-from-phone-not-from-web-interface-876216/

This script works great, but I need to stop call recording during the call rather than when I hang up. I want to be able to press *3 to stop the recording. Does anyone have a solution?

Add a feature code to use the StopMixMonitor application

Can you supply me with some code to use, say *4, to stop MixMonitor and which config file I should add it to?

I can’t but the wonders of google can:

http://lists.digium.com/pipermail/asterisk-users/2014-August/284335.html

1 Like

This is what my config files look like. Apparently I’m missing something because it’s not working yet.

extensions_custom.conf

#include mwi_blf.conf ;DO NOT DELETE THIS LINE
[macro-recordtovm]
exten => s,1,Set(MONITOR_FILENAME=${STRFTIME(${EPOCH},%Y%m%d-%H%M%S)}-${CALLERID(num)})
exten => s,n,Set(DYNAMIC_FEATURES=recordtovm)
exten => s,n,MixMonitor(${MONITOR_FILENAME}.wav,b, /var/lib/asterisk/scripts/recordtovm.pl ${CALLERID(num)} ${MONITOR_FILENAME}.wav "${STRFTIME(${EPOCH},%a %b %d %T %$

[macro-pauseRecording]
exten => s,1,Verbose(Stopping Recording)
exten => s,n,Set(DYNAMIC_FEATURES=StopMixMonitor)
exten => s,n,StopMixMonitor()

[macro-resumeRecording]
exten => s,1,Verbose(Resuming Recording)
exten => s,n,Set(DYNAMIC_FEATURES=ResumeMixMonitor)
exten =>,s,n,MixMonitor(${MONITOR_FILENAME}.wav,a)

features_applicationmap_custom.conf

recordtovm =>*3,self,Macro,recordtovm
StopMixMonitor =>#00,self,Macro,pauseRecording
ResumeMixMonitor =>#01,self,Macro,resumeRecording

globals_custom.conf

DYNAMIC_FEATURES=>recordtovm#pauseRecording#resumeRecording

Asterisk CLI output

[2017-08-09 07:54:26] WARNING[5410][C-000015bf]: features_config.c:1349 ast_get_chan_applicationmap: Unknown DYNAMIC_FEATURES item ‘pauseRecording’ on channel SIP/cnttrunk-000061aa.
[2017-08-09 07:54:26] WARNING[5410][C-000015bf]: features_config.c:1349 ast_get_chan_applicationmap: Unknown DYNAMIC_FEATURES item ‘resumeRecording’ on channel SIP/cnttrunk-000061aa.
[2017-08-09 07:54:26] WARNING[5416][C-000015bf]: features_config.c:1349 ast_get_chan_applicationmap: Unknown DYNAMIC_FEATURES item ‘pauseRecording’ on channel SIP/901-000061ac.
[2017-08-09 07:54:26] WARNING[5416][C-000015bf]: features_config.c:1349 ast_get_chan_applicationmap: Unknown DYNAMIC_FEATURES item ‘resumeRecording’ on channel SIP/901-000061ac.
[2017-08-09 07:54:26] WARNING[5410][C-000015bf]: features_config.c:1349 ast_get_chan_applicationmap: Unknown DYNAMIC_FEATURES item ‘pauseRecording’ on channel SIP/cnttrunk-000061aa.
[2017-08-09 07:54:26] WARNING[5410][C-000015bf]: features_config.c:1349 ast_get_chan_applicationmap: Unknown DYNAMIC_FEATURES item ‘resumeRecording’ on channel SIP/cnttrunk-000061aa.

Any suggestions on what I’m missing?

It looks like you are using the last field rather than the first field, in features.conf, when setting DYNAMIC_FEATURES.

And if I recall in the extensions.conf the dynamic feature should be underscored like Set(__DYNAMIC_FEATURES

May need some clarification on what is meant by “… last field rather than the first …”. I placed underscores before Dynamic and changed StopMixMonitor and ResumeMixMonitor to pauseRecording and resumeRecording, respectively. I’m still getting CLI output.

Are there any further suggestions?

extensions_custom.conf
#include mwi_blf.conf ;DO NOT DELETE THIS LINE
[macro-recordtovm]
exten => s,1,Set(MONITOR_FILENAME=${STRFTIME(${EPOCH},%Y%m%d-%H%M%S)}-${CALLERID(num)})
exten => s,n,Set(_DYNAMIC_FEATURES=pauseRecording)
exten => s,n,MixMonitor(${MONITOR_FILENAME}.wav,b, /var/lib/asterisk/scripts/recordtovm.pl ${CALLERID(num)} ${MONITOR_FILENAME}.wav "${STRFTIME(${EPOCH},%a %b %d %T %$

[macro-pauseRecording]
exten => s,1,Verbose(Stopping Recording)
exten => s,n,Set(_DYNAMIC_FEATURES=pauseRecording)
exten => s,n,StopMixMonitor()

[macro-resumeRecording]
exten => s,1,Verbose(Resuming Recording)
exten => s,n,Set(_DYNAMIC_FEATURES=resumeRecording)
exten =>,s,n,MixMonitor(${MONITOR_FILENAME}.wav,a)

features_applicationmap_custom.conf
recordtovm =>*3,self,Macro,recordtovm
pauseRecording =>#00,self,Macro,pauseRecording
resumeRecording =>#01,self,Macro,resumeRecording

Must be a double underscore, your Variable monitor_filename is lost at the first context you need to add underscores too for the inheritance.

After those changes, show us the output of dialplan show command, the complete features.conf and finally the output of a failed call.

I think it is more likely the OP has got the FreePBX customisation wrong and the features definitions haven’t been parsed at all.

Thanks for the help! It’s working just the way I want.

I also found a couple of things.
1, I didn’t double underscore the monitor file name variable.
2. I started the mixmonitor with an “a” option instead of the “b” option. This in particular seemed to solve the issue.

Thanks again!!