[Asterisk-Users] Newbie question - sip.conf incoming contexts

Rich Adamson radamson at routers.com
Sun Apr 2 07:34:26 MST 2006


Steve Gladden wrote:
>> What version of asterisk? (been lots of changes happening to the sip
>> code over the last year)
> 
> 
> SVN-branch-1.2-r9156
> 
>> Have you looked at the sample configs in /usr/src/asterisk/configs?
> 
> Yes I have and my own configs are pretty much copies of them.
> They do not detail, do or explain the simple concept that I am
> trying to accomplish.
> 
> If they do.... I don't see it.
> 
> #1 I have more than one incoming SIP account
> #2 I would like to have them come into the context of
>    my choice when a call comes in.
>    HOW do I do this?
> 
>    currently I have 3 register lines
>    there is no way to specify in a register line
>    some way of making the call start in any other context
>    other than what is specified in the [general] section
>    of sip.conf
> 
>    It seems that somehow maybe if there is a peer tat is somehow
>    matched to the register line (how???) it may work.
> 
> 
>    There may be some crazy way to do this within a peer
>    if so this is the information I am looking for...
> 
> 
> The examples and descriptions are not at all clear to me....
> 
> I have 3 accounts with the same provider....
> 
> How do I get incoming calls to come into three different contexts
> that I will create is the question.
> 
>>From the example file I see:
> 
> 
>  Asterisk can register as a SIP user agent to a SIP proxy (provider)
> ; Format for the register statement is:
> ;       register => user[:secret[:authuser]]@host[:port][/extension]
> ;
> ; If no extension is given, the 's' extension is used. The extension needs to
> ; be defined in extensions.conf to be able to accept calls from this SIP
> proxy
> 
> 
> I actually need to do 3 of these.....
>
> ;register => 2345:password at sip_proxy/1234
> ;
> ;    Register 2345 at sip provider 'sip_proxy'.  Calls from this provider
> ;    connect to local extension 1234 in extensions.conf, default context,
> ;    unless you configure a [sip_proxy] section below, and configure a
> ;    context.
> 
> Ok I have 3 accounts from the same provider....
> one [sip_proxy] section just puts me in the same problem boat I'm already
> in.... using a register line
> 
> the calls some into the context specified in [general] section of sip.conf
> 
> I need to somehow differentiate the three SIP 'lines' and give
> them different contexts to start in.
> 
> 
> 
> 
> ;    Tip 1: Avoid assigning hostname to a sip.conf section like
> [provider.com]
> 
> 
> OK sure then how will this associate with my register line that
> uses provider.com
> This makes no sense to me...
> I mean It really makes no sense...
> Sorry for my confusion.
> 
> Do I need the register line or do I not need the register line?
> 
> Why even have a register line if you don't need it and can somehow
> do this in a peerf, riend or user section.....
> and if you need the register line ---- the instructions say
> not to use [provider.com] as the peer, then how the heck do you
>  get that register line to work with an associated [peer].
> 
> I need to get a handle on how this works before I go posting my
> sporatic attempts to get a friend,peer or user to 'register'
> which is not working.
> 
> The only way I've been able to get my system to take incoming calls
> from our sip provider so far is to use register lines and keep
> the system 'registered' with our provider.

I don't use any sip providers, so be careful with what I say here.

Based on the current sip.conf.sample comments (as of today), it would 
appear you need to do something like this:

register => 2345:password at sip_proxy/1234
register => 2346:password at sip_proxy/2345
register => 2347:password at sip_proxy/3456

The above register statements are used to inform your sip provider which 
IP address you are coming from, and calls for each of those three 
accounts (eg, 2345, 2346, and 2347) will be routed to your system. In 
your extensions.conf, you would need something like:

exten => 1234,1,Dial(SIP/3000)
exten => 2345,1,Dial(SIP/3001)
exten => 3456,1,Dial(SIP/3002)

Note the comments in the sample config relative to not using a host= 
statement in the type=peer section. Also note the above register 
statements assume the use of three different account names (eg, 2345, 
2346, and 2347).

As I mentioned above, I don't use any sip providers. But, if I read the 
sample file correctly, the key to the above working is having three 
different account names.

Olle has made several changes to the sip implementation in asterisk over 
the last year or so, so there might be variations of how this is done 
that are asterisk version dependent. He has also posted (several times) 
comments relative to how incoming sip calls match the various 
definitions in sip.conf.

Again, since I don't use sip providers, I'll go from memory to try and 
repeat at least a portion of his posts. Be careful as I don't have any 
recent practical experience on this. It goes something like this:

If you specify a host= statement in sip.conf, incoming calls will match 
the "first" section in sip.conf that includes that statement 
(essentially disregarding username and secret, etc).

If you don't specify a host= statement in sip.conf and you have a 
section that includes a username and secret plus type=peer, it will 
match on username and secret. (That implies that if you have three 
different numbers registered with your sip provider all under one 
username, calls for all three will match the "first" section in sip.conf 
that contains that username and secret.)

Olle has also mentioned the entire type= stuff is going away in favor of 
another sip approach. I don't know where that effort stands or even if 
any of it appears in current code.

Hopefully, some other folks will comment on the above as I'm sure others 
have multiple numbers from a single sip provider working.

Rich





More information about the asterisk-users mailing list