[OpenSIPS-Users] drouting module -- How to use registered gateway as outbound gateway

Bogdan-Andrei Iancu bogdan at opensips.org
Fri Dec 15 11:33:52 EST 2017


Hi Jeffrey,

To do something like that, you need to have in DR  (as gateway) the AOR 
used by the GW to register with. And after you do do_routing() you do 
lookup(location).

Now the tricky part is to link them, as Drouting is IP/domain driven 
while user location is AOR driven.

So, in DR use as GW 127.0.0.1 (.2 and so on) - even if there is 
something phony, it has to be a valid IP. Now, after do_routing() you 
will have in RURI sip:DID at 127.0.0.1 which needs to be pushed into user 
location. Do transform it into a valid AOR (to be used as search key by 
user location), save the username part of RURI into a variable (for 
later restoring) and strip it -> ruri = sip:127.0.0.1 .Further use some 
subst/string transformation to do a static transformation from 127.0.0.N 
to gwN string and build AOR as sip:gwN at opensips_domain. So, in your case 
you will get sip:gw1 at opensips_domain as an AOR that can be used for 
lookup location (of course, your GW must register under the AOR of 
sip:gw1 at opensips_domain). After lookup(location) just restore the DID 
back into username part -> sip:DID at gw_address .
Basically the trick is to get a static mapping between the phony IPs you 
put in DR (like 127.0.0.N) and the AORs used by the GW to register (like 
gwN at opensips_domain), so you can link them.

Regards,

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

On 12/15/2017 02:39 AM, Jeffrey Zhao wrote:
> Dear all
> We are using drouting module for dialplan routing,  for NAT issues, we need to register outbound voice gateway to opensips, instead of fixed static IP.
> Is there any way to use registered gateway as routing destination?
>
> Thanks.
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users




More information about the Users mailing list