[Home]

Summary:ASTERISK-15822: [patch] Explicit context set in SIP peer overridden by default domain context
Reporter:Philip Prindeville (pprindeville)Labels:
Date Opened:2010-03-16 12:19:29Date Closed:2010-05-03 15:18:40
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/Configuration
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) asterisk-1.6-bugid17040.patch
Description:I'm running a couple of different internal domains in a multi-tenant configuration.  SIP phones (SPA-942's and PAP2T's) register in their respective domains, but have explicit contexts set per peer-definition (for instance, the Fax hanging off the PAP2T can only 7 and 10-digit dial... it has no international and no internal extensions).

In trying to support E.164 (ENUM) dialling, we tried to enable incoming SIP calls to the domains by specifying a default context for each domain, e.g.

domain=redfish-solutions.com,redfish-internet

in the configuration snippet below.  Unfortunately, doing this also puts all of the internal SIP phones registering in that domain into the redfish-internet context as well, which is neither desirable nor intuitive.

I posit that the proper behavior is to always use the "context=..." specified in a [peer] SIP definition when present, and fallback on the domain-associated context only when it isn't present.

Summary:

If "domain=redfish-solutions.com,redfish-internet" is commented out, then calls made by "lab_1" use the [redfish-internal] context.  If it's uncommented, then "lab_1" uses the [redfish-internet] context (making it indistinguishable from an outside SIP caller [or hacker]).


****** ADDITIONAL INFORMATION ******

Configuration being used as sip.conf:


[general]
context=INVALID
allowguest=yes
autodomain=no
...
domain=redfish-solutions.com,redfish-internet
...


[internal](!)
type=friend
qualify=50
nat=yes
host=dynamic
canreinvite=no
vmexten=voicemail

[sipura](!)
; nothing for now, add SLA's later

[redfish](!)
context=redfish-internal

[lab_1](internal,sipura,redfish)
callerid=Redfish Solutions <117>
secret=xyzzy
port=5060
mailbox=117@redfish,1234


Comments:By: Philip Prindeville (pprindeville) 2010-03-16 14:03:39

Looking at the source in channels/chan_sip.c get_destination():

               /* If we have a context defined, overwrite the original context */
               if (!ast_strlen_zero(domain_context))
                       ast_string_field_set(p, context, domain_context);


I'm thinking this would work better if (a) this was a 'guest' caller and not an explicitly configured peer, or (b) an explicitly configured peer that didn't already have a set context.

By: Leif Madsen (lmadsen) 2010-03-16 18:41:06

I think this should be put on reviewboard as any non-trivial changes (documentation) for chan_sip should go through that process to see what other developers think about the change.

Changes to chan_sip can be very sensitive.

By: Leif Madsen (lmadsen) 2010-03-17 13:40:12

Reviewboard link added.

By: Philip Prindeville (pprindeville) 2010-04-14 19:10:30

https://reviewboard.asterisk.org/r/565/

By: Digium Subversion (svnbot) 2010-04-28 17:34:16

Repository: asterisk
Revision: 259957

U   trunk/channels/chan_sip.c
U   trunk/channels/sip/include/sip.h

------------------------------------------------------------------------
r259957 | mmichelson | 2010-04-28 17:34:15 -0500 (Wed, 28 Apr 2010) | 11 lines

Don't override peer context with domain context.

(closes issue ASTERISK-15822)
Reported by: pprindeville
Patches:
     asterisk-1.6-bugid17040.patch uploaded by pprindeville (license 347)
Tested by: pprindeville

Review: https://reviewboard.asterisk.org/r/565/


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

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

By: Digium Subversion (svnbot) 2010-04-28 17:35:30

Repository: asterisk
Revision: 259958

_U  branches/1.6.1/
U   branches/1.6.1/channels/chan_sip.c

------------------------------------------------------------------------
r259958 | mmichelson | 2010-04-28 17:35:29 -0500 (Wed, 28 Apr 2010) | 17 lines

Merged revisions 259957 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

........
 r259957 | mmichelson | 2010-04-28 17:34:15 -0500 (Wed, 28 Apr 2010) | 11 lines
 
 Don't override peer context with domain context.
 
 (closes issue ASTERISK-15822)
 Reported by: pprindeville
 Patches:
       asterisk-1.6-bugid17040.patch uploaded by pprindeville (license 347)
 Tested by: pprindeville
 
 Review: https://reviewboard.asterisk.org/r/565/
........

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

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

By: Digium Subversion (svnbot) 2010-04-28 17:36:29

Repository: asterisk
Revision: 259959

_U  branches/1.6.2/
U   branches/1.6.2/channels/chan_sip.c

------------------------------------------------------------------------
r259959 | mmichelson | 2010-04-28 17:36:28 -0500 (Wed, 28 Apr 2010) | 17 lines

Merged revisions 259957 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

........
 r259957 | mmichelson | 2010-04-28 17:34:15 -0500 (Wed, 28 Apr 2010) | 11 lines
 
 Don't override peer context with domain context.
 
 (closes issue ASTERISK-15822)
 Reported by: pprindeville
 Patches:
       asterisk-1.6-bugid17040.patch uploaded by pprindeville (license 347)
 Tested by: pprindeville
 
 Review: https://reviewboard.asterisk.org/r/565/
........

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

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

By: Digium Subversion (svnbot) 2010-04-28 17:37:45

Repository: asterisk
Revision: 259960

_U  branches/1.6.0/
U   branches/1.6.0/channels/chan_sip.c

------------------------------------------------------------------------
r259960 | mmichelson | 2010-04-28 17:37:45 -0500 (Wed, 28 Apr 2010) | 17 lines

Merged revisions 259957 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

........
 r259957 | mmichelson | 2010-04-28 17:34:15 -0500 (Wed, 28 Apr 2010) | 11 lines
 
 Don't override peer context with domain context.
 
 (closes issue ASTERISK-15822)
 Reported by: pprindeville
 Patches:
       asterisk-1.6-bugid17040.patch uploaded by pprindeville (license 347)
 Tested by: pprindeville
 
 Review: https://reviewboard.asterisk.org/r/565/
........

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

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