[Asterisk-Users] Newbie question - sip.conf incoming contexts
Tom Vile
tvile at baldwintechsolutions.com
Sun Apr 2 19:41:52 MST 2006
What I do is the following and keep in mind I only use one register
statement with my provider:
exten => 18665551234,1,SetVar(FROM_DID=18665551234) ;
exten => 18665551234,2,Goto(from-pstn,s,1) ;
exten => 5185551234,1,SetVar(FROM_DID=5185551234) ;
exten => 5185551234,2,Goto(custom-callid,s,1) ;
On 4/2/06, Marco Mouta <marco.mouta at gmail.com> wrote:
> Hi,
>
> I'm not an expert, but as far as i know, your incoming calls will
> arrive with DID in ${EXTEN}
> so the only thing you need is:
>
> exten => 1234,1,GoTo(context1,1234,1) ; example for context extension
> and priority
> exten => 2345,1,GoTo(context2,2345,1)
> exten => 3456,1,GoTo(context3,3456,1)
>
> Be sure that you have created context1 context2 and context3 in your
> extensions.conf
> And in this context1 context2 and context3 you must have handler for
> 1234; 2345; and 3456;
>
> example:
> [context1]
> exten => 1234,1,Answer()
> exten => 1234,2,Playback(vm-goodbye)
> exten => 1234,3,Hangup()
>
>
> I didn't test this code, but this is my tip the main idea is that you
> need to catch de DID and make a GoTo for the context you want.
>
>
> Best regards,
> Marco Mouta
>
>
> On 4/2/06, Rich Adamson <radamson at routers.com> wrote:
> > 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
> >
> >
> > _______________________________________________
> > --Bandwidth and Colocation provided by Easynews.com --
> >
> > Asterisk-Users mailing list
> > To UNSUBSCRIBE or update options visit:
> > http://lists.digium.com/mailman/listinfo/asterisk-users
> >
> _______________________________________________
> --Bandwidth and Colocation provided by Easynews.com --
>
> Asterisk-Users mailing list
> To UNSUBSCRIBE or update options visit:
> http://lists.digium.com/mailman/listinfo/asterisk-users
>
--
Tom Vile
Baldwin Technology Solutions, Inc
Consulting - Web Design - VoIP Telephony
www.baldwintechsolutions.com
Phone: 518-631-2855 x205
Fax: 518-631-2856
More information about the asterisk-users
mailing list