Ignore:
Timestamp:
Jun 3, 2017 9:22:34 AM (7 years ago)
Author:
nanang
Message:

Re #2018: Initial version of DTLS-SRTP implementation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c

    r5587 r5597  
    12751275        const pjmedia_sdp_media *m = sdp->media[i]; 
    12761276        const pjmedia_sdp_conn *c; 
     1277        static const pj_str_t ID_RTP_SAVP = { "RTP/SAVP", 8 }; 
    12771278 
    12781279        /* Skip different media */ 
     
    12851286 
    12861287        /* Supported transports */ 
    1287         if (pj_stricmp2(&m->desc.transport, "RTP/SAVP")==0) { 
     1288        if (pj_stristr(&m->desc.transport, &ID_RTP_SAVP)) { 
    12881289            switch (use_srtp) { 
    12891290            case PJMEDIA_SRTP_MANDATORY: 
     
    14941495} 
    14951496 
     1497 
     1498/* This callback is called when SRTP negotiation completes */ 
     1499static void on_srtp_nego_complete(pjmedia_transport *tp,  
     1500                                  pj_status_t result) 
     1501{ 
     1502    pjsua_call_media *call_med = (pjsua_call_media*)tp->user_data; 
     1503    pjsua_call *call; 
     1504 
     1505    if (!call_med) 
     1506        return; 
     1507 
     1508    call = call_med->call; 
     1509    PJ_PERROR(4,(THIS_FILE, result, 
     1510                 "Call %d: Media %d: SRTP negotiation completes", 
     1511                 call->index, call_med->idx)); 
     1512 
     1513    if (result != PJ_SUCCESS) { 
     1514        call_med->state = PJSUA_CALL_MEDIA_ERROR; 
     1515        call_med->dir = PJMEDIA_DIR_NONE; 
     1516        if (call && pjsua_var.ua_cfg.cb.on_call_media_state) { 
     1517            /* Defer the callback to a timer */ 
     1518            pjsua_schedule_timer2(&ice_failed_nego_cb, 
     1519                                  (void*)(pj_ssize_t)call->index, 1); 
     1520        } 
     1521    } 
     1522} 
     1523 
     1524 
    14961525/* Callback to resume pjsua_call_media_init() after media transport 
    14971526 * creation is completed. 
     
    15471576        pjmedia_srtp_setting_default(&srtp_opt); 
    15481577        srtp_opt.close_member_tp = PJ_TRUE; 
     1578        srtp_opt.cb.on_srtp_nego_complete = &on_srtp_nego_complete; 
     1579        srtp_opt.user_data = call_med; 
    15491580 
    15501581        /* If media session has been ever established, let's use remote's  
Note: See TracChangeset for help on using the changeset viewer.