Changeset 4177 for pjproject/trunk/tests/pjsua/mod_sipp.py
- Timestamp:
- Jun 26, 2012 2:28:59 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/tests/pjsua/mod_sipp.py
r4147 r4177 8 8 import subprocess 9 9 from inc_cfg import * 10 import inc_const 10 11 11 12 # SIPp executable path and param … … 13 14 SIPP_PATH = 'sipp' 14 15 SIPP_PARAM = "-i 127.0.0.1 -p 6000 -m 1 127.0.0.1" 15 SIPP_TIMEOUT = 1016 SIPP_TIMEOUT = 60 16 17 # On BG mode, SIPp doesn't require special terminal 17 18 # On non-BG mode, on win, it needs env var: "TERMINFO=c:\cygwin\usr\share\terminfo" 18 19 SIPP_BG_MODE = True 19 20 20 PJSUA_DEF_PARAM = "--null-audio --max-calls=1 --no-tcp" 21 # Will be updated based on configuration file (a .py file whose the same name as SIPp XML file) 21 22 PJSUA_INST_PARAM = [] 22 23 PJSUA_EXPECTS = [] 24 25 # Default PJSUA param if configuration file (the corresponding .py file) is not available: 26 # - no-tcp as SIPp is on UDP only 27 # - id, username, and realm: to allow PJSUA sending re-INVITE with auth after receiving 401/407 response 28 PJSUA_DEF_PARAM = "--null-audio --max-calls=1 --no-tcp --id=sip:a@localhost --username=a --realm=*" 23 29 24 30 # Get SIPp scenario (XML file) … … 58 64 sipp_param = sipp_param + " -bg" 59 65 if SIPP_TIMEOUT: 60 sipp_param = sipp_param + " -timeout "+str(SIPP_TIMEOUT)+"s -timeout_error" 66 sipp_param = sipp_param + " -timeout "+str(SIPP_TIMEOUT)+"s -timeout_error" + " -deadcall_wait "+str(SIPP_TIMEOUT)+"s" 61 67 fullcmd = os.path.normpath(SIPP_PATH) + " " + sipp_param 62 68 print "Running SIPP: " + fullcmd … … 132 138 ua.append(t.process[ua_idx]) 133 139 134 # If there is no PJSUA EXPECT scenario, must keep polling PJSUA stdout135 # otherwise PJSUA process may stuck (due to stdout pipe buffer full?)136 # Ideally the poll should be done contiunously until SIPp process is137 # terminated.138 if len(PJSUA_EXPECTS)==0:139 import inc_const140 ua[0].expect(inc_const.STDOUT_REFRESH, raise_on_error = False)141 return ""142 143 140 ua_err_st = "" 144 141 while len(PJSUA_EXPECTS): … … 159 156 ua_err_st = "Unknown error" 160 157 break; 158 159 # Need to poll here for handling these cases: 160 # - If there is no PJSUA EXPECT scenario, we must keep polling the stdout, 161 # otherwise PJSUA process may stuck (due to stdout pipe buffer full?). 162 # - last PJSUA_EXPECT contains a pjsua command that needs time to 163 # finish, for example "v" (re-INVITE), the SIPp XML scenario may expect 164 # that re-INVITE transaction to be completed and without stdout poll 165 # PJSUA process may stuck. 166 # Ideally the poll should be done contiunously until SIPp process is 167 # terminated. 168 ua[0].expect(inc_const.STDOUT_REFRESH, raise_on_error = False) 161 169 162 170 return ua_err_st
Note: See TracChangeset
for help on using the changeset viewer.