1
# $Id: inc_cfg.py 2237 2008-08-26 12:13:25Z bennylp $
7
DEFAULT_START_SIP_PORT = 50000
10
ARGS = [] # arguments containing script module & config
11
HAS_SND_DEV = config_site.HAS_SND_DEV
13
# Individual pjsua instance configuration class
15
# Name to identify this pjsua instance (e.g. "caller", "callee", etc.)
17
# pjsua command line arguments, concatenated in string
19
# Specify whether pjsua output should be echoed to stdout
20
echo_enabled = DEFAULT_ECHO
21
# Enable/disable test tracing
22
trace_enabled = DEFAULT_TRACE
23
# SIP URI to send request to this instance
25
# SIP port number, zero to automatically assign
27
# Does this have registration? If yes then the test function will
28
# wait until the UA is registered before doing anything else
30
# Does this have PUBLISH?
32
# Enable stdout buffer?
36
arg, # Cmd-line arguments
38
uri_param="", # Additional URI param
39
sip_port=0, # SIP port
40
have_reg=False, # Have registration?
41
have_publish=False, # Have publish?
42
echo_enabled=DEFAULT_ECHO,
43
trace_enabled=DEFAULT_TRACE,
44
enable_buffer = False):
47
# Give random sip_port if it's not specified
49
self.sip_port = random.randint(DEFAULT_START_SIP_PORT, 65534)
51
self.sip_port = sip_port
52
# Autogenerate URI if it's empty.
55
self.uri = "sip:pjsip@127.0.0.1:" + str(self.sip_port)
56
# Add uri_param to the URI
57
self.uri = self.uri + uri_param
58
# Add bracket to the URI
59
if self.uri[0] != "<":
60
self.uri = "<" + self.uri + ">"
61
# Add SIP local port to the argument
62
self.arg = arg + " --local-port=" + str(self.sip_port)
63
self.have_reg = have_reg
64
self.have_publish = have_publish
65
if have_publish and have_reg and not ("--publish" in self.arg):
66
self.arg = self.arg + " --publish"
67
self.echo_enabled = echo_enabled
68
self.trace_enabled = trace_enabled
69
self.enable_buffer = enable_buffer
72
############################################
73
# Test parameter class
76
# params is list containing InstanceParams objects
78
# flag if this tes should be skipped
80
# list of Expect instances, to be filled at run-time by
83
# the function for test body
88
inst_params, # InstanceParam's as list
92
need_stdout_buffer=False):
94
self.inst_params = inst_params
97
self.post_func = post_func
100
###################################
101
# TestError exception
104
def __init__(self, desc):