Changeset 2064
- Timestamp:
- Jun 26, 2008 7:12:09 PM (16 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/include/pjmedia/config.h
r2048 r2064 610 610 */ 611 611 #ifndef PJMEDIA_TRANSPORT_SPECIFIC_INFO_MAXSIZE 612 # define PJMEDIA_TRANSPORT_SPECIFIC_INFO_MAXSIZE (1 2*sizeof(long))612 # define PJMEDIA_TRANSPORT_SPECIFIC_INFO_MAXSIZE (16*sizeof(long)) 613 613 #endif 614 614 -
pjproject/trunk/pjmedia/include/pjmedia/transport_srtp.h
r2039 r2064 139 139 * Specify the usage policy. Default is PJMEDIA_SRTP_OPTIONAL. 140 140 */ 141 pjmedia_srtp_use 141 pjmedia_srtp_use use; 142 142 143 143 /** … … 180 180 */ 181 181 pjmedia_srtp_crypto tx_policy; 182 183 /** 184 * Specify the usage policy. 185 */ 186 pjmedia_srtp_use use; 187 188 /** 189 * Specify the peer's usage policy. 190 */ 191 pjmedia_srtp_use peer_use; 182 192 183 193 } pjmedia_srtp_info; -
pjproject/trunk/pjmedia/src/pjmedia/transport_srtp.c
r2039 r2064 112 112 pjmedia_transport *member_tp; /**< Underlying transport. */ 113 113 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. 119 118 */ 120 pj _bool_t remote_prefer_rtp_savp;119 pjmedia_srtp_use peer_use; 121 120 122 121 } transport_srtp; … … 349 348 srtp->session_inited = PJ_FALSE; 350 349 srtp->bypass_srtp = PJ_FALSE; 351 srtp-> remote_prefer_rtp_savp = PJ_FALSE;350 srtp->peer_use = opt->use; 352 351 353 352 if (opt) { … … 587 586 srtp_info.rx_policy = srtp->rx_policy; 588 587 srtp_info.tx_policy = srtp->tx_policy; 588 srtp_info.use = srtp->setting.use; 589 srtp_info.peer_use = srtp->peer_use; 589 590 590 591 spc_info_idx = info->specific_info_cnt++; … … 1077 1078 goto BYPASS_SRTP; 1078 1079 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; 1081 1083 break; 1082 1084 case PJMEDIA_SRTP_MANDATORY: … … 1284 1286 m_loc = sdp_local->media[media_index]; 1285 1287 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; 1288 1292 1289 1293 /* For answerer side, this function will just have to start SRTP */ … … 1383 1387 BYPASS_SRTP: 1384 1388 srtp->bypass_srtp = PJ_TRUE; 1389 srtp->peer_use = PJMEDIA_SRTP_DISABLED; 1385 1390 1386 1391 PROPAGATE_MEDIA_START: -
pjproject/trunk/pjsip/include/pjsua-lib/pjsua_internal.h
r2039 r2064 75 75 pj_timer_entry hangup_tm; /**< Timer to hangup call. */ 76 76 pj_stun_nat_type rem_nat_type; /**< NAT type of remote endpoint. */ 77 pjmedia_srtp_use rem_srtp_use; /**< Remote's SRTP usage policy. */ 77 78 78 79 char last_text_buf_[128]; /**< Buffer for last_text. */ -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c
r2060 r2064 116 116 call->res_time.msec = 0; 117 117 call->rem_nat_type = PJ_STUN_NAT_TYPE_UNKNOWN; 118 call->rem_srtp_use = PJMEDIA_SRTP_DISABLED; 118 119 } 119 120 -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c
r2061 r2064 889 889 pjmedia_srtp_setting_default(&srtp_opt); 890 890 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 892 899 status = pjmedia_transport_srtp_create(pjsua_var.med_endpt, 893 900 call->med_tp, … … 1144 1151 1145 1152 } else { 1153 pjmedia_srtp_info srtp_info; 1154 pjmedia_transport_info tp_info; 1155 1146 1156 /* Start/restart media transport */ 1147 1157 status = pjmedia_transport_media_start(call->med_tp, … … 1152 1162 1153 1163 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 } 1154 1181 1155 1182 /* Override ptime, if this option is specified. */
Note: See TracChangeset
for help on using the changeset viewer.