IP OPS Module

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

IP OPS Module

Nathan Baker
Hi Everyone,

I've come across a few instances where it would be nice to check if the URI is an IP address or domain, or check if an IP address is a private (RFC 1918) address, and a few other things.  I don't see an easy way to do these things in OpenSIPS, but I do see a Kamailio module called IPOPS that does these sort of things.  I'm just wondering, is it possible to use the Kamailio module in OpenSIPS (either drop in the compiled module, or compile it)?  Or is there an easier way to do similar things in OpenSIPS?

If not, it looks like the licenses are compatible, is it possible to pull that module into OpenSIPS?  Sorry if this has come up before, I couldn't find it when searching.

Thanks!

-Nate

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: IP OPS Module

Razvan Crainea-3
Hi, Nathan!

In OpenSIPS you can easily check if an IP is an address using the ip transformation[1]:

if ($(rd{ip.isip}) == 1)
    xlog("It is an IP!\n");

There is no transormation to check if the value of a variable is private, but you can use the nat_uac_test() function to do that for certain parts of the message[2]. If that's not enough for you, better open a feature request and we will add the necessary function/transformation.

Porting a Kamailio module shouldn't be that hard, since both project have a similar core, but as you can see, each project has its different vision of sorting out a problem. IMO, it's not worth having an entire module in opensips for this.

[1] http://www.opensips.org/Documentation/Script-Tran-2-3#toc73
[2] http://www.opensips.org/html/docs/modules/2.3.x/nathelper.html#idp5549968

Best regards,
Răzvan Crainea
OpenSIPS Developer
www.opensips-solutions.com
On 12/09/2017 07:40 AM, Nathan Baker wrote:
Hi Everyone,

I've come across a few instances where it would be nice to check if the URI is an IP address or domain, or check if an IP address is a private (RFC 1918) address, and a few other things.  I don't see an easy way to do these things in OpenSIPS, but I do see a Kamailio module called IPOPS that does these sort of things.  I'm just wondering, is it possible to use the Kamailio module in OpenSIPS (either drop in the compiled module, or compile it)?  Or is there an easier way to do similar things in OpenSIPS?

If not, it looks like the licenses are compatible, is it possible to pull that module into OpenSIPS?  Sorry if this has come up before, I couldn't find it when searching.

Thanks!

-Nate


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: IP OPS Module

Bogdan-Andrei Iancu-2
In reply to this post by Nathan Baker
Hi Nate,

If you simply want to check if the domain part of a SIP URI is an IP, you do not need a module for that, you can simply use a regexp for that. For example for checking the FROM domain:

    if ($fd=~"[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}" )

Best regards,
Bogdan-Andrei Iancu
  OpenSIPS Founder and Developer
  http://www.opensips-solutions.com
On 12/09/2017 07:40 AM, Nathan Baker wrote:
Hi Everyone,

I've come across a few instances where it would be nice to check if the URI is an IP address or domain, or check if an IP address is a private (RFC 1918) address, and a few other things.  I don't see an easy way to do these things in OpenSIPS, but I do see a Kamailio module called IPOPS that does these sort of things.  I'm just wondering, is it possible to use the Kamailio module in OpenSIPS (either drop in the compiled module, or compile it)?  Or is there an easier way to do similar things in OpenSIPS?

If not, it looks like the licenses are compatible, is it possible to pull that module into OpenSIPS?  Sorry if this has come up before, I couldn't find it when searching.

Thanks!

-Nate


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: IP OPS Module

Nathan Baker
In reply to this post by Razvan Crainea-3
Thanks Bogdan and Răzvan, that is very helpful and should do what I need.  I also looked at the other script transformations available and it's great there are so many of them.

-Nate

On Mon, Dec 11, 2017 at 4:05 AM, Răzvan Crainea <[hidden email]> wrote:
Hi, Nathan!

In OpenSIPS you can easily check if an IP is an address using the ip transformation[1]:

if ($(rd{ip.isip}) == 1)
    xlog("It is an IP!\n");

There is no transormation to check if the value of a variable is private, but you can use the nat_uac_test() function to do that for certain parts of the message[2]. If that's not enough for you, better open a feature request and we will add the necessary function/transformation.

Porting a Kamailio module shouldn't be that hard, since both project have a similar core, but as you can see, each project has its different vision of sorting out a problem. IMO, it's not worth having an entire module in opensips for this.

[1] http://www.opensips.org/Documentation/Script-Tran-2-3#toc73
[2] http://www.opensips.org/html/docs/modules/2.3.x/nathelper.html#idp5549968

Best regards,
Răzvan Crainea
OpenSIPS Developer
www.opensips-solutions.com
On 12/09/2017 07:40 AM, Nathan Baker wrote:
Hi Everyone,

I've come across a few instances where it would be nice to check if the URI is an IP address or domain, or check if an IP address is a private (RFC 1918) address, and a few other things.  I don't see an easy way to do these things in OpenSIPS, but I do see a Kamailio module called IPOPS that does these sort of things.  I'm just wondering, is it possible to use the Kamailio module in OpenSIPS (either drop in the compiled module, or compile it)?  Or is there an easier way to do similar things in OpenSIPS?

If not, it looks like the licenses are compatible, is it possible to pull that module into OpenSIPS?  Sorry if this has come up before, I couldn't find it when searching.

Thanks!

-Nate


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users



_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users