Changeset 1098 for pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c
- Timestamp:
- Mar 23, 2007 4:34:20 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c
r1044 r1098 145 145 puts (" --outbound=url Set the URL of global outbound proxy server"); 146 146 puts (" May be specified multiple times"); 147 puts (" --use-stun1=FORMAT where FORMAT=host[:port]"); 148 puts (" --use-stun2=FORMAT Resolve local IP with the specified STUN servers"); 147 puts (" --stun-srv=name Set STUN server host or domain"); 149 148 puts (""); 150 149 puts ("TLS Options:"); … … 160 159 puts (""); 161 160 puts ("Media Options:"); 161 puts (" --use-ice Enable ICE (default:no)"); 162 162 puts (" --add-codec=name Manually add codec (default is to enable all)"); 163 163 puts (" --clock-rate=N Override sound device clock rate"); … … 326 326 OPT_REGISTRAR, OPT_REG_TIMEOUT, OPT_PUBLISH, OPT_ID, OPT_CONTACT, 327 327 OPT_REALM, OPT_USERNAME, OPT_PASSWORD, 328 OPT_NAMESERVER, OPT_ USE_STUN1, OPT_USE_STUN2,328 OPT_NAMESERVER, OPT_STUN_SRV, 329 329 OPT_ADD_BUDDY, OPT_OFFER_X_MS_MSG, OPT_NO_PRESENCE, 330 330 OPT_AUTO_ANSWER, OPT_AUTO_HANGUP, OPT_AUTO_PLAY, OPT_AUTO_LOOP, 331 OPT_AUTO_CONF, OPT_CLOCK_RATE, 331 OPT_AUTO_CONF, OPT_CLOCK_RATE, OPT_USE_ICE, 332 332 OPT_PLAY_FILE, OPT_PLAY_TONE, OPT_RTP_PORT, OPT_ADD_CODEC, 333 333 OPT_ILBC_MODE, OPT_REC_FILE, OPT_AUTO_REC, … … 367 367 { "password", 1, 0, OPT_PASSWORD}, 368 368 { "nameserver", 1, 0, OPT_NAMESERVER}, 369 { "use-stun1", 1, 0, OPT_USE_STUN1}, 370 { "use-stun2", 1, 0, OPT_USE_STUN2}, 369 { "stun-srv", 1, 0, OPT_STUN_SRV}, 371 370 { "add-buddy", 1, 0, OPT_ADD_BUDDY}, 372 371 { "offer-x-ms-msg",0,0,OPT_OFFER_X_MS_MSG}, … … 382 381 { "rec-file", 1, 0, OPT_REC_FILE}, 383 382 { "rtp-port", 1, 0, OPT_RTP_PORT}, 383 { "use-ice", 0, 0, OPT_USE_ICE}, 384 384 { "add-codec", 1, 0, OPT_ADD_CODEC}, 385 385 { "complexity", 1, 0, OPT_COMPLEXITY}, … … 442 442 pj_optind = 0; 443 443 while((c=pj_getopt_long(argc,argv, "", long_options,&option_index))!=-1) { 444 char *p;445 444 pj_str_t tmp; 446 445 long lval; … … 633 632 break; 634 633 635 case OPT_USE_STUN1: /* STUN server 1 */ 636 p = pj_ansi_strchr(pj_optarg, ':'); 637 if (p) { 638 *p = '\0'; 639 cfg->udp_cfg.stun_config.stun_srv1 = pj_str(pj_optarg); 640 cfg->udp_cfg.stun_config.stun_port1 = pj_strtoul(pj_cstr(&tmp, p+1)); 641 if (cfg->udp_cfg.stun_config.stun_port1 < 1 || cfg->udp_cfg.stun_config.stun_port1 > 65535) { 642 PJ_LOG(1,(THIS_FILE, 643 "Error: expecting port number with " 644 "option --use-stun1")); 645 return PJ_EINVAL; 646 } 647 } else { 648 cfg->udp_cfg.stun_config.stun_port1 = 3478; 649 cfg->udp_cfg.stun_config.stun_srv1 = pj_str(pj_optarg); 650 } 651 cfg->udp_cfg.use_stun = PJ_TRUE; 652 break; 653 654 case OPT_USE_STUN2: /* STUN server 2 */ 655 p = pj_ansi_strchr(pj_optarg, ':'); 656 if (p) { 657 *p = '\0'; 658 cfg->udp_cfg.stun_config.stun_srv2 = pj_str(pj_optarg); 659 cfg->udp_cfg.stun_config.stun_port2 = pj_strtoul(pj_cstr(&tmp,p+1)); 660 if (cfg->udp_cfg.stun_config.stun_port2 < 1 || cfg->udp_cfg.stun_config.stun_port2 > 65535) { 661 PJ_LOG(1,(THIS_FILE, 662 "Error: expecting port number with " 663 "option --use-stun2")); 664 return PJ_EINVAL; 665 } 666 } else { 667 cfg->udp_cfg.stun_config.stun_port2 = 3478; 668 cfg->udp_cfg.stun_config.stun_srv2 = pj_str(pj_optarg); 669 } 634 case OPT_STUN_SRV: /* STUN server */ 635 cfg->cfg.stun_srv = pj_str(pj_optarg); 670 636 break; 671 637 … … 727 693 case OPT_REC_FILE: 728 694 cfg->rec_file = pj_str(pj_optarg); 695 break; 696 697 case OPT_USE_ICE: 698 cfg->media_cfg.enable_ice = PJ_TRUE; 729 699 break; 730 700 … … 1114 1084 1115 1085 /* STUN */ 1116 if (config->udp_cfg.stun_config.stun_port1) { 1117 pj_ansi_sprintf(line, "--use-stun1 %.*s:%d\n", 1118 (int)config->udp_cfg.stun_config.stun_srv1.slen, 1119 config->udp_cfg.stun_config.stun_srv1.ptr, 1120 config->udp_cfg.stun_config.stun_port1); 1086 if (config->cfg.stun_srv.slen) { 1087 pj_ansi_sprintf(line, "--stun-srv %.*s\n", 1088 (int)config->cfg.stun_srv.slen, 1089 config->cfg.stun_srv.ptr); 1121 1090 pj_strcat2(&cfg, line); 1122 1091 } 1123 1092 1124 if (config->udp_cfg.stun_config.stun_port2) {1125 pj_ansi_sprintf(line, "--use-stun2 %.*s:%d\n",1126 (int)config->udp_cfg.stun_config.stun_srv2.slen,1127 config->udp_cfg.stun_config.stun_srv2.ptr,1128 config->udp_cfg.stun_config.stun_port2);1129 pj_strcat2(&cfg, line);1130 }1131 1093 1132 1094 /* TLS */ … … 1175 1137 1176 1138 /* Media */ 1139 if (config->media_cfg.enable_ice) 1140 pj_strcat2(&cfg, "--use-ice\n"); 1177 1141 if (config->null_audio) 1178 1142 pj_strcat2(&cfg, "--null-audio\n"); … … 2963 2927 return status; 2964 2928 2965 /* Copy udp_cfg STUN config to rtp_cfg */2966 app_config.rtp_cfg.use_stun = app_config.udp_cfg.use_stun;2967 app_config.rtp_cfg.stun_config = app_config.udp_cfg.stun_config;2968 2969 2970 2929 /* Initialize application callbacks */ 2971 2930 app_config.cfg.cb.on_call_state = &on_call_state;
Note: See TracChangeset
for help on using the changeset viewer.