[Home]

Summary:ASTERISK-09218: Variables used in MixMonitor [command] section don't update after a dial command has been run.
Reporter:Shawn Kelley (netoguy)Labels:
Date Opened:2007-04-07 01:01:13Date Closed:2007-07-06 19:18:19
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Applications/app_mixmonitor
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:According to the documentation and ^{vars} should be evaluated at the time MixMonitor end. However, I'm finding that once a dial command is called the variables become frozen and MixMonitor doesn't reflect any additional changes to them.

I can set the variable any time before the dial command and that value will be populated into the MixMonitor command when the MixMonitor Ends. (Just like it should).
However, If I set the variable anytime after the dial command, then when MixMonitor ends it doesn't utilize what I set the variable to.

In the example below, the ^{EmailRecording} will always be replaced with 'true'
Even if the MixMonitor doesn't end until priority 10 or priority 108.
Based on the documentation that is wrong. It just evaluate the variables at the time MixMonitor is ending.

Example:

exten => 1909,1,Wait(2)
exten => 1909,2,MixMonitor(${TIMESTAMP}-${UNIQUEID}.WAV||test "^{EmailRecording}" = "true" && mime-construct --header "From: 'The Asterisk PBX'<asterisk@test.com>" --to user@test.com --subject "Recorded Call From:   ^{CALLERID(name)} <^{CALLERID(num)}>" --type "text/plain" --string "Attached is the recorded file from this caller:  ^{CALLERID(name)} <^{CALLERID(num)}>" --attachment RecordedFile_${STRFTIME(${EPOCH},CDT,%F_%H%M)}.WAV --type audio/x-wave --file ^{MixMonitor_FILENAME} || echo "Not Sending Recording because of no call answer.")
exten => 1909,3,Set(cfstatus=${DB(CF/4170000000)})
exten => 1909,4,Set(EmailRecording=true) ;Set the recording flag to true by default so the MixMonitor will email if we talk to the caller.
exten => 1909,5,GotoIf($["${cfstatus}" = ""]?SendToOfficePhone)
;Goto cell phone
exten => 1909,6,Set(CALLERID(number)=${CALLERIDNUM})
exten => 1909,7,Dial(${PSTN_TRUNK}/${cfstatus},20,rM(screen))
exten => 1909,8,Set(EmailRecording=false) ;Reset the recording flag to false since we didn't talk to them and they are just going to VoiceMail.
exten => 1909,9,Voicemail(su1909)
exten => 1909,10,Hangup
;Goto office phone
exten => 1909,101(SendToOfficePhone),NoOp()
exten => 1909,102,Set(OriginalCID=${CALLERID})  ;Store the original caller id for the voicemail.
exten => 1909,103,Set(CALLERID(name)=HOTcall:${CALLERIDNAME})
exten => 1909,104,Dial(SIP/251,20,r)
exten => 1909,105,Set(CALLERID(all)=${OriginalCID}) ;Reset the CallerID for VoiceMail usage.
exten => 1909,106,Set(EmailRecording=false) ;Reset the recording flag to false since we didn't talk to them and they are just going to VoiceMail.
exten => 1909,107,Voicemail(su1909)
exten => 1909,108,Hangup()

[macro-screen]
exten => s,1,Wait(0.2)
exten => s,n,Set(MACRO_RESULT=CONTINUE) ;Set the result to not accept as default.
exten => s,n,Read(ACCEPT|custom/You-Have-A-Call-Waiting-Press1-To-Accept-TS|1||1)
exten => s,n,GotoIf($[${ACCEPT} = 1 ] ?yes:no)
exten => s,n(yes),Playback(beep&connected)
exten => s,n,Set(MACRO_RESULT=)
exten => s,n,Goto(exit)
exten => s,n(no),Set(MACRO_RESULT=CONTINUE)
exten => s,n(exit),NoOp()
Comments:By: Joshua C. Colp (jcolp) 2007-04-08 12:26:39

I was unable to reproduce this issue on the latest 1.2, can you please upgrade, try again, and if it persists post your console output?

By: Serge Vecher (serge-v) 2007-04-09 11:34:41

in fact, bug guidelines specifically say to test with the latest release, which is 1.2.17 for 1.2 branch. If you are able to reproduce this, please reopen with debugging information.

By: Shawn Kelley (netoguy) 2007-04-10 22:36:35

I updated to 1.2.17 and still have the same problem. I have re-wrote a much simpler example below. It looks like it's not acutally the dial command that is causing the problems. It appears that I can only use variables that are set before the MixMonitor app is called. Any new variables I set or any modifications I make to existing variables doesn't get populated in the command when MixMonitor ends.


;For testing of MixMonitor variable usage.
exten => 1911,1,Wait(2)
exten => 1911,2,Set(MyVar1=true)
exten => 1911,3,MixMonitor(${TIMESTAMP}-${UNIQUEID}.WAV||echo "MyVar1: ^{MyVar1}  MyVar2: ^{MyVar2}")
exten => 1911,4,Set(MyVar2=true)
exten => 1911,5,Dial(SIP/269,20,r)
exten => 1911,6,Hangup()


CONSOLE PRINTOUT:
 -- Accepting call from 'MY_NUMBER_HERE' to '1911' on channel 0/1, span 1
 -- Executing Wait("Zap/1-1", "2") in new stack
 -- Executing Set("Zap/1-1", "MyVar1=true") in new stack
 -- Executing MixMonitor("Zap/1-1", "20070410-222059-1176261657.19.WAV||echo "MyVar1: ^{MyVar1}  MyVar2: ^{MyVar2}"") in new stack
 -- Executing Set("Zap/1-1", "MyVar2=true") in new stack
 -- Executing Dial("Zap/1-1", "SIP/269|20|r") in new stack
 -- Called 269
== Begin MixMonitor Recording Zap/1-1
 -- SIP/269-084b50e0 is ringing
 -- SIP/269-084b50e0 answered Zap/1-1
== Spawn extension (from-mcleod-pri, 1911, 5) exited non-zero on 'Zap/1-1'
== End MixMonitor Recording Zap/1-1
== Executing [echo "MyVar1: true  MyVar2: "]
 -- Hungup 'Zap/1-1'

----------
As you can see any variable that is set before the MixMonitor App is called gets populated when the MixMonitor App is ended, but any variable set after MixMonitor App is called does not get populated when MixMonitor Ends.

By: Shawn Kelley (netoguy) 2007-04-11 13:39:05

Just to clarify, the summary I assigned appears to be incorrect.
It's not the dial command that is affecting it.
It is just any variable assigned after the MixMonitor application is run is not properly populated in the MixMonitors [command] when MixMonitor ends.



By: reformed (reformed) 2007-04-24 10:47:57

MixMonitor must process the variables at the time it is called.
Just re-position your mixmonitor to be just before your dial command.
The problem is that MixMonitor must process its variables at the time of calling.

The reason for this is that somtimes when the cannles are hanged up the variables will not be available to MixMonitor and it will not process the ^ commands.

I hope i explained it clearly :)

By: Shawn Kelley (netoguy) 2007-04-24 11:22:09

reformed,
If that is the case then I won't be able to use the Command feature of MixMonitor since I won't have my variable set until after the dial command completes because I need to know what happened during the dial command (if the call was answered or if it is going to voicemail instead.) Therefore I would have to call MixMonitor after the dial command, which would be pointless :)
The documentation on voip-info.org needs to be updated if this is the case also since it states: "<command> will be executed when the recording is over. Any strings matching ^{X} will be unescaped to ${X} and all variables will be evaluated at that time."  
You notice that part about "ALL VARIABLES WILL BE EVALUATED AT THAT TIME"
That would be incorrect and should be stated as "ALL VARIABLES WILL BE EVALUATED AT THE TIME MIXMONITOR IS CALLED" (NOT WHEN THE RECORDING ENDS)

If this is all true then I suppose I will have to figure out a different way of acomplishing what I need. Thanks for the input.

By: Tilghman Lesher (tilghman) 2007-04-25 01:10:59

This isn't fixable in 1.2, for the race condition in ASTERISK-6287.  However, we might be able to fix this for 1.4, by registering a datastore on the channel, since datastores are destroyed just prior to variables.

By: Joshua C. Colp (jcolp) 2007-06-27 18:26:36

I've updated the documentation in 1.2 as of revision 72378, 1.4 as of revision 72381, and trunk as of revision 72382. Sorry for the troubles that caused.

By: Digium Subversion (svnbot) 2007-07-04 18:38:36

Repository: asterisk
Revision: 73297

------------------------------------------------------------------------
r73297 | file | 2007-07-04 18:38:34 -0500 (Wed, 04 Jul 2007) | 817 lines

Merged revisions 72207,72232-72233,72241,72258,72261,72274,72304,72325-72326,72329-72330,72332,72337,72354,72358,72382,72384,72437,72452,72454-72457,72466,72490-72492,72494,72524,72539,72555,72557,72598,72600,72666,72670,72700-72701,72706,72727,72738,72741,72767,72807,72867-72869,72889,72920-72923,72927-72932,72935-72940,72982,72986-72987,73003,73006,73054,73127,73144,73174-73175,73191,73209,73254 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

................
r72207 | kpfleming | 2007-06-27 16:13:54 -0300 (Wed, 27 Jun 2007) | 10 lines

Merged revisions 72205 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r72205 | kpfleming | 2007-06-27 14:13:21 -0500 (Wed, 27 Jun 2007) | 2 lines

use the proper type for storing group number bits so that if someone specifies 'group=42' it will actually work instead of being silently ignored

........

................
r72232 | mmichelson | 2007-06-27 16:50:21 -0300 (Wed, 27 Jun 2007) | 10 lines

Adding feature to support the storage and retrieval of voicemail greetings using IMAP storage.
This feature may be turned on by adding imapgreetings=yes to the general section of voicemail.conf
voicemail.conf.sample has details on the options added.

As a result, IMAP storage now has RETRIEVE and DISPOSE macros defined.

In addition to the IMAP greeting changes, I also have added an enum for the voicemail folders
and so now the code should be easier to understand and maintain when it comes to this area.


................
r72233 | file | 2007-06-27 16:57:36 -0300 (Wed, 27 Jun 2007) | 2 lines

Fix -T option. (issue ASTERISK-9767 reported by xylome)

................
r72241 | file | 2007-06-27 17:07:46 -0300 (Wed, 27 Jun 2007) | 2 lines

Fix up properties.

................
r72258 | file | 2007-06-27 17:26:53 -0300 (Wed, 27 Jun 2007) | 18 lines

Merged revisions 72257 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r72257 | file | 2007-06-27 16:25:24 -0400 (Wed, 27 Jun 2007) | 10 lines

Merged revisions 72256 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r72256 | file | 2007-06-27 16:23:24 -0400 (Wed, 27 Jun 2007) | 2 lines

I may possibly get shot for doing this... but... defer CDR processing until after the channel has been dealt with. This should eliminate all of the issues with channels going funky (SIP/PRI) when you are posting CDRs to a database that is either slow or unavailable and do not want to enable batching.

........

................

................
r72261 | bbryant | 2007-06-27 17:47:45 -0300 (Wed, 27 Jun 2007) | 20 lines

Merged revisions 72260 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r72260 | bbryant | 2007-06-27 15:46:12 -0500 (Wed, 27 Jun 2007) | 12 lines

Merged revisions 72259 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r72259 | bbryant | 2007-06-27 15:43:53 -0500 (Wed, 27 Jun 2007) | 4 lines

Fixes 1000ad when controlling terminal disappears.

Issue ASTERISK-9371, ASTERISK-9710

........

................

................
r72274 | russell | 2007-06-27 18:09:24 -0300 (Wed, 27 Jun 2007) | 21 lines

Merged revisions 72272 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r72272 | russell | 2007-06-27 16:08:34 -0500 (Wed, 27 Jun 2007) | 13 lines

Merged revisions 72267 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r72267 | russell | 2007-06-27 16:06:45 -0500 (Wed, 27 Jun 2007) | 5 lines

Fix a minor issue with parsing the priority number.  You could have as much
whitespace as you want around a numeric priority, but you couldn't have any
whitespace around a special priority like "n" or "hint".
(issue ASTERISK-9736, reported by mitheloc, fixed by me)

........

................

................
r72304 | mattf | 2007-06-27 18:44:13 -0300 (Wed, 27 Jun 2007) | 1 line

Let's NOT create a deadlock scenario here
................
r72325 | qwell | 2007-06-27 19:17:59 -0300 (Wed, 27 Jun 2007) | 4 lines

Add support for Thai language in say.c

Issue 9417, patch by dome, with some cleanup done by me.

................
r72326 | qwell | 2007-06-27 19:27:09 -0300 (Wed, 27 Jun 2007) | 4 lines

Fix a segfault when trying to tab complete the "core show uptime" command.

Reported in #asterisk-dev on IRC by jcmoore, fixed by me.

................
r72329 | mmichelson | 2007-06-27 19:47:08 -0300 (Wed, 27 Jun 2007) | 4 lines

Added ability to customize which buttons control forward, reverse, pause, and stop during message playback.
(closes issue 9474, reported and patched by jaroth with modifications by me)


................
r72330 | file | 2007-06-27 19:48:15 -0300 (Wed, 27 Jun 2007) | 18 lines

Merged revisions 72328 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r72328 | file | 2007-06-27 18:45:49 -0400 (Wed, 27 Jun 2007) | 10 lines

Merged revisions 72327 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r72327 | file | 2007-06-27 18:43:11 -0400 (Wed, 27 Jun 2007) | 2 lines

Fix issue where queue log events might be missing. (issue ASTERISK-7561 reported by mtryfoss)

........

................

................
r72332 | file | 2007-06-27 19:58:53 -0300 (Wed, 27 Jun 2007) | 10 lines

Merged revisions 72331 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r72331 | file | 2007-06-27 18:58:02 -0400 (Wed, 27 Jun 2007) | 2 lines

Make payload IDs for iLBC/Speex match to our list. Since these are dynamic payloads the other side shouldn't care. (issue ASTERISK-9150 reported by irroot)

........

................
r72337 | bbryant | 2007-06-27 20:04:06 -0300 (Wed, 27 Jun 2007) | 18 lines

Merged revisions 72335 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r72335 | bbryant | 2007-06-27 18:03:01 -0500 (Wed, 27 Jun 2007) | 10 lines

Merged revisions 72333 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r72333 | bbryant | 2007-06-27 17:58:53 -0500 (Wed, 27 Jun 2007) | 2 lines

Reverted changes for earlier revisions 72259 to 72261. Issue ASTERISK-9371, ASTERISK-9710

........

................

................
r72354 | file | 2007-06-27 20:13:09 -0300 (Wed, 27 Jun 2007) | 2 lines

Add SIPREFERRINGCONTEXT and SIPREFERREDBYHDR variables when a transfer takes place. (issue ASTERISK-8148 reported by jcovert)

................
r72358 | file | 2007-06-27 20:14:39 -0300 (Wed, 27 Jun 2007) | 2 lines

Silly jingle...

................
r72382 | file | 2007-06-27 20:26:46 -0300 (Wed, 27 Jun 2007) | 18 lines

Merged revisions 72381 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r72381 | file | 2007-06-27 19:25:12 -0400 (Wed, 27 Jun 2007) | 10 lines

Merged revisions 72378 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r72378 | file | 2007-06-27 19:24:01 -0400 (Wed, 27 Jun 2007) | 2 lines

Update documentation to clarify variable usage with MixMonitor. (issue ASTERISK-9218 reported by netoguy)

........

................

................
r72384 | bbryant | 2007-06-27 20:30:31 -0300 (Wed, 27 Jun 2007) | 19 lines

Merged revisions 72383 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r72383 | bbryant | 2007-06-27 18:29:14 -0500 (Wed, 27 Jun 2007) | 11 lines

Merged revisions 72373 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r72373 | bbryant | 2007-06-27 18:22:13 -0500 (Wed, 27 Jun 2007) | 3 lines

Reinstating patch. This actually fixes the problem, however I was running a development branch without it and mistakenly thought it wasn't fixed.
Fixes issue ASTERISK-9710, and ASTERISK-9371: 100