MixMonitor getting answer time


I’m using MixMonitor to try and implement recording. However, what I really need is the answer time rather than the channel start time.

As I cant pass this through the ‘run script after’ option, can anyone help explain the best way to handle this?

I did try taking the duration of the recording from the end time, but using pause/resume and call holds mean this doesn’t always work out.

Many thanks

1 - How about, at whatever point in your dialplan you determine the call has been answered, you save EPOCH in a variable:


and then use that variable when you execute:


2 - Why won’t some combination of MONITOR_EXEC and MONITOR_EXEC_ARGS work for you?

Hi sedwards,

Thanks for the reply,

I don’t understand how to achieve what you’ve explained which is probably why I’m struggling myself.

The MixMonitor app is run as the channel is being created, so therefore there is no way to get the answer time from the channel as it has not happened yet.

I tried using ${ANSWEREDTIME} variable but this is substituted at the point the app is run and not when the execution script is ran.

The MixMonitor app is triggered using the b and B options on the Dial app, like this:

same = n,Dial(PJSIP/${EXTEN}@${SIPDOMAIN},30,THB(recording,s,1(outbound,${ARG1},${ARG2},${ARG3})))

exten s,1,Set(MIXMONITOR_FILENAME=/recordings/${BASE64_ENCODE(${UNIQUEID}_${EPOCH}_${ARG1}_${ARG2}@${SIPDOMAIN}_${ARG3}_${ARG4})}.wav)
 same = n,MixMonitor(${MIXMONITOR_FILENAME},abi(MIXMONID),/usr/scripts/asterisk/recording.py "${MIXMONITOR_FILENAME}")
 same = n,Return()

How would I dial and carry on a dialplan after its answered? I thought I had to wait for hangup to come out of the Dial app?

Many thanks

I think there’re a couple of options but you’ll have to change your dialplan a little bit
#1 : MixMonitor using option U of Dial application. Note: This will start recording only when a call gets answered and not when the channel is created.
#2 : Mixmonitor before you dial without using script and then use h extension or hangup handler to execute your script.

Hi satish4asterisk,

Thanks for your input.

The issue I have, which highlights I should really supply more information when asking questions! Is that I may be running MixMonitor on each channel using B and b Dial option, like this:

same = n,Dial(PJSIP/${EXTEN}@${SIPDOMAIN},30,THB(recording,s,1(outbound,${ARG1},${ARG2},${ARG3}))b(recording,s,1(outbound,${ARG4},${ARG2},${ARG3})))

This is because I’m wanting stop/start to be channel specific, and the U only runs on the called channel.

I like the idea of using the ‘h’ extension, is it possible to specify a ‘h’ dialplan for hangup on the called channel?

Many thanks

Yes, use hangup handler for the called channel.

That’s super helpful thanks!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.