[asterisk-bugs] [Asterisk 0013249]: AEL does not translate quoted strings correctly in 1.6

Asterisk Bug Tracker noreply at bugs.digium.com
Tue Aug 19 09:13:28 CDT 2008


A NOTE has been added to this issue. 
====================================================================== 
http://bugs.digium.com/view.php?id=13249 
====================================================================== 
Reported By:                dimas
Assigned To:                murf
====================================================================== 
Project:                    Asterisk
Issue ID:                   13249
Category:                   Core/PBX
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     acknowledged
Asterisk Version:           1.6.0-beta9 
SVN Branch (only for SVN checkouts, not tarball releases): N/A 
SVN Revision (number only!):  
Disclaimer on File?:        N/A 
Request Review:              
====================================================================== 
Date Submitted:             2008-08-06 09:48 CDT
Last Modified:              2008-08-19 09:13 CDT
====================================================================== 
Summary:                    AEL does not translate quoted strings correctly in
1.6
Description: 
I used to use constructs like 

    a = "test here";

in the Asterisk AEL scripts. These were working fine in 1.4 (translating
to)

    Set(a=$[ "test here"])

This does not work for 1.6 anymore although translates to exactly the same
dialplan. After executing this line the value of a variable on 1.6 contains
quotes.

This results in:
1. The following construct:

    b = "${a}";
does not work at all giving parse error [Aug  6 18:01:24] WARNING[29514]:
ast_expr2.fl:437 ast_yyerror: ast_yyerror():  syntax error: syntax error,
unexpected '<token>', expecting $end; Input:

2. when the variable being assigned is CALLERID(number) - this results in
sending 

    From: ""test here"" <sip:xxxxxxxxxxx at 1.2.3.4>;tag=as1539ede1

in the SIP INVITE header. Note the double quotes. As result, the Aastra
57i phone rejects the invite with 400 Bad Request.
====================================================================== 

---------------------------------------------------------------------- 
 (0091548) murf (administrator) - 2008-08-19 09:13
 http://bugs.digium.com/view.php?id=13249#c91548 
---------------------------------------------------------------------- 
This is interesting. I just spent over an hour trying to repeat your
results
between 1.4 and 1.6.0, and could not see the difference. I had absolutely
no [compat] section in my asterisk.conf file. So, I put it in, and set
app_set = 1.6

and THEN I could see the results you mentioned.

So, a closer study of the code shows ast_compat set to 7 initially; so the
code
acts like 1.4 by default. To get it to act like 1.6, you probably need to

do a fresh install of 1.6.0, and do the "make samples", and let it 
write out the asterisk.conf for you, with app_set = 1.6 to get your
behavior.
If you had simply upgraded your 1.4 to 1.6, and kept the same config
files,
you would not have noticed the difference....

I see that under compat mode, the Multiple set is called, which uses the
AST_STANDARD_APP_ARGS(args, data) to seperate prop=val pairs, and
AST_NONSTANDARD_APP_ARGS(pair, args.pair[x], '=') to seperate the name
from the value. NONSTANDARD is a macro that calls ast_app_separate_args
(in main/app.c) to do the work, and it is the func that removes the
quotes.

Tilghman Lesher is gone for the rest of this week, and he is the
authority
as to why the new version of set was explicitly written to NOT dequote
strings,
and to NOT use the app-arg stuff in slicing and dicing the set argument
string.
These reasons would make great explanation in the doc strings in Set() and
MSet().

I think what I will do is add verbage to the docstrings for Set() and
MSet().
This will/should close this bug. When Tilghman gets back, he can further
expound and clarify (redact) what I added. 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2008-08-19 09:13 murf           Note Added: 0091548                          
======================================================================




More information about the asterisk-bugs mailing list