Hello, I use the following macro to screen calls when they come in. Priv-instruct-custom says "press 1 to accept, press 2 to reject" However, when no input is made (or the call goes to my mobile's voicemail and therefore no input is made), the result is that the ACCEPT variable is not set and then the GotoIf statement fails. How can I resolve this? Can I simply preset the ACCEPT variable to 2, or will the read cmd override the ACCEPT variable with nothing if it times out? [macro-screen] exten => s,1,Wait(0.2) exten => s,n,Read(ACCEPT|priv-instruct-custom|1) exten => s,n,GotoIf($[${ACCEPT} = 1 ] ?yes:no) exten => s,n(no),Set(MACRO_RESULT=CONTINUE) exten => s,n(yes),Wait(0.1) Many thanks Dan -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20100420/f2f5c1c0/attachment.htm
Not necessarily the best way, but here's how I handle this type of thing in 1.4.X macro-screen] exten => s,1,Wait(0.2) exten => s,n,Read(ACCEPT|priv-instruct-custom|1) exten => s,n,GotoIf($[LEN(${ACCEPT}) < 1 ] ?no) exten => s,n,GotoIf($[${ACCEPT} = 1 ] ?yes:no) exten => s,n(no),Set(MACRO_RESULT=CONTINUE) exten => s,n(yes),Wait(0.1) _____ From: asterisk-users-bounces at lists.digium.com [mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Dan Journo Sent: Tuesday, April 20, 2010 8:12 AM To: Asterisk Users Mailing List - Non-Commercial Discussion Subject: [asterisk-users] Read Timeout Hello, I use the following macro to screen calls when they come in. Priv-instruct-custom says "press 1 to accept, press 2 to reject" However, when no input is made (or the call goes to my mobile's voicemail and therefore no input is made), the result is that the ACCEPT variable is not set and then the GotoIf statement fails. How can I resolve this? Can I simply preset the ACCEPT variable to 2, or will the read cmd override the ACCEPT variable with nothing if it times out? [macro-screen] exten => s,1,Wait(0.2) exten => s,n,Read(ACCEPT|priv-instruct-custom|1) exten => s,n,GotoIf($[${ACCEPT} = 1 ] ?yes:no) exten => s,n(no),Set(MACRO_RESULT=CONTINUE) exten => s,n(yes),Wait(0.1) Many thanks Dan -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20100420/def31101/attachment.htm
Do this: exten => s,n,GotoIf($["${ACCEPT}" = "1" ] ?yes:no) -- Jim Dickenson mailto:dickenson at cfmc.com CfMC http://www.cfmc.com/ On Apr 20, 2010, at 6:11 AM, Dan Journo wrote:> Hello, > > I use the following macro to screen calls when they come in. > > Priv-instruct-custom says ?press 1 to accept, press 2 to reject? > > However, when no input is made (or the call goes to my mobile?s voicemail and therefore no input is made), the result is that the ACCEPT variable is not set and then the GotoIf statement fails. > > How can I resolve this? Can I simply preset the ACCEPT variable to 2, or will the read cmd override the ACCEPT variable with nothing if it times out? > > [macro-screen] > exten => s,1,Wait(0.2) > exten => s,n,Read(ACCEPT|priv-instruct-custom|1) > exten => s,n,GotoIf($[${ACCEPT} = 1 ] ?yes:no) > exten => s,n(no),Set(MACRO_RESULT=CONTINUE) > exten => s,n(yes),Wait(0.1) > > Many thanks > Dan > -- > _____________________________________________________________________ > -- Bandwidth and Colocation Provided by http://www.api-digital.com -- > New to Asterisk? Join us for a live introductory webinar every Thurs: > http://www.asterisk.org/hello > > asterisk-users mailing list > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users-------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20100420/6f440e2c/attachment.htm