Asterisk and multiple SIP binds to the same VOIP provider
One of the SIP provider I am using offers an interesting feature. They provide a few personal short identifiers that someone can use with their local dial-in numbers to forward that incoming call to you over SIP. It is like you a getting the shared local DIDs in various locations with one or more “extensions” that are linked to your SIP account. So, one can call a local number in, say, Prague, enter 5 digits and this call will be sent to you over SIP. And it is also free, what I like the most.
Each of these identifiers comes with its own username/password for SIP registration.
I have realized that I can use everal of these IDs to do different things. For example, one would be automatically forwarded to my home phone, another one can be used to send me a fax and I can use the third one so my mom can call some of her friends via my system rather than buying these expensive calling cards (no, she uses only plain old telephone ;( ).
After adding the new registrations and peers to sip.conf I have discovered that all the incoming calls from that provider were going to the same context and its default extension. Regardless of the actual registration that accepted the incoming call. So my peer declarations did not really work. After reading more on how matching was done and exploring what does this provider send me I had to use this method of handlign these incoming calls in different way:
register => 12345:email@example.com:5060/12345 register => 12346:firstname.lastname@example.org:5060/12346
For both registrations I use the same peer:
[provider-inbound] type=peer dtmfmode=rfc2833 host=sip.provider.com context=from-provider preferred_codec_only=no disallow=all allow=ulaw allow=alaw ;allow=g729 insecure=port,invite
And, finally, in my extensions.conf I have:
[from-provider] exten => 12345,1,Goto(context-for-ext-12345,s,1) exten => 12346,1,Goto(context-for-ext-12346,s,1)
And this worked. So, each registration defines the extension that will be associated with it. Then both of them match the same peer that is associated with “from-provider” context. And inside of this context I do the things that are specific for each extension.
blog comments powered by Disqus