Hi,
Iam too interested in this discussion, can some one explicitly elaborate
how iam gonna satisfy all the conditions in a situation whereby OpenSER
is relaying to Asterisk for local PSTN calls and to another a voip
provider for International PSTN calls, ofcourse this applies for any
numeric uri.
I have a Sipwise generated config with offnet-termination which i tried
to edit route [5] 'invite-find-calee' using t_relay() and
rewritehostport conditions, but my concern is the role of LCR module
which is supposed to be taking care of the GWs especially in route[7]
"Request route invite-to-external", will it gonna disrupt/conflict my
set conditions??
########################################################################
# Request route 'invite-find-callee'
########################################################################
route[5]
{
if(alias_db_lookup("dbaliases"))
{
xlog("L_INFO", "Callee was aliased - M=$rm RURI=$ru F=$fu T=$tu IP=$si
ID=$ci\n");
#CHECK WHERE THE REQUEST IS FROM???-edit by me
if($fd=="sip.domain")
{
#FORWARD THEM TO ASTERISK -edit by me
rewritehostport("asterisk IP");
#AND THEN TAKE THEM TO REQUEST ROUTE 'base-outbound'-edit by me
route(3);
}
else if(uri=~"Sip:00[0-9]+@"){
#RELAY THEM TO INTERNETIONAL PSTN-edit by me
t_relay("IP_of_international_PSTN_ provider");
route (3);
}
if(!is_domain_local("$rd"))
{
setflag(20);
route(7);
}
if(does_uri_exist())
{
xlog("L_INFO", "Callee is local - M=$rm RURI=$ru F=$fu T=$tu IP=$si
ID=$ci\n");
route(6);
}
else
{
xlog("L_INFO", "Callee is not local - M=$rm RURI=$ru F=$fu T=$tu IP=
$si ID=$ci\n");
route(7);
}
exit;
}
########################################################################
# Request route 'invite-to-external'
########################################################################
route[7]
{
if(isflagset(20))
{
xlog("L_INFO", "Call to foreign domain - M=$rm RURI=$ru F=$fu T=$tu
IP=$si ID=$ci\n");
route(3);
exit;
}
if(!isflagset(23))
{
# don't allow calls relaying from PSTN to PSTN, if not explicitely
forwarded
if(uri =~ "^sip:[0-9]+@")
{
# only route numeric users to PSTN
if(!load_gws())
{
xlog("L_ERR", "Error loading PSTN gateways - M=$rm RURI=$ru F=$fu T=
$tu IP=$si ID=$ci\n");
sl_send_reply("503", "PSTN Termination Currently Unavailable");
exit;
}
if(!next_gw())
{
xlog("L_ERR", "No PSTN gateways available - M=$rm RURI=$ru F=$fu T=
$tu IP=$si ID=$ci\n");
sl_send_reply("503", "PSTN Termination Currently Unavailable");
exit;
}
setflag(21);
t_on_failure("1");
route(3);
}
}
xlog("L_INFO", "Call to unknown user - M=$rm RURI=$ru F=$fu T=$tu IP=
$si ID=$ci\n");
sl_send_reply("404", "User Not Found");
exit;
}
WBR,
LU.
On Tue, 2007-11-06 at 06:35 +0000, users-request(a)lists.openser.org
wrote:
Send Users mailing list submissions to
users(a)lists.openser.org
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.openser.org/cgi-bin/mailman/listinfo/users
or, via email, send a message with subject or body 'help' to
users-request(a)lists.openser.org
You can reach the person managing the list at
users-owner(a)lists.openser.org
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Users digest..."
Today's Topics:
1. Re: Openser as a conditional stateless proxy (Christian Schlatter)
2. Presence RLS module: initialization error (Schumann Sebastian)
3. CPL and XML schema (Daniel)
4. Re: MediaProxy 1.9.0 - Radius (Miles Scruggs)
5. Re: Is it possible to insert avp to reply message? (Tung Tran)
6. Re: Is it possible to insert avp to reply message?
(I?aki Baz Castillo)
7. Cellphones and voicemail (Chris Heiser)
8. dispatcher with GeoIP (Victor Sergeev)
9. Re: Cellphones and voicemail (Christian Schlatter)
10. Re: retransmissions after final response (Vasile Zaharia)
----------------------------------------------------------------------
Message: 1
Date: Mon, 05 Nov 2007 10:16:18 -0500
From: Christian Schlatter <cs(a)unc.edu>
Subject: Re: [OpenSER-Users] Openser as a conditional stateless proxy
To: Padmaja <padmaja.rv(a)vodcalabs.com>
Cc: users(a)lists.openser.org
Message-ID: <472F33C2.90900(a)unc.edu>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Padmaja wrote:
Hi,
Thanks for the reply,
Could you provide me the example script for stateless forwarding of
invite when a call is received from say a 911 operator to the server?
I suppose this should be implemented by checking the From field of the
invite and if it is from a certain 911, then it should be forwarded
statelessly (or is this logic incorrect?). I am new to the Openser
stuff, so I do not wish to change the script myself.
Your logic is correct, you can either check the From: header or the
request URI or any other part of an incoming SIP message to make the
routing decision.
A simple example looks like:
if (is_method('INVITE'))
{
# check if from URI domain equals
911operator.com
if ($fd == '911operator.com')
{
# relay stateless using request URI
forward();
exit;
}
else
{
# relay statefull using request URI
if (!t_relay())
{
sl_reply_error();
};
exit;
}
}
Please always CC users(a)lists.openser.org so that others can take
advantage of the discussion.
/Christian
>
> Thanks again,
> Padmaja
>
> ----- Original Message ----- From: "Christian Schlatter"
<cs(a)unc.edu>
> To: "Padmaja" <padmaja.rv(a)vodcalabs.com>
> Cc: <users(a)lists.openser.org>
> Sent: Monday, November 05, 2007 4:53 AM
> Subject: Re: [OpenSER-Users] Openser as a conditional stateless proxy
>
>
>> Padmaja wrote:
>>> Hi all,
>>>
>>> Can any one tell me if the same running instance of Openser can be
>>> configured as a stateful proxy for some user accounts and for some
>>> numbers like emergency services, it acts like a stateless proxy, just
>>> forwarding the request to the destination?
>>
>> Yes, it only depends on what forwarding function is used in the
>> routing script:
>>
>> - t_forward(..) --> stateless
>>
>> - t_relay(..) --> stateful
>>
>> /Christian