mobdim / siphon

Automatically exported from code.google.com/p/siphon
0 stars 1 forks source link

Siphon takes forever to connect local WiFi (without internet connectivity) #382

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

Prerequisite:

Run PAXB on local desktop i.e pbxnsip for mac
Connect Wireless router to desktop via LAN cable
Camp iPhone to wireless router.

So we have a local wireless connection going but no internet connectivity.

1. Startup Siphon using Build and Run in Xcode (so this way the iPhone
never sleeps and kills Siphon). 
2. Siphon reports "Service Unavailable" and GUI is frozen. No REGISTER is
sent out.
3. After 5mins eventually a REGISTER message is sent out. Siphon connects
to PABX and changes state to "Connected" and GUI is working ok.

What is the expected output? What do you see instead?
I expect Siphon to connect immediately without having to wait 5mins

What version of the product are you using? On what operating system?
MacBook Snow Leopard
iPhone 3.1.3. 
PJSIP 1.5.5 revision 3119
Siphon revision 624

Please provide any additional information below.
Using Wireshark you can see that no attempt was made to send out the
REGISTER command until about 5 minutes later which then made a successful
connection.

Original issue reported on code.google.com by rukshan...@gmail.com on 25 Mar 2010 at 4:35

GoogleCodeExporter commented 9 years ago
You dont need a PABX on the desktop to test this. If your monitoring with 
WireShark
you would expect a REGISTER command sent immediately on Siphon startup however 
it
takes 5minutes to send this out under this WiFi scenario.

Original comment by rukshan...@gmail.com on 25 Mar 2010 at 4:41

GoogleCodeExporter commented 9 years ago
More info.

Turns out that the 5mins or so is spent on the function 

 rc = getaddrinfo(nodecopy, NULL, &hint, &res);

which is in pj_getaddrinfo() in Addr_resolv_sock.c

Any idea why this function take a long time on the iphone to execute when there 
is no internet connectivity
on the local WiFi?

Original comment by rukshan...@gmail.com on 25 Mar 2010 at 8:39

GoogleCodeExporter commented 9 years ago
How important is the call to pj_gethostip() in init_random_seed() in 
pjsua_core.c ?

It seems that if i comment out these lines, it resolves the issue below:

    /* Add primary IP address */
   // if (pj_gethostip(pj_AF_INET(), &addr)==PJ_SUCCESS)
    //seed = pj_hash_calc(seed, &addr.ipv4.sin_addr, 4);

Original comment by rukshan...@gmail.com on 25 Mar 2010 at 8:55

GoogleCodeExporter commented 9 years ago
I have confirmed commenting those lines out fixes this issue. Also the call to 
pj_gethostip() in 
init_random_seed() seems unimportant. 

Samuel, what do you think?

Original comment by rukshan...@gmail.com on 25 Mar 2010 at 8:57

GoogleCodeExporter commented 9 years ago
Actually the fix above is invalid. The correct fix is:

In sock_common.c in pj_gethostip()

look for:

status = pj_getaddrinfo(af, pj_gethostname(), &count, &ai);

and modify to:

status = PJ_ERESOLVE; //pj_getaddrinfo(af, pj_gethostname(), &count, &ai);

That will fix this issue.

Original comment by rukshan...@gmail.com on 26 Mar 2010 at 1:18

GoogleCodeExporter commented 9 years ago
Would love to know how I can get a version with this fix in it! It takes 
forever to
connect to my phone system using siphon!!!

Original comment by abuthema...@gmail.com on 6 Apr 2010 at 3:45