Changeset 5131


Ignore:
Timestamp:
Jul 13, 2015 7:56:19 AM (9 years ago)
Author:
ming
Message:

Fixed #1867: Add pjsua callback to notify when STUN resolution completes

Location:
pjproject/trunk/pjsip
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h

    r5125 r5131  
    284284typedef struct pjsua_msg_data pjsua_msg_data; 
    285285 
     286/** Forward declaration for pj_stun_resolve_result */ 
     287typedef struct pj_stun_resolve_result pj_stun_resolve_result; 
     288 
    286289 
    287290/** 
     
    558561(*pjsua_med_tp_state_cb)(pjsua_call_id call_id, 
    559562                         const pjsua_med_tp_state_info *info); 
     563 
     564 
     565/** 
     566 * Typedef of callback to be registered to #pjsua_resolve_stun_servers() 
     567 * and to be called when STUN resolution completes. 
     568 */ 
     569typedef void (*pj_stun_resolve_cb)(const pj_stun_resolve_result *result); 
    560570 
    561571 
     
    13521362                                     pjsua_acc_id* acc_id); 
    13531363 
     1364    /** 
     1365     * Calling #pjsua_init() will initiate an async process to resolve and 
     1366     * contact each of the STUN server entries to find which is usable. 
     1367     * This callback is called when the process is complete, and can be 
     1368     * used by the application to start creating and registering accounts. 
     1369     * This way, the accounts can avoid call setup delay caused by pending 
     1370     * STUN resolution. 
     1371     * 
     1372     * See also #pj_stun_resolve_cb. 
     1373     */ 
     1374    pj_stun_resolve_cb on_stun_resolution_complete; 
     1375 
    13541376} pjsua_callback; 
    13551377 
     
    19701992 * This structure will be passed in #pj_stun_resolve_cb callback. 
    19711993 */ 
    1972 typedef struct pj_stun_resolve_result 
     1994struct pj_stun_resolve_result 
    19731995{ 
    19741996    /** 
     
    19972019    pj_sockaddr      addr; 
    19982020 
    1999 } pj_stun_resolve_result; 
    2000  
    2001  
    2002 /** 
    2003  * Typedef of callback to be registered to #pjsua_resolve_stun_servers(). 
    2004  */ 
    2005 typedef void (*pj_stun_resolve_cb)(const pj_stun_resolve_result *result); 
     2021}; 
     2022 
    20062023 
    20072024/** 
  • pjproject/trunk/pjsip/include/pjsua2/endpoint.hpp

    r5123 r5131  
    11821182    /** 
    11831183     * Callback when the Endpoint has finished performing STUN server 
    1184      * checking that is initiated with natCheckStunServers(). 
     1184     * checking that is initiated when calling libInit(), or by 
     1185     * calling natCheckStunServers(). 
    11851186     * 
    11861187     * @param prm       Callback parameters. 
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c

    r5127 r5131  
    14721472        } 
    14731473    } 
     1474     
     1475    if (pjsua_var.ua_cfg.cb.on_stun_resolution_complete) 
     1476        (*pjsua_var.ua_cfg.cb.on_stun_resolution_complete)(result); 
    14741477} 
    14751478 
  • pjproject/trunk/pjsip/src/pjsua2/endpoint.cpp

    r5123 r5131  
    12781278    ua_cfg.cb.on_call_media_event       = &Endpoint::on_call_media_event; 
    12791279    ua_cfg.cb.on_create_media_transport = &Endpoint::on_create_media_transport; 
     1280    ua_cfg.cb.on_stun_resolution_complete =  
     1281        &Endpoint::stun_resolve_cb; 
    12801282 
    12811283    /* Init! */ 
Note: See TracChangeset for help on using the changeset viewer.