Changeset 2062
- Timestamp:
- Jun 26, 2008 4:27:17 PM (16 years ago)
- Location:
- pjproject/trunk/pjsip-apps/src/test-pjsua
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/src/test-pjsua
- Property svn:ignore
-
old new 1 1 *.pyc 2 2 *log 3 p*.txt
-
- Property svn:ignore
-
pjproject/trunk/pjsip-apps/src/test-pjsua/mod_call.py
r2059 r2062 71 71 # Hold call by caller 72 72 caller.send("H") 73 caller.sync_stdout()73 #caller.sync_stdout() 74 74 caller.expect(const.MEDIA_HOLD) 75 75 callee.expect(const.MEDIA_HOLD) … … 82 82 time.sleep(2) 83 83 caller.send("v") 84 caller.sync_stdout()85 callee.expect(const.MEDIA_ACTIVE )86 caller.expect(const.MEDIA_ACTIVE )84 #caller.sync_stdout() 85 callee.expect(const.MEDIA_ACTIVE, title="waiting for media active after call hold") 86 caller.expect(const.MEDIA_ACTIVE, title="waiting for media active after call hold") 87 87 88 88 # Synchronize stdout … … 100 100 # Hold call by callee 101 101 callee.send("H") 102 callee.sync_stdout()102 #callee.sync_stdout() 103 103 caller.expect(const.MEDIA_HOLD) 104 104 callee.expect(const.MEDIA_HOLD) … … 111 111 time.sleep(2) 112 112 callee.send("v") 113 callee.sync_stdout()114 caller.expect(const.MEDIA_ACTIVE )115 callee.expect(const.MEDIA_ACTIVE )113 #callee.sync_stdout() 114 caller.expect(const.MEDIA_ACTIVE, title="waiting for media active after call hold") 115 callee.expect(const.MEDIA_ACTIVE, title="waiting for media active after call hold") 116 116 117 117 # Synchronize stdout … … 129 129 # UPDATE (by caller) 130 130 caller.send("U") 131 caller.sync_stdout()132 callee.expect(const.MEDIA_ACTIVE )133 caller.expect(const.MEDIA_ACTIVE )131 #caller.sync_stdout() 132 callee.expect(const.MEDIA_ACTIVE, title="waiting for media active with UPDATE") 133 caller.expect(const.MEDIA_ACTIVE, title="waiting for media active with UPDATE") 134 134 135 135 # Synchronize stdout … … 144 144 # UPDATE (by callee) 145 145 callee.send("U") 146 callee.sync_stdout() 147 caller.expect(const.MEDIA_ACTIVE) 148 callee.expect(const.MEDIA_ACTIVE) 149 150 # Synchronize stdout 151 caller.sync_stdout() 152 callee.sync_stdout() 153 154 # Test that media is okay 155 time.sleep(2) 156 check_media(caller, callee) 157 check_media(callee, caller) 146 #callee.sync_stdout() 147 caller.expect(const.MEDIA_ACTIVE, title="waiting for media active with UPDATE") 148 callee.expect(const.MEDIA_ACTIVE, title="waiting for media active with UPDATE") 149 150 # Synchronize stdout 151 caller.sync_stdout() 152 callee.sync_stdout() 153 154 # Test that media is okay 155 time.sleep(2) 156 check_media(caller, callee) 157 check_media(callee, caller) 158 159 # Synchronize stdout 160 caller.sync_stdout() 161 callee.sync_stdout() 162 163 # Set codecs in both caller and callee so that there is 164 # no common codec between them. 165 # In caller we only enable PCMU, in callee we only enable PCMA 166 caller.send("Cp") 167 caller.send("* 0") 168 caller.send("Cp") 169 caller.send("pcmu 120") 170 171 callee.send("Cp") 172 callee.send("* 0") 173 callee.send("Cp") 174 callee.send("pcma 120") 175 176 # Test when UPDATE fails (by callee) 177 callee.send("U") 178 caller.expect("SIP/2.0 488") 179 callee.expect("SIP/2.0 488") 180 callee.sync_stdout() 181 caller.sync_stdout() 182 183 # Test that media is still okay 184 time.sleep(2) 185 check_media(caller, callee) 186 check_media(callee, caller) 187 188 # Test when UPDATE fails (by caller) 189 caller.send("U") 190 callee.expect("SIP/2.0 488") 191 caller.expect("SIP/2.0 488") 192 caller.sync_stdout() 193 callee.sync_stdout() 194 195 # Test that media is still okay 196 time.sleep(2) 197 check_media(callee, caller) 198 check_media(caller, callee) 158 199 159 200 # Hangup call -
pjproject/trunk/pjsip-apps/src/test-pjsua/run.py
r2057 r2062 62 62 fullcmd = G_EXE + " " + inst_param.arg + " --stdout-refresh=5 --stdout-refresh-text=" + const.STDOUT_REFRESH 63 63 self.trace("Popen " + fullcmd) 64 self.proc = subprocess.Popen(fullcmd, shell=G_INUNIX, bufsize=0, stdin=subprocess.PIPE, stdout=subprocess.PIPE, universal_newlines= True)64 self.proc = subprocess.Popen(fullcmd, shell=G_INUNIX, bufsize=0, stdin=subprocess.PIPE, stdout=subprocess.PIPE, universal_newlines=False) 65 65 def send(self, cmd): 66 66 self.trace("send " + cmd) 67 67 self.proc.stdin.writelines(cmd + "\n") 68 def expect(self, pattern, raise_on_error=True): 68 self.proc.stdin.flush() 69 def expect(self, pattern, raise_on_error=True, title=""): 69 70 self.trace("expect " + pattern) 70 71 r = re.compile(pattern, re.I) … … 89 90 self.trace("Timed-out!") 90 91 if raise_on_error: 91 raise TestError(self.name + " : Timeout expecting pattern: " + pattern)92 raise TestError(self.name + " " + title + ": Timeout expecting pattern: \"" + pattern + "\"") 92 93 else: 93 94 return None # timeout
Note: See TracChangeset
for help on using the changeset viewer.