summaryrefslogtreecommitdiff
path: root/tests/pjsua/inc_sip.py
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2010-08-01 09:48:51 +0000
committerBenny Prijono <bennylp@teluu.com>2010-08-01 09:48:51 +0000
commit059d687249f0f95e0b30785c418e1aa47555615a (patch)
tree792e10acf82954faca0a2b7fe937064a1ecb81d8 /tests/pjsua/inc_sip.py
parent1426b8301e4d99837bd70ce73b350d03fafbfd45 (diff)
Implemented core multipart support and support in the invite session (re #1070)
- incoming multipart message will be handled automatically - for testing, enable HAVE_MULTIPART_TEST in pjsua_app.c git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@3243 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'tests/pjsua/inc_sip.py')
-rw-r--r--tests/pjsua/inc_sip.py19
1 files changed, 13 insertions, 6 deletions
diff --git a/tests/pjsua/inc_sip.py b/tests/pjsua/inc_sip.py
index d64ae87f..c27c72f3 100644
--- a/tests/pjsua/inc_sip.py
+++ b/tests/pjsua/inc_sip.py
@@ -107,7 +107,7 @@ class Dialog:
msg = msg.replace("$BRANCH", branch)
return msg
- def create_req(self, method, sdp, branch="", extra_headers=""):
+ def create_req(self, method, sdp, branch="", extra_headers="", body=""):
if branch=="":
self.cseq = self.cseq + 1
msg = req_templ
@@ -119,10 +119,14 @@ class Dialog:
if sdp!="":
msg = msg.replace("$CONTENT_LENGTH", str(len(sdp)))
msg = msg + "Content-Type: application/sdp\r\n"
+ msg = msg + "\r\n"
+ msg = msg + sdp
+ elif body!="":
+ msg = msg.replace("$CONTENT_LENGTH", str(len(body)))
+ msg = msg + "\r\n"
+ msg = msg + body
else:
msg = msg.replace("$CONTENT_LENGTH", "0")
- msg = msg + "\r\n"
- msg = msg + sdp
return self.update_fields(msg)
def create_response(self, request, code, reason, to_tag=""):
@@ -138,9 +142,9 @@ class Dialog:
response = response + line + "\r\n"
return response
- def create_invite(self, sdp, extra_headers=""):
+ def create_invite(self, sdp, extra_headers="", body=""):
self.inv_branch = str(random.random())
- return self.create_req("INVITE", sdp, branch=self.inv_branch, extra_headers=extra_headers)
+ return self.create_req("INVITE", sdp, branch=self.inv_branch, extra_headers=extra_headers, body=body)
def create_ack(self, sdp="", extra_headers=""):
return self.create_req("ACK", sdp, extra_headers=extra_headers, branch=self.inv_branch)
@@ -252,10 +256,12 @@ class SendtoCfg:
resp_include = []
# List of RE patterns that must NOT exist in response
resp_exclude = []
+ # Full (non-SDP) body
+ body = ""
# Constructor
def __init__(self, name, pjsua_args, sdp, resp_code,
resp_inc=[], resp_exc=[], use_tcp=False,
- extra_headers="", complete_msg="",
+ extra_headers="", body="", complete_msg="",
enable_buffer = False):
self.complete_msg = complete_msg
self.sdp = sdp
@@ -264,6 +270,7 @@ class SendtoCfg:
self.resp_exclude = resp_exc
self.use_tcp = use_tcp
self.extra_headers = extra_headers
+ self.body = body
self.inst_param = cfg.InstanceParam("pjsua", pjsua_args)
self.inst_param.enable_buffer = enable_buffer