John Millican
2006-Aug-26 07:24 UTC
[asterisk-users] can not get ${LEN(VAR)} and greater than ">" to work for me
Hello all, I am trying to test if the length of a dialed number is greater than 7. When i use: exten => 1,n,GoToIf($["${LEN(${numdial})}">"7"]?dialout:nodial); and I dial an 11 digit number i.e. 1 800 xxx xxxx i get this in the console: Executing GotoIf("SIP/xxx-xxx-xxx-xxx-006ca720", "0?dialout:nodial") in new stack indicating that the number was not greater than 7. if i use: exten => 1,n,GoToIf($["${LEN(${numdial})}"="11"]?dialout:nodial); and dial the same 1 800 xxx xxxx i get: Executing GotoIf("SIP/xxx-xxx-xxx-xxx-006ca720", "1?dialout:nodial") in new stack indicating that the length of number dialed was equal to 11 digits. so equal to works and greater than does not? Can any one see what I am doing wrong? * version 1.2.9.1 TIA John M
Matt Riddell (IT)
2006-Aug-26 08:15 UTC
[asterisk-users] can not get ${LEN(VAR)} and greater than ">" to work for me
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 John Millican wrote:> Hello all, > I am trying to test if the length of a dialed number is greater than 7. When > i use: > exten => 1,n,GoToIf($["${LEN(${numdial})}">"7"]?dialout:nodial); > and I dial an 11 digit number i.e. 1 800 xxx xxxx > i get this in the console: > Executing GotoIf("SIP/xxx-xxx-xxx-xxx-006ca720", "0?dialout:nodial") in new > stack > > indicating that the number was not greater than 7. > if i use: > exten => 1,n,GoToIf($["${LEN(${numdial})}"="11"]?dialout:nodial); > and dial the same 1 800 xxx xxxx > i get: > > Executing GotoIf("SIP/xxx-xxx-xxx-xxx-006ca720", "1?dialout:nodial") in new > stack > indicating that the length of number dialed was equal to 11 digits. > so equal to works and greater than does not? > Can any one see what I am doing wrong? > * version 1.2.9.1Maybe string comparison because of the speech marks? - -- Cheers, Matt Riddell _______________________________________________ http://www.sineapps.com/news.php (Daily Asterisk News - html) http://freevoip.gedameurope.com (Free Asterisk Voip Community) http://www.sineapps.com/rssfeed.php (Daily Asterisk News - rss) -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFE8GWiS6d5vy0jeVcRAsFuAJ4wTDyndhLkJ1DvaXmEmV+F6DQumACffrXI RRoE2Dc4FsL2wycfFy3pm8Y=bhT0 -----END PGP SIGNATURE-----
Ira
2006-Aug-26 10:11 UTC
[asterisk-users] can not get ${LEN(VAR)} and greater than ">" to work for me
At 07:24 AM 8/26/2006, you wrote:>exten => 1,n,GoToIf($["${LEN(${numdial})}">"7"]?dialout:nodial); >and I dial an 11 digit number i.e. 1 800 xxx xxxx >i get this in the console: >Executing GotoIf("SIP/xxx-xxx-xxx-xxx-006ca720", "0?dialout:nodial") >in new stackI'm guessing that you need to remove the quotes like this:>exten => 1,n,GoToIf($[${LEN(${numdial})}>7]?dialout:nodial);You know neither side of the expressions will never be empty so you don't need them. You might also try something like:>exten => 1,n,GoToIf(${len({numdial:7})}?dialout:nodial)or even:>exten => 1,n,GoToIf($["${numdial:7}"=""]?nodial:dialout);Ira
John Millican
2006-Aug-27 05:50 UTC
[asterisk-users] can not get ${LEN(VAR)} and greater than ">" to work for me
On Saturday August 26 2006 11:15 am, Matt Riddell (IT) wrote:> John Millican wrote: > > Hello all, > > I am trying to test if the length of a dialed number is greater than 7. > > When i use: > > exten => 1,n,GoToIf($["${LEN(${numdial})}">"7"]?dialout:nodial); > > and I dial an 11 digit number i.e. 1 800 xxx xxxx > > i get this in the console: > > Executing GotoIf("SIP/xxx-xxx-xxx-xxx-006ca720", "0?dialout:nodial") in > > new stack > > > > indicating that the number was not greater than 7. > > if i use: > > exten => 1,n,GoToIf($["${LEN(${numdial})}"="11"]?dialout:nodial); > > and dial the same 1 800 xxx xxxx > > i get: > > > > Executing GotoIf("SIP/xxx-xxx-xxx-xxx-006ca720", "1?dialout:nodial") in > > new stack > > indicating that the length of number dialed was equal to 11 digits. > > so equal to works and greater than does not? > > Can any one see what I am doing wrong? > > * version 1.2.9.1 > > Maybe string comparison because of the speech marks?Thank You Matt and Ira The speech marks/quotes were the problem. Matt sorry about the earlier direct mail used R instead of L for the reply. John M