[asterisk-bugs] [Asterisk 0017892]: [patch] contact header does not get ast_uri_encoded value from p->exten, but dialplan does

Asterisk Bug Tracker noreply at bugs.digium.com
Fri Oct 1 11:20:03 CDT 2010


A NOTE has been added to this issue. 
====================================================================== 
https://issues.asterisk.org/view.php?id=17892 
====================================================================== 
Reported By:                wdoekes
Assigned To:                jpeeler
====================================================================== 
Project:                    Asterisk
Issue ID:                   17892
Category:                   Channels/chan_sip/General
Reproducibility:            always
Severity:                   trivial
Priority:                   normal
Status:                     acknowledged
Target Version:             1.6.2.15
Asterisk Version:           1.6.2.11 
JIRA:                       SWP-2116 
Regression:                 No 
Reviewboard Link:            
SVN Branch (only for SVN checkouts, not tarball releases): N/A 
SVN Revision (number only!):  
Request Review:              
====================================================================== 
Date Submitted:             2010-08-20 04:49 CDT
Last Modified:              2010-10-01 11:20 CDT
====================================================================== 
Summary:                    [patch] contact header does not get ast_uri_encoded
value from p->exten, but dialplan does
Description: 
Hi, I have two asterisken, asterisk1 and asterisk2. (They run 1.6.2.11 and
1.6.2.8 respectively, but I'm fairly sure no sip encoding issues have been
fixed between those versions.)

With pedantic mode off, I get (url)decoded INVITE values, but they're not
re-encoded in the contact header. (I'm not sure about pedantic mode on, but
I'm guessing that will yield wrong results too.)

I was expecting to get no encoding/decoding at all with pedantic mode off,
but it seems I'm getting some:

(1) invite asterisk1 to asterisk2, triggered by:
Dial(126680004%40126680004 at asterisk2)

INVITE sip:126680004%40126680004 at asterisk2 SIP/2.0
Via: SIP/2.0/UDP x.x.x.1:5060;branch=z9hG4bK4a2faaf6
From: "209" <sip:209 at x.x.x.1>;tag=as39764467
To: <sip:126680004%40126680004 at asterisk2>
Contact: <sip:209 at x.x.x.1>

(2) response from asterisk2 to asterisk1, found by:
exten => _[0-9].@[0-9].,1,NoOp(got exten ${EXTEN})

SIP/2.0 100 Trying
Via: SIP/2.0/UDP x.x.x.1:5060;branch=z9hG4bK4a2faaf6;received=x.x.x.1
From: "209" <sip:209 at x.x.x.1>;tag=as39764467
To: <sip:126680004%40126680004 at asterisk2>
Contact: <sip:126680004 at 126680004@x.x.x.2>

In asterisk2, with pedantic mode off, I expect 126680004%40126680004 to be
found, but it matches 126680004 at 126680004. This could be a good thing,
because that's what I really wanted.

But, as you can see, the Contact header is wrong. This is to be expected,
because only with pedantic mode the encoding functions (should) get
triggered.

However, when checking static void build_contact(struct sip_pvt *p) {}, I
see no logic to ast_uri_encode p->exten if sip_cfg.pedanticsipchecking.


The non-encoded Contact poses a problem when trying to create the ACK on
asterisk1 as response to the 200 from asterisk2:

Capabilities: us - 0x8 (alaw), peer - audio=0x8 (alaw)/video=0x0
(nothing)/text=0x0 (nothing), combined - 0x8 (alaw)
Non-codec capabilities (dtmf): us - 0x1 (telephone-event), peer - 0x1
(telephone-event), combined - 0x1 (telephone-event)
Peer audio RTP is at port x.x.x.2:10060
list_route: hop: <sip:126680004 at 126680004@x.x.x.2>
[2010-08-20 11:08:01] WARNING[1580]: chan_sip.c:12259
__set_address_from_contact: Invalid host name in Contact: (can't resolve in
DNS) : '126680004 at x.x.x.2'
set_destination: Parsing <sip:126680004 at 126680004@x.x.x.2> for
address/port to send to
[2010-08-20 11:08:01] WARNING[1580]: chan_sip.c:9323 set_destination:
Can't find address for host '126680004 at x.x.x.2'

(In my case, this isn't a problem, as the Contact destination is the same
as the original destination, causing the set_destination to be a harmless
no-op.)
======================================================================
Relationships       ID      Summary
----------------------------------------------------------------------
has duplicate       0016329 chan_sip transforms %23 to # (UTF-8 iss...
====================================================================== 

---------------------------------------------------------------------- 
 (0127590) svnbot (reporter) - 2010-10-01 11:20
 https://issues.asterisk.org/view.php?id=17892#c127590 
---------------------------------------------------------------------- 
Repository: asterisk
Revision: 289699

U   branches/1.4/channels/chan_sip.c

------------------------------------------------------------------------
r289699 | jpeeler | 2010-10-01 11:20:02 -0500 (Fri, 01 Oct 2010) | 14
lines

Ensure user portion of SIP URI matches dialplan when using encoded
characters.

This commit takes a simliar approach to 288112 and checks the dialplan to
determine the proper action for an incoming contact header as to whether
or not
it should be decoded or not. sip_new was blindly always decoding the
extension,
which also caused the outgoing contact header to be incorrect as well as
failing
to match the encoded extension in the dialplan.

(closes issue https://issues.asterisk.org/view.php?id=17892)
Reported by: wdoekes
Patches: 
      bug17892-1.patch uploaded by jpeeler (license 325)
Tested by: wdoekes

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=289699 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2010-10-01 11:20 svnbot         Note Added: 0127590                          
======================================================================




More information about the asterisk-bugs mailing list