[OpenSIPS-Users] Return GW IP

Bogdan-Andrei Iancu bogdan at opensips.org
Tue Mar 5 11:44:18 EST 2019


Mark,

Drouting is pushing the the GW IP into the host/domain part of the RURI, 
so you can "see" it via $rd (after do_routing()). Also your scripting 
seems logic.

Regards,

Bogdan-Andrei Iancu

OpenSIPS Founder and Developer
   https://www.opensips-solutions.com
OpenSIPS Summit 2019
   https://www.opensips.org/events/Summit-2019Amsterdam/

On 03/05/2019 06:00 PM, Mark Farmer wrote:
> Thanks for the reply.
>
> This actually stems from an earlier post regarding rtpproxy. Within 
> that logic I am testing $si which is fine but I also need to test the 
> destination GW IP hence $dd but the variable is null at that point so 
> I'm thinking I need to grab the destination GW IP address beforehand 
> and store it for later use, not nessesarily $dd - just something I can 
> test later.
>
> I've just changed my route logic, see below, does this make sense?
>
> --------
> route[RTPPROXY] {
>
>         if (is_method("BYE|CANCEL")) {
>                 rtpproxy_unforce();
>         }
>
>             if (is_method("INVITE")) {
>                 xlog("Processing INVITE);
>                 if (is_from_gw("1") && goes_to_gw("2")) {
>                 xlog("Internal to External");
>                     setflag(INT_EXT);
>                 } else if (is_from_gw("2") && goes_to_gw("3")) {
>                         xlog("External to 3rd Party");
>                         setflag(EXT_PCI);
>                 } else if (is_from_gw("3") && goes_to_gw("1")) {
>                         xlog("3rd Party to Internal");
>                         setflag(PCI_INT);
>                 } else {
>                         xlog("External to Internal");
>                         setflag(EXT_INT);
>                 }
>         }
>
>         if (isflagset(INT_EXT)) {
>                         rtpproxy_offer("corwfei");
>                 } else if (isflagset(EXT_PCI)) {
>                         rtpproxy_offer("corwfie");
>                 } else if (isflagset(PCI_INT)) {
>                         rtpproxy_offer("corwfii");
>                 } else if (isflagset(EXT_INT)) {
>                         rtpproxy_offer("corwfie");
>                 }
> }
> -----
>
>
> On Tue, 5 Mar 2019 at 15:13, Bogdan-Andrei Iancu <bogdan at opensips.org 
> <mailto:bogdan at opensips.org>> wrote:
>
>     Hi Mark,
>
>     The Dynamic Routing module is doing routing based on prefix/number
>     - that's what the engine knows. Of course you can combine with
>     source IP by translating/mapping groups of src IPs into routing
>     groups.
>
>     Not sure what you are expect the module to do, if you want to
>     route only based on SRC and DST IPs....In order to have drouting
>     setting a destination GW, you need to do the actual routing (via
>     do_routing()).
>
>     Regards,
>
>     Bogdan-Andrei Iancu
>
>     OpenSIPS Founder and Developer
>        https://www.opensips-solutions.com
>     OpenSIPS Summit 2019
>        https://www.opensips.org/events/Summit-2019Amsterdam/
>
>     On 03/05/2019 04:01 PM, Mark Farmer wrote:
>>     Hi all
>>
>>     I'm using drouting and I need to route calls to various Gateway
>>     types based on $si and destination IP but it seems that $dd is
>>     not known at this point.
>>     How can I get the IP address of the destination gateway from the
>>     drouting database and assign it to a usable variable?
>>
>>     I'm thinking something like this:
>>
>>     if ($si =~"^(10\.*)" && goes_to_gw("1")) {
>>     $dd = ???????
>>                     }
>>
>>
>>     Many thanks
>>     Mark.
>>
>>
>>     -- 
>>     Mark Farmer
>>     farmorg at gmail.com <mailto:farmorg at gmail.com>
>>
>>
>>     _______________________________________________
>>     Users mailing list
>>     Users at lists.opensips.org <mailto:Users at lists.opensips.org>
>>     http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
>
> -- 
> Mark Farmer
> farmorg at gmail.com <mailto:farmorg at gmail.com>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20190305/57460660/attachment-0001.html>


More information about the Users mailing list