[asterisk-users] Originate with label?

Mark Murawski markm-lists at intellasoft.net
Wed Aug 31 09:47:16 CDT 2022



On 8/31/22 09:25, Antony Stone wrote:
>
> If I simply do
>
> 	Tracker="${CDR(uniqueid)}";
>
> it works as required.
>
> It's just not the sort of syntax I've seen in any other language, and it feels
> (to me) weird.

^^^ Yup!  This is what I was suggesting in my last email.  Just add quotes.


Think of it this way.  Compared to other languages.. If you want to do 
math, do math, if you want to use a string, use a string.  I think it 
follows the convention quite nicely, other than the weird behavior of 
AEL of when you use an assignment of mixed text-math without quoting.


c
----
a = 1 + 1; /* correct */
b = "foo"; /* correct */
c = 1 + "bar"; /* syntax error */

perl
----
$a = 1 + 1;  # correct
$b = "foo";  # correct
$c = 1 + "bar"; # syntax error

php
----
$a = 1 + 1;
$b = "foo";
$c = 1 + "bar"; # treats "bar" as 0, results in a runtime warning, final 
value: $c=1

python
----
a = 1 + 1 # correct
b = "foo"  # correct
c = 1 + "bar" # runtime error


So... the only weird thing here... is AEL 'works' with "<number> 
<operand> <string>", and does something unexpected with it

> Maybe the documentation: "NOTE: AEL wraps the right hand side of an assignment
> with $[ ] to allow expressions to be used If this is unwanted, you can protect
> the right hand side from being wrapped by using the Set() application." could
> be enhanced to point out that quote marks can overcome the problem as well?
>
> https://wiki.asterisk.org/wiki/display/AST/AEL+Variables
>
>
> Antony.
>


Thanks for the suggestion.. I'll update the documentation and add some 
examples.



More information about the asterisk-users mailing list