[OpenSIPS-Users] RURI Modification for NATed endpoints after en ENUM Request

Bogdan-Andrei Iancu bogdan at opensips.org
Mon Mar 31 18:48:24 CEST 2014


Hi Kevin,

I'm not sure about the logic of your query, but you can replicate that 
scripting (in perl) into the OpenSIPS script - see the avpops module for 
the raw DB lookups.

Regards,
Bogdan

Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com

On 28.03.2014 10:56, Kevin Mathy wrote:
> Hi Bogdan,
>
> Thanks for those informations, but I already know them :-)
> I've attached my script to this mail, so you can take a look at what 
> I've done.
>
> Also, here is the part of the code calling the script :
>
>
>     route[enum] {
>         t_on_reply("reply");
>         if (enum_query("asbc2.e164.local."))
>         {
>             xlog("L_INFO","$ci Sending INVITE to customer / ENUM\n");
>             if(!serialize_branches(1))
>             {
>                 xlog("L_ERR", "$ci SERIALIZE_BRANCHES Failed\n");
>             }
>             next_branches();
>             t_on_failure("failenum");
>             xlog("L_INFO", "$ci ENUM lookup returned <$ru>\n");
>             xlog("L_INFO", "$ci ENUM lookup returned rd : <$rd>\n");
>
>     *        $avp(ruriDomain)=$rd;
>             perl_exec("locationRuriUpdate");
>             if(is_avp_set("$avp(newRuriDomain)"))
>             {
>                 #xlog("L_INFO","$ci New RURI Domain =
>     $avp(newRuriDomain)\n");
>                 #xlog("L_INFO","$ci New RURI Port = $avp(newRuriPort)\n");
>                 $rd = $avp(newRuriDomain) + ":" + $avp(newRuriPort);
>                 xlog("L_INFO", "$ci We modified rd : <$rd>\n");
>             }
>     *
>             uac_replace_from("sip:$fU@*XX.XX.XX.XX*");
>             uac_replace_to("$ru");
>             if (t_relay())
>             {
>                 xlog("L_INFO", "$ci t_relay done <$ru>\n");
>             }
>             else
>             {
>                 xlog("L_INFO", "$ci t_relay problem \n");
>             }
>             exit;
>         }
>         xlog("L_INFO","$ci ENUM not found\n");
>         sl_send_reply("404", "Not Found");
>     }
>
>
> Please note : I've intentionally hidden the IP's in both scripts. And 
> the script may not be perfect, as it's only there to show you what I'd 
> like to do :-)
>
>
> So, this configuration is working well, but is there a way to not use 
> the "perl method" and simply use some methods of the registrar module, 
> or any other ?
>
> If you need further informations to understand what I want to do, feel 
> free to ask me ;-)
>
> Thanks a lot,
>
>
> *
> Bien cordialement,
> Best Regards,
>
> **Kevin MATHY* |**Ingénieur VoIP
> *
> *
>
>
> 2014-03-28 9:37 GMT+01:00 Bogdan-Andrei Iancu <bogdan at opensips.org 
> <mailto:bogdan at opensips.org>>:
>
>     Hello Kevin,
>
>     Simply do in your script (after the ENUM lookup):
>
>     $rd = "foo.com <http://foo.com>"; # see
>     http://www.opensips.org/Documentation/Script-CoreVar-1-10#toc65
>     $rp = 1234;  # see
>     http://www.opensips.org/Documentation/Script-CoreVar-1-10#toc70
>
>     Regards,
>
>     Bogdan-Andrei Iancu
>     OpenSIPS Founder and Developer
>     http://www.opensips-solutions.com
>
>     On 28.03.2014 00:28, Kevin Mathy wrote:
>>     Hi Bogdan,
>>
>>     I'd like to modify only the hostname (and port) part of the RURI,
>>     to put inside informations taken from the location table.
>>
>>     I've made it this afternoon, using a homemade perl script (which
>>     I'll be able to share tomorrow if needed), and it works well, but
>>     for the process to be perfect, I prefer if I can avoid the perl
>>     method, and only use Opensips's integrated methods ;-)
>>
>>     Thanks,
>>
>>     Best regards,
>>
>>     Kevin
>>
>>
>>     Le jeudi 27 mars 2014, Bogdan-Andrei Iancu <bogdan at opensips.org
>>     <mailto:bogdan at opensips.org>> a écrit :
>>
>>         Hi Kevin,
>>
>>         Nothing is normal here, everything is strange, so..... :)
>>
>>         You can modify any parts of the RURI, no problem - what
>>         exactly part of it you want to change ?
>>
>>         Regards,
>>
>>         Bogdan-Andrei Iancu
>>         OpenSIPS Founder and Developer
>>         http://www.opensips-solutions.com
>>
>>         On 27.03.2014 12 <tel:27.03.2014%2012>:31, Kevin Mathy wrote:
>>>         Hi List,
>>>
>>>         What I'm trying to do may be "strange" for some people, but
>>>         here is the situation :
>>>         I've got an OpenSIPS server, which do some ENUM requests to
>>>         route Incoming calls (from me, the provider, to the customers).
>>>         It works well when my customer's endpoints are configured
>>>         with a public IP, without any NAT.
>>>
>>>         But, when those endpoints connect to my server through a NAT
>>>         router, I face a problem for incoming calls, as the port
>>>         used by endpoint isn't the same as the classical 5060.
>>>
>>>         So, my question is : is there a way to simply modify the
>>>         Request-URI obtained after an ENUM query, with the
>>>         informations inserted in the location table ?
>>>
>>>         I've got an idea on how to make it with a perl script, but I
>>>         prefer to not use this method, and to use only existant
>>>         modules of methods.
>>>
>>>         Thanks for your ideas
>>>
>>>         Kevin
>>>
>>>
>>>         *
>>>         Bien cordialement,
>>>         Best Regards,
>>>
>>>         **Kevin MATHY* |**Ingénieur VoIP
>>>         *
>>>         *
>>>
>>>
>>>
>>>         _______________________________________________
>>>         Users mailing list
>>>         Users at lists.opensips.org
>>>         http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>
>>
>>
>>     -- 
>>     *
>>     Bien cordialement,
>>     Best Regards,
>>
>>     **Kevin MATHY* |**Ingénieur VoIP
>>     *
>>     *
>>
>>
>
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20140331/dcd41b0d/attachment.htm>


More information about the Users mailing list