Loginless SIP configuration

Is there a way to configure Asterisk to determine a context based solely on a provider’s IP (using SIP), or maybe to just accept a login too, but just ignore the secret?

Dustin Oprea

If your usin sip, you should be able to do both. This is by no means complete, but should illustrate the point.

[sipipbased]

host=ip-addr
context=mycontext

[sipnosecret]

secret=
context=mycontext

The host option will match on incoming calls the ip address your specify, or if you set secret to nothing, you can login with the a password.

Dan

Dan

Thanks a lot… That’s a great help.

In that first example, will Asterisk completely ignore any user/password that is given?

On a separate note, can you determine a context by DID?:

[didbased]
host=ip-addr
DID=_5551112222
context=mycontext

Ignore is a relative term, all settings are defaulted to something. So you’ll have to check to see what the default setting is to know if it will cause problems or not.

I don’t believe that you need to specify the DID in sip.conf. With my VoIP provider, I have one trunk for inbound calls that dumps into one context. In that context I just have an extension configured for each of my DID lines.

If you have a ton and want to break it down into smaller sections you can use the dial plan “include” features.

Dan

Great… Regarding IP-based contexts, that’s exactly what I needed to know.

In terms of multi-tenant systems, I want to determine a context based on one or more DIDs-- Isn’t this the only way to ensure that each company has their own context?

Can you confirm that there is no difference between an empty secret, and leaving out the secret completely?

Dustin

According the chan_sip.c, for incoming sip requests if secret is empty it is ok.

If you are looking to segment your extensions.conf file, perhaps for added security, look at using the include statements. The sample extensions.conf file that comes with Asterisk has some very good examples of this.

I can’t tell you much more because I’ve not had the need to put together a setup like that.

Dan