[asterisk-bugs] [JIRA] (ASTERISK-24889) Possible bug: PJSIP: stateless behavior when transport=tcp
Olle Johansson (JIRA)
noreply at issues.asterisk.org
Tue Mar 17 05:13:34 CDT 2015
[ https://issues.asterisk.org/jira/browse/ASTERISK-24889?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=225482#comment-225482 ]
Olle Johansson commented on ASTERISK-24889:
-------------------------------------------
Theory lesson:
The endpoint should register a listen port and not use that port when opening a session to Asterisk. Connection reuse happens if the endpoint signals support of the outbound extension to SIP - in that case Asterisk is allowed to reuse the existing TCP connection for the outbound request (the INVITE).
--- End theory lesson ---
Implementations may wary - some servers reuse connections as long as their open. They should NOT do this for TLS without outbound though.
Can you add the contact used at registration to this bug report? It's interesting to see how the client suggest that the server should connect to it.
> Possible bug: PJSIP: stateless behavior when transport=tcp
> ----------------------------------------------------------
>
> Key: ASTERISK-24889
> URL: https://issues.asterisk.org/jira/browse/ASTERISK-24889
> Project: Asterisk
> Issue Type: Bug
> Security Level: None
> Components: pjproject/pjsip
> Affects Versions: 13.2.0
> Environment: OS: Ubuntu 14.04, with all updates
> Kernel: 3.13.0-44-generic
> pjsip: 2.3 from http://www.pjsip.org/release/2.3/pjproject-2.3.tar.bz2 (./configure --prefix=/usr --enable-shared --enable-epoll; make; sudo make install)
> Asterisk: 13.2.0 from http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-13.2.0.tar.gz (./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var; make; sudo make install)
> Reporter: Anatoli
>
> When an endpoint registers via TCP, PJSIP processes everything as corresponds: the communication is via TCP, REGISTER/ACK pass OK, the endpoint can even establish calls. But, when another endpoint calls to the first one, PJSIP sends INVITE message in a new TCP session to the already opened port.
> So if the registration was performed from TCP 55880 to 5060 and everything except INVITE flows in the same TCP session, INVITE is sent via a new TCP session from a random port on asterisk server (e.g. 32926) to the already opened 55880 port. With tcpdump I see a new SYN packet (and the already established TCP session was not closed/reset yet):
> {noformat}
> From: 10.101.10.1 (asterisk IP)
> To: 10.101.100.100 (endpoint IP)
> Source port: 32926
> Destination port: 55880
> Protocol: TCP
> TCP Data: [SYN] Seq=0 Win=29200 Len=0 MSS=1460 SACK_PERM=1 TSval=9227246 TSecr=0 WS=128
> {noformat}
> Naturally, the endpoint responds with a RST,ACK.
> The CLI shows the following:
> {noformat}
> ERROR[19352]: pjsip:0 <?>: tcpc0x7fcdb404 TCP connect() error: Connection refused [code=120111]
> WARNING[19352]: pjsip:0 <?>: tsx0x7fcdb402e Failed to send Request msg INVITE/cseq=31054 (tdta0x7fcdb4034260)! err=120111 (Connection refused)
> {noformat}
> Investigating the code, I've found that to send the INVITE message PJSIP calls pjsip_endpt_send_request_stateless, which, as the name indicates, behaves statelessly, though using TCP.
> Call trace:
> {noformat}
> sip_dialog.c at 1164 pjsip_dlg_send_request(INVITE) => @1214 call to pjsip_tsx_create_uac
> sip_transaction.c at 1266 pjsip_tsx_create_uac => call to pjsip_tsx_create_uac2
> sip_transaction.c at 1273 pjsip_tsx_create_uac2 => @1367 tsx_on_state_null callback assignment
> sip_transaction.c at 2311 tsx_on_state_null => @2351 call to tsx_send_msg
> sip_transaction.c at 2006 tsx_send_msg => @2120 call to pjsip_endpt_send_request_stateless
> {noformat}
> Asterisk 13.2.0, PJSIP 2.3, everything compiled from sources.
> Config: same as in the examples except for one endpoint the transport=<tcp_transport> option is specified.
> Client: a number of softphones, tested with latest Linphone on iPhone, SessionChat (freeware from AppStore), Jitsi on Windows.
> Please let me know if additional information is required.
> Regards,
> Anatoli
--
This message was sent by Atlassian JIRA
(v6.2#6252)
More information about the asterisk-bugs
mailing list