Re: iOS Error: "Address already in use"

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

 



Thanks Colin, I tried to enable both PJSIP_TCP_TRANSPORT_DONT_CREATE_LISTENER and PJSIP_TLS_TRANSPORT_DONT_CREATE_LISTENER and recompiled the framework. However, this did not fix my problem, the error message still occurs when trying to reconnect to the system:

pjsua_core.c !Error creating SIP TCP listener: Address already in use [status=120048]

Is there anything else that could help fixing this problem?

Best,
Frederik


Am 10.04.2017 um 16:32 schrieb Colin Morelli <colin.morelli@xxxxxxxxx>:

You're probably tearing down more of the stack than you need to during an IP address change. However, even still, you should probably re-compile PJSIP with PJSIP_TCP_TRANSPORT_DONT_CREATE_LISTENER (and the same for TLS if you use TLS) when running on iOS.

The default behavior of PJSIP is to bind to port 5060 to receive incoming signaling messages. Chances are there's either a race condition or something wrong with your teardown process that keeps a hold on that ephemeral port during your IP change.

However, when running on iOS, this is largely pointless anyway. It's incredibly unlikely that an iOS device will be connected without a NAT/firewall in front of it that would block incoming connections anyway. Having something listen on port 5060 is not going to accomplish much. Instead, what you generally want to do, is use RFC 5626 for your PJSIP account. This way, your client registers with a random local ephemeral port with your SIP server. Once registration is successful, it keeps the connection open to your SIP proxy. Your proxy should then use the already-established connection to deliver incoming calls and signaling messages for active calls.

Ideally, though, you should move away from registrations for iOS devices entirely. Apple has already deprecated parking background TCP connections when the app is inactive, and prefers that you use VoIP push notifications to deliver incoming calls.

Hopefully this is helpful.

Best,
Colin

On Mon, Apr 10, 2017 at 10:22 AM, Frederik Riedel <frederik.riedel@xxxxxxxx> wrote:
Hello,

I am using PJSIP for iOS to connect to a hardware SIP interface.
Sometimes it is necessary to terminate a SIP connection and reconnect (for instance, WiFi switched, IP address changed).
The initial connection always works without any problem. However, when I terminate the connection and try to re-establish, I always receive the following error message:
pjsua_core.c !Error creating SIP TCP listener: Address already in use [status=120048]
When I force-quit the app and restart it I can reconnect without any problem. On the iOS Simulator everything works as expected even without restarting the app.

Do you have any idea what I could try to fix this problem?

Best regards,
Frederik

_______________________________________________
Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@xxxxxxxxxxxxxxx
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org


_______________________________________________
Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@xxxxxxxxxxxxxxx
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

_______________________________________________
Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@xxxxxxxxxxxxxxx
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

[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