[asterisk-dev] semicolons

Dmitry Andrianov dimas at dataart.com
Wed Sep 19 05:05:51 CDT 2007


Hello.

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

 

                                        fullcontact =
"${fullcontact};${value}";

 

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 

 

sip:1011 at 192.168.10.202:36328;rinstance=839ea2d8c21eda0a

 

And I'm trying to get it with ${REALTIME(...)} and series of
${CUT(...)}. 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

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-dev/attachments/20070919/7fcc9d2f/attachment-0001.htm 


More information about the asterisk-dev mailing list