Changeset 563 for pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c
- Timestamp:
- Jun 28, 2006 4:46:49 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c
r544 r563 30 30 pjsua_logging_config log_cfg; 31 31 pjsua_media_config media_cfg; 32 pj_bool_t no_tcp; 33 pj_bool_t no_udp; 32 34 pjsua_transport_config udp_cfg; 33 35 pjsua_transport_config rtp_cfg; … … 96 98 puts (""); 97 99 puts ("Transport Options:"); 98 puts (" --local-port=port Set TCP/UDP port"); 100 puts (" --local-port=port Set TCP/UDP port. This implicitly enables both "); 101 puts (" TCP and UDP transports on the specified port, unless"); 102 puts (" if TCP or UDP is disabled."); 103 puts (" --no-tcp Disable TCP transport."); 104 puts (" --no-udp Disable UDP transport."); 99 105 puts (" --outbound=url Set the URL of global outbound proxy server"); 100 106 puts (" May be specified multiple times"); … … 240 246 OPT_COMPLEXITY, OPT_QUALITY, OPT_PTIME, 241 247 OPT_NEXT_ACCOUNT, OPT_NEXT_CRED, OPT_MAX_CALLS, 242 OPT_DURATION, 248 OPT_DURATION, OPT_NO_TCP, OPT_NO_UDP, 243 249 }; 244 250 struct pj_getopt_option long_options[] = { … … 252 258 { "null-audio", 0, 0, OPT_NULL_AUDIO}, 253 259 { "local-port", 1, 0, OPT_LOCAL_PORT}, 260 { "no-tcp", 0, 0, OPT_NO_TCP}, 261 { "no-udp", 0, 0, OPT_NO_UDP}, 254 262 { "proxy", 1, 0, OPT_PROXY}, 255 263 { "outbound", 1, 0, OPT_OUTBOUND_PROXY}, … … 385 393 break; 386 394 395 case OPT_NO_UDP: /* no-udp */ 396 if (cfg->no_tcp) { 397 PJ_LOG(1,(THIS_FILE,"Error: can not disable both TCP and UDP")); 398 return PJ_EINVAL; 399 } 400 401 cfg->no_udp = PJ_TRUE; 402 break; 403 404 case OPT_NO_TCP: /* no-tcp */ 405 if (cfg->no_udp) { 406 PJ_LOG(1,(THIS_FILE,"Error: can not disable both TCP and UDP")); 407 return PJ_EINVAL; 408 } 409 410 cfg->no_tcp = PJ_TRUE; 411 break; 412 387 413 case OPT_PROXY: /* proxy */ 388 414 if (pjsua_verify_sip_url(pj_optarg) != 0) { … … 2047 2073 pj_status_t app_init(int argc, char *argv[]) 2048 2074 { 2049 pjsua_transport_id transport_id ;2075 pjsua_transport_id transport_id = -1; 2050 2076 unsigned i; 2051 2077 pj_status_t status; … … 2097 2123 } 2098 2124 2099 /* Add UDP transport */ 2100 status = pjsua_transport_create(PJSIP_TRANSPORT_UDP, 2101 &app_config.udp_cfg, 2102 &transport_id); 2103 if (status != PJ_SUCCESS) 2125 2126 /* Add TCP transport unless it's disabled */ 2127 if (!app_config.no_tcp) { 2128 status = pjsua_transport_create(PJSIP_TRANSPORT_TCP, 2129 &app_config.udp_cfg, 2130 &transport_id); 2131 if (status != PJ_SUCCESS) 2132 goto on_error; 2133 2134 /* Add local account */ 2135 pjsua_acc_add_local(transport_id, PJ_TRUE, ¤t_acc); 2136 pjsua_acc_set_online_status(current_acc, PJ_TRUE); 2137 2138 } 2139 2140 2141 /* Add UDP transport unless it's disabled. */ 2142 if (!app_config.no_udp) { 2143 status = pjsua_transport_create(PJSIP_TRANSPORT_UDP, 2144 &app_config.udp_cfg, 2145 &transport_id); 2146 if (status != PJ_SUCCESS) 2147 goto on_error; 2148 2149 /* Add local account */ 2150 pjsua_acc_add_local(transport_id, PJ_TRUE, ¤t_acc); 2151 pjsua_acc_set_online_status(current_acc, PJ_TRUE); 2152 } 2153 2154 if (transport_id == -1) { 2155 PJ_LOG(3,(THIS_FILE, "Error: no transport is configured")); 2156 status = -1; 2104 2157 goto on_error; 2105 2106 /* Add local account */ 2107 pjsua_acc_add_local(transport_id, PJ_TRUE, ¤t_acc); 2108 pjsua_acc_set_online_status(current_acc, PJ_TRUE); 2158 } 2109 2159 2110 2160
Note: See TracChangeset
for help on using the changeset viewer.