[asterisk-dev] Quoting in AGI data
Alistair Cunningham
acunningham at integrics.com
Sun Feb 1 17:41:07 CST 2009
Mark,
Thank you, that was exactly what I was looking for. The machines in
question are running 1.4.21.1. In my experience, the vast majority of
machines *do* work with quotes, but one or two don't. I will investigate
deeper before bothering you further.
Alistair Cunningham
+1 888 468 3111
+44 20 799 39 799
http://integrics.com/
Mark Michelson wrote:
> Alistair Cunningham wrote:
>> Can someone from Digium please definitively say whether AGI data which
>> contains spaces should be quoted or not? I.e. which of the following
>> methods are correct?
>>
>> A. SET VARIABLE CALLERID(name) Test User
>>
>> B. SET VARIABLE CALLERID(name) "Test User"
>>
>> We've found that some Asterisk machines seem to produce the following
>> incorrect header on an outdoing SIP Dial() after using method A:
>>
>> From: "Test" <sip:101 at 1.2.3.4>;tag=as6cf271a2
>>
>> but do not do it for method B, while other machines do it for method B
>> but not A. We have been unable to determine why there's a difference in
>> behaviour.
>>
>
> I took a look at Asterisk 1.4's res_agi.c and it appears that AGI
> commands are parsed with whitespace as a delimiter, unless that
> whitespace is in quotes. A command such as 'SET VARIABLE CALLERID(name)
> Test User' would have the following assignments in the argv array passed
> to the command handler:
>
> argv[0] = SET
> argv[1] = VARIABLE
> argv[2] = CALLERID(name)
> argv[3] = Test
> argv[4] = User
>
> The command handler for setting a variable only passes argv[3] to the
> pbx for setting the variable name, so I would expect that on current 1.4
> checkouts, using this command would incorrectly set the callerid name to
> be "Test" with "User" being completely ignored.
>
> While I'll admit it's not the most thorough of investigations, I did a
> comparison of parse_args and handle_setvariable in res_agi.c between the
> 1.4.0 tag, the 1.4 tip, the 1.2 tip, the 1.6.0 tip, and the current
> trunk, and found that they all are the same, so I'm at a bit of a loss
> here to try to explain where any particular change occurred. Can you
> specify what version of Asterisk you were using where the unquoted
> string actually worked?
>
> tl;dr version: the "correct" method from my code-reading is to use
> double quotes around the value used when using the SET VARIABLE command
> (the B method of your original message).
>
> Mark Michelson
>
> _______________________________________________
> --Bandwidth and Colocation Provided by http://www.api-digital.com--
>
> asterisk-dev mailing list
> To UNSUBSCRIBE or update options visit:
> http://lists.digium.com/mailman/listinfo/asterisk-dev
>
>
More information about the asterisk-dev
mailing list