In my (inherited) extensions.conf I have some lines of the format: exten => o,2,GotoIf($["foo${FROM_DID}" "foo"]?from-pstn,s,1:from-pstn,${FROM_DID},1) and some lines like: exten => s,1,GotoIf($[foo${ECID${CALLERIDNUM}} = foo]?4) Note the quotes around the "foo${FROM_DID}" and "foo" in the first, but the lack of quotes in the second. Are these syntacticly equivalent? In the first, is it just comparing to see if the string "foo" still equals "foo" after the vars are interpolated? Thanks, -dave
It's also catering for the fact that ${FROM_DID} might be a string with embedded spaces, and it's assuming, probably not unreasonably, that ${CALLERIDNUM} doesn't have embedded spaces. David Tillman wrote:> In my (inherited) extensions.conf I have some lines of the format: > > exten => o,2,GotoIf($["foo${FROM_DID}" > "foo"]?from-pstn,s,1:from-pstn,${FROM_DID},1) > > and some lines like: > > exten => s,1,GotoIf($[foo${ECID${CALLERIDNUM}} = foo]?4) > > > Note the quotes around the "foo${FROM_DID}" and "foo" in the > first, but the lack of quotes in the second. > > Are these syntacticly equivalent? > > In the first, is it just comparing to see if the string "foo" still equals > "foo" after the vars are interpolated? > > Thanks, > -dave > _______________________________________________ > --Bandwidth and Colocation sponsored by Easynews.com -- > > Asterisk-Users mailing list > Asterisk-Users@lists.digium.com > http://lists.digium.com/mailman/listinfo/asterisk-users > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users >-- Howard. LANNet Computing Associates - Your Linux people <http://lannet.com.au> -- When you just want a system that works, you choose Linux; When you want a system that works, just, you choose Microsoft. -- Flatter government, not fatter government; Get rid of the Australian states.
Syntacticly? Would that be the same as Telestrate? David Tillman wrote:> In my (inherited) extensions.conf I have some lines of the format: > > exten => o,2,GotoIf($["foo${FROM_DID}" > "foo"]?from-pstn,s,1:from-pstn,${FROM_DID},1) > > and some lines like: > > exten => s,1,GotoIf($[foo${ECID${CALLERIDNUM}} = foo]?4) > > > Note the quotes around the "foo${FROM_DID}" and "foo" in the > first, but the lack of quotes in the second. > > Are these syntacticly equivalent? > > In the first, is it just comparing to see if the string "foo" still equals > "foo" after the vars are interpolated? > > Thanks, > -dave > _______________________________________________ > --Bandwidth and Colocation sponsored by Easynews.com -- > > Asterisk-Users mailing list > Asterisk-Users@lists.digium.com > http://lists.digium.com/mailman/listinfo/asterisk-users > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users >-- Mark, G7LTT/KC2ENI Randolph, NJ http://www.g7ltt.com
On 10/24/05, David Tillman <photondave+asteriskusers@gmail.com> wrote:> In my (inherited) extensions.conf I have some lines of the format: > > exten => o,2,GotoIf($["foo${FROM_DID}" > "foo"]?from-pstn,s,1:from-pstn,${FROM_DID},1) > > and some lines like: > > exten => s,1,GotoIf($[foo${ECID${CALLERIDNUM}} = foo]?4) > > > Note the quotes around the "foo${FROM_DID}" and "foo" in the > first, but the lack of quotes in the second. > > Are these syntacticly equivalent? > > In the first, is it just comparing to see if the string "foo" still equals > "foo" after the vars are interpolated?In the above examples, it appears as if they are basically doing the same thing. In previous versions of Asterisk, the parser (apparently) didn't deal with NULL strings too well (i.e. "") and may have become confused. This caused a work around by appending "foo" or something similar to the front of a string. Thus, if a string was NULL (blank), then foo would equal foo, and you could consider the string null. Now, as someone has also pointed out, using quotes around the string is probably better form as it should handle spaces and such. However, the need to place "foo" in the string should no longer be necessary if you simple use the best practice is encapsulating your strings with double quotes. i.e., to check for a NULL value, you might use something like: exten => s,1,GotoIf($[ "${CALLERIDNUM}" = "" ]?invalid_callerid:valid_callerid) Note that in the above example I've assumed you have a named priority called invalid_callerid and valid_callerid in your dialplan (which is available in CVS HEAD, and the upcoming 1.2.x) -- Leif Madsen - http://www.leifmadsen.com http://www.asteriskdocs.org -- Co-Founder http://www.oreilly.com/catalog/asterisk -- Co-Author
On Tue, 2005-10-25 at 00:52 -0400, Leif Madsen wrote:> Now, as someone has also pointed out, using quotes around the string > is probably better form as it should handle spaces and such. >In expressions only. Set() command is broken in this area (1.2beta and CVS HEAD). To clear, for example, calleridname one must write Set(CALLERID(name)=) The command Set(CALLERID(name)="") will set the name part of callerid to guess what?-) Yes, to a string containing 2 double quote characters! -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20051025/8dbbf748/attachment.htm