Skip to content

Opensips 1.6.0 Proxy IP Based Authentication Script

by Jon on November 20th, 2009

In the process of building a sip proxy it is often that the administrator would like to do ip based authentication for security since registration is not always that reliable. So to do this there are a couple of ways, the first way is to check the ip address in the script where it is hard coded. In order to add or change ip addresses opensips needs to be restarted. This is not an ideal situation when adding and removing ip addresses often. This is however very easy to do and if there is no need to modify the ip address setting very often then this is a great way to handle authentication. Here is an example on how to do hard coded ip based authentication in the opensips script.

if (src_ip==127.0.0.1 && src_port==5060 && proto==UDP) {
sethostport(“10.10.10.1:5060”);
xlog(“set host port to pass call to”);
}

Also if you need to do multiple ip addresses:

if (src_ip==127.0.0.1 || src_ip==127.0.0.2 || src_ip==127.0.0.3) {
sethostport(“10.10.10.1:5060”);
xlog(“set host port to pass call to”);
}

From → VOIP

One Comment
  1. Hey very nice blog!! Man .. Beautiful .. Amazing .. I will bookmark your blog and take the feeds also¡­I am happy to find so many useful information here in the post, we need develop more strategies in this regard, thanks for sharing. . . . . .

Leave a Reply

Note: XHTML is allowed. Your email address will never be published.

Subscribe to this comment feed via RSS

%d bloggers like this: