Hi,
I'm setting up multiple OpenSER proxies in different locations to server a SIP domain. The proxies use a shared location database so they always know where to send requests to the client when an incoming call hits either one. The clients have the outbound proxy set to whichever one is closest to them. The problem is that because the clients are NAT they do not receive the request if the proxy IP that sends it is not the same as the one they have set as the outbound proxy. The NAT will reject the request because it does not arrive from the same IP that the connection was established to.
How can I make OpenSER relay requests to the "home proxy" of the user so that this can then forward it to the client? I have added an "ob_proxy" column to the subscriber table and tried using avp_db_load to get this value for use in a t_relay() but I'm getting errors in OpenSER.
With the following config:
modparam("avpops","avp_url","mysql://user:pass@localhost/openser") modparam("avpops", "avp_table", "dummy") modparam("avpops","db_scheme", "scheme1:username_col=username;value_col=ob_proxy;table=subscriber")
avp_db_load("$to","$avp(s:ob_proxy)/subscriber");
I'm getting errors in Openser log:
/usr/local/sbin/openser[15470]: ERROR:mysql:db_mysql_submit_query: driver error: Unknown column 'value' in 'field list' /usr/local/sbin/openser[15470]: ERROR:mysql:db_mysql_query: error while submitting query /usr/local/sbin/openser[15470]: ERROR:avpops:ops_dbload_avps: db_load failed
Does anyone know how to fix this or is there a better way of doing it?
El Domingo, 16 de Marzo de 2008, Adrian A escribió:
Hi,
I'm setting up multiple OpenSER proxies in different locations to server a SIP domain. The proxies use a shared location database so they always know where to send requests to the client when an incoming call hits either one. The clients have the outbound proxy set to whichever one is closest to them.
The problem is that because the clients are NAT they do not receive the request if the proxy IP that sends it is not the same as the one they have set as the outbound proxy. The NAT will reject the request because it does not arrive from the same IP that the connection was established to.
There is a RFC to solve your problem and a module for OpenSer. It's called PATH:
- SIP Extension Header Field for Registering Non-Adjacent Contacts : http://tools.ietf.org/html/rfc3327 - http://www.openser.org/docs/modules/1.3.x/path.html
Also you need to set some options in "registrar" module.
Regards.
I've looked over the RFC and the module and while they describe a slightly different scenario (with a load balancer and separate registrars), it seems like it should work.
I've added the required parameters to the config:
modparam("registrar", "use_path", 1) modparam("registrar", "path_mode", 0) modparam("registrar", "path_use_received", 1) modparam("path", "use_received", 1)
Then, in my auth section, I store the path:
if (is_method("REGISTER")) { add_path();
This does not seem to do anything however, the proxy still forwards directly to the client instead of sending it to the proper outbound proxy. I looked in the location table and I see path is set to NULL so unless this is stored in some other place, the proxy would not know where to send it anyway.
Have you used this? Am I doing something wrong? I could not find on this list or anywhere a sample openser config that uses it...
Thanks.
On Sat, Mar 15, 2008 at 4:12 PM, Iñaki Baz Castillo ibc@aliax.net wrote:
El Domingo, 16 de Marzo de 2008, Adrian A escribió:
Hi,
I'm setting up multiple OpenSER proxies in different locations to server
a
SIP domain. The proxies use a shared location database so they always
know
where to send requests to the client when an incoming call hits either
one.
The clients have the outbound proxy set to whichever one is closest to them.
The problem is that because the clients are NAT they do not receive the request if the proxy IP that sends it is not the same as the one
they
have set as the outbound proxy. The NAT will reject the request because
it
does not arrive from the same IP that the connection was established to.
There is a RFC to solve your problem and a module for OpenSer. It's called PATH:
- SIP Extension Header Field for Registering Non-Adjacent Contacts : http://tools.ietf.org/html/rfc3327
- http://www.openser.org/docs/modules/1.3.x/path.html
Also you need to set some options in "registrar" module.
Regards.
-- Iñaki Baz Castillo
Users mailing list Users@lists.openser.org http://lists.openser.org/cgi-bin/mailman/listinfo/users
El Domingo, 16 de Marzo de 2008, Adrian A escribió:
I've looked over the RFC and the module and while they describe a slightly different scenario (with a load balancer and separate registrars), it seems like it should work.
I've added the required parameters to the config:
modparam("registrar", "use_path", 1) modparam("registrar", "path_mode", 0) modparam("registrar", "path_use_received", 1) modparam("path", "use_received", 1)
Then, in my auth section, I store the path:
if (is_method("REGISTER")) { add_path();
This does not seem to do anything however, the proxy still forwards directly to the client instead of sending it to the proper outbound proxy. I looked in the location table and I see path is set to NULL so unless this is stored in some other place, the proxy would not know where to send it anyway.
Have you used this? Am I doing something wrong? I could not find on this list or anywhere a sample openser config that uses it...
Sorry, I've not used it, but I'm 100% sure that it's what you need.
Does anyone know how to use the Path functions or has an alternative method of solving this issue with multiple proxies?
Thanks in advance.
On Sat, Mar 15, 2008 at 7:45 PM, Iñaki Baz Castillo ibc@aliax.net wrote:
El Domingo, 16 de Marzo de 2008, Adrian A escribió:
I've looked over the RFC and the module and while they describe a
slightly
different scenario (with a load balancer and separate registrars), it
seems
like it should work.
I've added the required parameters to the config:
modparam("registrar", "use_path", 1) modparam("registrar", "path_mode", 0) modparam("registrar", "path_use_received", 1) modparam("path", "use_received", 1)
Then, in my auth section, I store the path:
if (is_method("REGISTER")) { add_path();
This does not seem to do anything however, the proxy still forwards directly to the client instead of sending it to the proper outbound
proxy.
I looked in the location table and I see path is set to NULL so unless
this
is stored in some other place, the proxy would not know where to send it anyway.
Have you used this? Am I doing something wrong? I could not find on this list or anywhere a sample openser config that uses it...
Sorry, I've not used it, but I'm 100% sure that it's what you need.
-- Iñaki Baz Castillo
Users mailing list Users@lists.openser.org http://lists.openser.org/cgi-bin/mailman/listinfo/users
Hi Adrian,
I wrote the path module for exactly the scenario you describe here, so it should work for you as well :)
So, on your outbound proxy you have to set:
loadmodule "path.so" modparam("path", "use_received", 1)
As well as something like the following in your routes:
if(method=="REGISTER") { add_path_received(); }
An on your registrar/proxy, you have to set:
modparam("registrar", "use_path", 1) modparam("registrar", "path_mode", 0) modparam("registrar", "path_use_received", 1)
Cheers, Andreas
Adrian A wrote:
Does anyone know how to use the Path functions or has an alternative method of solving this issue with multiple proxies?
Thanks in advance.
On Sat, Mar 15, 2008 at 7:45 PM, Iñaki Baz Castillo <ibc@aliax.net mailto:ibc@aliax.net> wrote:
El Domingo, 16 de Marzo de 2008, Adrian A escribió: > I've looked over the RFC and the module and while they describe a slightly > different scenario (with a load balancer and separate registrars), it seems > like it should work. > > I've added the required parameters to the config: > > modparam("registrar", "use_path", 1) > modparam("registrar", "path_mode", 0) > modparam("registrar", "path_use_received", 1) > modparam("path", "use_received", 1) > > Then, in my auth section, I store the path: > > if (is_method("REGISTER")) { > add_path(); > > This does not seem to do anything however, the proxy still forwards > directly to the client instead of sending it to the proper outbound proxy. > I looked in the location table and I see path is set to NULL so unless this > is stored in some other place, the proxy would not know where to send it > anyway. > > Have you used this? Am I doing something wrong? I could not find on this > list or anywhere a sample openser config that uses it... Sorry, I've not used it, but I'm 100% sure that it's what you need. -- Iñaki Baz Castillo _______________________________________________ Users mailing list Users@lists.openser.org <mailto:Users@lists.openser.org> http://lists.openser.org/cgi-bin/mailman/listinfo/users
Users mailing list Users@lists.openser.org http://lists.openser.org/cgi-bin/mailman/listinfo/users
Hi Andreas,
I have set the configuration as you mentioned below but it does not seem to help. Let me give you some more details about what I'm trying to accomplish.
In my setup, there are 2 proxies: Proxy A and Proxy B. Depending on the physical location, some users register to Proxy A and some to Proxy B. The openser database is shared between the two proxies.
Here is the call scenario that I'm looking to get working:
1. User Bob registers to Proxy A with a particular NAT binding 2. External call comes in to Proxy B for user Bob. 3. Proxy B tries to contact Bob at the location from the usrloc table but because the NAT binding does not know anything about Proxy B's IP, the request is not passed trough.
What I need is for Proxy B to send the request to Proxy A so this can then relay to client.
I have added the modparam settings on both proxies (since both can act as both outbound proxies and registrar for different users) and added inside the route:
... If (uri == myself) { ... If (is_method("REGISTER")) { add_path_received(); ...
I would have expected that this would add something to the 'path' value in the location table, but this is still NULL after user registers.
Thanks, Adrian
On Mon, Mar 17, 2008 at 7:57 AM, Andreas Granig agranig@sipwise.com wrote:
Hi Adrian,
I wrote the path module for exactly the scenario you describe here, so it should work for you as well :)
So, on your outbound proxy you have to set:
loadmodule "path.so" modparam("path", "use_received", 1)
As well as something like the following in your routes:
if(method=="REGISTER") { add_path_received(); }
An on your registrar/proxy, you have to set:
modparam("registrar", "use_path", 1) modparam("registrar", "path_mode", 0) modparam("registrar", "path_use_received", 1)
Cheers, Andreas
Adrian A wrote:
Does anyone know how to use the Path functions or has an alternative method of solving this issue with multiple proxies?
Thanks in advance.
On Sat, Mar 15, 2008 at 7:45 PM, Iñaki Baz Castillo <ibc@aliax.net mailto:ibc@aliax.net> wrote:
El Domingo, 16 de Marzo de 2008, Adrian A escribió: > I've looked over the RFC and the module and while they describe a slightly > different scenario (with a load balancer and separate registrars), it seems > like it should work. > > I've added the required parameters to the config: > > modparam("registrar", "use_path", 1) > modparam("registrar", "path_mode", 0) > modparam("registrar", "path_use_received", 1) > modparam("path", "use_received", 1) > > Then, in my auth section, I store the path: > > if (is_method("REGISTER")) { > add_path(); > > This does not seem to do anything however, the proxy still
forwards
> directly to the client instead of sending it to the proper outbound proxy. > I looked in the location table and I see path is set to NULL so unless this > is stored in some other place, the proxy would not know where to send it > anyway. > > Have you used this? Am I doing something wrong? I could not find on this > list or anywhere a sample openser config that uses it... Sorry, I've not used it, but I'm 100% sure that it's what you need. -- Iñaki Baz Castillo _______________________________________________ Users mailing list Users@lists.openser.org <mailto:Users@lists.openser.org> http://lists.openser.org/cgi-bin/mailman/listinfo/users
Users mailing list Users@lists.openser.org http://lists.openser.org/cgi-bin/mailman/listinfo/users
Adrian,
I see. So on the proxy where you call add_path_received(), you don't send out the request again but just call save() then? For such a scenario it unfortunately doesn't work.
Andreas
Adrian A wrote:
Hi Andreas,
I have set the configuration as you mentioned below but it does not seem to help. Let me give you some more details about what I'm trying to accomplish.
In my setup, there are 2 proxies: Proxy A and Proxy B. Depending on the physical location, some users register to Proxy A and some to Proxy B. The openser database is shared between the two proxies.
Here is the call scenario that I'm looking to get working:
- User Bob registers to Proxy A with a particular NAT binding
- External call comes in to Proxy B for user Bob.
- Proxy B tries to contact Bob at the location from the usrloc table
but because the NAT binding does not know anything about Proxy B's IP, the request is not passed trough.
What I need is for Proxy B to send the request to Proxy A so this can then relay to client.
I have added the modparam settings on both proxies (since both can act as both outbound proxies and registrar for different users) and added inside the route:
... If (uri == myself) { ... If (is_method("REGISTER")) { add_path_received(); ...
I would have expected that this would add something to the 'path' value in the location table, but this is still NULL after user registers.
Thanks, Adrian
On Mon, Mar 17, 2008 at 7:57 AM, Andreas Granig <agranig@sipwise.com mailto:agranig@sipwise.com> wrote:
Hi Adrian, I wrote the path module for exactly the scenario you describe here, so it should work for you as well :) So, on your outbound proxy you have to set: loadmodule "path.so" modparam("path", "use_received", 1) As well as something like the following in your routes: if(method=="REGISTER") { add_path_received(); } An on your registrar/proxy, you have to set: modparam("registrar", "use_path", 1) modparam("registrar", "path_mode", 0) modparam("registrar", "path_use_received", 1) Cheers, Andreas Adrian A wrote: > Does anyone know how to use the Path functions or has an alternative > method of solving this issue with multiple proxies? > > Thanks in advance. > > > On Sat, Mar 15, 2008 at 7:45 PM, Iñaki Baz Castillo <ibc@aliax.net <mailto:ibc@aliax.net> > <mailto:ibc@aliax.net <mailto:ibc@aliax.net>>> wrote: > > El Domingo, 16 de Marzo de 2008, Adrian A escribió: > > I've looked over the RFC and the module and while they describe a > slightly > > different scenario (with a load balancer and separate > registrars), it seems > > like it should work. > > > > I've added the required parameters to the config: > > > > modparam("registrar", "use_path", 1) > > modparam("registrar", "path_mode", 0) > > modparam("registrar", "path_use_received", 1) > > modparam("path", "use_received", 1) > > > > Then, in my auth section, I store the path: > > > > if (is_method("REGISTER")) { > > add_path(); > > > > This does not seem to do anything however, the proxy still forwards > > directly to the client instead of sending it to the proper > outbound proxy. > > I looked in the location table and I see path is set to NULL so > unless this > > is stored in some other place, the proxy would not know where to > send it > > anyway. > > > > Have you used this? Am I doing something wrong? I could not find > on this > > list or anywhere a sample openser config that uses it... > > Sorry, I've not used it, but I'm 100% sure that it's what you need. > > > -- > Iñaki Baz Castillo > > _______________________________________________ > Users mailing list > Users@lists.openser.org <mailto:Users@lists.openser.org> <mailto:Users@lists.openser.org <mailto:Users@lists.openser.org>> > http://lists.openser.org/cgi-bin/mailman/listinfo/users > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Users mailing list > Users@lists.openser.org <mailto:Users@lists.openser.org> > http://lists.openser.org/cgi-bin/mailman/listinfo/users
Thanks, that is what I thought as well after reading the module documentation.
I'm still looking for ways to solve this so any pointers are much appreciated.
Currently I have the following at the end of the main route:
if (avp_db_query("SELECT ob_proxy FROM subscriber WHERE username = '$rU'", "$avp(s:ob_proxy)")) { xlog("L_INFO", "SIP Request: method [$rm] from [$fu] to [$tu] after avp [$avp(s:ob_proxy)]\n"); avp_printf("$du", "sip:$avp(s:ob_proxy):5060"); };
This sets the destination URI to be the outbound proxy that the user is provisioned with. I would prefer an alternative solution without the need of an extra DB call and avp operations. This also does not seem to work if there are multiple branches (multiple locations for the user) - only one of them is relayed to the other proxy.
Thanks, Adrian
On Mon, Mar 17, 2008 at 1:40 PM, Andreas Granig agranig@sipwise.com wrote:
Adrian,
I see. So on the proxy where you call add_path_received(), you don't send out the request again but just call save() then? For such a scenario it unfortunately doesn't work.
Andreas
Adrian A wrote:
Hi Andreas,
I have set the configuration as you mentioned below but it does not seem to help. Let me give you some more details about what I'm trying to accomplish.
In my setup, there are 2 proxies: Proxy A and Proxy B. Depending on the physical location, some users register to Proxy A and some to Proxy B. The openser database is shared between the two proxies.
Here is the call scenario that I'm looking to get working:
- User Bob registers to Proxy A with a particular NAT binding
- External call comes in to Proxy B for user Bob.
- Proxy B tries to contact Bob at the location from the usrloc table
but because the NAT binding does not know anything about Proxy B's IP, the request is not passed trough.
What I need is for Proxy B to send the request to Proxy A so this can then relay to client.
I have added the modparam settings on both proxies (since both can act as both outbound proxies and registrar for different users) and added inside the route:
... If (uri == myself) { ... If (is_method("REGISTER")) { add_path_received(); ...
I would have expected that this would add something to the 'path' value in the location table, but this is still NULL after user registers.
Thanks, Adrian
On Mon, Mar 17, 2008 at 7:57 AM, Andreas Granig <agranig@sipwise.com mailto:agranig@sipwise.com> wrote:
Hi Adrian, I wrote the path module for exactly the scenario you describe here,
so
it should work for you as well :) So, on your outbound proxy you have to set: loadmodule "path.so" modparam("path", "use_received", 1) As well as something like the following in your routes: if(method=="REGISTER") { add_path_received(); } An on your registrar/proxy, you have to set: modparam("registrar", "use_path", 1) modparam("registrar", "path_mode", 0) modparam("registrar", "path_use_received", 1) Cheers, Andreas Adrian A wrote: > Does anyone know how to use the Path functions or has an
alternative
> method of solving this issue with multiple proxies? > > Thanks in advance. > > > On Sat, Mar 15, 2008 at 7:45 PM, Iñaki Baz Castillo <ibc@aliax.net <mailto:ibc@aliax.net> > <mailto:ibc@aliax.net <mailto:ibc@aliax.net>>> wrote: > > El Domingo, 16 de Marzo de 2008, Adrian A escribió: > > I've looked over the RFC and the module and while they describe a > slightly > > different scenario (with a load balancer and separate > registrars), it seems > > like it should work. > > > > I've added the required parameters to the config: > > > > modparam("registrar", "use_path", 1) > > modparam("registrar", "path_mode", 0) > > modparam("registrar", "path_use_received", 1) > > modparam("path", "use_received", 1) > > > > Then, in my auth section, I store the path: > > > > if (is_method("REGISTER")) { > > add_path(); > > > > This does not seem to do anything however, the proxy still forwards > > directly to the client instead of sending it to the proper > outbound proxy. > > I looked in the location table and I see path is set to NULL so > unless this > > is stored in some other place, the proxy would not know where to > send it > > anyway. > > > > Have you used this? Am I doing something wrong? I could not find > on this > > list or anywhere a sample openser config that uses it... > > Sorry, I've not used it, but I'm 100% sure that it's what you need. > > > -- > Iñaki Baz Castillo > > _______________________________________________ > Users mailing list > Users@lists.openser.org <mailto:Users@lists.openser.org> <mailto:Users@lists.openser.org <mailto:Users@lists.openser.org>> > http://lists.openser.org/cgi-bin/mailman/listinfo/users > > > >
> > _______________________________________________ > Users mailing list > Users@lists.openser.org <mailto:Users@lists.openser.org> > http://lists.openser.org/cgi-bin/mailman/listinfo/users