Code snippet from my dial plan…
exten => 21,1,Wait,1
exten => 21,2,Dial(Zap/1,20)
exten => 21,n,Wait,1 ; No answer, leave message
exten => 21,n,Playback(BNP/In/Eric/notavail)
exten => 21,n,Record(BNP/In/Eric/inmessage:wav,10,600)
exten => … Do some stuff to process the received voicemail message …
This is basically an implementation of an ULTRA-simple voicemail system that doesn’t use the Voicemail application (because I haven’t gotten around to figuring out the Voicemail application yet). Basically, the “stuff to process the received voicemail message” includes uuencoding it and emailing it as a file attachment to the owner of the voicemail box.
That all works fine IF the caller hits the pound (#) key after leaving the message.
If the caller just hangs up without hitting the # key, none of the post-processing happens.
I know that the Record application returns -1 if the caller hangs up (I guess that means it returns 0 if the caller hits the # key). What I don’t understand, and can’t find, is how to make use of the -1 return to make the dialplan do the normal post-processing of the voicemail message if the caller just hangs up.
I have looked through the sample dialplans and have seen things like…
exten => s,1,Dial(${ARG2},20|p)
exten => s,2,Goto(s-${DIALSTATUS},1)
exten => s-NOANSWER,1,Voicemail(u${ARG1})
exten => s-NOANSWER,2,Goto(default,s,1)
exten => s-BUSY,1,Voicemail(b${ARG1})
exten => s-BUSY,2,Goto(default,s,1)
exten => s-DONTCALL,1,Goto(${ARG3},s,1)
exten => s-TORTURE,1,Goto(${ARG4},s,1)
… where I guess Dial returns DIALSTATUS and one can jump based on that. So, if there were a variable called RECORDSTATUS I suppose I could do something like the above. But, there isn’t, at least not that I can find, so how do I get at that -1 value and do useful things with it?