Changeset 293
- Timestamp:
- Mar 6, 2006 1:35:47 PM (19 years ago)
- Location:
- pjproject/trunk/pjsip
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h
r284 r293 199 199 200 200 /* Account: */ 201 pj_bool_t has_acc; /**< Any --id cmdline? */ 201 202 int acc_cnt; /**< Number of client registrations */ 202 203 pjsua_acc acc[PJSUA_MAX_ACC]; /** Client regs array. */ -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c
r284 r293 284 284 285 285 status = pjsip_inv_initial_answer(inv, rdata, 286 (pjsua.auto_answer ? 200 : 100), 286 (pjsua.auto_answer ? pjsua.auto_answer 287 : 100), 287 288 NULL, NULL, &response); 288 289 if (status != PJ_SUCCESS) { 289 290 290 pjsua_perror(THIS_FILE, "Unable to create 100 response", status); 291 292 pjsip_dlg_respond(dlg, rdata, 500, NULL, NULL, NULL); 293 pjsip_inv_terminate(inv, 500, PJ_FALSE); 291 int st_code; 292 293 pjsua_perror(THIS_FILE, "Unable to send answer to incoming INVITE", 294 status); 295 296 /* If failed to send 2xx response, there's a good chance that it is 297 * because SDP negotiation has failed. 298 */ 299 if (pjsua.auto_answer/100 == 2) 300 st_code = PJSIP_SC_UNSUPPORTED_MEDIA_TYPE; 301 else 302 st_code = 500; 303 304 pjsip_dlg_respond(dlg, rdata, st_code, NULL, NULL, NULL); 305 pjsip_inv_terminate(inv, st_code, PJ_FALSE); 306 return PJ_TRUE; 294 307 295 308 } else { … … 763 776 pjsua_perror(THIS_FILE, "SDP negotiation has failed", status); 764 777 765 /* Disconnect call if this is not a re-INVITE */ 766 if (inv->state != PJSIP_INV_STATE_CONFIRMED) { 778 /* Disconnect call if we're not in the middle of initializing an 779 * UAS dialog and if this is not a re-INVITE 780 */ 781 if (inv->state != PJSIP_INV_STATE_NULL && 782 inv->state != PJSIP_INV_STATE_CONFIRMED) 783 { 767 784 call_disconnect(inv, PJSIP_SC_UNSUPPORTED_MEDIA_TYPE); 768 785 } -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c
r284 r293 75 75 /* Default for media: */ 76 76 pjsua.clock_rate = 8000; 77 pjsua.complexity = 4;77 pjsua.complexity = -1; 78 78 pjsua.quality = 4; 79 79 … … 85 85 pjsua.acc[i].local_uri = pj_str(PJSUA_LOCAL_URI); 86 86 pjsua.acc[i].reg_timeout = 55; 87 pjsua.acc[i].online_status = PJ_TRUE; 87 88 pj_list_init(&pjsua.acc[i].route_set); 88 89 pj_list_init(&pjsua.acc[i].pres_srv_list); -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_settings.c
r284 r293 93 93 puts (" --rtp-port=N Base port to try for RTP (default=4000)"); 94 94 puts (" --add-codec=name Specify alternate codec order"); 95 puts (" --complexity=N Specify encoding complexity (0-10, default= 4)");95 puts (" --complexity=N Specify encoding complexity (0-10, default=none(-1))"); 96 96 puts (" --quality=N Specify encoding quality (0-10, default=4)"); 97 97 puts (""); … … 394 394 } 395 395 cur_acc->local_uri = pj_str(optarg); 396 pjsua.has_acc = 1; 396 397 break; 397 398 … … 577 578 } 578 579 580 static const char *good_number(char *buf, pj_int32_t val) 581 { 582 if (val < 1000) { 583 pj_ansi_sprintf(buf, "%d", val); 584 } else if (val < 1000000) { 585 pj_ansi_sprintf(buf, "%d.%dK", 586 val / 1000, 587 (val % 1000) / 100); 588 } else { 589 pj_ansi_sprintf(buf, "%d.%02dM", 590 val / 1000000, 591 (val % 1000000) / 10000); 592 } 593 594 return buf; 595 } 596 579 597 static void dump_media_session(pjmedia_session *session) 580 598 { … … 589 607 int rem_port; 590 608 const char *dir; 609 char stxpkt[10], stxoct[10], srxpkt[10], srxoct[10]; 591 610 592 611 pjmedia_session_get_stream_stat(session, i, &strm_stat); … … 605 624 606 625 PJ_LOG(3,(THIS_FILE, 607 "%s [Media strm#%d] %.*s, %s, peer=%s:%d",626 "%s#%d %.*s @%dKHz, %s, peer=%s:%d", 608 627 " ", 609 628 i, 610 629 info.stream_info[i].fmt.encoding_name.slen, 611 630 info.stream_info[i].fmt.encoding_name.ptr, 631 info.stream_info[i].fmt.sample_rate / 1000, 612 632 dir, 613 633 rem_addr, rem_port)); 614 634 PJ_LOG(3,(THIS_FILE, 615 "%s tx {pkt=%u, bytes=%u} rx {pkt=%u, bytes=%u}", 616 " ", 617 strm_stat.enc.pkt, strm_stat.enc.bytes, 618 strm_stat.dec.pkt, strm_stat.dec.bytes)); 635 "%s tx{pt=%d,pkt=%s,oct=%s} rx{pt=%d,pkt=%s,oct=%s}", 636 " ", 637 info.stream_info[i].tx_pt, 638 good_number(stxpkt, strm_stat.enc.pkt), 639 good_number(stxoct, strm_stat.enc.bytes), 640 info.stream_info[i].fmt.pt, 641 good_number(srxpkt, strm_stat.dec.pkt), 642 good_number(srxoct, strm_stat.dec.bytes))); 619 643 620 644 } … … 763 787 764 788 /* Save account settings. */ 765 for (acc_index=0; acc_index < pjsua.acc_cnt; ++acc_index) { 766 767 save_account_settings(acc_index, &cfg); 768 769 if (acc_index < pjsua.acc_cnt-1) 770 pj_strcat2(&cfg, "--next-account\n"); 789 if (pjsua.has_acc) { 790 for (acc_index=0; acc_index < pjsua.acc_cnt; ++acc_index) { 791 792 save_account_settings(acc_index, &cfg); 793 794 if (acc_index < pjsua.acc_cnt-1) 795 pj_strcat2(&cfg, "--next-account\n"); 796 } 771 797 } 772 798 … … 850 876 pj_strcat2(&cfg, line); 851 877 } 852 878 /* Media clock rate. */ 879 if (pjsua.clock_rate >= 32000) 880 pj_strcat2(&cfg, "--uwb\n"); 881 else if (pjsua.clock_rate >= 16000) 882 pj_strcat2(&cfg, "--wb\n"); 883 884 /* Encoding quality and complexity */ 885 pj_ansi_sprintf(line, "--quality %d\n", 886 pjsua.quality); 887 pj_strcat2(&cfg, line); 888 pj_ansi_sprintf(line, "--complexity %d\n", 889 pjsua.complexity); 890 pj_strcat2(&cfg, line); 891 892 /* Start RTP port. */ 893 pj_ansi_sprintf(line, "--rtp-port %d\n", 894 pjsua.start_rtp_port); 895 pj_strcat2(&cfg, line); 896 897 /* Add codec. */ 898 for (i=0; i<pjsua.codec_cnt; ++i) { 899 pj_ansi_sprintf(line, "--add-codec %s\n", 900 pjsua.codec_arg[i].ptr); 901 pj_strcat2(&cfg, line); 902 } 853 903 854 904 pj_strcat2(&cfg, "#\n# User agent:\n#\n");
Note: See TracChangeset
for help on using the changeset viewer.