List Info

Thread: semicolons




semicolons
country flaguser name
Russian Federation
2007-09-19 05:05:51

Hello.

I have problems putting semicolon into variable. I’m trying to concatenate two variables placing semicolon delimiter in between:

 

ššššššššššššššššššššššššššššššššššššššš fullcontact = "${fullcontact};$";

 

for this AEL code, ‘dialplan show’; command displays:

 

ššššššššššššššššššš 14. Set(fullcontact=$[ "${fullcontact}])ššššš [pbx_ael]

 

Which is definitely not what I expect. Looks like semicolon just terminates the current line of code although it is quoted!

To me it seems like a bug in parser.

 

But there is more to say – why I started concatenating these things: there is fullcontact column in the database which contains something like

 

192.168.10.202:36328;rinstance=839ea2d8c21eda0a">sip:1011192.168.10.202:36328;rinstance=839ea2d8c21eda0a

 

And I’m trying to get it with ${REALTIME(R30;)} and series of ${CUT(R30;)}. And I found that res_config_odbc.c splits such a values into multiple slices with the following code:

 

ššššššššššššššš while(stringp) {

ššššššššššššššššššššššš chunk = strsep(&stringp, ";");

ššššššššššššššššššššššš if (!ast_strlen_zero(ast_strip(chunk))) {

ššššššššššššššššššššššššššššššš if (prev) {

ššššššššššššššššššššššššššššššššššššššš prev->next = ast_variable_new(coltitle, chunk);

ššššššššššššššššššššššššššššššššššššššš if (prev->next)

ššššššššššššššššššššššššššššššššššššššššššššššš prev = prev->next;

ššššššššššššššššššššššššššššššš } else

ššššššššššššššššššššššššššššššššššššššš prev = var = ast_variable_new(coltitle, chunk);

ššššššššššššššššššššššš }

ššššššššššššššš }

 

I understand that is done to be able to have multiple semicolon-separated values in the same column. But besides being violation of even first normal for of the DB :=) this is not the best design choice IMHO because as you see it splits even the values you do not expect to be splitted.

 

Is it really needed to have multi-value columns?

 

Regards,

Dmitry Andrianov

 

 

Re: semicolons
country flaguser name
Ukraine
2007-09-19 05:40:37
Π’ Π‘Ρ€Π΄, 19/09/2007 Π² 14:05 +0400, Dmitry Andrianov
ΠΏΠΈΡˆΠ΅Ρ‚:
> Hello.
> 
> I have problems putting semicolon into variable. I’m
trying to
> concatenate two variables placing semicolon delimiter
in between:
> 
>  
> 
>                                         fullcontact =
"$;
> $";
> 
>  
> 
> for this AEL code, β€˜dialplan show’ command
displays:
> 
>  
> 
<snip>
>  
Hi, use escape symbol
Like Set(VAR="stuff;stuff")





_______________________________________________

Sign up now for AstriCon 2007!  September 25-28th.  http://www.astricon.net/


--Bandwidth and Colocation Provided by http://www.api-digital.c
om--

asterisk-dev mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-dev
Re: semicolons
country flaguser name
Russian Federation
2007-09-19 06:09:06
Thanks for the hint. I already tried it before but was
confused by the
console output 

    -- Executing [107ael-default:14]
Set("SIP/1011-086de6a0",
"fullcontact="sip:1011192.168.10.202:36746;rinstance=ee62f56474639d4c"
;
") in new stack

because backslash was still there. But now I realize it
SHOULD be there
so everything is fine.

However, it is clearly a workaround so the main point in my
post was
more about somewhat unexpected behavior of
res_config_odbc...

Regards,
Dmitry Andrianov

-----Original Message-----
From: asterisk-dev-bounceslists.digium.com
[mailto:asterisk-dev-bounceslists.digium.com] On Behalf
Of st41ker
Sent: Wednesday, September 19, 2007 2:41 PM
To: Asterisk Developers Mailing List
Subject: Re: [asterisk-dev] semicolons

Π’ Π‘Ρ€Π΄, 19/09/2007 Π² 14:05 +0400, Dmitry Andrianov
ΠΏΠΈΡˆΠ΅Ρ‚:
> Hello.
> 
> I have problems putting semicolon into variable. I’m
trying to
> concatenate two variables placing semicolon delimiter
in between:
> 
>  
> 
>                                         fullcontact =
"$;
> $";
> 
>  
> 
> for this AEL code, β€˜dialplan show’ command
displays:
> 
>  
> 
<snip>
>  
Hi, use escape symbol
Like Set(VAR="stuff;stuff")





_______________________________________________

Sign up now for AstriCon 2007!  September 25-28th.
http://www.astricon.net/


--Bandwidth and Colocation Provided by http://www.api-digital.c
om--

asterisk-dev mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-dev
_______________________________________________

Sign up now for AstriCon 2007!  September 25-28th.  http://www.astricon.net/


--Bandwidth and Colocation Provided by http://www.api-digital.c
om--

asterisk-dev mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-dev
Re: semicolons
user name
2007-09-19 11:12:31
On Wed, 2007-09-19 at 14:05 +0400, Dmitry Andrianov wrote:
> fullcontact = "$;$";

Try Set(fullcontact="$;$");


And, if you really don't need the quotes, leave them out:

Set(fullcontact=$;$);


To get otherwise strange chars into a variable value, you
should use
Set() in AEL. It's OK.

murf


_______________________________________________

Sign up now for AstriCon 2007!  September 25-28th.  http://www.astricon.net/


--Bandwidth and Colocation Provided by http://www.api-digital.c
om--

asterisk-dev mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-dev
[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )