Code Monkey home page Code Monkey logo

pj-nat64's Introduction

pj-nat64

Helpers for NAT64 handling pending official solutions from pjsip

Apple requires NAT64 support for AppStore approval starting June. Pjsip has IPv6 support since many years but currently for NAT64 some things are not working.

The code in this repo should be seen as a temporary solution, there are more then one way to solve this problem but at least this approach does not require backend changes.

For the hostname resolution/synthezising to work you will need at least rev 5319 fixing these issues: http://trac.pjsip.org/repos/ticket/1925

http://trac.pjsip.org/repos/ticket/1917#comment:1

For the SIP transport functionality pjsip version 2.5.5 has pretty good support for most things but as of August 2016, the media rewriting is not managed so you might have to implement something like this module.

Activation

The pj_nat64 in this repo is implemented as a pjsip module meaning no code patching is necessary. There are many ways you can activate it and in the end it comes down to how your project is setup, weather you use bindings to another language or pjsua2 as well as how you manage connectivity changes. The example below is what I use and it is based on a C layer on top of pjsua, you might have to adapt to your specific situation.

  1. Register the module when starting up pjsip, normally after pjsua_start has returned with PJ_SUCCESS.
#if defined(PJ_HAS_IPV6) && PJ_HAS_IPV6 == 1
    pj_nat64_enable_rewrite_module();
#endif
  1. Once registration completes, you can check the transport type in the on_reg_state callback from pjsip and selectivly choose to activate nat64 rewriting and ipv6 media. Something like:
pjsip_transport* active_transport;
if (active_transport->factory->type & PJSIP_TRANSPORT_IPV6) {
  PJ_LOG(2,(THIS_FILE, "New transport is ipv6, activate ipv6 media"));
  pjsua_var.acc[your_active_account].cfg.ipv6_media_use = PJSUA_IPV6_ENABLED;
  if (your_config.nat_64_bitmap) {
    PJ_LOG(4,(THIS_FILE, "Activating NAT64 rewriting with value=%d", your_config.nat_64_bitmap));
    pj_nat64_set_options(your_config.nat_64_bitmap);
  }
}

You can not register the nat64 module from inside the registration callback since at that time the PJSUA_MUTEX is held by the stack and you will end up with a deadlock.

pj-nat64's People

Contributors

johanlantz avatar

Watchers

autm avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.