Re: NAT64 ios issue

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

 



Ashok,

What's almost certainly happening here is that the SDP returned from your server contains only IPv4 media addresses. When PJSIP goes to compare the SDP to local capabilities, it finds only IPv4 addresses for the remote endpoint, but can't find any local IPv4 interfaces. As a result, it thinks there's no way it can communicate with the remote server and fails.

I have been able to fix this with two steps:

 1) Enable ICE negotiation on both your media server and PJSIP client. ICE is helpful here because it allows the two endpoints to communicate multiple candidate media addresses. This step *may* be optional, although I've never really tested without this.
 2) Write a PJSIP module that intercepts incoming/outgoing SDPs to work around the NAT64 issue. There's an example of one of these on github, and I've written my own for my app (unfortunately can't share at this time). The general steps that need to be followed here are:

 - Intercept on_tx and on_rx PJSIP events
 - When sending an outgoing SDP, if signaling is connected over IPv6, then add an IPv4 address to the ICE candidates in the SDP (this step is optional, and depends on whether or not your server will explicitly reject an SDP that only contains IPv6 addresses)
 - When receiving an incoming SDP, if signaling is connected over IPv6, then iterate the ICE candidates in the SDP, find all IPv4 addresses, synthesize IPv6 addresses for them (by passing the IPv4 addresses to pj_getaddrinfo, iOS will return a synthesized IPv6 address if connected to a NAT64 network), and add the synthesized IPv6 addresses to the ICE candidates list

As long as this module is registered with a higher priority than the PJSIP transports module, the SDP will be rewritten before pjmedia actually parses the SDP. By the time it gets to the media stack, it will see your synthesized IPv6 addresses, which it can support, and should be able to establish a media connection.

Couple of tips here: don't underestimate the nuances of this issue. It's not necessarily a hard problem, but there are a lot of cases to consider. Once you solve the first issue, you then have the issue of what happens when the user changes networks during a call (i.e. their phone switches wifi networks, or off of wifi entirely). Additionally, if you're working on Android, you probably have this issue on Android as well, but Google as far as I know does not test apps on a NAT64 network like Apple does.

Apologies I can't be more specific at this time but I hope this points you in the right direction. I think it'd be great for PJSIP to include this in the core. NAT64 networks are likely to become more prevalent, and it would be considerably less work to simply add to the core than it would be to maintain a separate module.

Best,
Colin

On Fri, Mar 31, 2017 at 10:14 AM, Ashok Narvaneni <ashoknarvaneni7@xxxxxxxxx> wrote:
Hi,

We are trying to connect to IPV4 server from our pjsip ios app with NAT64.
We can able to register with the server successfully But when we make calls their is no audio and call disconnects.
Below is the error.

19:39:43.256  pjsua_media.c  .....Call 1: updating media..

19:39:43.256  pjsua_media.c  ......pjmedia_stream_info_from_sdp() failed for call_id 1 media 0: Unsupported address family (PJ_EAFNOTSUP)

19:39:43.257  pjsua_media.c  ......Error updating media call01:0: Unsupported address family (PJ_EAFNOTSUP)

19:39:43.257  pjsua_media.c  ......pjmedia_vid_stream_info_from_sdp() failed for call_id 1 media 1: Unsupported address family (PJ_EAFNOTSUP)

19:39:43.257  pjsua_media.c  ......Error updating media call01:1: Unsupported address family (PJ_EAFNOTSUP)

19:39:43.257   pjsua_call.c  .....Unable to create media session: No active media stream after negotiation (PJMEDIA_SDPNEG_ENOMEDIA) [status=220048]

19:39:43.257   pjsua_core.c  ........TX 389 bytes Request msg CANCEL/cseq=17639 (tdta0x1021ce200) to TCP 2001:2:0:1baa::4225:2ca6:5060:

What could be wrong? Can someone please help me on this. 

Thanks,

Ashok Narvaneni.





_______________________________________________
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