[Home]

Summary:ASTERISK-24345: StopMixMonitor doesn't stop audio recording when run using DYNAMIC_FEATURES
Reporter:Leandro Dardini (ldardini)Labels:
Date Opened:2014-09-20 16:54:37Date Closed:2014-09-24 15:46:25
Priority:MinorRegression?
Status:Closed/CompleteComponents:Features
Versions:11.12.1 12.5.0 Frequency of
Occurrence
Constant
Related
Issues:
Environment:Attachments:
Description:If MixMonitor recording is started in the dialplan and then the recording is attempted to stop using a macro executed using DYNAMIC_FEATURES, it is not stopped. If the MixMonitor recording is started using DYNAMIC_FEATURES, then it can be stopped using StopMixMonitor using DYNAMIC_FEATURES.

Example code:

From extensions.ael
{noformat}
9999 => {
   Set(RECORDINGFORMAT=wav);                 Set(__MONITOR_FILENAME=${UNIQUEID}.${RECORDINGFORMAT});
    Set(__DYNAMIC_FEATURES=StopMixMonitor#StartMixMonitor);
    MixMonitor(${MONITOR_FILENAME},ai(MIXMONITORID));
    Set(__MIXMONITORID=${MIXMONITORID});
    Dial(SIP/104-DEVEL);
     }
{noformat}

From extensions.conf
{noformat}
[macro-pause-recording]
exten => s,1,NoOp(Stopping Recording - MONITOR_FILENAME is ${MONITOR_FILENAME} - MIXMONITORID is ${MIXMONITORID})
exten => s,n,StopMixMonitor(${MIXMONITORID})

[macro-unpause-recording]
exten => s,1,NoOp(Resuming Recording - MONITOR_FILENAME is ${MONITOR_FILENAME} - MIXMONITORID is ${MIXMONITORID})
exten => s,n,MixMonitor(${MONITOR_FILENAME},a)
{noformat}

From features.conf
{noformat}
StopMixMonitor  => #0,peer/both,Macro(pause-recording)                                                
StartMixMonitor => #1,peer/both,Macro(unpause-recording)
{noformat}

The asterisk log shows that stopMixMonitor is executed, but the recording is not stopped:
{noformat}
   -- Executing [9999@authenticated:1] Set("SIP/103-DEVEL-0000001b", "RECORDINGFORMAT=wav") in new stack
   -- Executing [9999@authenticated:2] Set("SIP/103-DEVEL-0000001b", "__MONITOR_FILENAME=srv01-1411249646.27.wav") in new stack
   -- Executing [9999@authenticated:3] Set("SIP/103-DEVEL-0000001b", "__DYNAMIC_FEATURES=StopMixMonitor#StartMixMonitor") in new stack
   -- Executing [9999@authenticated:4] MixMonitor("SIP/103-DEVEL-0000001b", "srv01-1411249646.27.wav,i(MIXMONITORID)a") in new stack
   -- Executing [9999@authenticated:5] Set("SIP/103-DEVEL-0000001b", "__MIXMONITORID=0x7f41d0016730") in new stack
 == Begin MixMonitor Recording SIP/103-DEVEL-0000001b
   -- Executing [9999@authenticated:6] Dial("SIP/103-DEVEL-0000001b", "SIP/104-DEVEL") in new stack
 == Using SIP RTP TOS bits 184
 == Using SIP RTP CoS mark 5
   -- Called SIP/104-DEVEL
   -- SIP/104-DEVEL-0000001c is ringing
   -- SIP/104-DEVEL-0000001c answered SIP/103-DEVEL-0000001b
      > 0x7f41cc06bb50 -- Probation passed - setting RTP source address to 217.200.185.19:4010
      > 0x7f41d00228e0 -- Probation passed - setting RTP source address to 83.211.224.67:11790
      > 0x7f41d00228e0 -- Probation passed - setting RTP source address to 83.211.224.67:11790
      > 0x7f41cc06bb50 -- Probation passed - setting RTP source address to 217.200.185.19:4010
   --  Feature Found: StopMixMonitor exten: StopMixMonitor
   -- Executing [s@macro-pause-recording:1] NoOp("SIP/104-DEVEL-0000001c", "Stopping Recording - MONITOR_FILENAME is srv01-1411249646.27.wav - MIXMONITORID is 0x7f41d0016730") in new stack
   -- Executing [s@macro-pause-recording:2] StopMixMonitor("SIP/104-DEVEL-0000001c", "0x7f41d0016730") in new stack
srv01*CLI>
srv01*CLI>
srv01*CLI>
srv01*CLI>
srv01*CLI>
srv01*CLI>
srv01*CLI>
srv01*CLI>
srv01*CLI>
srv01*CLI>
{noformat}

Usually when the MixMonitor recording is stopped, the following messages appear in the log. When the StopMixMonitor is executed inside a macro called using DYNAMIC_FEATURES, they are not shown (and the recording is not stopped)
{noformat}
 == MixMonitor close filestream (mixed)
 == End MixMonitor Recording ....
{noformat}
Comments:By: Rusty Newton (rnewton) 2014-09-24 15:44:12.501-0500

First off, thank you [~ldardini] for providing a great description of your issue and all of the debug, logs and dialplan necessary to investigate the issue.

Fortunately the issue does not appear to be a bug, but only invalid configuration.

You are starting MixMonitor on one channel:

{noformat}
-- Executing [9999@authenticated:4] MixMonitor("SIP/103-DEVEL-0000001b", "srv01-1411249646.27.wav,i(MIXMONITORID)a") in new stack
{noformat}

You are attempting to stop MixMonitor on *a different channel*:

{noformat}
-- Executing [s@macro-pause-recording:2] StopMixMonitor("SIP/104-DEVEL-0000001c", "0x7f41d0016730") in new stack
{noformat}

The documentation for StopMixMonitor says:

{noformat}
[Description]
Stops the audio recording that was started with a call to 'MixMonitor()' on
the current channel.
{noformat}

Therefore, you must call StopMixMonitor on the same channel. I talked with [~mmichelson] (an Asterisk dev) to verify that this is the case.

You may wish to reconsider the construction of your dynamic feature mapping. Or else the ways in which you are starting and stopping MixMonitor altogether. In the case of the dynamic feature:

{noformat}
StopMixMonitor  => #0,peer/both,Macro(pause-recording)
{noformat}

For the ActivatedOn field, you are using *peer* which , in the case MixMonitor was started via your dialplan, will attempt to StopMixMonitor on the connected channel and not the channel calling the feature (where you have MixMonitor running).

I'm going to close out the issue. If you have any more questions on this; the best place to post them would probably be the [Asterisk Users mailing list|http://lists.digium.com/mailman/listinfo/asterisk-users].

Thanks again for being rigorous with the details you provided on your report.