[asterisk-users] Bug in Dial() string processing

Antony Stone Antony.Stone at asterisk.open.source.it
Tue Oct 27 05:00:10 CDT 2020


Hi.

I've discovered a bug in the Dial() string processing (for Asterisk 13.14.1 at 
least).

According to the documentation in channels/chan_sip.c the Dial() string syntax 
is:

 *     SIP/devicename
 * or SIP/username at domain (SIP uri)
 * or SIP/username[:password[:md5secret[:authname[:transport]]]]@host[:port]
 * or SIP/devicename/extension
 * or SIP/devicename/extension/IPorHost
 * or SIP/username at domain//IPorHost
 *
 * and there is an optional [!dnid] argument you can append to alter the
 * To: header.

The bug is in the last part - the optional !dnid argument.

This should parse for a ! *following* any of the above syntaxes and assign 
whatever follows it to dnid.  If there is more than one ! in the entire 
string, dnid should follow the final one.

Unfortunately, the string parsing checks *first* for a ! and assigns everything 
following the first occurrence to dnid, and then attempts to parse whatever 
preceded it according to the above possibilities.

This means that if a SIP password, for example, contains a !, it is impossible 
to use the stated syntax

SIP/username[:password[:md5secret[:authname[:transport]]]]@host[:port]

Note that in this syntax, @host is non-optional, therefore parsing for a ! 
preceding the @host part and regarding what follows the ! as dnid is 
incorrect.


Regards,


Antony.

-- 
+++ Divide By Cucumber Error.  Please Reinstall Universe And Reboot +++

                                                   Please reply to the list;
                                                         please *don't* CC me.



More information about the asterisk-users mailing list