Klaus Darilion
2008-Dec-29 18:13 UTC
[asterisk-users] AEL: how to check if variable is defined
Hi! I use an "if" condition in extensions.ael to check if a channel variable is defined and if defined I add a certain header: context toNormaleRufe { _X. => { if (${NUMBER}) { SIPAddHeader(X-NUMBER: ${NUMBER}); }; ... }; This works fine, except NUMBER starts with the + sign. I tried using quotes but if ("${NUMBER}") evaluates always true. What is the suggested way to solve this? thanks klaus
Philipp Kempgen
2008-Dec-29 19:48 UTC
[asterisk-users] AEL: how to check if variable is defined
Klaus Darilion schrieb:> I use an "if" condition in extensions.ael to check if a channel variable > is defined and if defined I add a certain header: > > context toNormaleRufe { > _X. => { > if (${NUMBER}) { > SIPAddHeader(X-NUMBER: ${NUMBER}); > }; > ... > }; > > This works fine, except NUMBER starts with the + sign. > > I tried using quotes but > if ("${NUMBER}") > evaluates always true. > > What is the suggested way to solve this?if ("${NUMBER}" != "") { // ... } That doesn't tell you whether the variable is defined but in most cases (if any) that doesn't matter anyway. Philipp Kempgen -- http://www.das-asterisk-buch.de - http://www.the-asterisk-book.com Amooma GmbH - Bachstr. 126 - 56566 Neuwied -> http://www.amooma.de Gesch?ftsf?hrer: Stefan Wintermeyer, Handelsregister: Neuwied B14998 --