Hi, very strange:
- I call to OpenSer using a TCP client.
- The INVITE arrives via TCP to OpenSer.
- I do: $rd=ASTERISK_IP; t_relay(); exit;
- Asterisk only speaks UDP of course.
- And OpenSer sends the INVITE to Asterisk by UDP.
WHY does it work??? I hoped it would fail trying to forward the INVITE by TCP to Asterisk since I didn't force the outgoing socket, just the two lines above.
Thanks for any explanation.
El Domingo, 2 de Marzo de 2008, Iñaki Baz Castillo escribió:
WHY does it work??? I hoped it would fail trying to forward the INVITE by TCP to Asterisk since I didn't force the outgoing socket, just the two lines above.
Maybe OpenSer tries first with TCP (since the incoming INVITE uses TCP) and if it can't establish a connection then it tries UDP? Is it RFC 3261 mandatory?
Iñaki Baz Castillo writes:
Maybe OpenSer tries first with TCP (since the incoming INVITE uses TCP) and if it can't establish a connection then it tries UDP? Is it RFC 3261 mandatory?
inaki,
how to select ip/port/transport of next hop is described in
J. Rosenberg and H. Schulzrinne, ÈSession initiation protocol (SIP): locating SIP servers,É RFC 3263, Internet Engineering Task Force, June 2002.
-- juha
El Domingo, 2 de Marzo de 2008, Juha Heinanen escribió:
Iñaki Baz Castillo writes:
Maybe OpenSer tries first with TCP (since the incoming INVITE uses TCP) and if it can't establish a connection then it tries UDP? Is it RFC 3261 mandatory?
inaki,
how to select ip/port/transport of next hop is described in
J. Rosenberg and H. Schulzrinne, ÈSession initiation protocol (SIP): locating SIP servers,É RFC 3263, Internet Engineering Task Force, June 2002.
Thanks Juha, now I understand that the only way OpenSer to set TCP for the destination is by adding a RURI parameter "transport=tcp".
In fact, if I do:
force_send_socket(tcp:MY_IP:5060); $rd = "ASTERISK_MEDIA_IP"; t_relay(); exit;
When I receive an INVITE via TCP OpenSer forwards it via UDP, the only way to force TCP is by using:
add_uri_param("transport=tcp"); $rd = "ASTERISK_MEDIA_IP"; t_relay(); exit;
So it makes sense tieh the RFC you told me:
-------------------------------------------------------------------- 4.1 Selecting a Transport Protocol
First, the client selects a transport protocol.
If the URI specifies a transport protocol in the transport parameter, that transport protocol SHOULD be used.
Otherwise, if no transport protocol is specified, but the TARGET is a numeric IP address, the client SHOULD use UDP for a SIP URI, and TCP for a SIPS URI. --------------------------------------------------------------------
Thanks a lot, I'm starting testing SIP TCP now and have not experience yet.
Best regards.