Discussion:
[OpenSIPS-Users] Forwarding REGISTER messages to Asterisk
Simon Shaw
2008-09-03 17:44:42 UTC
Permalink
I would like to use OpenSIPS as a pure router between some of my SIP UAs
and Asterisk such that when one of these UAs registers with OpenSIPS the
REGISTER message will be redirected to Asterisk where it will be
handled. When a UA that is connected directly to the Asterisk box
dials one of the OpenSIPS UAs I would like the SIP INVITE to be sent
from the Asterisk box via OpenSIPS.

I have managed to forward the REGISTER messages to Asterisk using
rewritehost(<IPofAsterisk>), however when a UA that is registered
directly with the Asterisk dials a UA that registered via OpenSIPS the
INVITE message is sent directly from Asterisk to the UA.

I guess this is happening because Contact header in the REGISTER message
has the IP of the UA and not that of OpenSIPS.

If this assumption is correct what is the correct method to change the
IP in the contact header? Could the NATHelper be useful here?



Thanks,



Simon
Iñaki Baz Castillo
2008-09-04 08:33:02 UTC
Permalink
Post by Simon Shaw
I would like to use OpenSIPS as a pure router between some of my SIP UAs
and Asterisk such that when one of these UAs registers with OpenSIPS the
REGISTER message will be redirected to Asterisk where it will be
handled. When a UA that is connected directly to the Asterisk box
dials one of the OpenSIPS UAs I would like the SIP INVITE to be sent
from the Asterisk box via OpenSIPS.
I have managed to forward the REGISTER messages to Asterisk using
rewritehost(<IPofAsterisk>), however when a UA that is registered
directly with the Asterisk dials a UA that registered via OpenSIPS the
INVITE message is sent directly from Asterisk to the UA.
I guess this is happening because Contact header in the REGISTER message
has the IP of the UA and not that of OpenSIPS.
If this assumption is correct what is the correct method to change the
IP in the contact header? Could the NATHelper be useful here?
It's easy: if you forward the REGISTER from OpenSIPS to Asterisk then when
Asterisk calls that user it will do it directly, since of course "Contact" in
REGISTER has the UA IP as it's logical.

This would be possible with "Path" feature (see "path" module and related
RFC), but of course, be sure that Asterisk doesn't implement it.
--
Iñaki Baz Castillo
***@in.ilimit.es
Simon Shaw
2008-09-04 14:58:22 UTC
Permalink
I was hoping to solve this issue in a more generic manner.
Any idea how I change the IP address in the contact header?

-----Original Message-----
From: users-***@lists.opensips.org [mailto:users-***@lists.opensips.org] On Behalf Of I?aki Baz Castillo
Sent: Thursday, September 04, 2008 11:33 AM
To: ***@lists.opensips.org
Subject: Re: [OpenSIPS-Users] Forwarding REGISTER messages to Asterisk
Post by Simon Shaw
I would like to use OpenSIPS as a pure router between some of my SIP UAs
and Asterisk such that when one of these UAs registers with OpenSIPS the
REGISTER message will be redirected to Asterisk where it will be
handled. When a UA that is connected directly to the Asterisk box
dials one of the OpenSIPS UAs I would like the SIP INVITE to be sent
from the Asterisk box via OpenSIPS.
I have managed to forward the REGISTER messages to Asterisk using
rewritehost(<IPofAsterisk>), however when a UA that is registered
directly with the Asterisk dials a UA that registered via OpenSIPS the
INVITE message is sent directly from Asterisk to the UA.
I guess this is happening because Contact header in the REGISTER message
has the IP of the UA and not that of OpenSIPS.
If this assumption is correct what is the correct method to change the
IP in the contact header? Could the NATHelper be useful here?
It's easy: if you forward the REGISTER from OpenSIPS to Asterisk then when
Asterisk calls that user it will do it directly, since of course "Contact" in
REGISTER has the UA IP as it's logical.

This would be possible with "Path" feature (see "path" module and related
RFC), but of course, be sure that Asterisk doesn't implement it.





--
Iñaki Baz Castillo
***@in.ilimit.es

_______________________________________________
Users mailing list
***@lists.opensips.org
http://lists.open
Darren Sessions
2008-09-04 15:27:49 UTC
Permalink
I would highly highly highly recommend you *DO NOT* use Asterisk if
you'll have any sort of volume of registrations (for the record, I am
an Asterisk advocate).

I speak from experience and can say first hand that this is a **bad
idea**.

Asterisk's sip stack and configuration setup really just don't allow
for a high concentration of SIP registrations without a very
significant penalty on the Asterisk host. I had a couple hundred
registrations on a single Asterisk server that started to visibly
effect the performance of the host server. When I hit 500
registrations, the Asterisk server was unusable. I have consistently
been able to reproduce this effect to varying degrees on several Linux
distros and on four different hardware vendor platforms.

Offloading the registrations to OpenSIPS is the smart way to do it. If
you're wanting to send the call simultaneously to Asterisk and the end-
point you can make a creative OpenSIPS config file using the LCR
module or dbalias or something.

If you're wanting to do processing on the Asterisk server before the
end-point is called, you could use the opensips config to route all
the calls to the Asterisk server(s) and then have the Asterisk servers
do their processing bit and send the call back to OpenSIPS which could
detect the call as coming from your pool of Asterisk server(s) and do
a location lookup at that point.

In any case, be creative, it's quite possible to do almost anything
with the call flows you'd like having OpenSIPS at the front of your
network.

Good Luck!


_____________________________

Darren Sessions
***@gmail.com
http://www.darrensessions.com
_____________________________
Post by Simon Shaw
I was hoping to solve this issue in a more generic manner.
Any idea how I change the IP address in the contact header?
-----Original Message-----
] On Behalf Of I?aki Baz Castillo
Sent: Thursday, September 04, 2008 11:33 AM
Subject: Re: [OpenSIPS-Users] Forwarding REGISTER messages to Asterisk
Post by Simon Shaw
I would like to use OpenSIPS as a pure router between some of my SIP UAs
and Asterisk such that when one of these UAs registers with
OpenSIPS the
REGISTER message will be redirected to Asterisk where it will be
handled. When a UA that is connected directly to the Asterisk box
dials one of the OpenSIPS UAs I would like the SIP INVITE to be sent
from the Asterisk box via OpenSIPS.
I have managed to forward the REGISTER messages to Asterisk using
rewritehost(<IPofAsterisk>), however when a UA that is registered
directly with the Asterisk dials a UA that registered via OpenSIPS the
INVITE message is sent directly from Asterisk to the UA.
I guess this is happening because Contact header in the REGISTER message
has the IP of the UA and not that of OpenSIPS.
If this assumption is correct what is the correct method to change the
IP in the contact header? Could the NATHelper be useful here?
It's easy: if you forward the REGISTER from OpenSIPS to Asterisk then when
Asterisk calls that user it will do it directly, since of course "Contact" in
REGISTER has the UA IP as it's logical.
This would be possible with "Path" feature (see "path" module and related
RFC), but of course, be sure that Asterisk doesn't implement it.
--
Iñaki Baz Castillo
_______________________________________________
Users mailing list
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
_______________________________________________
Users mailing list
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Simon Shaw
2008-09-05 08:34:33 UTC
Permalink
Hi Darren,



I will also want use this setup where the remote PBX is Cisco, Avaya or Nortel. I need this setup in my lab purely to make some of my testing and monitoring easier (long story, not really important here).



Thanks,



Simon





From: Darren Sessions [mailto:***@gmail.com]
Sent: Thursday, September 04, 2008 6:28 PM
To: Simon Shaw; ***@lists.opensips.org
Subject: Re: [OpenSIPS-Users] Forwarding REGISTER messages to Asterisk





I would highly highly highly recommend you *DO NOT* use Asterisk if you'll have any sort of volume of registrations (for the record, I am an Asterisk advocate).



I speak from experience and can say first hand that this is a **bad idea**.



Asterisk's sip stack and configuration setup really just don't allow for a high concentration of SIP registrations without a very significant penalty on the Asterisk host. I had a couple hundred registrations on a single Asterisk server that started to visibly effect the performance of the host server. When I hit 500 registrations, the Asterisk server was unusable. I have consistently been able to reproduce this effect to varying degrees on several Linux distros and on four different hardware vendor platforms.



Offloading the registrations to OpenSIPS is the smart way to do it. If you're wanting to send the call simultaneously to Asterisk and the end-point you can make a creative OpenSIPS config file using the LCR module or dbalias or something.



If you're wanting to do processing on the Asterisk server before the end-point is called, you could use the opensips config to route all the calls to the Asterisk server(s) and then have the Asterisk servers do their processing bit and send the call back to OpenSIPS which could detect the call as coming from your pool of Asterisk server(s) and do a location lookup at that point.



In any case, be creative, it's quite possible to do almost anything with the call flows you'd like having OpenSIPS at the front of your network.



Good Luck!





_____________________________



Darren Sessions

***@gmail.com

http://www.darrensessions.com

_____________________________











On Sep 4, 2008, at 8:58 AM, Simon Shaw wrote:





I was hoping to solve this issue in a more generic manner.
Any idea how I change the IP address in the contact header?

-----Original Message-----
From: users-***@lists.opensips.org [mailto:users-***@lists.opensips.org] On Behalf Of I?aki Baz Castillo
Sent: Thursday, September 04, 2008 11:33 AM
To: ***@lists.opensips.org
Subject: Re: [OpenSIPS-Users] Forwarding REGISTER messages to Asterisk

El Wednesday 03 September 2008 19:44:42 Simon Shaw escribió:



I would like to use OpenSIPS as a pure router between some of my SIP UAs

and Asterisk such that when one of these UAs registers with OpenSIPS the

REGISTER message will be redirected to Asterisk where it will be

handled. When a UA that is connected directly to the Asterisk box

dials one of the OpenSIPS UAs I would like the SIP INVITE to be sent

from the Asterisk box via OpenSIPS.



I have managed to forward the REGISTER messages to Asterisk using

rewritehost(<IPofAsterisk>), however when a UA that is registered

directly with the Asterisk dials a UA that registered via OpenSIPS the

INVITE message is sent directly from Asterisk to the UA.



I guess this is happening because Contact header in the REGISTER message

has the IP of the UA and not that of OpenSIPS.



If this assumption is correct what is the correct method to change the

IP in the contact header? Could the NATHelper be useful here?


It's easy: if you forward the REGISTER from OpenSIPS to Asterisk then when
Asterisk calls that user it will do it directly, since of course "Contact" in
REGISTER has the UA IP as it's logical.

This would be possible with "Path" feature (see "path" module and related
RFC), but of course, be sure that Asterisk doesn't implement it.
--
Iñaki Baz Castillo
***@in.ilimit.es
Alex Balashov
2008-09-05 06:20:39 UTC
Permalink
Post by Simon Shaw
I would like to use OpenSIPS as a pure router between some of my SIP UAs
and Asterisk such that when one of these UAs registers with OpenSIPS the
REGISTER message will be redirected to Asterisk where it will be
handled. When a UA that is connected directly to the Asterisk box
dials one of the OpenSIPS UAs I would like the SIP INVITE to be sent
from the Asterisk box via OpenSIPS.
I have managed to forward the REGISTER messages to Asterisk using
rewritehost(<IPofAsterisk>), however when a UA that is registered
directly with the Asterisk dials a UA that registered via OpenSIPS the
INVITE message is sent directly from Asterisk to the UA.
I guess this is happening because Contact header in the REGISTER message
has the IP of the UA and not that of OpenSIPS.
If this assumption is correct what is the correct method to change the
IP in the contact header? Could the NATHelper be useful here?
The easiest thing might be to use the externip= setting if Asterisk is
always the calling UA. Otherwise, you will have to mangle the Contact,
indeed.

The nathelper module won't help because the Contact URI needs to be
rewritten to the address of your proxy, not the external network IP
detected from the UA.
--
Alex Balashov
Evariste Systems
Web : http://www.evaristesys.com/
Tel : (+1) (678) 954-0670
Direct : (+1) (678) 954-0671
Mobile : (+1) (706) 338-8599
Simon Shaw
2008-09-05 08:36:24 UTC
Permalink
Just as a matter of academic interest, if I change the contact header
field do I stop being a proxy and become an SBC or is there no such
distinction?

-----Original Message-----
From: Alex Balashov [mailto:***@evaristesys.com]
Sent: Friday, September 05, 2008 9:21 AM
To: Simon Shaw
Cc: ***@lists.opensips.org
Subject: Re: [OpenSIPS-Users] Forwarding REGISTER messages to Asterisk
Post by Simon Shaw
I would like to use OpenSIPS as a pure router between some of my SIP UAs
and Asterisk such that when one of these UAs registers with OpenSIPS the
REGISTER message will be redirected to Asterisk where it will be
handled. When a UA that is connected directly to the Asterisk box
dials one of the OpenSIPS UAs I would like the SIP INVITE to be sent
from the Asterisk box via OpenSIPS.
I have managed to forward the REGISTER messages to Asterisk using
rewritehost(<IPofAsterisk>), however when a UA that is registered
directly with the Asterisk dials a UA that registered via OpenSIPS the
INVITE message is sent directly from Asterisk to the UA.
I guess this is happening because Contact header in the REGISTER message
has the IP of the UA and not that of OpenSIPS.
If this assumption is correct what is the correct method to change the
IP in the contact header? Could the NATHelper be useful here?
The easiest thing might be to use the externip= setting if Asterisk is
always the calling UA. Otherwise, you will have to mangle the Contact,
indeed.

The nathelper module won't help because the Contact URI needs to be
rewritten to the address of your proxy, not the external network IP
detected from the UA.
--
Alex Balashov
Evariste Systems
Web : http://www.evaristesys.com/
Tel : (+1) (678) 954-0670
Direct : (+1) (678) 954-0671
Mobile : (+1) (706) 338-8599
Alex Balashov
2008-09-05 08:56:37 UTC
Permalink
Post by Simon Shaw
Just as a matter of academic interest, if I change the contact header
field do I stop being a proxy and become an SBC or is there no such
distinction?
The dichotomy posed between a proxy and an SBC is incorrect, or least
orthogonal; an SBC is a particular kind of VoIP infrastructure
equipment. Perhaps you were referring to a UAC? An SBC generally has a
back-to-back user agent, and therefore constitutes a UAC, but the
reference to an SBC as such is specious. PBXs, phones, etc. are also UACs.

Either way, it is not contrary to proxy behaviour to change the Contact:
header, as long as the translation is statefully conserved on both sides
of the relay.

The formal distinction between a proxy and a user agent is that:

1) The proxy only relays, and as such, its behaviour is transactionally
event-driven; it does not create any call legs, nor originate any
transactional events. It just passes what it receives between
endpoints, when it receives it.

2) A proxy's role within a dialog participates in one logical call leg.
The properties that distinguish a call leg are its CSeq counters, GUID
(Call-ID), and dialog tags on to/from. Back-to-back user agents such as
PBXs create new call legs and bridge them in VoIP-to-VoIP calls, while
proxies are in the path of one leg.

There are other practical implications to being a proxy and not a UA;
they mainly revolve around not being able to do various things that an
endpoint can do, such as modify certain parameters of the session, or
handle media. Another implication concerns wrapping calls around to the
sending UA:

UA1 --> Proxy --> Back to UA1

This is a common attempted use of proxies for LCR and translation
functionality; i.e. a softswitch sends a call to a proxy, a proxy does
some intelligent database stuff, stamps a prefix onto the Request URI,
and sends the call back to the same originating signaling agent. This
won't work because a SIP UAC will detect the wrapped-around call as
being the same logical call leg that it originated and declare it a
"looped" call.

With the exception of the UAC module and some other pieces of
functionality (i.e. auxiliary NAT traversal via media proxies) that can
be hacked onto it, Kamailio won't let you do things that aren't properly
within the domain of a proxy to do. However, mangling SIP headers and
message parameters (well, certain ones, including the one you're asking
about) is a very common and acceptable use of proxies.

-- Alex
--
Alex Balashov
Evariste Systems
Web : http://www.evaristesys.com/
Tel : (+1) (678) 954-0670
Direct : (+1) (678) 954-0671
Mobile : (+1) (706) 338-8599
Alex Balashov
2008-09-05 08:57:43 UTC
Permalink
Post by Alex Balashov
With the exception of the UAC module and some other pieces of
functionality (i.e. auxiliary NAT traversal via media proxies) that can
be hacked onto it, Kamailio won't let you do things that aren't properly
within the domain of a proxy to do. However, mangling SIP headers and
message parameters (well, certain ones, including the one you're asking
about) is a very common and acceptable use of proxies.
I should have said, Kamailio/OpenSIPS. :-)
--
Alex Balashov
Evariste Systems
Web : http://www.evaristesys.com/
Tel : (+1) (678) 954-0670
Direct : (+1) (678) 954-0671
Mobile : (+1) (706) 338-8599
Continue reading on narkive:
Loading...