Steve Gladden
2006-Apr-01 05:08 UTC
[Asterisk-Users] Newbie question - sip.conf incoming contexts
Hello! I've been struggling with the documentation for months on this simple subject... I still have not been able to get this concept down... I have 3 sip accounts (PSTN DID's) that come into my asterisk box and give me phone service from my itsp via SIP. I for the life of me have not been able to figure out how to get them to come in to 3 seperate contexts! This must be simple but I am missing the point. All 3 accounts need a register line (I think) in order to work. The register lines work great but I have not been able to figure out how to get the other two lines to come into another seperate inbound context that I have defined other than the one that is specified in the [general] section of sip.conf The /extension number does not do the trick for me I wuld like for these incoming lines (from the same itsp) to truly land in one of 3 seperate starting contexts in my dialplan based on what phone number (account) they are. Thank you very much for your help... this must be simple but I have not really figured it out in several months of playing around and reading.... I've figured out a TON of other complex things, but this simple incoming context thing has me a bit stumped. I've tried a few things in my sip peer like register=yes which was suggested on a web site but it does not work. I also tried maing the peer name match the account (phone number) of the sip account and that did not do it either. The peers work fine as outgoing but I've not figured out how to make them work for incoming as my sip itsp requires that I 'register' for inbound calls. Steve
Rich Adamson
2006-Apr-01 07:27 UTC
[Asterisk-Users] Newbie question - sip.conf incoming contexts
> I've been struggling with the documentation for months on this simple > subject... > I still have not been able to get this concept down... > > > I have 3 sip accounts (PSTN DID's) that come into my asterisk box > and give me phone service from my itsp via SIP. > I for the life of me have not been able to figure out how to get them to > come in to 3 seperate contexts! > > This must be simple but I am missing the point. > All 3 accounts need a register line (I think) in order to work. > > The register lines work great but I have not been able to figure out > how to get the other two lines to come into another seperate inbound > context that I have defined other than the one that is specified > in the [general] section of sip.conf > > The /extension number does not do the trick for me > > I wuld like for these incoming lines (from the same itsp) to truly > land in one of 3 seperate starting contexts in my dialplan based > on what phone number (account) they are. > > Thank you very much for your help... this must be simple > but I have not really figured it out in several months of playing > around and reading.... > > I've figured out a TON of other complex things, but this simple > incoming context thing has me a bit stumped. > > I've tried a few things in my sip peer like > register=yes which was suggested on a web site but it does not work. > > I also tried maing the peer name match the account (phone number) > of the sip account and that did not do it either. > > The peers work fine as outgoing but I've not figured out how to make them > work for incoming as my sip itsp requires that I 'register' for inbound > calls.What version of asterisk? (been lots of changes happening to the sip code over the last year) Have you looked at the sample configs in /usr/src/asterisk/configs? It would be far more helpful if you'd post your register statements and each of the sip contexts from sip.conf. Might also include the section of your dialplan that each of the sip.conf contexts refer to.
Steve Gladden
2006-Apr-09 07:53 UTC
[Asterisk-Users] Newbie question - sip.conf incoming contexts
Hi,>> > If you don't specify a host= statement in sip.conf and you have asection 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.)Thank you for this tidbit as well. It seems that I need the host= to actually be there for it to work though. I've always used the same [peer] for incoming and outgoing calls, If I get rid of the host= outgoing calls of course stop working. This seems to be a strong hint that I need to explore using seperate peers for incoming and outbound calls. Put all the incoming peers first so they are not matched by host first and then have the others at the bottom for outbound calls. I will give this a try, Thanks! Steve> Thanks for the help! > > What I have gathered mentally so far is that asterisk can't do > exactly what I am asking/expecting it to do. > > Problem being that I am trying to get multiple inbound contexts > from multiple peers ( 3 of them in sip.conf) from one single provider. > > What happens is that it matches the first peer (for my provider) andnever matches the next two that I also want to use.> > Seems that it will only do a match based on IP Address/Host and not onaccountname or incoming phone number.> > The help I have recieved here has not really addressed the origial question > of how to get the calls to come directly into a context from the sippeer itself, however they have pointed out some work-arounds to what asterisk seemingly does not support doing directly.> > If I am wrong with this conclusion please help me out! > > I have been able to accomplish what is needed by simply having aninitial context that everything comes into (possible security issue) and then immediately issue a Goto() to get the call into the context where it belongs.> > This 'feels' very hokey and wrong, but it works for now! > > > Thanks for the help! > > > Take care! > > Steve > > > > > > > > > > > > > > > >> What I do is the following and keep in mind I only use one registerstatement 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@gmail.com> wrote: >>> Hi, >>> >>> I'm not an expert, but as far as i know, your incoming calls willarrive with DID in ${EXTEN}>>> so the only thing you need is: >>> >>> exten => 1234,1,GoTo(context1,1234,1) ; example for context extensionand 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 yourextensions.conf>>> And in this context1 context2 and context3 you must have handler for1234; 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 youneed to catch de DID and make a GoTo for the context you want.>>> >>> >>> Best regards, >>> Marco Mouta >>> >>> >>> On 4/2/06, Rich Adamson <radamson@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. Theydo 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 somehowmatched 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 contextsthat 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@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 givethem 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 thatuses 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 somehowdo this in a peerf, riend or user section.....>>> > > and if you need the register line ---- the instructions say not touse [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 mysporatic 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 incomingcalls 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), itwould appear you need to do something like this:>>> > >>> > register => 2345:password@sip_proxy/1234 >>> > register => 2346:password@sip_proxy/2345 >>> > register => 2347:password@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 threeaccounts (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 hoststatement in the type=peer section. Also note the above registerstatements 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 threedifferent 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 isdone that are asterisk version dependent. He has also posted (several>>> times) >>> > comments relative to how incoming sip calls match the variousdefinitions 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 asection 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 >> _______________________________________________ >> --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 >> > >