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

Ticket #544: Fixed SRTP on hold+reinvite scenario

File:
1 edited

Legend:

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

    r2061 r2064  
    889889        pjmedia_srtp_setting_default(&srtp_opt); 
    890890        srtp_opt.close_member_tp = PJ_FALSE; 
    891         srtp_opt.use = acc->cfg.use_srtp; 
     891        /* If media session has been ever established, let's use remote's  
     892         * preference in SRTP usage policy, especially when it is stricter. 
     893         */ 
     894        if (call->rem_srtp_use > acc->cfg.use_srtp) 
     895            srtp_opt.use = call->rem_srtp_use; 
     896        else 
     897            srtp_opt.use = acc->cfg.use_srtp; 
     898 
    892899        status = pjmedia_transport_srtp_create(pjsua_var.med_endpt,  
    893900                                               call->med_tp, 
     
    11441151 
    11451152    } else { 
     1153        pjmedia_srtp_info srtp_info; 
     1154        pjmedia_transport_info tp_info; 
     1155 
    11461156        /* Start/restart media transport */ 
    11471157        status = pjmedia_transport_media_start(call->med_tp,  
     
    11521162 
    11531163        call->med_tp_st = PJSUA_MED_TP_RUNNING; 
     1164 
     1165        /* Get remote SRTP usage policy */ 
     1166        pjmedia_transport_info_init(&tp_info); 
     1167        pjmedia_transport_get_info(call->med_tp, &tp_info); 
     1168        if (tp_info.specific_info_cnt > 0) { 
     1169            int i; 
     1170            for (i = 0; i < tp_info.specific_info_cnt; ++i) { 
     1171                if (tp_info.spc_info[i].type == PJMEDIA_TRANSPORT_TYPE_SRTP)  
     1172                { 
     1173                    pjmedia_srtp_info *srtp_info =  
     1174                                (pjmedia_srtp_info*) tp_info.spc_info[i].buffer; 
     1175 
     1176                    call->rem_srtp_use = srtp_info->peer_use; 
     1177                    break; 
     1178                } 
     1179            } 
     1180        } 
    11541181 
    11551182        /* Override ptime, if this option is specified. */ 
Note: See TracChangeset for help on using the changeset viewer.