Changeset 2024 for pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c
- Timestamp:
- Jun 14, 2008 10:43:56 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c
r2023 r2024 25 25 //#define STEREO_DEMO 26 26 27 /* Ringtones */ 28 #define RINGBACK_FREQ1 440 29 #define RINGBACK_FREQ2 480 30 #define RINGBACK_ON 2000 31 #define RINGBACK_OFF 4000 32 33 #define RING_FREQ1 500 34 #define RING_FREQ2 660 35 #define RING_ON 100 36 #define RING_OFF 100 37 #define RING_INTERVAL 4000 27 /* Ringtones US UK */ 28 #define RINGBACK_FREQ1 440 /* 400 */ 29 #define RINGBACK_FREQ2 480 /* 450 */ 30 #define RINGBACK_ON 2000 /* 400 */ 31 #define RINGBACK_OFF 4000 /* 200 */ 32 #define RINGBACK_CNT 1 /* 2 */ 33 #define RINGBACK_INTERVAL 4000 /* 2000 */ 34 35 #define RING_FREQ1 800 36 #define RING_FREQ2 640 37 #define RING_ON 200 38 #define RING_OFF 100 39 #define RING_CNT 3 40 #define RING_INTERVAL 3000 38 41 39 42 … … 3811 3814 /* Create ringback tones */ 3812 3815 if (app_config.no_tones == PJ_FALSE) { 3813 unsigned i ;3814 pjmedia_tone_desc tone[ 3];3816 unsigned i, samples_per_frame; 3817 pjmedia_tone_desc tone[RING_CNT+RINGBACK_CNT]; 3815 3818 pj_str_t name; 3819 3820 samples_per_frame = app_config.media_cfg.audio_frame_ptime * 3821 app_config.media_cfg.clock_rate * 3822 app_config.media_cfg.channel_count / 1000; 3816 3823 3817 3824 /* Ringback tone (call is ringing) */ 3818 3825 name = pj_str("ringback"); 3819 status = pjmedia_tonegen_create2(app_config.pool, &name, 8000, 1, 160, 3826 status = pjmedia_tonegen_create2(app_config.pool, &name, 3827 app_config.media_cfg.clock_rate, 3828 app_config.media_cfg.channel_count, 3829 samples_per_frame, 3820 3830 16, PJMEDIA_TONEGEN_LOOP, 3821 3831 &app_config.ringback_port); … … 3824 3834 3825 3835 pj_bzero(&tone, sizeof(tone)); 3826 tone[0].freq1 = RINGBACK_FREQ1; 3827 tone[0].freq2 = RINGBACK_FREQ2; 3828 tone[0].on_msec = RINGBACK_ON; 3829 tone[0].off_msec = RINGBACK_OFF; 3830 3831 pjmedia_tonegen_play(app_config.ringback_port, 1, &tone[0], 3836 for (i=0; i<RINGBACK_CNT; ++i) { 3837 tone[i].freq1 = RINGBACK_FREQ1; 3838 tone[i].freq2 = RINGBACK_FREQ2; 3839 tone[i].on_msec = RINGBACK_ON; 3840 tone[i].off_msec = RINGBACK_OFF; 3841 } 3842 tone[RINGBACK_CNT-1].off_msec = RINGBACK_INTERVAL; 3843 3844 pjmedia_tonegen_play(app_config.ringback_port, RINGBACK_CNT, tone, 3832 3845 PJMEDIA_TONEGEN_LOOP); 3833 3846 … … 3840 3853 /* Ring (to alert incoming call) */ 3841 3854 name = pj_str("ring"); 3842 status = pjmedia_tonegen_create2(app_config.pool, &name, 8000, 1, 160, 3855 status = pjmedia_tonegen_create2(app_config.pool, &name, 3856 app_config.media_cfg.clock_rate, 3857 app_config.media_cfg.channel_count, 3858 samples_per_frame, 3843 3859 16, PJMEDIA_TONEGEN_LOOP, 3844 3860 &app_config.ring_port); … … 3846 3862 goto on_error; 3847 3863 3848 for (i=0; i< PJ_ARRAY_SIZE(tone); ++i) {3864 for (i=0; i<RING_CNT; ++i) { 3849 3865 tone[i].freq1 = RING_FREQ1; 3850 3866 tone[i].freq2 = RING_FREQ2; … … 3852 3868 tone[i].off_msec = RING_OFF; 3853 3869 } 3854 tone[ PJ_ARRAY_SIZE(tone)-1].off_msec = RING_INTERVAL;3855 3856 pjmedia_tonegen_play(app_config.ring_port, PJ_ARRAY_SIZE(tone),3870 tone[RING_CNT-1].off_msec = RING_INTERVAL; 3871 3872 pjmedia_tonegen_play(app_config.ring_port, RING_CNT, 3857 3873 tone, PJMEDIA_TONEGEN_LOOP); 3858 3874
Note: See TracChangeset
for help on using the changeset viewer.