- Timestamp:
- Jun 25, 2008 6:18:32 PM (16 years ago)
- Location:
- pjproject/trunk/pjsip-apps/src/test-pjsua
- Files:
-
- 8 added
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/src/test-pjsua/inc_cfg.py
r2033 r2052 1 1 # $Id$ 2 2 import random 3 from config_site import * 3 4 4 5 DEFAULT_ECHO = True -
pjproject/trunk/pjsip-apps/src/test-pjsua/inc_const.py
r2029 r2052 43 43 44 44 # Filename to play / record 45 MEDIA_PLAY_FILE = "--play-file 46 MEDIA_REC_FILE = "--rec-file 45 MEDIA_PLAY_FILE = "--play-file\s+(\S+)" 46 MEDIA_REC_FILE = "--rec-file\s+(\S+)" 47 47 48 48 ########################## -
pjproject/trunk/pjsip-apps/src/test-pjsua/mod_media_playrec.py
r2051 r2052 35 35 36 36 # Get input file name 37 endpt.sync_stdout() 38 endpt.send("dc") 39 line = endpt.expect(const.MEDIA_PLAY_FILE) 40 ud.input_filename = re.compile(const.MEDIA_PLAY_FILE).match(line).group(1) 37 ud.input_filename = re.compile(const.MEDIA_PLAY_FILE).search(endpt.inst_param.arg).group(1) 41 38 endpt.trace("Input file = " + ud.input_filename) 42 39 43 40 # Get output file name 44 endpt.sync_stdout() 45 endpt.send("dc") 46 line = endpt.expect(const.MEDIA_REC_FILE) 47 ud.output_filename = re.compile(const.MEDIA_REC_FILE).match(line).group(1) 41 ud.output_filename = re.compile(const.MEDIA_REC_FILE).search(endpt.inst_param.arg).group(1) 48 42 endpt.trace("Output file = " + ud.output_filename) 49 43 -
pjproject/trunk/pjsip-apps/src/test-pjsua/mod_pesq.py
r2038 r2052 39 39 # Test body function 40 40 def test_func(t, user_data): 41 # module debugging purpose42 #user_data.pesq_sample_rate_opt = "+16000"43 #user_data.input_filename = "wavs/input.16.wav"44 #user_data.output_filename = "wavs/tmp.16.wav"45 #return46 47 41 ua1 = t.process[0] 48 42 ua2 = t.process[1] 49 43 50 # Get conference clock rate of UA2 for PESQ sample rate option51 ua2.send("cl")52 clock_rate_line = ua2.expect("Port \#00\[\d+KHz")53 if (clock_rate_line == None):54 raise TestError("Failed getting")55 clock_rate = re.match("Port \#00\[(\d+)KHz", clock_rate_line).group(1)56 user_data.pesq_sample_rate_opt = "+" + clock_rate + "000"57 58 44 # Get input file name 59 ua1.sync_stdout() 60 ua1.send("dc") 61 line = ua1.expect(const.MEDIA_PLAY_FILE) 62 user_data.input_filename = re.compile(const.MEDIA_PLAY_FILE).match(line).group(1) 45 user_data.input_filename = re.compile(const.MEDIA_PLAY_FILE).search(ua1.inst_param.arg).group(1) 63 46 64 47 # Get output file name 65 ua2.sync_stdout() 66 ua2.send("dc") 67 line = ua2.expect(const.MEDIA_REC_FILE) 68 user_data.output_filename = re.compile(const.MEDIA_REC_FILE).match(line).group(1) 48 user_data.output_filename = re.compile(const.MEDIA_REC_FILE).search(ua2.inst_param.arg).group(1) 69 49 70 50 # Find appropriate clock rate for the input file 71 clock_rate = re.compile(".+(\.\d+\.wav)$").match(user_data.output_filename)72 if ( clock_rate==None):51 mo_clock_rate = re.compile("\.(\d+)\.wav").search(user_data.output_filename) 52 if (mo_clock_rate==None): 73 53 raise TestError("Cannot compare input & output, incorrect output filename format") 74 user_data.input_filename = re.sub("\.\d+\.wav$", clock_rate.group(1), user_data.input_filename) 54 clock_rate = mo_clock_rate.group(1) 55 user_data.input_filename = re.sub("\.\d+\.wav", "."+clock_rate+".wav", user_data.input_filename) 75 56 76 time.sleep(1) 77 ua1.sync_stdout() 78 ua2.sync_stdout() 57 if (clock_rate != "8") & (clock_rate != "16"): 58 raise TestError("PESQ only works on clock rate 8kHz or 16kHz, clock rate used = "+clock_rate+ "kHz") 59 60 # Get conference clock rate of UA2 for PESQ sample rate option 61 user_data.pesq_sample_rate_opt = "+" + clock_rate + "000" 79 62 80 63 # UA1 making call … … 82 65 ua1.send(t.inst_params[1].uri) 83 66 ua1.expect(const.STATE_CALLING) 84 67 ua2.expect(const.STATE_CONFIRMED) 68 69 # Disconnect mic -> rec file to avoid echo recorded when using sound device 70 ua2.send("cd 0 1") 71 85 72 # Auto answer, auto play, auto hangup 86 73 # Just wait for call disconnected 87 88 if ua1.expect(const.STATE_CONFIRMED, False)==None: 89 raise TestError("Call failed") 90 ua2.expect(const.STATE_CONFIRMED) 91 92 while True: 74 # Assumed WAV input is no more than 30 secs 75 while 1: 93 76 line = ua2.proc.stdout.readline() 94 77 if line == "": 95 78 raise TestError(ua2.name + ": Premature EOF") 79 96 80 # Search for disconnected text 97 81 if re.search(const.STATE_DISCONNECTED, line) != None: … … 116 100 # Evaluate the similarity value 117 101 pesq_res = mo_pesq_out.group(1) 118 if ( pesq_res>= PESQ_THRESHOLD):102 if (float(pesq_res) >= PESQ_THRESHOLD): 119 103 endpt.trace("Success, PESQ result=" + pesq_res) 120 104 else: -
pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-media-playrec/100_resample_lf_11_16.py
r2029 r2052 7 7 "Resample (large filter) 11 KHZ to 16 KHZ", 8 8 [ 9 InstanceParam("endpt", "--null-audio --quality 10 --clock-rate 16000 --play-file wavs/input.11.wav --rec-file wavs/tmp _output.16.wav")9 InstanceParam("endpt", "--null-audio --quality 10 --clock-rate 16000 --play-file wavs/input.11.wav --rec-file wavs/tmp.16.wav") 10 10 ] 11 11 ) -
pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-media-playrec/100_resample_lf_11_22.py
r2029 r2052 7 7 "Resample (large filter) 11 KHZ to 22 KHZ", 8 8 [ 9 InstanceParam("endpt", "--null-audio --quality 10 --clock-rate 22050 --play-file wavs/input.11.wav --rec-file wavs/tmp _output.22.wav")9 InstanceParam("endpt", "--null-audio --quality 10 --clock-rate 22050 --play-file wavs/input.11.wav --rec-file wavs/tmp.22.wav") 10 10 ] 11 11 ) -
pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-media-playrec/100_resample_lf_11_32.py
r2029 r2052 7 7 "Resample (large filter) 11 KHZ to 32 KHZ", 8 8 [ 9 InstanceParam("endpt", "--null-audio --quality 10 --clock-rate 32000 --play-file wavs/input.11.wav --rec-file wavs/tmp _output.32.wav")9 InstanceParam("endpt", "--null-audio --quality 10 --clock-rate 32000 --play-file wavs/input.11.wav --rec-file wavs/tmp.32.wav") 10 10 ] 11 11 ) -
pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-media-playrec/100_resample_lf_11_44.py
r2029 r2052 7 7 "Resample (large filter) 11 KHZ to 44 KHZ", 8 8 [ 9 InstanceParam("endpt", "--null-audio --quality 10 --clock-rate 44100 --play-file wavs/input.11.wav --rec-file wavs/tmp _output.44.wav")9 InstanceParam("endpt", "--null-audio --quality 10 --clock-rate 44100 --play-file wavs/input.11.wav --rec-file wavs/tmp.44.wav") 10 10 ] 11 11 ) -
pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-media-playrec/100_resample_lf_11_48.py
r2029 r2052 7 7 "Resample (large filter) 11 KHZ to 48 KHZ", 8 8 [ 9 InstanceParam("endpt", "--null-audio --quality 10 --clock-rate 48000 --play-file wavs/input.11.wav --rec-file wavs/tmp _output.48.wav")9 InstanceParam("endpt", "--null-audio --quality 10 --clock-rate 48000 --play-file wavs/input.11.wav --rec-file wavs/tmp.48.wav") 10 10 ] 11 11 ) -
pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-media-playrec/100_resample_lf_11_8.py
r2029 r2052 7 7 "Resample (large filter) 11 KHZ to 8 KHZ", 8 8 [ 9 InstanceParam("endpt", "--null-audio --quality 10 --clock-rate 8000 --play-file wavs/input.11.wav --rec-file wavs/tmp _output.8.wav")9 InstanceParam("endpt", "--null-audio --quality 10 --clock-rate 8000 --play-file wavs/input.11.wav --rec-file wavs/tmp.8.wav") 10 10 ] 11 11 ) -
pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-media-playrec/100_resample_lf_8_11.py
r2029 r2052 7 7 "Resample (large filter) 8 KHZ to 11 KHZ", 8 8 [ 9 InstanceParam("endpt", "--null-audio --quality 10 --clock-rate 11025 --play-file wavs/input.8.wav --rec-file wavs/tmp _output.11.wav")9 InstanceParam("endpt", "--null-audio --quality 10 --clock-rate 11025 --play-file wavs/input.8.wav --rec-file wavs/tmp.11.wav") 10 10 ] 11 11 ) -
pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-media-playrec/100_resample_lf_8_16.py
r2029 r2052 7 7 "Resample (large filter) 8 KHZ to 16 KHZ", 8 8 [ 9 InstanceParam("endpt", "--null-audio --quality 10 --clock-rate 16000 --play-file wavs/input.8.wav --rec-file wavs/tmp _output.16.wav")9 InstanceParam("endpt", "--null-audio --quality 10 --clock-rate 16000 --play-file wavs/input.8.wav --rec-file wavs/tmp.16.wav") 10 10 ] 11 11 ) -
pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-media-playrec/100_resample_lf_8_22.py
r2029 r2052 7 7 "Resample (large filter) 8 KHZ to 22 KHZ", 8 8 [ 9 InstanceParam("endpt", "--null-audio --quality 10 --clock-rate 22050 --play-file wavs/input.8.wav --rec-file wavs/tmp _output.22.wav")9 InstanceParam("endpt", "--null-audio --quality 10 --clock-rate 22050 --play-file wavs/input.8.wav --rec-file wavs/tmp.22.wav") 10 10 ] 11 11 ) -
pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-media-playrec/100_resample_lf_8_32.py
r2029 r2052 7 7 "Resample (large filter) 8 KHZ to 32 KHZ", 8 8 [ 9 InstanceParam("endpt", "--null-audio --quality 10 --clock-rate 32000 --play-file wavs/input.8.wav --rec-file wavs/tmp _output.32.wav")9 InstanceParam("endpt", "--null-audio --quality 10 --clock-rate 32000 --play-file wavs/input.8.wav --rec-file wavs/tmp.32.wav") 10 10 ] 11 11 ) -
pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-media-playrec/100_resample_lf_8_44.py
r2029 r2052 7 7 "Resample (large filter) 8 KHZ to 44 KHZ", 8 8 [ 9 InstanceParam("endpt", "--null-audio --quality 10 --clock-rate 44100 --play-file wavs/input.8.wav --rec-file wavs/tmp _output.44.wav")9 InstanceParam("endpt", "--null-audio --quality 10 --clock-rate 44100 --play-file wavs/input.8.wav --rec-file wavs/tmp.44.wav") 10 10 ] 11 11 ) -
pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-media-playrec/100_resample_lf_8_48.py
r2029 r2052 7 7 "Resample (large filter) 8 KHZ to 48 KHZ", 8 8 [ 9 InstanceParam("endpt", "--null-audio --quality 10 --clock-rate 48000 --play-file wavs/input.8.wav --rec-file wavs/tmp _output.48.wav")9 InstanceParam("endpt", "--null-audio --quality 10 --clock-rate 48000 --play-file wavs/input.8.wav --rec-file wavs/tmp.48.wav") 10 10 ] 11 11 ) -
pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-pesq/100_defaults.py
r2038 r2052 3 3 from inc_cfg import * 4 4 5 # Simple call 5 ADD_PARAM = "" 6 7 if (HAS_SND_DEV == 0): 8 ADD_PARAM += "--null-audio" 9 10 # Call with default pjsua settings 6 11 test_param = TestParam( 7 "PESQ ",12 "PESQ defaults pjsua settings", 8 13 [ 9 InstanceParam("UA1", "--null-audio--max-calls=1 --play-file wavs/input.16.wav --auto-play-hangup"),10 InstanceParam("UA2", "--null-audio--max-calls=1 --rec-file wavs/tmp.16.wav --clock-rate 16000 --auto-answer 200 --auto-rec")14 InstanceParam("UA1", ADD_PARAM + " --max-calls=1 --play-file wavs/input.16.wav --auto-play-hangup"), 15 InstanceParam("UA2", ADD_PARAM + " --max-calls=1 --rec-file wavs/tmp.16.wav --clock-rate 16000 --auto-answer 200 --auto-rec") 11 16 ] 12 17 ) -
pjproject/trunk/pjsip-apps/src/test-pjsua/wavs
-
Property
svn:ignore
set to
tmp*.wav
-
Property
svn:ignore
set to
Note: See TracChangeset
for help on using the changeset viewer.