Changes between Version 9 and Version 10 of IPv6


Ignore:
Timestamp:
May 23, 2016 9:46:42 AM (8 years ago)
Author:
nanang
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • IPv6

    v9 v10  
    9393 
    9494 
    95 == Enabling IPv6 support in application using PJSUA == 
     95== Enabling IPv6 support in application using PJSUA == #appusingpjsua 
    9696 
    9797Application needs to configure SIP transport and SIP account with IPv6 support. 
     
    102102 
    103103 {{{ 
    104         pjsua_transport_config tp_cfg; 
    105         pjsip_transport_type_e tp_type; 
    106         pjsua_transport_id     tp_id = -1; 
     104pjsua_transport_config tp_cfg; 
     105pjsip_transport_type_e tp_type; 
     106pjsua_transport_id     tp_id = -1; 
    107107 
    108         pjsua_transport_config_default(&tp_cfg); 
    109         tp_cfg.port = 5060; 
     108pjsua_transport_config_default(&tp_cfg); 
     109tp_cfg.port = 5060; 
    110110 
    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             ... 
     111/* TCP */ 
     112tp_type = PJSIP_TRANSPORT_TCP6; 
     113status = pjsua_transport_create(tp_type, &tp_cfg, &tp_id); 
     114if (status != PJ_SUCCESS) 
     115    ... 
    116116 
    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             ... 
     117/* UDP */ 
     118tp_type = PJSIP_TRANSPORT_UDP6; 
     119status = pjsua_transport_create(tp_type, &tp_cfg, &tp_id); 
     120if (status != PJ_SUCCESS) 
     121    ... 
    122122 
    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             ... 
     123/* TLS */ 
     124tp_type = PJSIP_TRANSPORT_TLS6; 
     125tp_cfg.port = 5061; 
     126tp_cfg.tls_setting.ca_list_file = pj_str("<path to CA file>"); 
     127tp_cfg.tls_setting.cert_file    = ...; 
     128tp_cfg.tls_setting.privkey_file = ...; 
     129tp_cfg.tls_setting.password     = ...; 
     130status = pjsua_transport_create(tp_type, &tp_cfg, &tp_id); 
     131if (status != PJ_SUCCESS) 
     132    ... 
    133133 }}} 
    134134 
     
    138138Here is sample code for setting up account using IPv6 SIP server. 
    139139 
    140 {{{ 
    141         #define SIP_USER        "user" 
    142         #define SIP_SERVER      "example.com" 
    143         #define SIP_SERVER_IPv6 "[1234::5678]" 
    144         #define SIP_PASSWD      "pwd" 
     140 {{{ 
     141#define SIP_USER        "user" 
     142#define SIP_SERVER      "example.com" 
     143#define SIP_SERVER_IPv6 "[1234::5678]" 
     144#define SIP_PASSWD      "pwd" 
    145145 
    146         pjsua_acc_config acc_cfg; 
    147         pjsua_acc_config_default(&acc_cfg); 
     146pjsua_acc_config acc_cfg; 
     147pjsua_acc_config_default(&acc_cfg); 
    148148 
    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); 
     149acc_cfg.id         = pj_str("sip:" SIP_USER "@" SIP_SERVER); 
     150acc_cfg.reg_uri    = pj_str("sip:" SIP_SERVER); 
     151acc_cfg.cred_count = 1; 
     152acc_cfg.cred_info[0].realm     = pj_str("*"); 
     153acc_cfg.cred_info[0].scheme    = pj_str("digest"); 
     154acc_cfg.cred_info[0].username  = pj_str(SIP_USER); 
     155acc_cfg.cred_info[0].data_type = PJSIP_CRED_DATA_PLAIN_PASSWD; 
     156acc_cfg.cred_info[0].data      = pj_str(SIP_PASSWD); 
    157157 
    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"); 
     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) */ 
     160acc_cfg.proxy_cnt = 1; 
     161acc_cfg.proxy[0]  = pj_str("sip:" SIP_SERVER_IPv6 ";lr;hide"); 
    162162 
    163         /* Enable IPv6 in media transport */ 
    164         acc_cfg.ipv6_media_use = PJSUA_IPV6_ENABLED; 
     163/* Enable IPv6 in media transport */ 
     164acc_cfg.ipv6_media_use = PJSUA_IPV6_ENABLED; 
    165165 
    166         /* Finally */ 
    167         status = pjsua_acc_add(&acc_cfg, PJ_TRUE, NULL); 
    168         if (status != PJ_SUCCESS) 
    169             ... 
    170 }}} 
     166/* Finally */ 
     167status = pjsua_acc_add(&acc_cfg, PJ_TRUE, NULL); 
     168if (status != PJ_SUCCESS) 
     169    ... 
     170 }}}