Blocking certain IP address from my asterisk server

Can I block a certain IP address?Or Range of IP addresses? These IP addresses that I will blocked are users that uses mjsip which emulates the IP address of my asterisk server.Then can call any numbers configured in my dialplan even without any registration. How will I blocked this IP addresses.

Please help.


Check iptables if you’re on Linux.


I think this matter should be handled by your OS/network firewall. But you can checkout this page … sip_header, it has something on how to get the IP address a sip user (caller). Also, you may want to try this this on sip.conf, “allowguest=no” to block unwanted calls unregistered users.

as well as beefing up your network security, you might want to consider looking at your dialplan/config too, particularly looking at where you’re allowing unknown SIP callers to start from. if the context in sip.conf is given access to the internal dialplan then you’re in a world of trouble … but it’s easy to fix.

agreed. you need to redo some of your sip.conf/dialplan. That should not be happening.

make sure that all sip peers have secrets defined, and insecure=very is used as little as possible.