Changes between Version 7 and Version 8 of IPv6


Ignore:
Timestamp:
May 13, 2016 8:22:23 AM (8 years ago)
Author:
nanang
Comment:

Add sample codes for enabling IPv6 in app

Legend:

Unmodified
Added
Removed
Modified
  • IPv6

    v7 v8  
    11= IPv6 support = 
     2 
     3[[PageOutline(2-3,,inline)]] 
    24 
    35== Availability == 
    46 
    57IPv6 support is available in the following platforms: 
    6  - Windows XP, Windows Server 2003, and Windows Vista, using Microsoft Platform SDK for Windows Server 2003 SP1 
     8 - Windows families, e.g.: Windows 7/8/10, Windows XP, Windows Server 2003, and Windows Vista, using Microsoft Platform SDK for Windows Server 2003 SP1 
     9 - !Linux/Unix/MacOS X with GNU development systems, IPv6 features are detected by the {{{./configure}}} script. 
     10 - iOS 
    711 - Symbian 
    8  - On !Linux/Unix/MacOS X with GNU development systems, IPv6 features are detected by the {{{./configure}}} script. 
    912 
    1013Note about Windows 2000: 
     
    8891 
    8992The work for adding IPv6 support in pjnath is documented by ticket #422. 
     93 
     94 
     95== Enabling IPv6 support in application using PJSUA == 
     96 
     97Application needs to configure SIP transport and SIP account with IPv6 support. 
     98 
     99=== Creating SIP transport === 
     100 
     101Here is sample code for IPv6 SIP transport initializations. 
     102 
     103 {{{ 
     104        pjsua_transport_config tp_cfg; 
     105        pjsip_transport_type_e tp_type; 
     106        pjsua_transport_id     tp_id = -1; 
     107 
     108        pjsua_transport_config_default(&tp_cfg); 
     109        tp_cfg.port = 5060; 
     110 
     111        /* TCP */ 
     112        tp_type = PJSIP_TRANSPORT_TCP6; 
     113        status = pjsua_transport_create(tp_type, &tp_cfg, &tp_id); 
     114        if (status != PJ_SUCCESS) 
     115            ... 
     116 
     117        /* UDP */ 
     118        tp_type = PJSIP_TRANSPORT_UDP6; 
     119        status = pjsua_transport_create(tp_type, &tp_cfg, &tp_id); 
     120        if (status != PJ_SUCCESS) 
     121            ... 
     122 
     123        /* TLS */ 
     124        tp_type = PJSIP_TRANSPORT_TLS6; 
     125        tp_cfg.port = 5061; 
     126        tp_cfg.tls_setting.ca_list_file = pj_str("<path to CA file>"); 
     127        tp_cfg.tls_setting.cert_file    = ...; 
     128        tp_cfg.tls_setting.privkey_file = ...; 
     129        tp_cfg.tls_setting.password     = ...; 
     130        status = pjsua_transport_create(tp_type, &tp_cfg, &tp_id); 
     131        if (status != PJ_SUCCESS) 
     132            ... 
     133 }}} 
     134 
     135 
     136=== Adding SIP Account === 
     137 
     138Here is sample code for setting up account using IPv6 SIP server. 
     139 
     140{{{ 
     141        #define SIP_USER        "user" 
     142        #define SIP_SERVER      "example.com" 
     143        #define SIP_SERVER_IPv6 "1234::5678" 
     144        #define SIP_PASSWD      "pwd" 
     145 
     146        pjsua_acc_config acc_cfg; 
     147        pjsua_acc_config_default(&acc_cfg); 
     148 
     149        acc_cfg.id         = pj_str("sip:" SIP_USER "@" SIP_SERVER); 
     150        acc_cfg.reg_uri    = pj_str("sip:" SIP_SERVER); 
     151        acc_cfg.cred_count = 1; 
     152        acc_cfg.cred_info[0].realm     = pj_str("*"); 
     153        acc_cfg.cred_info[0].scheme    = pj_str("digest"); 
     154        acc_cfg.cred_info[0].username  = pj_str(SIP_USER); 
     155        acc_cfg.cred_info[0].data_type = PJSIP_CRED_DATA_PLAIN_PASSWD; 
     156        acc_cfg.cred_info[0].data      = pj_str(SIP_PASSWD); 
     157 
     158        /* As currently IPv6 DNS resolution is not supported yet, application should resolve it manually, e.g: using getaddrinfo(), and set the IPv6 address via proxy setting */ 
     159        /* Note that application may add 'hide' param to hide the proxy setting from the message (this is PJSIP proprietary feature) */ 
     160        acc_cfg.proxy_cnt = 1; 
     161        acc_cfg.proxy[0]  = pj_str("sip:" SIP_SERVER_IPv6 ";lr;hide"); 
     162 
     163        /* Enable IPv6 in media transport */ 
     164        acc_cfg.ipv6_media_use = PJSUA_IPV6_ENABLED; 
     165 
     166        /* Finally */ 
     167        status = pjsua_acc_add(&acc_cfg, PJ_TRUE, NULL); 
     168        if (status != PJ_SUCCESS) 
     169            ... 
     170}}}