regarding the failure of lookup(); you can stick to sending an error
reply or you can try the next gateway provided by LCR.
In other words, the simplified configuration may be as the following:
# Save original user name (the called phone number).
avp_printf("$orig_called_num", "$rU");
if (load_gws())
{
if (next_gw())
{
if (lookup("location"))
{
avp_pushto("$ruri/username", "$orig_called_num");
t_on_failure("2");
route(x); # NAT and other usual staff there
exit;
}
else
{
xlog("L_INFO", "I have to think what to do in this
situation.\n");
sl_send_reply("404", "User Not Found");
}
}
}
failure_route[2]
{
if (method=="INVITE" && t_check_status("408|500|503"))
{
if (!next_gw())
{
t_reply("503", "Service not available, no more gateways");
}
else
{
if (!lookup("location"))
{
xlog("L_INFO", "I have to think what to do in this
situation.\n");
t_reply("503", "Service not available, no more
gateways");
exit;
};
t_on_failure("2");
t_on_branch("2");
t_relay();
}
}
}
branch_route[2]
{
avp_pushto("$ruri/username", "$orig_called_num");
}
Am I correct? Actually I don't know what to do if one of the gateways
is off-line (lookup() failed).
Best regards,
Leonid Fainshtein
-----Original Message-----
From: Bogdan-Andrei Iancu [mailto:bogdan@voice-system.ro]
Sent: Tuesday, November 08, 2005 5:30 PM
To: Leonid Fainshtein
Cc: users@openser.org
Subject: Re: [Users] Routing to NATed gateways
Hi Leonid,
the scenario you are probing might be already doable. Set in the LCR
table some IP addresses which will be used as aliases: private
addresses in 10.10.x.x class for example. Then register this IPs in
usrloc pointing to the real GWs address.
So you can do lcr (next_gw) and then lookup.
for this to work, lcr must operate on RURI and not on DST_URI (not
sure
how exactly is working).
regards,
bogdan
Leonid Fainshtein wrote:
Hi,
I'd like to use OpenSER for routing calls to NATed gateways. I also
want to support the LCR feature. Unfortunately, the current LCR
module
doesn't support NAT. I mean that the gateway IP addresses must be
defined explicitly in the "gtw" table. Now I'm looking for a way to
force OpenSer to use information from the "location" table.
I want to write a module that will have the similar functionality
like
the current LCR module has but resolving procedure will be more
complicated (not based on prefix and From only). The module should
build avp list where each gateway will have symbolic user name. For
example, g1, g2 etc. The gateways will also be registered on the
proxy
with those names. Then I think it will be possible to call
lookup("location") after successful call the next_gtw() from the
script.
Is it feasible? Is there another way to solve my problem?
Thank you in advance,
Leonid Fainshtein
Users mailing list
Users@openser.org
http://openser.org/cgi-bin/mailman/listinfo/users