Changeset 2025 for pjproject/trunk/pjsip-apps/src/test-pjsua/inc_cfg.py
- Timestamp:
- Jun 15, 2008 7:43:43 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/src/test-pjsua/inc_cfg.py
- Property svn:eol-style set to native
- Property svn:keywords set to id
r2017 r2025 1 1 # $Id:$ 2 import random 2 3 3 4 DEFAULT_ECHO = True 4 5 DEFAULT_TRACE = True 6 DEFAULT_START_SIP_PORT = 50000 5 7 6 # Individual pjsua config class 7 class Config: 8 # Individual pjsua instance configuration class 9 class InstanceParam: 10 # Name to identify this pjsua instance (e.g. "caller", "callee", etc.) 11 name = "" 8 12 # pjsua command line arguments, concatenated in string 9 13 arg = "" … … 12 16 # Enable/disable test tracing 13 17 trace_enabled = DEFAULT_TRACE 14 def __init__(self, arg, echo_enabled=DEFAULT_ECHO, trace_enabled=DEFAULT_TRACE): 15 self.arg = arg 18 # SIP URI to send request to this instance 19 uri = "" 20 # SIP port number, zero to automatically assign 21 sip_port = 0 22 # Does this have registration? If yes then the test function will 23 # wait until the UA is registered before doing anything else 24 have_reg = False 25 # Does this have PUBLISH? 26 have_publish = False 27 def __init__( self, 28 name, # Instance name 29 arg, # Cmd-line arguments 30 uri="", # URI 31 uri_param="", # Additional URI param 32 sip_port=0, # SIP port 33 have_reg=False, # Have registration? 34 have_publish=False, # Have publish? 35 echo_enabled=DEFAULT_ECHO, 36 trace_enabled=DEFAULT_TRACE): 37 # Instance name 38 self.name = name 39 # Give random sip_port if it's not specified 40 if sip_port==0: 41 self.sip_port = random.randint(DEFAULT_START_SIP_PORT, 65534) 42 else: 43 self.sip_port = sip_port 44 # Autogenerate URI if it's empty. 45 self.uri = uri 46 if self.uri=="": 47 self.uri = "sip:pjsip@127.0.0.1:" + str(self.sip_port) 48 # Add uri_param to the URI 49 self.uri = self.uri + uri_param 50 # Add bracket to the URI 51 if self.uri[0] != "<": 52 self.uri = "<" + self.uri + ">" 53 # Add SIP local port to the argument 54 self.arg = arg + " --local-port=" + str(self.sip_port) 55 self.have_reg = have_reg 56 self.have_publish = have_publish 57 if not ("--publish" in self.arg): 58 self.arg = self.arg + " --publish" 16 59 self.echo_enabled = echo_enabled 17 60 self.trace_enabled = trace_enabled 18 61 19 # Call config class 20 class CallConfig: 21 # additional parameter to be added to target URI 22 uri_param = "" 23 def __init__(self, title, callee_cfg, caller_cfg): 62 63 ############################################ 64 # Test parameter class 65 class TestParam: 66 title = "" 67 # params is list containing InstanceParams objects 68 inst_params = [] 69 # list of Expect instances, to be filled at run-time by 70 # the test program 71 process = [] 72 # the function for test body 73 test_func = None 74 def __init__( self, 75 title, # Test title 76 inst_params, # InstanceParam's as list 77 func=None): 24 78 self.title = title 25 self. callee_cfg = callee_cfg26 self. caller_cfg = caller_cfg79 self.inst_params = inst_params 80 self.test_func = func 27 81 82 83
Note: See TracChangeset
for help on using the changeset viewer.