Changeset 422 for pjproject/trunk
- Timestamp:
- Apr 29, 2006 8:31:09 AM (19 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib/src/pj/config.c
r419 r422 22 22 23 23 static const char *id = "config.c"; 24 const char *PJ_VERSION = "0.5.4.1 2";24 const char *PJ_VERSION = "0.5.4.13"; 25 25 26 26 PJ_DEF(void) pj_dump_config(void) -
pjproject/trunk/pjsip-apps/src/pjsua/main.c
r355 r422 414 414 struct input_result result; 415 415 416 417 /* If user specifies URI to call, then call the URI */ 418 if (pjsua.uri_to_call.slen) { 419 pjsua_make_call( current_acc, pjsua.uri_to_call.ptr, NULL); 420 } 421 416 422 keystroke_help(); 417 423 -
pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h
r398 r422 184 184 pjmedia_endpt *med_endpt; /**< Media endpoint. */ 185 185 unsigned clock_rate; /**< Internal clock rate. */ 186 pj_bool_t has_wb; /**< Include wideband codecs */187 pj_bool_t has_uwb; /**< Include ultra-wideband codecs */188 186 pjmedia_conf *mconf; /**< Media conference. */ 189 187 pj_bool_t null_audio; /**< Null audio flag. */ … … 250 248 251 249 /* PJSUA Calls: */ 250 pj_str_t uri_to_call; /**< URI to call. */ 252 251 int max_calls; /**< Max nb of calls. */ 253 252 int call_cnt; /**< Number of calls. */ -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c
r398 r422 1048 1048 call->conf_slot, 0); 1049 1049 1050 } else if (pjsua.auto_loop && call->inv->role == PJSIP_ROLE_UAS) { 1050 } 1051 if (pjsua.auto_loop && call->inv->role == PJSIP_ROLE_UAS) { 1051 1052 1052 1053 pjmedia_conf_connect_port( pjsua.mconf, call->conf_slot, 1053 1054 call->conf_slot, 0); 1054 1055 1055 } else if (pjsua.auto_conf) {1056 1056 } 1057 if (pjsua.auto_conf) { 1057 1058 int i; 1058 1059 … … 1071 1072 } 1072 1073 1073 } else { 1074 1075 /* Connect new call to the sound device port (port zero) in the 1076 * main conference bridge. 1077 */ 1074 } 1075 1076 /* Normal operation: if no auto_xx is given, connect new call to 1077 * the sound device port (port zero) in the main conference bridge. 1078 */ 1079 if (pjsua.auto_play == 0 && pjsua.auto_loop == 0 && 1080 pjsua.auto_conf == 0) 1081 { 1078 1082 pjmedia_conf_connect_port( pjsua.mconf, 0, call->conf_slot, 0); 1079 1083 pjmedia_conf_connect_port( pjsua.mconf, call->conf_slot, 0, 0); -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c
r412 r422 80 80 #if defined(PJ_DARWINOS) && PJ_DARWINOS!=0 81 81 pjsua.clock_rate = 44100; 82 #else83 pjsua.clock_rate = 8000;84 82 #endif 85 83 pjsua.complexity = -1; 86 84 pjsua.quality = 4; 87 pjsua.has_wb = 0;88 pjsua.has_uwb = 0;89 85 90 86 … … 621 617 static pj_status_t init_media(void) 622 618 { 619 int i; 623 620 unsigned options; 621 unsigned clock_rate; 622 unsigned samples_per_frame; 623 pj_str_t codec_id; 624 624 pj_status_t status; 625 625 626 /* If user doesn't specify any codecs, register all of them. */ 627 if (pjsua.codec_cnt == 0) { 628 626 /* Register all codecs */ 629 627 #if PJMEDIA_HAS_SPEEX_CODEC 630 unsigned option = PJMEDIA_SPEEX_NO_WB | PJMEDIA_SPEEX_NO_UWB; 631 632 /* Register speex. */ 633 if (pjsua.has_wb) 634 option &= ~PJMEDIA_SPEEX_NO_WB; 635 if (pjsua.has_uwb) 636 option &= ~PJMEDIA_SPEEX_NO_UWB; 637 638 status = pjmedia_codec_speex_init(pjsua.med_endpt, option, 639 pjsua.quality, pjsua.complexity ); 640 if (status != PJ_SUCCESS) { 641 pjsua_perror(THIS_FILE, "Error initializing Speex codec", 642 status); 643 return status; 644 } 645 646 pjsua.codec_arg[pjsua.codec_cnt] = pj_str("speex"); 647 pjsua.codec_deinit[pjsua.codec_cnt] = &pjmedia_codec_speex_deinit; 648 pjsua.codec_cnt++; 628 /* Register speex. */ 629 status = pjmedia_codec_speex_init(pjsua.med_endpt, 630 PJMEDIA_SPEEX_NO_UWB, 631 pjsua.quality, pjsua.complexity ); 632 if (status != PJ_SUCCESS) { 633 pjsua_perror(THIS_FILE, "Error initializing Speex codec", 634 status); 635 return status; 636 } 637 638 /* Set "speex/16000/1" to have highest priority */ 639 codec_id = pj_str("speex/16000/1"); 640 pjmedia_codec_mgr_set_codec_priority( 641 pjmedia_endpt_get_codec_mgr(pjsua.med_endpt), 642 &codec_id, 643 PJMEDIA_CODEC_PRIO_HIGHEST); 644 649 645 #endif /* PJMEDIA_HAS_SPEEX_CODEC */ 650 646 651 647 #if PJMEDIA_HAS_GSM_CODEC 652 /* Register GSM */ 653 status = pjmedia_codec_gsm_init(pjsua.med_endpt); 654 if (status != PJ_SUCCESS) { 655 pjsua_perror(THIS_FILE, "Error initializing GSM codec", 656 status); 657 return status; 658 } 659 660 pjsua.codec_arg[pjsua.codec_cnt] = pj_str("gsm"); 661 pjsua.codec_deinit[pjsua.codec_cnt] = &pjmedia_codec_gsm_deinit; 662 pjsua.codec_cnt++; 648 /* Register GSM */ 649 status = pjmedia_codec_gsm_init(pjsua.med_endpt); 650 if (status != PJ_SUCCESS) { 651 pjsua_perror(THIS_FILE, "Error initializing GSM codec", 652 status); 653 return status; 654 } 663 655 #endif /* PJMEDIA_HAS_GSM_CODEC */ 664 656 657 #if PJMEDIA_HAS_G711_CODEC 658 /* Register PCMA and PCMU */ 659 status = pjmedia_codec_g711_init(pjsua.med_endpt); 660 if (status != PJ_SUCCESS) { 661 pjsua_perror(THIS_FILE, "Error initializing G711 codec", 662 status); 663 return status; 664 } 665 #endif /* PJMEDIA_HAS_G711_CODEC */ 666 665 667 #if PJMEDIA_HAS_L16_CODEC 666 /* Register L16 */ 667 status = pjmedia_codec_l16_init(pjsua.med_endpt, 0); 668 if (status != PJ_SUCCESS) { 669 pjsua_perror(THIS_FILE, "Error initializing L16 codec", 670 status); 671 return status; 672 } 673 674 pjsua.codec_arg[pjsua.codec_cnt] = pj_str("l16"); 675 pjsua.codec_deinit[pjsua.codec_cnt] = &pjmedia_codec_l16_deinit; 676 pjsua.codec_cnt++; 677 #endif /* PJMEDIA_HAS_L16_CODEC */ 678 679 680 #if PJMEDIA_HAS_G711_CODEC 681 /* Register PCMA and PCMU */ 682 status = pjmedia_codec_g711_init(pjsua.med_endpt); 683 if (status != PJ_SUCCESS) { 684 pjsua_perror(THIS_FILE, "Error initializing G711 codec", 685 status); 686 return status; 687 } 688 689 pjsua.codec_arg[pjsua.codec_cnt] = pj_str("pcmu"); 690 pjsua.codec_deinit[pjsua.codec_cnt] = &pjmedia_codec_g711_deinit; 691 pjsua.codec_cnt++; 692 pjsua.codec_arg[pjsua.codec_cnt] = pj_str("pcma"); 693 pjsua.codec_deinit[pjsua.codec_cnt] = &pjmedia_codec_g711_deinit; 694 pjsua.codec_cnt++; 695 #endif /* PJMEDIA_HAS_G711_CODEC */ 696 697 } else { 698 699 /* If user specifies the exact codec to be used, then create only 700 * those codecs. 701 */ 702 int i; 703 704 for (i=0; i<pjsua.codec_cnt; ++i) { 668 /* Register L16 family codecs, but disable all */ 669 status = pjmedia_codec_l16_init(pjsua.med_endpt, 0); 670 if (status != PJ_SUCCESS) { 671 pjsua_perror(THIS_FILE, "Error initializing L16 codecs", 672 status); 673 return status; 674 } 675 676 /* Disable ALL L16 codecs */ 677 codec_id = pj_str("L16"); 678 pjmedia_codec_mgr_set_codec_priority( 679 pjmedia_endpt_get_codec_mgr(pjsua.med_endpt), 680 &codec_id, 681 PJMEDIA_CODEC_PRIO_DISABLED); 682 683 #endif /* PJMEDIA_HAS_L16_CODEC */ 684 685 686 /* If user specifies the exact codec to be used, then disable all codecs 687 * and only enable those specific codecs. 688 */ 689 if (pjsua.codec_cnt != 0) { 690 codec_id = pj_str(""); 691 pjmedia_codec_mgr_set_codec_priority( 692 pjmedia_endpt_get_codec_mgr(pjsua.med_endpt), 693 &codec_id, 694 PJMEDIA_CODEC_PRIO_DISABLED); 695 } 696 705 697 706 if (0) { 707 /* Dummy */ 708 } 709 #if PJMEDIA_HAS_SPEEX_CODEC 710 /* Is it speex? */ 711 else if (!pj_stricmp2(&pjsua.codec_arg[i], "speex")) { 712 713 unsigned option = PJMEDIA_SPEEX_NO_WB | PJMEDIA_SPEEX_NO_UWB; 714 715 /* Register speex. */ 716 if (pjsua.has_wb) 717 option &= ~(PJMEDIA_SPEEX_NO_WB); 718 if (pjsua.has_uwb) 719 option &= ~(PJMEDIA_SPEEX_NO_UWB); 720 721 status = pjmedia_codec_speex_init(pjsua.med_endpt, option, 722 -1, -1); 723 if (status != PJ_SUCCESS) { 724 pjsua_perror(THIS_FILE, "Error initializing Speex codec", 725 status); 726 return status; 727 } 728 729 pjsua.codec_deinit[i] = &pjmedia_codec_speex_deinit; 730 } 731 #endif /* PJMEDIA_HAS_SPEEX_CODEC */ 732 733 #if PJMEDIA_HAS_GSM_CODEC 734 /* Is it gsm? */ 735 else if (!pj_stricmp2(&pjsua.codec_arg[i], "gsm")) { 736 737 status = pjmedia_codec_gsm_init(pjsua.med_endpt); 738 if (status != PJ_SUCCESS) { 739 pjsua_perror(THIS_FILE, "Error initializing GSM codec", 740 status); 741 return status; 742 } 743 744 pjsua.codec_deinit[i] = &pjmedia_codec_gsm_deinit; 745 746 } 747 #endif /* PJMEDIA_HAS_GSM_CODEC */ 748 749 #if PJMEDIA_HAS_L16_CODEC 750 /* Is it l16? */ 751 else if (!pj_stricmp2(&pjsua.codec_arg[i], "l16")) { 752 753 status = pjmedia_codec_l16_init(pjsua.med_endpt, 0); 754 if (status != PJ_SUCCESS) { 755 pjsua_perror(THIS_FILE, "Error initializing L16 codec", 756 status); 757 return status; 758 } 759 760 pjsua.codec_deinit[i] = &pjmedia_codec_l16_deinit; 761 762 pjsua.clock_rate = 44100; 763 } 764 #endif /* PJMEDIA_HAS_L16_CODEC */ 765 766 #if PJMEDIA_HAS_G711_CODEC 767 /* Is it pcma/pcmu? */ 768 else if (!pj_stricmp2(&pjsua.codec_arg[i], "pcmu") || 769 !pj_stricmp2(&pjsua.codec_arg[i], "pcma")) 770 { 771 772 status = pjmedia_codec_g711_init(pjsua.med_endpt); 773 if (status != PJ_SUCCESS) { 774 pjsua_perror(THIS_FILE, "Error initializing G711 codec", 775 status); 776 return status; 777 } 778 779 pjsua.codec_deinit[i] = &pjmedia_codec_g711_deinit; 780 781 } 782 #endif /* PJMEDIA_HAS_G711_CODEC */ 783 784 /* Don't know about this codec... */ 785 else { 786 787 PJ_LOG(1,(THIS_FILE, "Error: unsupported codecs %s", 788 pjsua.codec_arg[i].ptr)); 789 return PJMEDIA_CODEC_EUNSUP; 790 } 791 } 792 } 698 699 for (i=0; i<pjsua.codec_cnt; ++i) { 700 pjmedia_codec_mgr_set_codec_priority( 701 pjmedia_endpt_get_codec_mgr(pjsua.med_endpt), 702 &pjsua.codec_arg[i], 703 PJMEDIA_CODEC_PRIO_NEXT_HIGHER); 704 } 705 793 706 794 707 /* Init options for conference bridge. */ … … 798 711 799 712 /* Init conference bridge. */ 800 713 clock_rate = pjsua.clock_rate ? pjsua.clock_rate : 16000; 714 samples_per_frame = clock_rate * 20 / 1000; 801 715 status = pjmedia_conf_create(pjsua.pool, 802 716 pjsua.max_calls+PJSUA_CONF_MORE_PORTS, 803 pjsua.clock_rate,717 clock_rate, 804 718 1, /* mono */ 805 pjsua.clock_rate * 20 / 1000, 16, 719 samples_per_frame, 720 16, 806 721 options, 807 722 &pjsua.mconf); … … 814 729 815 730 /* Add NULL port to the bridge. */ 816 status = pjmedia_null_port_create( pjsua.pool, pjsua.clock_rate,731 status = pjmedia_null_port_create( pjsua.pool, clock_rate, 817 732 1, /* mono */ 818 pjsua.clock_rate * 20 / 1000, 16,733 samples_per_frame, 16, 819 734 &pjsua.null_port); 820 735 pjmedia_conf_add_port( pjsua.mconf, pjsua.pool, pjsua.null_port, … … 1128 1043 1129 1044 /* Shutdown all codecs: */ 1130 for (i = pjsua.codec_cnt-1; i >= 0; --i) { 1131 (*pjsua.codec_deinit[i])(); 1132 } 1045 #if PJMEDIA_HAS_SPEEX_CODEC 1046 pjmedia_codec_speex_deinit(); 1047 #endif /* PJMEDIA_HAS_SPEEX_CODEC */ 1048 1049 #if PJMEDIA_HAS_GSM_CODEC 1050 pjmedia_codec_gsm_deinit(); 1051 #endif /* PJMEDIA_HAS_GSM_CODEC */ 1052 1053 #if PJMEDIA_HAS_G711_CODEC 1054 pjmedia_codec_g711_deinit(); 1055 #endif /* PJMEDIA_HAS_G711_CODEC */ 1056 1057 #if PJMEDIA_HAS_L16_CODEC 1058 pjmedia_codec_l16_deinit(); 1059 #endif /* PJMEDIA_HAS_L16_CODEC */ 1133 1060 1134 1061 /* Destroy media endpoint. */ -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_settings.c
r412 r422 84 84 puts (""); 85 85 puts ("Media Options:"); 86 puts (" --wb Enable wideband codecs and set clock-rate to 16KHz"); 87 puts (" --uwb Enable ultra-wideband codecs and set clock-rate to 32KHz"); 86 puts (" --add-codec=name Manually add codec (default is to enable all)"); 88 87 puts (" --clock-rate=N Override sound device clock rate"); 89 88 puts (" --null-audio Use NULL audio device"); … … 94 93 puts (" --auto-conf Automatically put incoming calls to conference"); 95 94 puts (" --rtp-port=N Base port to try for RTP (default=4000)"); 96 puts (" --add-codec=name Specify alternate codec order");97 95 puts (" --complexity=N Specify encoding complexity (0-10, default=none(-1))"); 98 96 puts (" --quality=N Specify encoding quality (0-10, default=4)"); … … 159 157 fhnd = fopen(filename, "rt"); 160 158 if (!fhnd) { 161 printf("Unable to open config file %s\n", filename);159 PJ_LOG(1,(THIS_FILE, "Unable to open config file %s", filename)); 162 160 fflush(stdout); 163 161 return -1; … … 192 190 193 191 if (argc == MAX_ARGS && (i!=*app_argc || !feof(fhnd))) { 194 printf("Too many arguments specified in cmd line/config file\n"); 192 PJ_LOG(1,(THIS_FILE, 193 "Too many arguments specified in cmd line/config file")); 195 194 fflush(stdout); 196 195 fclose(fhnd); … … 228 227 OPT_AUTO_ANSWER, OPT_AUTO_HANGUP, OPT_AUTO_PLAY, OPT_AUTO_LOOP, 229 228 OPT_AUTO_CONF, OPT_CLOCK_RATE, 230 OPT_PLAY_FILE, OPT_ WB, OPT_UWB, OPT_RTP_PORT, OPT_ADD_CODEC,229 OPT_PLAY_FILE, OPT_RTP_PORT, OPT_ADD_CODEC, 231 230 OPT_COMPLEXITY, OPT_QUALITY, 232 231 OPT_NEXT_ACCOUNT, OPT_NEXT_CRED, OPT_MAX_CALLS, OPT_UAS_REFRESH, … … 240 239 { "help", 0, 0, OPT_HELP}, 241 240 { "version", 0, 0, OPT_VERSION}, 242 { "wb", 0, 0, OPT_WB},243 { "uwb", 0, 0, OPT_UWB},244 241 { "clock-rate", 1, 0, OPT_CLOCK_RATE}, 245 242 { "null-audio", 0, 0, OPT_NULL_AUDIO}, … … 322 319 c = pj_strtoul(pj_cstr(&tmp, pj_optarg)); 323 320 if (c < 0 || c > 6) { 324 printf("Error: expecting integer value 0-6 for --log-level\n"); 321 PJ_LOG(1,(THIS_FILE, 322 "Error: expecting integer value 0-6 " 323 "for --log-level")); 325 324 return PJ_EINVAL; 326 325 } … … 331 330 pjsua.app_log_level = pj_strtoul(pj_cstr(&tmp, pj_optarg)); 332 331 if (pjsua.app_log_level < 0 || pjsua.app_log_level > 6) { 333 printf("Error: expecting integer value 0-6 for --app-log-level\n"); 332 PJ_LOG(1,(THIS_FILE, 333 "Error: expecting integer value 0-6 " 334 "for --app-log-level")); 334 335 return PJ_EINVAL; 335 336 } … … 352 353 break; 353 354 354 case OPT_WB:355 pjsua.has_wb = 1;356 break;357 358 case OPT_UWB:359 pjsua.has_uwb = 1;360 break;361 362 355 case OPT_CLOCK_RATE: 363 356 lval = pj_strtoul(pj_cstr(&tmp, pj_optarg)); 364 357 if (lval < 8000 || lval > 48000) { 365 printf("Error: expecting value between 8000-48000 for clock rate\n"); 358 PJ_LOG(1,(THIS_FILE, "Error: expecting value between " 359 "8000-48000 for clock rate")); 366 360 return PJ_EINVAL; 367 361 } … … 372 366 lval = pj_strtoul(pj_cstr(&tmp, pj_optarg)); 373 367 if (lval < 1 || lval > 65535) { 374 printf("Error: expecting integer value for --local-port\n"); 368 PJ_LOG(1,(THIS_FILE, 369 "Error: expecting integer value for " 370 "--local-port")); 375 371 return PJ_EINVAL; 376 372 } … … 380 376 case OPT_PROXY: /* proxy */ 381 377 if (pjsua_verify_sip_url(pj_optarg) != 0) { 382 printf("Error: invalid SIP URL '%s' in proxy argument\n", pj_optarg); 378 PJ_LOG(1,(THIS_FILE, 379 "Error: invalid SIP URL '%s' " 380 "in proxy argument", pj_optarg)); 383 381 return PJ_EINVAL; 384 382 } … … 388 386 case OPT_OUTBOUND_PROXY: /* outbound proxy */ 389 387 if (pjsua_verify_sip_url(pj_optarg) != 0) { 390 printf("Error: invalid SIP URL '%s' in outbound proxy argument\n", pj_optarg); 388 PJ_LOG(1,(THIS_FILE, 389 "Error: invalid SIP URL '%s' " 390 "in outbound proxy argument", pj_optarg)); 391 391 return PJ_EINVAL; 392 392 } … … 396 396 case OPT_REGISTRAR: /* registrar */ 397 397 if (pjsua_verify_sip_url(pj_optarg) != 0) { 398 printf("Error: invalid SIP URL '%s' in registrar argument\n", pj_optarg); 398 PJ_LOG(1,(THIS_FILE, 399 "Error: invalid SIP URL '%s' in " 400 "registrar argument", pj_optarg)); 399 401 return PJ_EINVAL; 400 402 } … … 405 407 cur_acc->reg_timeout = pj_strtoul(pj_cstr(&tmp,pj_optarg)); 406 408 if (cur_acc->reg_timeout < 1 || cur_acc->reg_timeout > 3600) { 407 printf("Error: invalid value for --reg-timeout (expecting 1-3600)\n"); 409 PJ_LOG(1,(THIS_FILE, 410 "Error: invalid value for --reg-timeout " 411 "(expecting 1-3600)")); 408 412 return PJ_EINVAL; 409 413 } … … 412 416 case OPT_ID: /* id */ 413 417 if (pjsua_verify_sip_url(pj_optarg) != 0) { 414 printf("Error: invalid SIP URL '%s' in local id argument\n", pj_optarg); 418 PJ_LOG(1,(THIS_FILE, 419 "Error: invalid SIP URL '%s' " 420 "in local id argument", pj_optarg)); 415 421 return PJ_EINVAL; 416 422 } … … 421 427 case OPT_CONTACT: /* contact */ 422 428 if (pjsua_verify_sip_url(pj_optarg) != 0) { 423 printf("Error: invalid SIP URL '%s' in contact argument\n", pj_optarg); 429 PJ_LOG(1,(THIS_FILE, 430 "Error: invalid SIP URL '%s' " 431 "in contact argument", pj_optarg)); 424 432 return PJ_EINVAL; 425 433 } … … 460 468 pjsua.stun_port1 = pj_strtoul(pj_cstr(&tmp, p+1)); 461 469 if (pjsua.stun_port1 < 1 || pjsua.stun_port1 > 65535) { 462 printf("Error: expecting port number with option --use-stun1\n"); 470 PJ_LOG(1,(THIS_FILE, 471 "Error: expecting port number with " 472 "option --use-stun1")); 463 473 return PJ_EINVAL; 464 474 } … … 476 486 pjsua.stun_port2 = pj_strtoul(pj_cstr(&tmp,p+1)); 477 487 if (pjsua.stun_port2 < 1 || pjsua.stun_port2 > 65535) { 478 printf("Error: expecting port number with option --use-stun2\n"); 488 PJ_LOG(1,(THIS_FILE, 489 "Error: expecting port number with " 490 "option --use-stun2")); 479 491 return PJ_EINVAL; 480 492 } … … 487 499 case OPT_ADD_BUDDY: /* Add to buddy list. */ 488 500 if (pjsua_verify_sip_url(pj_optarg) != 0) { 489 printf("Error: invalid URL '%s' in --add-buddy option\n", pj_optarg); 501 PJ_LOG(1,(THIS_FILE, 502 "Error: invalid URL '%s' in " 503 "--add-buddy option", pj_optarg)); 490 504 return -1; 491 505 } 492 506 if (pjsua.buddy_cnt == PJSUA_MAX_BUDDIES) { 493 printf("Error: too many buddies in buddy list.\n"); 507 PJ_LOG(1,(THIS_FILE, 508 "Error: too many buddies in buddy list.")); 494 509 return -1; 495 510 } … … 517 532 if (pjsua.start_rtp_port < 1 || pjsua.start_rtp_port > 65535) { 518 533 PJ_LOG(1,(THIS_FILE, 519 "Error: rtp-port argument value (expecting 1-65535")); 534 "Error: rtp-port argument value " 535 "(expecting 1-65535")); 520 536 return -1; 521 537 } … … 548 564 if (pjsua.auto_answer < 100 || pjsua.auto_answer > 699) { 549 565 PJ_LOG(1,(THIS_FILE, 550 "Error: invalid code in --auto-answer (expecting 100-699")); 566 "Error: invalid code in --auto-answer " 567 "(expecting 100-699")); 551 568 return -1; 552 569 } … … 564 581 pjsua.uas_refresh = my_atoi(pj_optarg); 565 582 if (pjsua.uas_refresh < 1) { 566 PJ_LOG(1,(THIS_FILE,"Invalid value for --uas-refresh (must be >0)")); 583 PJ_LOG(1,(THIS_FILE, 584 "Invalid value for --uas-refresh (must be >0)")); 567 585 return -1; 568 586 } … … 572 590 pjsua.uas_duration = my_atoi(pj_optarg); 573 591 if (pjsua.uas_duration < 1) { 574 PJ_LOG(1,(THIS_FILE,"Invalid value for --uas-duration (must be >0)")); 592 PJ_LOG(1,(THIS_FILE, 593 "Invalid value for --uas-duration " 594 "(must be >0)")); 575 595 return -1; 576 596 } … … 580 600 581 601 if (pj_optind != argc) { 582 printf("Error: unknown options %s\n", argv[pj_optind]); 602 int i; 603 604 if (pjsua_verify_sip_url(argv[pj_optind]) != PJ_SUCCESS) { 605 PJ_LOG(1,(THIS_FILE, "Invalid SIP URI %s", argv[pj_optind])); 606 return -1; 607 } 608 pjsua.uri_to_call = pj_str(argv[pj_optind]); 609 pj_optind++; 610 611 /* Add URI to call to buddy list if it's not already there */ 612 for (i=0; i<pjsua.buddy_cnt; ++i) { 613 if (pj_stricmp(&pjsua.buddies[i].uri, &pjsua.uri_to_call)==0) 614 break; 615 } 616 if (i == pjsua.buddy_cnt && pjsua.buddy_cnt < PJSUA_MAX_BUDDIES) { 617 pjsua.buddies[pjsua.buddy_cnt++].uri = pjsua.uri_to_call; 618 } 619 } 620 621 if (pj_optind != argc) { 622 PJ_LOG(1,(THIS_FILE, "Error: unknown options %s", argv[pj_optind])); 583 623 return PJ_EINVAL; 584 624 } 585 586 /* Adjust clock rate */587 if (pjsua.clock_rate == 8000 && pjsua.has_uwb)588 pjsua.clock_rate = 32000;589 else if (pjsua.clock_rate == 8000 && pjsua.has_wb)590 pjsua.clock_rate = 16000;591 625 592 626 return PJ_SUCCESS; … … 1048 1082 } 1049 1083 /* Media clock rate. */ 1050 if (pjsua.has_uwb) 1051 pj_strcat2(&cfg, "--uwb\n"); 1052 1053 if (pjsua.has_wb) 1054 pj_strcat2(&cfg, "--wb\n"); 1055 1056 pj_ansi_sprintf(line, "--clock-rate %d\n", 1057 pjsua.clock_rate); 1058 pj_strcat2(&cfg, line); 1084 if (pjsua.clock_rate) { 1085 pj_ansi_sprintf(line, "--clock-rate %d\n", 1086 pjsua.clock_rate); 1087 pj_strcat2(&cfg, line); 1088 } 1059 1089 1060 1090
Note: See TracChangeset
for help on using the changeset viewer.