TCP transport With Public IP address Server

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Every one:
	Greetings, I am a developer working on pjsip with iPhone, i got a problem with it when I use the tcp transport, and I find the a 
similar problem in mail list:
	http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/2011-October/013597.html

	first of all, I use pjsip 2.1.0, iPhone 5.1.1 , freeswitch 1.4

	as we know, in order to implement the background mode in iPhone, we should use tcp transport to wake up our app when the data arrived. In fact, use tcp transport to got the sip Invite request when app is in background mode was implemented, but it only works with LAN network, when I got a public IP address to do the same thing, the pjsip couldn?t register at all.

	this is what I found:

	when we use pjsua_transport_create(PJSIP_TRANSPORT_TCP, &config.tcp_cfg, &transport_id); to create a tcp transport, the console log will come out a line like this:

Sip TCP listener ready for incoming connection at 10.253.23.204:51220

	that means I got a tcp socket to listen the connection. then I found I use the ?;transport=TCP? to register, I got the following log:

1 09:55:22.945 pjsua_acc.c Adding account: id="1001"<sip:1001 at 10.253.23.204;transport=TCP>
2 09:55:22.946 pjsua_acc.c .Account "1001"<sip:1001 at 10.253.23.204;transport=TCP> added with id 0
3 09:55:22.946 pjsua_acc.c .Acc 0: setting registration..
4 09:55:22.946 pjsua_acc.c ..Contact for acc 0 updated for SIP outbound: "1001? 
5 <sip:1001 at 192.168.1.102:51220;transport=TCP;ob>;reg-id=1;+sip.instance="<urn:uuid:00000000-0000-0000-0000-000018a8877b>"
6 09:55:22.946 endpoint ..Request msg REGISTER/cseq=47860 (tdta0x1be9c00) created.
7 09:55:22.947 tsx0x1beac64 ...Transaction created for Request msg REGISTER/cseq=47861 (tdta0x1be9c00)
8 09:55:22.947 tsx0x1beac64 ..Sending Request msg REGISTER/cseq=47861 (tdta0x1be9c00) in state Null
9 09:55:22.947 sip_resolve.c ...Target '10.253.23.204:0' type=TCP resolved to '10.253.23.204:5060' type=TCP (TCP transport)
created
10 09:55:22.948 tcpc0x1beb414 ...TCP transport 192.168.1.102:51221 is connecting to 10.253.23.204:5060...
11 09:55:22.948 pjsua_core.c ...TX 688 bytes Request msg REGISTER/cseq=47861 (tdta0x1be9c00) to TCP 10.253.23.204:5060:
	
	from line 10, I found it is not the port 51220 got connection, but the port51221. so it means there are two tcp socket connection has been created when use pjsip on tcp.

	then I use wireshark to sniffing tcp packet, pjsip and freeswitch have a strange tcp communication method, I hope to make it clear with a simple use case to describe it, the tcp socket establishment like this:
	
	first, client establishes a tcp listener to server;
	
			==>listener
	(10.253.23.204:51220)			(10.253.23.10:5060)			
	client						server

	second, client establishes a tcp connection to server, for example ipaddress and port like this:

				
			==>listener
	(10.253.23.204:51220)			(10.253.23.10:5060)	
	client 						server
	(10.253.23.204:51221)			(10.253.23.10:5060)	
			================>
			tcp connection 1

	third, the time is before anyone calling, there will be another tcp socket connection established but is from server to client

			tcp connection 2
			==>listener <=======
	(10.253.23.204:51220)			(10.253.23.10:5060)
	client 						server
	(10.253.23.204:51221)			(10.253.23.10:5060)	
			================>
			tcp connection 1

	in fact, the tcp connection 1 is the tcp transport we created in the pjsip_init() method by the pjsua api ?pjsua_transport_create()? . this all work fine under LAN nework because of server can get connection with the client. but when I register my app to my server on public ip address, register timeout. I think it is because th tcp connection 2 is impossible when server address is public, it can not got the connection right establishment.

	I want to know how to let the server or client to reuse the tcp connection 1, which is from client connecting to server. did any one implement the tcp transport with public ip address server? 
	looking forward anyone?s rely! thanks a lot!!!

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20131114/7c2a1a19/attachment-0001.html>


[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux