Ignore:
Timestamp:
Oct 16, 2007 1:34:14 AM (17 years ago)
Author:
bennylp
Message:

More ticket #399: added callback to report NAT detection result, and sends NAT type in SDP

File:
1 edited

Legend:

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

    r1495 r1501  
    566566     * Notify application when media state in the call has changed. 
    567567     * Normal application would need to implement this callback, e.g. 
    568      * to connect the call's media to sound device. 
     568     * to connect the call's media to sound device. When ICE is used, 
     569     * this callback will also be called to report ICE negotiation 
     570     * failure. 
    569571     * 
    570572     * @param call_id   The call index. 
     
    892894                      pj_bool_t is_typing); 
    893895 
     896    /** 
     897     * Callback when the library has finished performing NAT type 
     898     * detection. 
     899     * 
     900     * @param res           NAT detection result. 
     901     */ 
     902    void (*on_nat_detect)(const pj_stun_nat_detect_result *res); 
     903 
    894904} pjsua_callback; 
    895905 
     
    978988     */ 
    979989    pj_str_t        stun_relay_host; 
     990 
     991    /** 
     992     * Include local endpoint's NAT type in the SDP to assist troubleshooting. 
     993     * The valid values are: 
     994     *  - 0: no information will be added in SDP. 
     995     *  - 1: only the NAT type number is added. 
     996     *  - 2: add both NAT type number and name. 
     997     * 
     998     * Default: 2 
     999     */ 
     1000    int             nat_type_in_sdp; 
    9801001 
    9811002    /** 
     
    13161337 * This is a utility function to detect NAT type in front of this 
    13171338 * endpoint. Once invoked successfully, this function will complete  
    1318  * asynchronously and report the result in the callback. 
    1319  * 
    1320  * @param srv_port      Optional STUN server and port, in "SERVER[:PORT]" 
    1321  *                      format. If this option is NULL, the function will use 
    1322  *                      the STUN server that has been set in the pjsua 
    1323  *                      configuration. 
    1324  * @param user_data     User data to be returned back in the callback. 
    1325  * @param cb            Optional callback to report the detection result. 
    1326  * 
    1327  * @return              PJ_SUCCESS if detection is started successfully. 
    1328  */ 
    1329 PJ_DECL(pj_status_t) pjsua_detect_nat_type(void *user_data, 
    1330                                            pj_stun_nat_detect_cb *cb); 
     1339 * asynchronously and report the result in \a on_nat_detect() callback 
     1340 * of pjsua_callback. 
     1341 * 
     1342 * After NAT has been detected and the callback is called, application can 
     1343 * get the detected NAT type by calling #pjsua_get_nat_type(). Application 
     1344 * can also perform NAT detection by calling #pjsua_detect_nat_type() 
     1345 * again at later time. 
     1346 * 
     1347 * Note that STUN must be enabled to run this function successfully. 
     1348 * 
     1349 * @return              PJ_SUCCESS on success, or the appropriate error code. 
     1350 */ 
     1351PJ_DECL(pj_status_t) pjsua_detect_nat_type(void); 
     1352 
     1353 
     1354/** 
     1355 * Get the NAT type as detected by #pjsua_detect_nat_type() function. 
     1356 * This function will only return useful NAT type after #pjsua_detect_nat_type() 
     1357 * has completed successfully and \a on_nat_detect() callback has been called. 
     1358 * 
     1359 * @param type          NAT type. 
     1360 * 
     1361 * @return              When detection is in progress, this function will  
     1362 *                      return PJ_EPENDING and \a type will be set to  
     1363 *                      PJ_STUN_NAT_TYPE_UNKNOWN. After NAT type has been 
     1364 *                      detected successfully, this function will return 
     1365 *                      PJ_SUCCESS and \a type will be set to the correct 
     1366 *                      value. Other return values indicate error and 
     1367 *                      \a type will be set to PJ_STUN_NAT_TYPE_ERR_UNKNOWN. 
     1368 */ 
     1369PJ_DECL(pj_status_t) pjsua_get_nat_type(pj_stun_nat_type *type); 
    13311370 
    13321371 
Note: See TracChangeset for help on using the changeset viewer.