Changeset 3172
- Timestamp:
- May 13, 2010 5:22:51 AM (14 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c
r3128 r3172 179 179 puts (" --use-ims Enable 3GPP/IMS related settings on this account"); 180 180 #if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0) 181 puts (" --use-srtp=N Use SRTP? 0:disabled, 1:optional, 2:mandatory (def:0)"); 181 puts (" --use-srtp=N Use SRTP? 0:disabled, 1:optional, 2:mandatory,"); 182 puts (" 3:optional by duplicating media offer (def:0)"); 182 183 puts (" --srtp-secure=N SRTP require secure SIP? 0:no, 1:tls, 1:sips (def:1)"); 183 184 #endif … … 1093 1094 case OPT_USE_SRTP: 1094 1095 app_config.cfg.use_srtp = my_atoi(pj_optarg); 1095 if (!pj_isdigit(*pj_optarg) || app_config.cfg.use_srtp > 2) {1096 if (!pj_isdigit(*pj_optarg) || app_config.cfg.use_srtp > 3) { 1096 1097 PJ_LOG(1,(THIS_FILE, "Invalid value for --use-srtp option")); 1097 1098 return -1; 1099 } 1100 if ((int)app_config.cfg.use_srtp == 3) { 1101 /* SRTP optional mode with duplicated media offer */ 1102 app_config.cfg.use_srtp = PJMEDIA_SRTP_OPTIONAL; 1103 app_config.cfg.srtp_optional_dup_offer = PJ_TRUE; 1104 cur_acc->srtp_optional_dup_offer = PJ_TRUE; 1098 1105 } 1099 1106 cur_acc->use_srtp = app_config.cfg.use_srtp; … … 1504 1511 /* SRTP */ 1505 1512 if (acc_cfg->use_srtp) { 1506 pj_ansi_sprintf(line, "--use-srtp %i\n", 1507 (int)acc_cfg->use_srtp); 1513 int use_srtp = (int)acc_cfg->use_srtp; 1514 if (use_srtp == PJMEDIA_SRTP_OPTIONAL && 1515 acc_cfg->srtp_optional_dup_offer) 1516 { 1517 use_srtp = 3; 1518 } 1519 pj_ansi_sprintf(line, "--use-srtp %i\n", use_srtp); 1520 pj_strcat2(result, line); 1521 } 1522 if (acc_cfg->srtp_secure_signaling != 1523 PJSUA_DEFAULT_SRTP_SECURE_SIGNALING) 1524 { 1525 pj_ansi_sprintf(line, "--srtp-secure %d\n", 1526 acc_cfg->srtp_secure_signaling); 1508 1527 pj_strcat2(result, line); 1509 1528 } … … 1737 1756 #if PJMEDIA_HAS_SRTP 1738 1757 if (app_config.cfg.use_srtp != PJSUA_DEFAULT_USE_SRTP) { 1739 pj_ansi_sprintf(line, "--use-srtp %d\n", 1740 app_config.cfg.use_srtp); 1758 int use_srtp = (int)app_config.cfg.use_srtp; 1759 if (use_srtp == PJMEDIA_SRTP_OPTIONAL && 1760 app_config.cfg.srtp_optional_dup_offer) 1761 { 1762 use_srtp = 3; 1763 } 1764 pj_ansi_sprintf(line, "--use-srtp %d\n", use_srtp); 1741 1765 pj_strcat2(&cfg, line); 1742 1766 } -
pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h
r3128 r3172 1084 1084 */ 1085 1085 int srtp_secure_signaling; 1086 1087 /** 1088 * Specify whether SRTP in PJMEDIA_SRTP_OPTIONAL mode should compose 1089 * duplicated media in SDP offer, i.e: unsecured and secured version. 1090 * Otherwise, the SDP media will be composed as unsecured media but 1091 * with SDP "crypto" attribute. 1092 * 1093 * Default: PJ_FALSE 1094 */ 1095 pj_bool_t srtp_optional_dup_offer; 1086 1096 #endif 1087 1097 … … 2127 2137 */ 2128 2138 int srtp_secure_signaling; 2139 2140 /** 2141 * Specify whether SRTP in PJMEDIA_SRTP_OPTIONAL mode should compose 2142 * duplicated media in SDP offer, i.e: unsecured and secured version. 2143 * Otherwise, the SDP media will be composed as unsecured media but 2144 * with SDP "crypto" attribute. 2145 * 2146 * Default: PJ_FALSE 2147 */ 2148 pj_bool_t srtp_optional_dup_offer; 2129 2149 #endif 2130 2150 -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_acc.c
r3144 r3172 752 752 acc->cfg.use_srtp = cfg->use_srtp; 753 753 acc->cfg.srtp_secure_signaling = cfg->srtp_secure_signaling; 754 acc->cfg.srtp_optional_dup_offer = cfg->srtp_optional_dup_offer; 754 755 #endif 755 756 -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c
r3138 r3172 176 176 cfg->use_srtp = pjsua_var.ua_cfg.use_srtp; 177 177 cfg->srtp_secure_signaling = pjsua_var.ua_cfg.srtp_secure_signaling; 178 cfg->srtp_optional_dup_offer = pjsua_var.ua_cfg.srtp_optional_dup_offer; 178 179 #endif 179 180 cfg->reg_retry_interval = PJSUA_REG_RETRY_INTERVAL; -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c
r3153 r3172 1369 1369 return status; 1370 1370 } 1371 1372 #if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0) 1373 /* Check if SRTP is in optional mode and configured to use duplicated 1374 * media, i.e: secured and unsecured version, in the SDP offer. 1375 */ 1376 if (!rem_sdp && 1377 pjsua_var.acc[call->acc_id].cfg.use_srtp == PJMEDIA_SRTP_OPTIONAL && 1378 pjsua_var.acc[call->acc_id].cfg.srtp_optional_dup_offer) 1379 { 1380 unsigned i; 1381 1382 for (i = 0; i < sdp->media_count; ++i) { 1383 pjmedia_sdp_media *m = sdp->media[i]; 1384 1385 /* Check if this media is unsecured but has SDP "crypto" 1386 * attribute. 1387 */ 1388 if (pj_stricmp2(&m->desc.transport, "RTP/AVP") == 0 && 1389 pjmedia_sdp_media_find_attr2(m, "crypto", NULL) != NULL) 1390 { 1391 pjmedia_sdp_media *new_m; 1392 1393 /* Duplicate this media and apply secured transport */ 1394 new_m = pjmedia_sdp_media_clone(pool, m); 1395 pj_strdup2(pool, &new_m->desc.transport, "RTP/SAVP"); 1396 1397 /* Remove the "crypto" attribute in the unsecured media */ 1398 pjmedia_sdp_media_remove_all_attr(m, "crypto"); 1399 1400 /* Insert the new media before the unsecured media */ 1401 if (sdp->media_count < PJMEDIA_MAX_SDP_MEDIA) { 1402 pj_array_insert(sdp->media, sizeof(new_m), 1403 sdp->media_count, i, &new_m); 1404 ++sdp->media_count; 1405 ++i; 1406 } 1407 } 1408 } 1409 } 1410 #endif 1371 1411 1372 1412 /* Update currently advertised RTP source address */
Note: See TracChangeset
for help on using the changeset viewer.