Ignore:
Timestamp:
Jun 26, 2008 7:12:09 PM (16 years ago)
Author:
nanang
Message:

Ticket #544: Fixed SRTP on hold+reinvite scenario

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/src/pjmedia/transport_srtp.c

    r2039 r2064  
    112112    pjmedia_transport   *member_tp; /**< Underlying transport.       */ 
    113113 
    114     /* When in SRTP optional mode, instead of always offering RTP/AVP, 
    115      * we should create offer based on remote preference. At the first time, 
    116      * remote preference is unknown, it is known after media_start() called. 
    117      * So next time the same session need to create an offer, it will create 
    118      * SDP with transport type based on remote preference. 
     114    /* SRTP usage policy of peer. This field is updated when media is starting. 
     115     * This is useful when SRTP is in optional mode and peer is using mandatory 
     116     * mode, so when local is about to reinvite/update, it should offer  
     117     * RTP/SAVP instead of offering RTP/AVP. 
    119118     */ 
    120     pj_bool_t            remote_prefer_rtp_savp; 
     119    pjmedia_srtp_use     peer_use; 
    121120 
    122121} transport_srtp; 
     
    349348    srtp->session_inited = PJ_FALSE; 
    350349    srtp->bypass_srtp = PJ_FALSE; 
    351     srtp->remote_prefer_rtp_savp = PJ_FALSE; 
     350    srtp->peer_use = opt->use; 
    352351 
    353352    if (opt) { 
     
    587586    srtp_info.rx_policy = srtp->rx_policy; 
    588587    srtp_info.tx_policy = srtp->tx_policy; 
     588    srtp_info.use = srtp->setting.use; 
     589    srtp_info.peer_use = srtp->peer_use; 
    589590 
    590591    spc_info_idx = info->specific_info_cnt++; 
     
    10771078                goto BYPASS_SRTP; 
    10781079            case PJMEDIA_SRTP_OPTIONAL: 
    1079                 m_loc->desc.transport = srtp->remote_prefer_rtp_savp? 
    1080                                         ID_RTP_SAVP : ID_RTP_AVP; 
     1080                m_loc->desc.transport =  
     1081                                (srtp->peer_use == PJMEDIA_SRTP_MANDATORY)? 
     1082                                ID_RTP_SAVP : ID_RTP_AVP; 
    10811083                break; 
    10821084            case PJMEDIA_SRTP_MANDATORY: 
     
    12841286    m_loc = sdp_local->media[media_index]; 
    12851287 
    1286     srtp->remote_prefer_rtp_savp = (pj_stricmp(&m_rem->desc.transport,  
    1287                                    &ID_RTP_SAVP) == 0); 
     1288    if (pj_stricmp(&m_rem->desc.transport, &ID_RTP_SAVP) == 0) 
     1289        srtp->peer_use = PJMEDIA_SRTP_MANDATORY; 
     1290    else 
     1291        srtp->peer_use = PJMEDIA_SRTP_OPTIONAL; 
    12881292 
    12891293    /* For answerer side, this function will just have to start SRTP */ 
     
    13831387BYPASS_SRTP: 
    13841388    srtp->bypass_srtp = PJ_TRUE; 
     1389    srtp->peer_use = PJMEDIA_SRTP_DISABLED; 
    13851390 
    13861391PROPAGATE_MEDIA_START: 
Note: See TracChangeset for help on using the changeset viewer.