You could also put the AoR that the gateways will use to register as an 
attribute on the rule/carrier/gateway in DR. Then when you do the lookup you 
provide avps for the attributes to be provided back and you can do the lookup 
based on that.

Ben Newlin

From: Users <users-boun...@lists.opensips.org> on behalf of Bogdan-Andrei Iancu 
<bog...@opensips.org>
Reply-To: OpenSIPS users mailling list <users@lists.opensips.org>
Date: Friday, December 15, 2017 at 11:35 AM
To: OpenSIPS users mailling list <users@lists.opensips.org>, Jeffrey Zhao 
<chunyong.z...@qq.com>
Subject: Re: [OpenSIPS-Users] drouting module -- How to use registered gateway 
as outbound gateway

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@127.0.0.1<mailto:DID@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@opensips_domain. So, in your case
you will get sip:gw1@opensips_domain as an AOR that can be used for
lookup location (of course, your GW must register under the AOR of
sip:gw1@opensips_domain). After lookup(location) just restore the DID
back into username part -> sip:DID@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@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@lists.opensips.org<mailto:Users@lists.opensips.org>
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
Users@lists.opensips.org<mailto:Users@lists.opensips.org>
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

Reply via email to