Posts Tagged ‘sip.conf’

Asterisk: contactpermit and contactdeny

Thursday, May 23rd, 2013

We can control in the [general] section of the sip.conf from which IP-addresses the device can register against our Asterisk server. This could be achieved with the ‘contactpermit‘ and ‘contactdeny‘ parameters:

contactdeny=0.0.0.0/0.0.0.0
contactpermit=10.145.13.0/255.255.255.0
contactpermit=10.145.14.0/255.255.255.0

The example above denies to register from any IP address and allows registration for devices which have 10.145.13.x or 10.145.14.x address.

Note, that these are separate options, besides ‘deny=x.x.x.x/x.x.x.x’ and ‘permit=x.x.x.x/x.x.x.x’, which are set in your SIP peers sections.