Voice mail Notify with more cell phone numbers

voice mail Notify with more cell phone numbers.

i´m working with a VM cell phone notify (Provided by BobH), great application.
i´m doing some changes, like a program more phone numbers, but i have a serious problem. this is the code of VM notify:

[macro-vm-notify]

exten => s,1,Set(phonenumber=${DB(vmnotify/${ARG1})})
exten => s,2,Gotoif($[“foo${phonenumber}” = “foo”]?0:10) ;see if this vmbox has out-calling enabled

exten => s,10,HasNewVoicemail(${ARG1}) ;check for new voicemails first

;now build a .call file and then move it into the spool
exten => s,111,SetVar(spooldir=/var/spool/asterisk)
exten => s,n,System(echo “Channel: Zap/g0/”${phonenumber} > ${spooldir}/${ARG1}.call)
exten => s,n,System(echo “MaxRetries: 1” >> ${spooldir}/${ARG1}.call)
exten => s,n,System(echo “RetryTime: 60” >> ${spooldir}/${ARG1}.call)
exten => s,n,System(echo “WaitTime: 30” >> ${spooldir}/${ARG1}.call)
exten => s,n,System(echo “Context: macro-vm-notify” >> ${spooldir}/${ARG1}.call)
exten => s,n,System(echo “Extension: vmcall” >> ${spooldir}/${ARG1}.call)
exten => s,n,System(echo “Priority: 1” >> ${spooldir}/${ARG1}.call)
exten => s,n,System(echo “Setvar: vmext=”${ARG1} >> ${spooldir}/${ARG1}.call)
exten => s,n,System(mv ${spooldir}/${ARG1}.call ${spooldir}/outgoing/)

;This is where the .call file starts from
exten => vmcall,1,Answer
exten => vmcall,n,NoOp( Waiting for Answer )
exten => vmcall,n,WaitForSilence(2000)
exten => vmcall,n,NoOp( Hello )
exten => vmcall,n,Goto(talk,1)

;Somebody answered or we timed out let them know it’s a voicemail
exten => talk,1,Wait(1)
exten => talk,n,Background(this-is-the-voice-mail-system)
exten => talk,n,Background(to-log-in-to-voice-mail)
exten => talk,n,Background(press-1)
exten => talk,n,Background(or)
exten => talk,n,Background(to-hang-up)
exten => talk,n,Background(press-2)
;Wait a little bit then repeat the message
exten => talk,n,Wait(3)
exten => talk,n,Background(this-is-the-voice-mail-system)
exten => talk,n,Background(to-log-in-to-voice-mail)
exten => talk,n,Background(press-1)
exten => talk,n,Background(or)
exten => talk,n,Background(to-hang-up)
exten => talk,n,Background(press-2)

;drop them into the voicemail system
exten => 1,1,Wait(1)
exten => 1,n,VoiceMailMain(${vmext}@default)

;they don’t want to talk to us
exten => 2,1,Wait(1)
exten => 2,n,Playback(vm-goodbye)
exten => 2,n,Hangup

;They must be ignoring us
exten => t,1,Hangup

after this command line…
exten => s,n,System(mv ${spooldir}/${ARG1}.call ${spooldir}/outgoing/)
… “SIP/172-082c5a80” changed to “Zap/2-1” for example:

Executing BackGround(“SIP/172-082c5a80”, “to-log-in-to-voice-mail”)
Executing BackGround(“Zap/2-1”, “to-log-in-to-voice-mail”)

OK no problem, the problem is as follows.

look:

i copied the same code to make a second call or dial. i changed some values or variables to make it works. when the second part run with “Zap/2-1” (this is like call tag or something), it works good but don´t forget, when i made the first call the last line says Hangup and it did a hangup Zap/2 and this stop the second notify number, because the call tag is “Zap/2-1”.

if i could change “Zap/2-1” to “SIP/172-082c5a80” or something like this, probably works.
i don´t have more ideas if someone knows send me a idea and i´ll try it.

Regards carlosmg

i´m going to put here all the secuence of my aplication (Asterisk CLI), to easy understand the problem. look carefully when it tries to make the second call, i think that the final hangup at the end finish the second call. first the 172 ext is in DND, i call to the 172 ext to left a VM, when i left a VM it runs the notify.

-- Executing Macro("SIP/172-08882318", "exten-vm|172|172") in new stack
-- Executing Macro("SIP/172-08882318", "user-callerid") in new stack
-- Executing NoOp("SIP/172-08882318", "user-callerid: device 172") in new stack
-- Executing GotoIf("SIP/172-08882318", "0?report") in new stack
-- Executing GotoIf("SIP/172-08882318", "0?start") in new stack
-- Executing Set("SIP/172-08882318", "REALCALLERIDNUM=172") in new stack
-- Executing NoOp("SIP/172-08882318", "REALCALLERIDNUM is 172") in new stack
-- Executing Set("SIP/172-08882318", "AMPUSER=172") in new stack
-- Executing Set("SIP/172-08882318", "AMPUSERCIDNAME=Col_Teleco_BAGFallas") in new stack
-- Executing GotoIf("SIP/172-08882318", "0?report") in new stack
-- Executing Set("SIP/172-08882318", "CALLERID(all)=Col_Teleco_BAGFallas <172>") in new stack
-- Executing Set("SIP/172-08882318", "REALCALLERIDNUM=172") in new stack
-- Executing NoOp("SIP/172-08882318", "TTL:  ARG1: 172") in new stack
-- Executing GotoIf("SIP/172-08882318", "0?continue") in new stack
-- Executing Set("SIP/172-08882318", "_TTL=64") in new stack
-- Executing GotoIf("SIP/172-08882318", "1?continue") in new stack
-- Goto (macro-user-callerid,s,21)
-- Executing NoOp("SIP/172-08882318", "Using CallerID "Col_Teleco_BAGFallas" <172>") in new stack
-- Executing Set("SIP/172-08882318", "FROMCONTEXT=exten-vm") in new stack
-- Executing Set("SIP/172-08882318", "VMBOX=172") in new stack
-- Executing Set("SIP/172-08882318", "EXTTOCALL=172") in new stack
-- Executing Set("SIP/172-08882318", "CFUEXT=") in new stack
-- Executing Set("SIP/172-08882318", "CFBEXT=") in new stack
-- Executing Set("SIP/172-08882318", "RT=15") in new stack
-- Executing Macro("SIP/172-08882318", "record-enable|172|IN") in new stack
-- Executing GotoIf("SIP/172-08882318", "0?2:4") in new stack
-- Goto (macro-record-enable,s,4)
-- Executing DeadAGI("SIP/172-08882318", "recordingcheck|20070523-081614|1179926174.0") in new stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/recordingcheck

recordingcheck|20070523-081614|1179926174.0: Inbound recording not enabled
– AGI Script recordingcheck completed, returning 0
– Executing NoOp(“SIP/172-08882318”, “No recording needed”) in new stack
– Executing Macro(“SIP/172-08882318”, “dial|15|tr|172”) in new stack
– Executing DeadAGI(“SIP/172-08882318”, “dialparties.agi”) in new stack
– Launched AGI Script /var/lib/asterisk/agi-bin/dialparties.agi
dialparties.agi: Starting New Dialparties.agi
dialparties.agi: priority is 1
dialparties.agi: Caller ID name is ‘Col_Teleco_BAGFallas’ number is '172’
dialparties.agi: Methodology of ring is ‘none’
– dialparties.agi: Added extension 172 to extension map
– dialparties.agi: Extension 172 cf is disabled
dialparties.agi: Extension 172 has do not disturb enabled, or followme pre-ring returned busy
– AGI Script dialparties.agi completed, returning 0
– Executing NoOp(“SIP/172-08882318”, “Returned from dialparties with no extensions to call”) in new stack
– Executing NoOp(“SIP/172-08882318”, “DIALSTATUS is BUSY”) in new stack
– Executing GosubIf(“SIP/172-08882318”, “0?docfu|1”) in new stack
– Executing GosubIf(“SIP/172-08882318”, “0?docfb|1”) in new stack
– Executing NoOp(“SIP/172-08882318”, “Voicemail is 172”) in new stack
– Executing GotoIf(“SIP/172-08882318”, “0?s-BUSY|1”) in new stack
– Executing NoOp(“SIP/172-08882318”, “Sending to Voicemail box 172”) in new stack
– Executing Macro(“SIP/172-08882318”, “vm|172|BUSY”) in new stack
– Executing Macro(“SIP/172-08882318”, “user-callerid|SKIPTTL”) in new stack
– Executing NoOp(“SIP/172-08882318”, “user-callerid: Col_Teleco_BAGFallas 172”) in new stack
– Executing GotoIf(“SIP/172-08882318”, “0?report”) in new stack
– Executing GotoIf(“SIP/172-08882318”, “1?start”) in new stack
– Goto (macro-user-callerid,s,5)
– Executing NoOp(“SIP/172-08882318”, “REALCALLERIDNUM is 172”) in new stack
– Executing Set(“SIP/172-08882318”, “AMPUSER=172”) in new stack
– Executing Set(“SIP/172-08882318”, “AMPUSERCIDNAME=Col_Teleco_BAGFallas”) in new stack
– Executing GotoIf(“SIP/172-08882318”, “0?report”) in new stack
– Executing Set(“SIP/172-08882318”, “CALLERID(all)=Col_Teleco_BAGFallas <172>”) in new stack
– Executing Set(“SIP/172-08882318”, “REALCALLERIDNUM=172”) in new stack
– Executing NoOp(“SIP/172-08882318”, “TTL: 64 ARG1: SKIPTTL”) in new stack
– Executing GotoIf(“SIP/172-08882318”, “1?continue”) in new stack
– Goto (macro-user-callerid,s,21)
– Executing NoOp(“SIP/172-08882318”, “Using CallerID “Col_Teleco_BAGFallas” <172>”) in new stack
– Executing Set(“SIP/172-08882318”, “VMGAIN=”) in new stack
– Executing GotoIf(“SIP/172-08882318”, “1?s-BUSY|1”) in new stack
– Goto (macro-vm,s-BUSY,1)
– Executing NoOp(“SIP/172-08882318”, “BUSY voicemail”) in new stack
– Executing Macro(“SIP/172-08882318”, “get-vmcontext|172”) in new stack
– Executing Set(“SIP/172-08882318”, “VMCONTEXT=default”) in new stack
– Executing GotoIf(“SIP/172-08882318”, “0?200:300”) in new stack
– Goto (macro-get-vmcontext,s,300)
– Executing NoOp(“SIP/172-08882318”, “”) in new stack
– Executing VoiceMail(“SIP/172-08882318”, “172@default|b”) in new stack
– Playing ‘vm-theperson’ (language ‘es’)
– Playing ‘digits/1’ (language ‘es’)
– Playing ‘digits/7’ (language ‘es’)
– Playing ‘digits/2’ (language ‘es’)
– Playing ‘vm-isonphone’ (language ‘es’)
– Playing ‘vm-intro’ (language ‘es’)
– Got SIP response 481 “Call/Transaction Does Not Exist” back from 192.168.1.96
– Playing ‘beep’ (language ‘es’)
– Recording the message
– x=0, open writing: /var/spool/asterisk/voicemail/default/172/tmp/1sC8Ya format: wav49, 0x88898d0
– x=1, open writing: /var/spool/asterisk/voicemail/default/172/tmp/1sC8Ya format: wav, 0x8889b58
– User hung up
== Spawn extension (macro-vm, s-BUSY, 3) exited non-zero on ‘SIP/172-08882318’ in macro ‘vm’
== Spawn extension (macro-vm, s-BUSY, 3) exited non-zero on ‘SIP/172-08882318’ in macro ‘exten-vm’
== Spawn extension (macro-vm, s-BUSY, 3) exited non-zero on ‘SIP/172-08882318’
– Executing Macro(“SIP/172-08882318”, “vm-notify|172”) in new stack
– Executing Set(“SIP/172-08882318”, “phonenumber=033112511123”) in new stack
– Executing GotoIf(“SIP/172-08882318”, “0?0:10”) in new stack
– Goto (macro-vm-notify,s,10)
– Executing HasNewVoicemail(“SIP/172-08882318”, “172”) in new stack
– Executing SetVar(“SIP/172-08882318”, “spooldir=/var/spool/asterisk”) in new stack
– Executing System(“SIP/172-08882318”, "echo "Channel: Zap/2/“033112511123 > /var/spool/asterisk/172.call”) in new stack
– Executing System(“SIP/172-08882318”, “echo “MaxRetries: 5” >> /var/spool/asterisk/172.call”) in new stack
– Executing System(“SIP/172-08882318”, “echo “RetryTime: 60” >> /var/spool/asterisk/172.call”) in new stack
– Executing System(“SIP/172-08882318”, “echo “WaitTime: 50” >> /var/spool/asterisk/172.call”) in new stack
– Executing System(“SIP/172-08882318”, “echo “Context: macro-vm-notify” >> /var/spool/asterisk/172.call”) in new stack
– Executing System(“SIP/172-08882318”, “echo “Extension: vmcall” >> /var/spool/asterisk/172.call”) in new stack
– Executing System(“SIP/172-08882318”, “echo “Priority: 1” >> /var/spool/asterisk/172.call”) in new stack
– Executing System(“SIP/172-08882318”, "echo "Setvar: vmext=“172 >> /var/spool/asterisk/172.call”) in new stack
– Executing System(“SIP/172-08882318”, “mv /var/spool/asterisk/172.call /var/spool/asterisk/outgoing/”) in new stack
– Executing Set(“SIP/172-08882318”, “DB(test/count)=172”) in new stack
– Attempting call on Zap/2/033112511123 for vmcall@macro-vm-notify:1 (Retry 1)
– Got SIP response 481 “Call/Transaction Does Not Exist” back from 192.168.1.96
– Executing Answer(“Zap/2-1”, “”) in new stack
– Executing NoOp(“Zap/2-1”, " Waiting for Answer ") in new stack
– Executing WaitForSilence(“Zap/2-1”, “2000”) in new stack
– Waiting 1 time(s) for 2000 ms silence
– Exiting with 2000ms silence > 2000ms required
– Executing NoOp(“Zap/2-1”, " Hello ") in new stack
– Executing Goto(“Zap/2-1”, “talk|1”) in new stack
– Goto (macro-vm-notify,talk,1)
– Executing Wait(“Zap/2-1”, “3”) in new stack
– Executing BackGround(“Zap/2-1”, “this-is-the-voice-mail-system”) in new stack
– Executing BackGround(“Zap/2-1”, “to-log-in-to-voice-mail”) in new stack
– Playing ‘to-log-in-to-voice-mail’ (language ‘es’)
– Executing BackGround(“Zap/2-1”, “press-1”) in new stack
– Playing ‘press-1’ (language ‘es’)
– Executing BackGround(“Zap/2-1”, “or”) in new stack
– Playing ‘or’ (language ‘es’)
– Executing BackGround(“Zap/2-1”, “to-hang-up”) in new stack
– Playing ‘to-hang-up’ (language ‘es’)
– Executing BackGround(“Zap/2-1”, “press-2”) in new stack
– Playing ‘press-2’ (language ‘es’)
– Executing Set(“Zap/2-1”, “COUNT=172”) in new stack
– Executing Macro(“Zap/2-1”, “vm-notify2|172”) in new stack
– Executing Set(“Zap/2-1”, “phonenumber1=033112511108”) in new stack
– Executing GotoIf(“Zap/2-1”, “0?0:10”) in new stack
– Goto (macro-vm-notify2,s,10)
– Executing HasNewVoicemail(“Zap/2-1”, “172”) in new stack
– Executing SetVar(“Zap/2-1”, “spooldir=/var/spool/asterisk”) in new stack
– Executing System(“Zap/2-1”, "echo "Channel: Zap/2/“033112511108 > /var/spool/asterisk/172.call”) in new stack
– Executing System(“Zap/2-1”, “echo “MaxRetries: 5” >> /var/spool/asterisk/172.call”) in new stack
– Executing System(“Zap/2-1”, “echo “RetryTime: 60” >> /var/spool/asterisk/172.call”) in new stack
– Executing System(“Zap/2-1”, “echo “WaitTime: 50” >> /var/spool/asterisk/172.call”) in new stack
– Executing System(“Zap/2-1”, “echo “Context: macro-vm-notify” >> /var/spool/asterisk/172.call”) in new stack
– Executing System(“Zap/2-1”, “echo “Extension: vmcall1” >> /var/spool/asterisk/172.call”) in new stack
– Executing System(“Zap/2-1”, “echo “Priority: 1” >> /var/spool/asterisk/172.call”) in new stack
– Executing System(“Zap/2-1”, "echo "Setvar: vmext=“172 >> /var/spool/asterisk/172.call”) in new stack
– Executing System(“Zap/2-1”, “mv /var/spool/asterisk/172.call /var/spool/asterisk/outgoing/”) in new stack
– Hungup ‘Zap/2-1’

when:

exten => s,111,SetVar(spooldir=/var/spool/asterisk)
exten => s,n,System(echo “Channel: Zap/2/”${phonenumber} > ${spooldir}/${ARG1}.call)
exten => s,n,System(echo “MaxRetries: 5” >> ${spooldir}/${ARG1}.call)
exten => s,n,System(echo “RetryTime: 60” >> ${spooldir}/${ARG1}.call)
exten => s,n,System(echo “WaitTime: 50” >> ${spooldir}/${ARG1}.call)
exten => s,n,System(echo “Context: macro-vm-notify” >> ${spooldir}/${ARG1}.call)
exten => s,n,System(echo “Extension: vmcall” >> ${spooldir}/${ARG1}.call)
exten => s,n,System(echo “Priority: 1” >> ${spooldir}/${ARG1}.call)
exten => s,n,System(echo “Setvar: vmext=”${ARG1} >> ${spooldir}/${ARG1}.call)
exten => s,n,System(mv ${spooldir}/${ARG1}.call ${spooldir}/outgoing/)

these lines created a .call and send to var/spool/asterisk/outgoing/ and then:
Attempting call on Zap/2/033112511123 for vmcall@macro-vm-notify:1 (Retry 1)
it made the call.
but when i tried to make the second call:

;now build a .call file and then move it into the spool
exten => s,111,SetVar(spooldir=/var/spool/asterisk)
exten => s,n,System(echo “Channel: Zap/2/”${phonenumber1} > ${spooldir}/${ARG1}.call)
exten => s,n,System(echo “MaxRetries: 5” >> ${spooldir}/${ARG1}.call)
exten => s,n,System(echo “RetryTime: 60” >> ${spooldir}/${ARG1}.call)
exten => s,n,System(echo “WaitTime: 50” >> ${spooldir}/${ARG1}.call)
exten => s,n,System(echo “Context: macro-vm-notify2” >> ${spooldir}/${ARG1}.call)
exten => s,n,System(echo “Extension: vmcall” >> ${spooldir}/${ARG1}.call)
exten => s,n,System(echo “Priority: 2” >> ${spooldir}/${ARG1}.call)
exten => s,n,System(echo “Setvar: vmext=”${ARG1} >> ${spooldir}/${ARG1}.call)
exten => s,n,System(mv ${spooldir}/${ARG1}.call ${spooldir}/outgoing/)

it executed all lines but it didn´t created a .call to be sent to var/spool/asterisk/outgoing/ ,
i dont´know why?

this is the result of Asterisk CLI when executed the Previous line code:

Executing Macro(“SIP/172-09711b80”, “vm-notify|172”) in new stack
– Executing Set(“SIP/172-09711b80”, “phonenumber=033112511123”) in new stack
– Executing GotoIf(“SIP/172-09711b80”, “0?0:10”) in new stack
– Goto (macro-vm-notify,s,10)
– Executing HasNewVoicemail(“SIP/172-09711b80”, “172”) in new stack
– Executing SetVar(“SIP/172-09711b80”, “spooldir=/var/spool/asterisk”) in new stack
– Executing System(“SIP/172-09711b80”, "echo "Channel: Zap/2/“033112511123 > /var/spool/asterisk/172.call”) in new stack
– Executing System(“SIP/172-09711b80”, “echo “MaxRetries: 5” >> /var/spool/asterisk/172.call”) in new stack
– Executing System(“SIP/172-09711b80”, “echo “RetryTime: 60” >> /var/spool/asterisk/172.call”) in new stack
– Executing System(“SIP/172-09711b80”, “echo “WaitTime: 50” >> /var/spool/asterisk/172.call”) in new stack
– Executing System(“SIP/172-09711b80”, “echo “Context: macro-vm-notify” >> /var/spool/asterisk/172.call”) in new stack
– Executing System(“SIP/172-09711b80”, “echo “Extension: vmcall” >> /var/spool/asterisk/172.call”) in new stack
– Executing System(“SIP/172-09711b80”, “echo “Priority: 1” >> /var/spool/asterisk/172.call”) in new stack
– Executing System(“SIP/172-09711b80”, "echo "Setvar: vmext=“172 >> /var/spool/asterisk/172.call”) in new stack
– Executing System(“SIP/172-09711b80”, “mv /var/spool/asterisk/172.call /var/spool/asterisk/outgoing/”) in new stack
– Executing Set(“SIP/172-09711b80”, “DB(test/count)=172”) in new stack
– Attempting call on Zap/2/033112511123 for vmcall@macro-vm-notify:1 (Retry 1)
– Executing Answer(“Zap/2-1”, “”) in new stack
– Executing NoOp(“Zap/2-1”, " Waiting for Answer ") in new stack
– Executing WaitForSilence(“Zap/2-1”, “2000”) in new stack
– Waiting 1 time(s) for 2000 ms silence
– Exiting with 2000ms silence > 2000ms required
– Executing NoOp(“Zap/2-1”, " Hello ") in new stack
– Executing Goto(“Zap/2-1”, “talk|1”) in new stack
– Goto (macro-vm-notify,talk,1)
– Executing Wait(“Zap/2-1”, “3”) in new stack
– Executing BackGround(“Zap/2-1”, “this-is-the-voice-mail-system”) in new stack
– Executing BackGround(“Zap/2-1”, “to-log-in-to-voice-mail”) in new stack
– Playing ‘to-log-in-to-voice-mail’ (language ‘es’)
– Executing BackGround(“Zap/2-1”, “press-1”) in new stack
– Playing ‘press-1’ (language ‘es’)
– Executing BackGround(“Zap/2-1”, “or”) in new stack
– Playing ‘or’ (language ‘es’)
– Executing BackGround(“Zap/2-1”, “to-hang-up”) in new stack
– Playing ‘to-hang-up’ (language ‘es’)
– Executing BackGround(“Zap/2-1”, “press-2”) in new stack
– Playing ‘press-2’ (language ‘es’)
– Timeout on Zap/2-1
== CDR updated on Zap/2-1
– Executing Hangup(“Zap/2-1”, “”) in new stack
== Spawn extension (macro-vm-notify, t, 1) exited non-zero on ‘Zap/2-1’
– Executing Set(“Zap/2-1”, “COUNT=172”) in new stack
– Executing Macro(“Zap/2-1”, “vm-notify2|172”) in new stack
– Executing Set(“Zap/2-1”, “phonenumber1=033112511108”) in new stack
– Executing GotoIf(“Zap/2-1”, “0?0:10”) in new stack
– Goto (macro-vm-notify2,s,10)
– Executing HasNewVoicemail(“Zap/2-1”, “172”) in new stack
– Executing SetVar(“Zap/2-1”, “spooldir=/var/spool/asterisk”) in new stack
– Executing System(“Zap/2-1”, "echo "Channel: Zap/2/“033112511108 > /var/spool/asterisk/172.call”) in new stack
– Executing System(“Zap/2-1”, “echo “MaxRetries: 5” >> /var/spool/asterisk/172.call”) in new stack
– Executing System(“Zap/2-1”, “echo “RetryTime: 60” >> /var/spool/asterisk/172.call”) in new stack
– Executing System(“Zap/2-1”, “echo “WaitTime: 50” >> /var/spool/asterisk/172.call”) in new stack
– Executing System(“Zap/2-1”, “echo “Context: macro-vm-notify2” >> /var/spool/asterisk/172.call”) in new stack
– Executing System(“Zap/2-1”, “echo “Extension: vmcall” >> /var/spool/asterisk/172.call”) in new stack
– Executing System(“Zap/2-1”, “echo “Priority: 2” >> /var/spool/asterisk/172.call”) in new stack
– Executing System(“Zap/2-1”, "echo "Setvar: vmext=“172 >> /var/spool/asterisk/172.call”) in new stack
– Executing System(“Zap/2-1”, “mv /var/spool/asterisk/172.call /var/spool/asterisk/outgoing/”) in new stack
– Executing Set(“Zap/2-1”, “DB(test/count)=172”) in new stack
– Hungup ‘Zap/2-1’

i´m very close to make this work. Regards carlosmg