Changeset 487 for pjproject/trunk
- Timestamp:
- Jun 1, 2006 12:28:44 PM (18 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 13 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/build/pjsip_apps.dsw
r336 r487 4 4 ############################################################################### 5 5 6 Project: "activex_pjsua"=".\activex-pjsua.dsp" - Package Owner=<4> 7 8 Package=<5> 9 {{{ 10 }}} 11 12 Package=<4> 13 {{{ 14 Begin Project Dependency 15 Project_Dep_Name pjlib 16 End Project Dependency 17 Begin Project Dependency 18 Project_Dep_Name pjlib_util 19 End Project Dependency 20 Begin Project Dependency 21 Project_Dep_Name pjmedia 22 End Project Dependency 23 Begin Project Dependency 24 Project_Dep_Name pjmedia_codec 25 End Project Dependency 26 Begin Project Dependency 27 Project_Dep_Name pjsip_core 28 End Project Dependency 29 Begin Project Dependency 30 Project_Dep_Name pjsip_simple 31 End Project Dependency 32 Begin Project Dependency 33 Project_Dep_Name pjsip_ua 34 End Project Dependency 35 Begin Project Dependency 36 Project_Dep_Name pjsua_lib 37 End Project Dependency 38 }}} 39 40 ############################################################################### 41 6 42 Project: "pjlib"="..\..\pjlib\build\pjlib.dsp" - Package Owner=<4> 7 43 -
pjproject/trunk/pjsip-apps/src/pjsua/main.c
r482 r487 43 43 44 44 45 /* Init logging: */46 if (pjsua_console_app_logging_init(&cfg) != PJ_SUCCESS)47 return 1;48 49 50 45 /* Init pjsua */ 51 46 if (pjsua_init(&cfg, &console_callback) != PJ_SUCCESS) … … 83 78 84 79 85 /* Close logging: */86 pjsua_console_app_logging_shutdown();87 88 89 80 /* Exit... */ 90 81 -
pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h
r482 r487 144 144 unsigned conf_ports; 145 145 146 /** Number of worker threads ( default: 1) */146 /** Number of worker threads (value >=0, default: 1) */ 147 147 unsigned thread_cnt; 148 149 /** Separate ioqueue for media? (default: yes) */ 150 pj_bool_t media_has_ioqueue; 151 152 /** Number of worker thread for media (value >=0, default: 1) */ 153 unsigned media_thread_cnt; 148 154 149 155 /** First STUN server IP address. When STUN is configured, then the … … 360 366 pj_str_t status_text; 361 367 pj_bool_t monitor; 368 int acc_index; 362 369 }; 363 370 … … 440 447 441 448 /** 449 * Poll pjsua. 450 */ 451 PJ_DECL(int) pjsua_handle_events(unsigned msec_timeout); 452 453 454 /** 442 455 * Get SIP endpoint instance. 443 456 * Only valid after pjsua_init(). … … 559 572 */ 560 573 PJ_DECL(void) pjsua_call_hangup_all(void); 574 575 576 /** 577 * Dump call and media statistics to string. 578 */ 579 PJ_DECL(void) pjsua_dump_call(int call_index, int with_media, 580 char *buffer, unsigned maxlen, 581 const char *indent); 561 582 562 583 … … 599 620 * this will start unregistration process. 600 621 */ 601 PJ_DECL( void) pjsua_acc_set_registration(unsigned acc_index, pj_bool_t renew);622 PJ_DECL(pj_status_t) pjsua_acc_set_registration(unsigned acc_index, pj_bool_t renew); 602 623 603 624 … … 638 659 * Refresh both presence client and server subscriptions. 639 660 */ 640 PJ_DECL(void) pjsua_pres_refresh( int acc_index);661 PJ_DECL(void) pjsua_pres_refresh(void); 641 662 642 663 /** … … 713 734 * Get conference port associated with player. 714 735 */ 715 PJ_DECL( unsigned) pjsua_player_get_conf_port(pjsua_player_id id);736 PJ_DECL(int) pjsua_player_get_conf_port(pjsua_player_id id); 716 737 717 738 … … 740 761 * Get conference port associated with recorder. 741 762 */ 742 PJ_DECL( unsigned) pjsua_recorder_get_conf_port(pjsua_recorder_id id);763 PJ_DECL(int) pjsua_recorder_get_conf_port(pjsua_recorder_id id); 743 764 744 765 -
pjproject/trunk/pjsip/include/pjsua-lib/pjsua_console_app.h
r476 r487 21 21 22 22 23 pj_status_t pjsua_console_app_logging_init(const pjsua_config *cfg);24 void pjsua_console_app_logging_shutdown(void);25 26 23 void pjsua_console_app_main(void); 27 24 -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_console_app.c
r482 r487 782 782 } 783 783 784 pjsua_pres_refresh( current_acc);784 pjsua_pres_refresh(); 785 785 786 786 } else if (result.uri_result) { … … 815 815 acc_info.acc_id.ptr, 816 816 (acc_info.online_status?"online":"offline")); 817 pjsua_pres_refresh( current_acc);817 pjsua_pres_refresh(); 818 818 break; 819 819 … … 972 972 973 973 /***************************************************************************** 974 * Console application custom logging:975 */976 977 978 static FILE *log_file;979 980 981 static void app_log_writer(int level, const char *buffer, int len)982 {983 /* Write to both stdout and file. */984 985 if (level <= (int)pjsua_get_config()->app_log_level)986 pj_log_write(level, buffer, len);987 988 if (log_file) {989 fwrite(buffer, len, 1, log_file);990 fflush(log_file);991 }992 }993 994 995 pj_status_t pjsua_console_app_logging_init(const pjsua_config *cfg)996 {997 /* Redirect log function to ours */998 999 pj_log_set_log_func( &app_log_writer );1000 1001 /* If output log file is desired, create the file: */1002 1003 if (cfg->log_filename.slen) {1004 log_file = fopen(cfg->log_filename.ptr, "wt");1005 if (log_file == NULL) {1006 PJ_LOG(1,(THIS_FILE, "Unable to open log file %s",1007 cfg->log_filename.ptr));1008 return -1;1009 }1010 }1011 1012 return PJ_SUCCESS;1013 }1014 1015 1016 void pjsua_console_app_logging_shutdown(void)1017 {1018 /* Close logging file, if any: */1019 1020 if (log_file) {1021 fclose(log_file);1022 log_file = NULL;1023 }1024 }1025 1026 /*****************************************************************************1027 974 * Error display: 1028 975 */ -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c
r482 r487 52 52 53 53 cfg->thread_cnt = 1; 54 cfg->media_has_ioqueue = 1; 55 cfg->media_thread_cnt = 1; 54 56 cfg->udp_port = 5060; 55 57 cfg->start_rtp_port = 4000; … … 247 249 } 248 250 251 /** 252 * Poll pjsua. 253 */ 254 PJ_DECL(int) pjsua_handle_events(unsigned msec_timeout) 255 { 256 unsigned count = 0; 257 pj_time_val tv; 258 pj_status_t status; 259 260 tv.sec = 0; 261 tv.msec = msec_timeout; 262 pj_time_val_normalize(&tv); 263 264 status = pjsip_endpt_handle_events2(pjsua.endpt, &tv, &count); 265 if (status != PJ_SUCCESS) 266 return -status; 267 268 return count; 269 } 249 270 250 271 … … 505 526 /* Must create media endpoint too */ 506 527 status = pjmedia_endpt_create(&pjsua.cp.factory, 507 pjsip_endpt_get_ioqueue(pjsua.endpt), 0, 528 pjsua.config.media_has_ioqueue? NULL : 529 pjsip_endpt_get_ioqueue(pjsua.endpt), 530 pjsua.config.media_thread_cnt, 508 531 &pjsua.med_endpt); 509 532 if (status != PJ_SUCCESS) { … … 755 778 756 779 780 /***************************************************************************** 781 * Console application custom logging: 782 */ 783 784 785 static void log_writer(int level, const char *buffer, int len) 786 { 787 /* Write to both stdout and file. */ 788 789 if (level <= (int)pjsua.config.app_log_level) 790 pj_log_write(level, buffer, len); 791 792 if (pjsua.log_file) { 793 fwrite(buffer, len, 1, pjsua.log_file); 794 fflush(pjsua.log_file); 795 } 796 } 797 798 799 static pj_status_t logging_init() 800 { 801 /* Redirect log function to ours */ 802 803 pj_log_set_log_func( &log_writer ); 804 805 /* If output log file is desired, create the file: */ 806 807 if (pjsua.config.log_filename.slen) { 808 pjsua.log_file = fopen(pjsua.config.log_filename.ptr, "wt"); 809 if (pjsua.log_file == NULL) { 810 PJ_LOG(1,(THIS_FILE, "Unable to open log file %s", 811 pjsua.config.log_filename.ptr)); 812 return -1; 813 } 814 } 815 816 return PJ_SUCCESS; 817 } 818 819 820 static void logging_shutdown(void) 821 { 822 /* Close logging file, if any: */ 823 824 if (pjsua.log_file) { 825 fclose(pjsua.log_file); 826 pjsua.log_file = NULL; 827 } 828 } 829 830 757 831 /* 758 832 * Initialize pjsua application. … … 807 881 pj_log_set_level(pjsua.config.log_level); 808 882 pj_log_set_decor(pjsua.config.log_decor); 883 884 status = logging_init(); 885 if (status != PJ_SUCCESS) 886 goto on_error; 809 887 810 888 … … 854 932 } 855 933 status = pjmedia_transport_udp_attach(pjsua.med_endpt, NULL, 856 &pjsua.calls[i].skinfo, 934 &pjsua.calls[i].skinfo, 0, 857 935 &pjsua.calls[i].med_tp); 858 936 } … … 1369 1447 * Get conference port associated with player. 1370 1448 */ 1371 PJ_DEF( unsigned) pjsua_player_get_conf_port(pjsua_player_id id)1449 PJ_DEF(int) pjsua_player_get_conf_port(pjsua_player_id id) 1372 1450 { 1373 1451 PJ_ASSERT_RETURN(id>=0 && id < PJ_ARRAY_SIZE(pjsua.player), PJ_EINVAL); … … 1453 1531 * Get conference port associated with recorder. 1454 1532 */ 1455 PJ_DEF( unsigned) pjsua_recorder_get_conf_port(pjsua_recorder_id id)1533 PJ_DEF(int) pjsua_recorder_get_conf_port(pjsua_recorder_id id) 1456 1534 { 1457 1535 PJ_ASSERT_RETURN(id>=0 && id < PJ_ARRAY_SIZE(pjsua.recorder), PJ_EINVAL); … … 1521 1599 /* Signal threads to quit: */ 1522 1600 pjsua.quit_flag = 1; 1523 1524 /* Terminate all calls. */1525 pjsua_call_hangup_all();1526 1527 /* Terminate all presence subscriptions. */1528 pjsua_pres_shutdown();1529 1530 /* Unregister, if required: */1531 for (i=0; i<(int)pjsua.config.acc_cnt; ++i) {1532 if (pjsua.acc[i].regc) {1533 pjsua_acc_set_registration(i, PJ_FALSE);1534 }1535 }1536 1601 1537 1602 /* Wait worker threads to quit: */ … … 1545 1610 } 1546 1611 1547 1548 /* Wait for some time to allow unregistration to complete: */ 1612 1549 1613 if (pjsua.endpt) { 1614 /* Terminate all calls. */ 1615 pjsua_call_hangup_all(); 1616 1617 /* Terminate all presence subscriptions. */ 1618 pjsua_pres_shutdown(); 1619 1620 /* Unregister, if required: */ 1621 for (i=0; i<(int)pjsua.config.acc_cnt; ++i) { 1622 if (pjsua.acc[i].regc) { 1623 pjsua_acc_set_registration(i, PJ_FALSE); 1624 } 1625 } 1626 1627 /* Wait for some time to allow unregistration to complete: */ 1550 1628 PJ_LOG(4,(THIS_FILE, "Shutting down...")); 1551 1629 busy_sleep(1000); … … 1630 1708 1631 1709 1710 PJ_LOG(4,(THIS_FILE, "PJSUA destroyed...")); 1711 1712 /* End logging */ 1713 logging_shutdown(); 1714 1632 1715 /* Done. */ 1633 1716 -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_imp.h
r482 r487 127 127 pjsua_config config; /**< PJSUA configs */ 128 128 129 /* Log file: */ 130 FILE *log_file; /**< Log file. */ 131 129 132 /* Application callback 130 133 : */ -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_pres.c
r482 r487 472 472 } 473 473 474 info->acc_index = buddy->acc_index; 474 475 return PJ_SUCCESS; 475 476 } … … 550 551 * Refresh presence 551 552 */ 552 PJ_DEF(void) pjsua_pres_refresh(int acc_index) 553 { 553 PJ_DEF(void) pjsua_pres_refresh() 554 { 555 unsigned i; 556 554 557 refresh_client_subscription(); 555 refresh_server_subscription(acc_index); 558 559 for (i=0; i<PJ_ARRAY_SIZE(pjsua.acc); ++i) 560 refresh_server_subscription(i); 556 561 } 557 562 … … 573 578 } 574 579 575 for (acc_index=0; acc_index<(int)pjsua.config.acc_cnt; ++acc_index) { 576 pjsua_pres_refresh(acc_index); 577 } 580 pjsua_pres_refresh(); 578 581 } 579 582 -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_reg.c
r482 r487 133 133 * Update registration. If renew is false, then unregistration will be performed. 134 134 */ 135 PJ_DECL( void) pjsua_acc_set_registration(unsigned acc_index, pj_bool_t renew)135 PJ_DECL(pj_status_t) pjsua_acc_set_registration(unsigned acc_index, pj_bool_t renew) 136 136 { 137 137 pj_status_t status = 0; … … 144 144 pjsua_perror(THIS_FILE, "Unable to create registration", 145 145 status); 146 return ;146 return PJ_EINVALIDOP; 147 147 } 148 148 } 149 149 if (!pjsua.acc[acc_index].regc) 150 return ;150 return PJ_EINVALIDOP; 151 151 152 152 status = pjsip_regc_register(pjsua.acc[acc_index].regc, 1, … … 156 156 if (pjsua.acc[acc_index].regc == NULL) { 157 157 PJ_LOG(3,(THIS_FILE, "Currently not registered")); 158 return ;158 return PJ_EINVALIDOP; 159 159 } 160 160 status = pjsip_regc_unregister(pjsua.acc[acc_index].regc, &tdata); … … 171 171 (renew? "Registration" : "Unregistration"))); 172 172 } 173 174 return status; 173 175 } 174 176 -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_settings.c
r482 r487 686 686 } 687 687 688 static void dump_media_session(pjmedia_session *session) 688 static void dump_media_session(const char *indent, 689 char *buf, unsigned maxlen, 690 pjmedia_session *session) 689 691 { 690 692 unsigned i; 693 char *p = buf, *end = buf+maxlen; 694 int len; 691 695 pjmedia_session_info info; 692 696 … … 716 720 717 721 718 PJ_LOG(3,(THIS_FILE, 719 "%s#%d %.*s @%dKHz, %s, peer=%s:%d", 720 " ", 721 i, 722 len = pj_ansi_snprintf(buf, end-p, 723 "%s #%d %.*s @%dKHz, %s, peer=%s:%d", 724 indent, i, 722 725 info.stream_info[i].fmt.encoding_name.slen, 723 726 info.stream_info[i].fmt.encoding_name.ptr, 724 727 info.stream_info[i].fmt.clock_rate / 1000, 725 728 dir, 726 rem_addr, rem_port)); 729 rem_addr, rem_port); 730 if (len < 1 || len > end-p) { 731 *p = '\0'; 732 return; 733 } 734 735 p += len; 736 *p++ = '\n'; 737 *p = '\0'; 727 738 728 739 if (stat.rx.update_cnt == 0) … … 738 749 } 739 750 740 PJ_LOG(3,(THIS_FILE,741 " 742 " total %spkt %sB (%sB +IP hdr)%s\n"743 " pkt loss=%d (%3.1f%%), dup=%d (%3.1f%%), reorder=%d (%3.1f%%)%s\n"744 " 745 " loss period: %7.3f %7.3f %7.3f %7.3f%s\n"746 " 747 in fo.stream_info[i].fmt.pt,751 len = pj_ansi_snprintf(p, end-p, 752 "%s RX pt=%d, stat last update: %s\n" 753 "%s total %spkt %sB (%sB +IP hdr)\n" 754 "%s pkt loss=%d (%3.1f%%), dup=%d (%3.1f%%), reorder=%d (%3.1f%%)\n" 755 "%s (msec) min avg max last\n" 756 "%s loss period: %7.3f %7.3f %7.3f %7.3f\n" 757 "%s jitter : %7.3f %7.3f %7.3f %7.3f%s", 758 indent, info.stream_info[i].fmt.pt, 748 759 last_update, 760 indent, 749 761 good_number(packets, stat.rx.pkt), 750 762 good_number(bytes, stat.rx.bytes), 751 763 good_number(ipbytes, stat.rx.bytes + stat.rx.pkt * 32), 752 "",764 indent, 753 765 stat.rx.loss, 754 766 stat.rx.loss * 100.0 / stat.rx.pkt, … … 757 769 stat.rx.reorder, 758 770 stat.rx.reorder * 100.0 / stat.rx.pkt, 759 "",771 indent, indent, 760 772 stat.rx.loss_period.min / 1000.0, 761 773 stat.rx.loss_period.avg / 1000.0, 762 774 stat.rx.loss_period.max / 1000.0, 763 775 stat.rx.loss_period.last / 1000.0, 764 "",776 indent, 765 777 stat.rx.jitter.min / 1000.0, 766 778 stat.rx.jitter.avg / 1000.0, … … 768 780 stat.rx.jitter.last / 1000.0, 769 781 "" 770 )); 771 772 782 ); 783 784 if (len < 1 || len > end-p) { 785 *p = '\0'; 786 return; 787 } 788 789 p += len; 790 *p++ = '\n'; 791 *p = '\0'; 792 773 793 if (stat.tx.update_cnt == 0) 774 794 strcpy(last_update, "never"); … … 783 803 } 784 804 785 PJ_LOG(3,(THIS_FILE, 786 " TX pt=%d, ptime=%dms, stat last update: %s\n" 787 " total %spkt %sB (%sB +IP hdr)%s\n" 788 " pkt loss=%d (%3.1f%%), dup=%d (%3.1f%%), reorder=%d (%3.1f%%)%s\n" 789 " (msec) min avg max last\n" 790 " loss period: %7.3f %7.3f %7.3f %7.3f%s\n" 791 " jitter : %7.3f %7.3f %7.3f %7.3f%s", 805 len = pj_ansi_snprintf(p, end-p, 806 "%s TX pt=%d, ptime=%dms, stat last update: %s\n" 807 "%s total %spkt %sB (%sB +IP hdr)\n" 808 "%s pkt loss=%d (%3.1f%%), dup=%d (%3.1f%%), reorder=%d (%3.1f%%)\n" 809 "%s (msec) min avg max last\n" 810 "%s loss period: %7.3f %7.3f %7.3f %7.3f\n" 811 "%s jitter : %7.3f %7.3f %7.3f %7.3f%s", 812 indent, 792 813 info.stream_info[i].tx_pt, 793 814 info.stream_info[i].param->info.frm_ptime * 794 815 info.stream_info[i].param->setting.frm_per_pkt, 795 816 last_update, 817 818 indent, 796 819 good_number(packets, stat.tx.pkt), 797 820 good_number(bytes, stat.tx.bytes), 798 821 good_number(ipbytes, stat.tx.bytes + stat.tx.pkt * 32), 799 "", 822 823 indent, 800 824 stat.tx.loss, 801 825 stat.tx.loss * 100.0 / stat.tx.pkt, … … 804 828 stat.tx.reorder, 805 829 stat.tx.reorder * 100.0 / stat.tx.pkt, 806 "", 830 831 indent, indent, 807 832 stat.tx.loss_period.min / 1000.0, 808 833 stat.tx.loss_period.avg / 1000.0, 809 834 stat.tx.loss_period.max / 1000.0, 810 835 stat.tx.loss_period.last / 1000.0, 811 "",836 indent, 812 837 stat.tx.jitter.min / 1000.0, 813 838 stat.tx.jitter.avg / 1000.0, … … 815 840 stat.tx.jitter.last / 1000.0, 816 841 "" 817 )); 818 819 820 PJ_LOG(3,(THIS_FILE, 821 " RTT msec : %7.3f %7.3f %7.3f %7.3f%s", 842 ); 843 844 if (len < 1 || len > end-p) { 845 *p = '\0'; 846 return; 847 } 848 849 p += len; 850 *p++ = '\n'; 851 *p = '\0'; 852 853 len = pj_ansi_snprintf(p, end-p, 854 "%s RTT msec : %7.3f %7.3f %7.3f %7.3f", 855 indent, 822 856 stat.rtt.min / 1000.0, 823 857 stat.rtt.avg / 1000.0, 824 858 stat.rtt.max / 1000.0, 825 stat.rtt.last / 1000.0, 826 "" 827 )); 828 829 } 859 stat.rtt.last / 1000.0 860 ); 861 if (len < 1 || len > end-p) { 862 *p = '\0'; 863 return; 864 } 865 866 p += len; 867 *p++ = '\n'; 868 *p = '\0'; 869 } 870 } 871 872 PJ_DEF(void) pjsua_dump_call(int call_index, int with_media, 873 char *buffer, unsigned maxlen, 874 const char *indent) 875 { 876 pjsua_call *call = &pjsua.calls[call_index]; 877 pj_time_val duration, res_delay, con_delay; 878 char tmp[128]; 879 char *p, *end; 880 int len; 881 882 *buffer = '\0'; 883 p = buffer; 884 end = buffer + maxlen; 885 len = 0; 886 887 PJ_ASSERT_ON_FAIL(call_index >= 0 && 888 call_index < PJ_ARRAY_SIZE(pjsua.calls), return); 889 890 if (call->inv == NULL) 891 return; 892 893 print_call(indent, call_index, tmp, sizeof(tmp)); 894 895 len = pj_ansi_strlen(tmp); 896 pj_ansi_strcpy(buffer, tmp); 897 898 p += len; 899 *p++ = '\r'; 900 *p++ = '\n'; 901 902 /* Calculate call duration */ 903 if (call->inv->state >= PJSIP_INV_STATE_CONFIRMED) { 904 pj_gettimeofday(&duration); 905 PJ_TIME_VAL_SUB(duration, call->conn_time); 906 con_delay = call->conn_time; 907 PJ_TIME_VAL_SUB(con_delay, call->start_time); 908 } else { 909 duration.sec = duration.msec = 0; 910 con_delay.sec = con_delay.msec = 0; 911 } 912 913 /* Calculate first response delay */ 914 if (call->inv->state >= PJSIP_INV_STATE_EARLY) { 915 res_delay = call->res_time; 916 PJ_TIME_VAL_SUB(res_delay, call->start_time); 917 } else { 918 res_delay.sec = res_delay.msec = 0; 919 } 920 921 /* Print duration */ 922 len = pj_ansi_snprintf(p, end-p, 923 "%s Call time: %02dh:%02dm:%02ds, " 924 "1st res in %d ms, conn in %dms", 925 indent, 926 (duration.sec / 3600), 927 ((duration.sec % 3600)/60), 928 (duration.sec % 60), 929 PJ_TIME_VAL_MSEC(res_delay), 930 PJ_TIME_VAL_MSEC(con_delay)); 931 932 if (len > 0 && len < end-p) { 933 p += len; 934 *p++ = '\n'; 935 *p = '\0'; 936 } 937 938 /* Dump session statistics */ 939 if (with_media && call->session) 940 dump_media_session(indent, p, end-p, call->session); 941 830 942 } 831 943 … … 835 947 PJ_DEF(void) pjsua_dump(pj_bool_t detail) 836 948 { 837 char buf[128];838 949 unsigned old_decor; 950 char buf[1024]; 839 951 840 952 PJ_LOG(3,(THIS_FILE, "Start dumping application states:")); … … 863 975 864 976 for (i=0; i<pjsua.config.max_calls; ++i) { 865 866 pjsua_call *call = &pjsua.calls[i]; 867 pj_time_val duration, res_delay, con_delay; 868 869 if (call->inv == NULL) 870 continue; 871 872 print_call(" ", i, buf, sizeof(buf)); 873 PJ_LOG(3,(THIS_FILE, "%s", buf)); 874 875 /* Calculate call duration */ 876 if (call->inv->state >= PJSIP_INV_STATE_CONFIRMED) { 877 pj_gettimeofday(&duration); 878 PJ_TIME_VAL_SUB(duration, call->conn_time); 879 con_delay = call->conn_time; 880 PJ_TIME_VAL_SUB(con_delay, call->start_time); 881 } else { 882 duration.sec = duration.msec = 0; 883 con_delay.sec = con_delay.msec = 0; 884 } 885 886 /* Calculate first response delay */ 887 if (call->inv->state >= PJSIP_INV_STATE_EARLY) { 888 res_delay = call->res_time; 889 PJ_TIME_VAL_SUB(res_delay, call->start_time); 890 } else { 891 res_delay.sec = res_delay.msec = 0; 892 } 893 894 /* Print duration */ 895 PJ_LOG(3,(THIS_FILE, 896 " Call time: %02dh:%02dm:%02ds, " 897 "1st res in %d ms, conn in %dms", 898 (duration.sec / 3600), 899 ((duration.sec % 3600)/60), 900 (duration.sec % 60), 901 PJ_TIME_VAL_MSEC(res_delay), 902 PJ_TIME_VAL_MSEC(con_delay))); 903 904 /* Dump session statistics */ 905 if (call->session) 906 dump_media_session(call->session); 977 if (pjsua.calls[i].inv) { 978 pjsua_dump_call(i, detail, buf, sizeof(buf), " "); 979 PJ_LOG(3,(THIS_FILE, "%s", buf)); 980 } 907 981 } 908 982 } … … 925 999 char *argv[4] = { "pjsua", "--config-file", NULL, NULL}; 926 1000 927 argv[ 3] = (char*)filename;1001 argv[2] = (char*)filename; 928 1002 return pjsua_parse_args(argc, argv, cfg); 929 1003 } … … 1104 1178 1105 1179 /* Encoding quality and complexity */ 1106 pj_ansi_sprintf(line, "--quality %d\n", 1107 config->quality); 1108 pj_strcat2(&cfg, line); 1109 pj_ansi_sprintf(line, "--complexity %d\n", 1110 config->complexity); 1111 pj_strcat2(&cfg, line); 1180 if (config->quality > 0) { 1181 pj_ansi_sprintf(line, "--quality %d\n", 1182 config->quality); 1183 pj_strcat2(&cfg, line); 1184 } 1185 if (config->complexity > 0) { 1186 pj_ansi_sprintf(line, "--complexity %d\n", 1187 config->complexity); 1188 pj_strcat2(&cfg, line); 1189 } 1112 1190 1113 1191 /* ptime */
Note: See TracChangeset
for help on using the changeset viewer.