initial commit

This commit is contained in:
Dan Bastone committed 2021-10-29 14:41:03 -04:00
commit 636959b37b
2474 files changed
+1343178

No files matched your search

@@ -0,0 +1,52 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
# Torture message from RFC 4475
# 3.1.1. Valid Messages
# 3.1.1.1. A Short Tortuous INVITE
complete_msg = \
"""INVITE sip:vivekg@chair-dnrc.example.com;unknownparam SIP/2.0
TO :
sip:vivekg@chair-dnrc.example.com ; tag = 1918181833n
from : "J Rosenberg \\\\\\"" <sip:jdrosen@example.com>
;
tag = 98asjd8
MaX-fOrWaRdS: 0068
Call-ID: wsinv.ndaksdj@192.0.2.1
Content-Length : 150
cseq: 0009
INVITE
Via : SIP / 2.0
/UDP
192.0.2.2;rport;branch=390skdjuw
s :
NewFangledHeader: newfangled value
continued newfangled value
UnknownHeaderWithUnusualValue: ;;,,;;,;
Content-Type: application/sdp
Route:
<sip:services.example.com;lr;unknownwith=value;unknown-no-value>
v: SIP / 2.0 / TCP spindle.example.com ;
branch = z9hG4bK9ikj8 ,
SIP / 2.0 / UDP 192.168.255.111 ; branch=
z9hG4bK30239
m:"Quoted string \\"\\"" <sip:jdrosen@example.com> ; newparam =
newvalue ;
secondparam ; q = 0.33
v=0
o=mhandley 29739 7272939 IN IP4 192.0.2.3
s=-
c=IN IP4 192.0.2.4
t=0 0
m=audio 49217 RTP/AVP 0 12
m=video 3227 RTP/AVP 31
a=rtpmap:31 LPC
"""
sendto_cfg = sip.SendtoCfg( "RFC 4475 3.1.1.1",
"--null-audio --auto-answer 200",
"", 481, complete_msg=complete_msg)
@@ -0,0 +1,25 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
# Torture message from RFC 4475
# 3.1.1. Valid Messages
# 3.1.1.2. Wide Range of Valid Characters
complete_msg = \
"""!interesting-Method0123456789_*+`.%indeed'~ sip:1_unusual.URI~(to-be!sure)&isn't+it$/crazy?,/;;*:&it+has=1,weird!*pas$wo~d_too.(doesn't-it)@example.com SIP/2.0
Via: SIP/2.0/UDP host1.example.com;rport;branch=z9hG4bK-.!%66*_+`'~
To: "BEL:\\\x07 NUL:\\\x00 DEL:\\\x7F" <sip:1_unusual.URI~(to-be!sure)&isn't+it$/crazy?,/;;*@example.com>
From: token1~` token2'+_ token3*%!.- <sip:mundane@example.com> ;fromParam''~+*_!.-%="\xD1\x80\xD0\xB0\xD0\xB1\xD0\xBE\xD1\x82\xD0\xB0\xD1\x8E\xD1\x89\xD0\xB8\xD0\xB9";tag=_token~1'+`*%!-.
Call-ID: intmeth.word%ZK-!.*_+'@word`~)(><:\\/"][?}{
CSeq: 139122385 !interesting-Method0123456789_*+`.%indeed'~
Max-Forwards: 255
extensionHeader-!.%*+_`'~: \xEF\xBB\xBF\xE5\xA4\xA7\xE5\x81\x9C\xE9\x9B\xBB
Content-Length: 0
"""
sendto_cfg = sip.SendtoCfg( "RFC 4475 3.1.1.2",
"--null-audio --auto-answer 200",
"", 405, complete_msg=complete_msg)
@@ -0,0 +1,35 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
# Torture message from RFC 4475
# 3.1.1. Valid Messages
# 3.1.1.3. Valid Use of the % Escaping Mechanism
complete_msg = \
"""INVITE sip:sips%3Auser%40example.com@example.net SIP/2.0
To: sip:%75se%72@example.com
From: <sip:I%20have%20spaces@example.net>;tag=$FROM_TAG
Max-Forwards: 87
i: esc01.239409asdfakjkn23onasd0-3234
CSeq: 234234 INVITE
Via: SIP/2.0/UDP host5.example.net;rport;branch=z9hG4bKkdjuw
C: application/sdp
Contact:
<sip:cal%6Cer@$LOCAL_IP:$LOCAL_PORT;%6C%72;n%61me=v%61lue%25%34%31>
Content-Length: 150
v=0
o=mhandley 29739 7272939 IN IP4 192.0.2.1
s=-
c=IN IP4 192.0.2.1
t=0 0
m=audio 49217 RTP/AVP 0 12
m=video 3227 RTP/AVP 31
a=rtpmap:31 LPC
"""
sendto_cfg = sip.SendtoCfg( "RFC 4475 3.1.1.3",
"--null-audio --auto-answer 200",
"", 200, complete_msg=complete_msg)
@@ -0,0 +1,25 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
# Torture message from RFC 4475
# 3.1.1. Valid Messages
# 3.1.1.4. Escaped Nulls in URIs
complete_msg = \
"""REGISTER sip:example.com SIP/2.0
To: sip:null-%00-null@example.com
From: sip:null-%00-null@example.com;tag=839923423
Max-Forwards: 70
Call-ID: escnull.39203ndfvkjdasfkq3w4otrq0adsfdfnavd
CSeq: 14398234 REGISTER
Via: SIP/2.0/UDP host5.example.com;rport;branch=z9hG4bKkdjuw
Contact: <sip:%00@host5.example.com>
Contact: <sip:%00%00@host5.example.com>
L:0
"""
sendto_cfg = sip.SendtoCfg( "RFC 4475 3.1.1.4",
"--null-audio --auto-answer 200",
"", 200, complete_msg=complete_msg)
@@ -0,0 +1,25 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
# Torture message from RFC 4475
# 3.1.1. Valid Messages
# 3.1.1.5. Use of % When It Is Not an Escape
complete_msg = \
"""RE%47IST%45R sip:registrar.example.com SIP/2.0
To: "%Z%45" <sip:resource@example.com>
From: "%Z%45" <sip:resource@example.com>;tag=f232jadfj23
Call-ID: esc02.asdfnqwo34rq23i34jrjasdcnl23nrlknsdf
Via: SIP/2.0/TCP host.example.com;rport;branch=z9hG4bK209%fzsnel234
CSeq: 29344 RE%47IST%45R
Max-Forwards: 70
Contact: <sip:alias1@host1.example.com>
C%6Fntact: <sip:alias2@host2.example.com>
Contact: <sip:alias3@host3.example.com>
l: 0
"""
sendto_cfg = sip.SendtoCfg( "RFC 4475 3.1.1.5",
"--null-audio --auto-answer 200",
"", 405, complete_msg=complete_msg)
@@ -0,0 +1,20 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=pjmedia
c=IN IP4 127.0.0.1
t=0 0
m=audio 4000 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=sendrecv
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
"""
sendto_cfg = sip.SendtoCfg( "simple call", "--null-audio --auto-answer 200", sdp, 200)
@@ -0,0 +1,46 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
# Handling of incoming tel: URI.
complete_msg = \
"""INVITE tel:+2065551212 SIP/2.0
Via: SIP/2.0/UDP $LOCAL_IP:$LOCAL_PORT;rport;x-route-tag="tgrp:cococisco1";branch=z9hG4bK61E05
From: <tel:12345>$FROM_TAG
To: <tel:+2065551212>
Date: Thu, 12 Feb 2009 18:32:33 GMT
Call-ID: 58F8F7D6-F86A11DD-8013D591-5694EF79
Supported: 100rel,timer,resource-priority
Min-SE: 86400
Cisco-Guid: 1492551325-4167700957-2148586897-1452601209
User-Agent: Cisco-SIPGateway/IOS-12.x
Allow: INVITE, OPTIONS, BYE, CANCEL, ACK, PRACK, UPDATE, REFER, SUBSCRIBE, NOTIFY, INFO, REGISTER
CSeq: 101 INVITE
Max-Forwards: 70
Timestamp: 1234463553
Contact: <tel:+1234;ext=1>
Contact: <sip:tester@$LOCAL_IP:$LOCAL_PORT>
Record-Route: <sip:tester@$LOCAL_IP:$LOCAL_PORT;lr>
Expires: 180
Allow-Events: telephone-event
Content-Type: application/sdp
Content-Disposition: session;handling=required
Content-Length: 265
v=0
o=CiscoSystemsSIP-GW-UserAgent 1296 9529 IN IP4 X.X.X.X
s=SIP Call
c=IN IP4 $LOCAL_IP
t=0 0
m=audio 18676 RTP/AVP 0 101 19
c=IN IP4 $LOCAL_IP
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=rtpmap:19 CN/8000
a=ptime:20
"""
sendto_cfg = sip.SendtoCfg( "tel: URI", "--null-audio --auto-answer 200",
"", 200, complete_msg=complete_msg)
@@ -0,0 +1,28 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
# Video uses dynamic payload type
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=-
c=IN IP4 127.0.0.1
t=0 0
m=audio 5000 RTP/AVP 0
m=video 4000 RTP/AVP 100
a=rtpmap:100 myvideo/80000
"""
pjsua_args = "--null-audio --auto-answer 200"
extra_headers = ""
include = ["Content-Type: application/sdp", # response must include SDP
"m=audio [1-9]+[0-9]* RTP/AVP[\\s\\S]+m=video 0 RTP/AVP"
]
exclude = []
sendto_cfg = sip.SendtoCfg("Mixed audio and video", pjsua_args, sdp, 200,
extra_headers=extra_headers,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,28 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
# In this case the video codec uses dynamic payload type
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=-
c=IN IP4 127.0.0.1
t=0 0
m=video 4000 RTP/AVP 100
a=rtpmap:100 myvideo/96000
m=audio 5000 RTP/AVP 0
"""
pjsua_args = "--null-audio --auto-answer 200"
extra_headers = ""
include = ["Content-Type: application/sdp", # response must include SDP
"m=video 0 RTP[\\s\\S]+m=audio [1-9]+[0-9]* RTP/AVP"
]
exclude = []
sendto_cfg = sip.SendtoCfg("Mixed audio and video", pjsua_args, sdp, 200,
extra_headers=extra_headers,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,28 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
# Video uses static payload type which will cause failure
# when session.c looks-up the codec in codec manager
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=-
c=IN IP4 127.0.0.1
t=0 0
m=audio 5000 RTP/AVP 0
m=video 4000 RTP/AVP 54
"""
pjsua_args = "--null-audio --auto-answer 200"
extra_headers = ""
include = ["Content-Type: application/sdp", # response must include SDP
"m=audio [1-9]+[0-9]* RTP/AVP[\\s\\S]+m=video 0 RTP"
]
exclude = []
sendto_cfg = sip.SendtoCfg("Mixed audio and video", pjsua_args, sdp, 200,
extra_headers=extra_headers,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,28 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
# Video uses static payload type which will cause failure
# when session.c looks-up the codec in codec manager
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=-
c=IN IP4 127.0.0.1
t=0 0
m=video 4000 RTP/AVP 54
m=audio 5000 RTP/AVP 0
"""
pjsua_args = "--null-audio --auto-answer 200"
extra_headers = ""
include = ["Content-Type: application/sdp", # response must include SDP
"m=video 0 RTP/AVP[\\s\\S]+m=audio [1-9]+[0-9]* RTP/AVP"
]
exclude = []
sendto_cfg = sip.SendtoCfg("Mixed audio and video", pjsua_args, sdp, 200,
extra_headers=extra_headers,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,27 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=-
c=IN IP4 127.0.0.1
t=0 0
m=audio 5000 RTP/AVP 0
m=xapplicationx 4000 RTP/AVP 100
a=rtpmap:100 myapp/80000
"""
pjsua_args = "--null-audio --auto-answer 200"
extra_headers = ""
include = ["Content-Type: application/sdp", # response must include SDP
"m=audio [1-9]+[0-9]* RTP/AVP[\\s\\S]+m=xapplicationx 0 RTP/AVP"
]
exclude = []
sendto_cfg = sip.SendtoCfg("Mixed audio and unknown", pjsua_args, sdp, 200,
extra_headers=extra_headers,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,27 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=-
c=IN IP4 127.0.0.1
t=0 0
m=xapplicationx 4000 RTP/AVP 100
a=rtpmap:100 myapp/80000
m=audio 5000 RTP/AVP 0
"""
pjsua_args = "--null-audio --auto-answer 200"
extra_headers = ""
include = ["Content-Type: application/sdp", # response must include SDP
"m=xapplicationx 0 RTP/AVP[\\s\\S]+m=audio [1-9]+[0-9]* RTP/AVP"
]
exclude = []
sendto_cfg = sip.SendtoCfg("Mixed audio and unknown", pjsua_args, sdp, 200,
extra_headers=extra_headers,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,27 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
# The unknown media uses static payload type
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=-
c=IN IP4 127.0.0.1
t=0 0
m=audio 5000 RTP/AVP 0
m=xapplicationx 4000 RTP/AVP 54
"""
pjsua_args = "--null-audio --auto-answer 200"
extra_headers = ""
include = ["Content-Type: application/sdp", # response must include SDP
"m=audio [1-9]+[0-9]* RTP/AVP[\\s\\S]+m=xapplicationx 0 RTP/AVP"
]
exclude = []
sendto_cfg = sip.SendtoCfg("Mixed audio and unknown", pjsua_args, sdp, 200,
extra_headers=extra_headers,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,27 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
# The unknown media uses static payload type
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=-
c=IN IP4 127.0.0.1
t=0 0
m=xapplicationx 4000 RTP/AVP 54
m=audio 5000 RTP/AVP 0
"""
pjsua_args = "--null-audio --auto-answer 200"
extra_headers = ""
include = ["Content-Type: application/sdp", # response must include SDP
"m=xapplicationx 0 RTP/AVP[\\s\\S]+m=audio [1-9]+[0-9]* RTP/AVP"
]
exclude = []
sendto_cfg = sip.SendtoCfg("Mixed audio and unknown", pjsua_args, sdp, 200,
extra_headers=extra_headers,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,27 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=-
c=IN IP4 127.0.0.1
t=0 0
m=audio 5000 RTP/AVP 0
m=xapplicationx 4000 XRTPX/XAVPX 54
"""
pjsua_args = "--null-audio --auto-answer 200"
extra_headers = ""
include = ["Content-Type: application/sdp", # response must include SDP
"m=audio [1-9]+[0-9]* RTP/AVP[\\s\\S]+m=xapplicationx 0 XRTPX/XAVPX "
]
exclude = []
sendto_cfg = sip.SendtoCfg("Mixed audio and unknown and with unknown transport",
pjsua_args, sdp, 200,
extra_headers=extra_headers,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,29 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
# Multiple good m=audio lines! The current algorithm in pjsua-lib will
# select the first audio (note that in 1.x it will select the last audio)
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=-
c=IN IP4 127.0.0.1
t=0 0
m=audio 5000 RTP/AVP 0
m=audio 4000 RTP/AVP 0
m=audio 3000 RTP/AVP 0
"""
pjsua_args = "--null-audio --auto-answer 200"
extra_headers = ""
include = ["Content-Type: application/sdp", # response must include SDP
"m=audio [1-9]+[0-9]* RTP/AVP[\\s\\S]+m=audio 0 RTP/AVP[\\s\\S]+m=audio 0 RTP/AVP"
]
exclude = []
sendto_cfg = sip.SendtoCfg("Mutiple good m=audio lines", pjsua_args, sdp, 200,
extra_headers=extra_headers,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,27 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
# Multiple m=audio, one of them is bad
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=-
c=IN IP4 127.0.0.1
t=0 0
m=audio 5000 RTP/AVP 0
m=audio 4000 UNKNOWN 0
"""
pjsua_args = "--null-audio --auto-answer 200"
extra_headers = ""
include = ["Content-Type: application/sdp", # response must include SDP
"m=audio [1-9]+[0-9]* RTP/AVP[\\s\\S]+m=audio 0 UNKNOWN"
]
exclude = []
sendto_cfg = sip.SendtoCfg("Audio and bad audio", pjsua_args, sdp, 200,
extra_headers=extra_headers,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,27 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
# Multiple m=audio, one of them is bad
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=-
c=IN IP4 127.0.0.1
t=0 0
m=audio 4000 UNKNOWN 0
m=audio 5000 RTP/AVP 0
"""
pjsua_args = "--null-audio --auto-answer 200"
extra_headers = ""
include = ["Content-Type: application/sdp", # response must include SDP
"m=audio 0 UNKNOWN[\\s\\S]+m=audio [1-9]+[0-9]* RTP/AVP"
]
exclude = []
sendto_cfg = sip.SendtoCfg("Audio and bad audio", pjsua_args, sdp, 200,
extra_headers=extra_headers,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,28 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
# Multiple m=audio, one of them has dynamic PT codec that we don't support
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=-
c=IN IP4 127.0.0.1
t=0 0
m=audio 5000 RTP/AVP 100
a=rtpmap:100 someunknowncodec/8000
m=audio 4000 RTP/AVP 0
"""
pjsua_args = "--null-audio --auto-answer 200"
extra_headers = ""
include = ["Content-Type: application/sdp", # response must include SDP
"m=audio 0 RTP/AVP[\s\S]+m=audio [1-9]+[0-9]* RTP/AVP"
]
exclude = []
sendto_cfg = sip.SendtoCfg("Multiple audio lines", pjsua_args, sdp, 200,
extra_headers=extra_headers,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,27 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
# Multiple m=audio, one of them has static PT codec that we don't support
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=-
c=IN IP4 127.0.0.1
t=0 0
m=audio 5000 RTP/AVP 80
m=audio 4000 RTP/AVP 0
"""
pjsua_args = "--null-audio --auto-answer 200"
extra_headers = ""
include = ["Content-Type: application/sdp", # response must include SDP
"m=audio 0 RTP/AVP[\s\S]+m=audio [1-9]+[0-9]* RTP/AVP"
]
exclude = []
sendto_cfg = sip.SendtoCfg("Multiple audio lines", pjsua_args, sdp, 200,
extra_headers=extra_headers,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,26 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=-
c=IN IP4 127.0.0.1
t=0 0
m=video 0 RTP/AVP 100
m=audio 5000 RTP/AVP 0
"""
pjsua_args = "--null-audio --auto-answer 200"
extra_headers = ""
include = ["Content-Type: application/sdp", # response must include SDP
"m=video 0 RTP/AVP[\\s\\S]+m=audio [1-9]+[0-9]* RTP/AVP"
]
exclude = []
sendto_cfg = sip.SendtoCfg("SDP media with port 0 and no rtpmap for dynamic PT", pjsua_args, sdp, 200,
extra_headers=extra_headers,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,28 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
# Offer contains "sendonly" attribute in the session. Answer should
# respond with appropriate direction in session or media
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=-
c=IN IP4 127.0.0.1
t=0 0
a=sendonly
m=audio 5000 RTP/AVP 0
"""
pjsua_args = "--null-audio --auto-answer 200"
extra_headers = ""
include = ["Content-Type: application/sdp", # response must include SDP
"a=recvonly"
]
exclude = []
sendto_cfg = sip.SendtoCfg("SDP direction in session", pjsua_args, sdp, 200,
extra_headers=extra_headers,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,30 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
# Offer contains "inactive" attribute in the session, however the media
# also has "sendonly" attribute. Answer should appropriately respond
# direction attribute in media, instead of the one in session.
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=-
c=IN IP4 127.0.0.1
t=0 0
a=inactive
m=audio 5000 RTP/AVP 0
a=sendonly
"""
pjsua_args = "--null-audio --auto-answer 200"
extra_headers = ""
include = ["Content-Type: application/sdp", # response must include SDP
"a=recvonly"
]
exclude = []
sendto_cfg = sip.SendtoCfg("SDP direction in session", pjsua_args, sdp, 200,
extra_headers=extra_headers,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,27 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=pjmedia
c=IN IP4 127.0.0.1
t=0 0
m=audio 4000 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=sendrecv
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
"""
pjsua_args = "--null-audio --auto-answer 200"
extra_headers = "Require: xxx-my-extension\n"
include = ["Unsupported: xxx-my-extension"]
exclude = []
sendto_cfg = sip.SendtoCfg("Bad extension", pjsua_args, sdp, 420,
extra_headers=extra_headers,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,23 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=pjmedia
c=IN IP4 127.0.0.1
t=0 0
m=video 4000 RTP/AVP 0
"""
pjsua_args = "--null-audio --auto-answer 200"
extra_headers = ""
include = []
exclude = []
sendto_cfg = sip.SendtoCfg("Video not acceptable", pjsua_args, sdp, 488,
extra_headers=extra_headers,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,22 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=pjmedia
c=IN IP4 127.0.0.1
t=0 0
"""
pjsua_args = "--null-audio --auto-answer 200"
extra_headers = ""
include = []
exclude = []
sendto_cfg = sip.SendtoCfg("No media in SDP", pjsua_args, sdp, 400,
extra_headers=extra_headers,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,24 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=pjmedia
c=IN IP4 127.0.0.1
t=0 0
m=video 4000 RTP/AVP 101
a=rtpmap:101 my-proprietary-codec
"""
pjsua_args = "--null-audio --auto-answer 200"
extra_headers = ""
include = []
exclude = []
sendto_cfg = sip.SendtoCfg("Unsupported codec", pjsua_args, sdp, 488,
extra_headers=extra_headers,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,23 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
sdp = \
"""
v=
o=
s=
c=
t=
a=
"""
pjsua_args = "--null-audio --auto-answer 200"
extra_headers = ""
include = [ "Warning: " ] # better have Warning header
exclude = []
sendto_cfg = sip.SendtoCfg("Bad SDP syntax", pjsua_args, sdp, 400,
extra_headers=extra_headers,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,27 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=pjmedia
c=AF IP4 127.0.0.1
t=0 0
m=audio 4000 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=sendrecv
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
"""
pjsua_args = "--null-audio --auto-answer 200"
extra_headers = ""
include = [ "Warning: " ] # better have Warning header
exclude = []
sendto_cfg = sip.SendtoCfg("Bad SDP network type", pjsua_args, sdp, 400,
extra_headers=extra_headers,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,27 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=pjmedia
c=IN IP7 127.0.0.1
t=0 0
m=audio 4000 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=sendrecv
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
"""
pjsua_args = "--null-audio --auto-answer 200"
extra_headers = ""
include = [ "Warning: " ] # better have Warning header
exclude = []
sendto_cfg = sip.SendtoCfg("Bad SDP address type", pjsua_args, sdp, 400,
extra_headers=extra_headers,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,27 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=pjmedia
c=IN IP4 127.0.0.1
t=0 0
m=audio 4000 RTP/XAVP 0 101
a=rtpmap:0 PCMU/8000
a=sendrecv
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
"""
pjsua_args = "--null-audio --auto-answer 200"
extra_headers = ""
include = []
exclude = []
sendto_cfg = sip.SendtoCfg("Unsupported transport type", pjsua_args, sdp, 488,
extra_headers=extra_headers,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,38 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
# Ticket http://trac.pjsip.org/repos/ticket/718
# RTC doesn't put rport in Via, and it is report to have caused segfault.
complete_msg = \
"""INVITE sip:localhost SIP/2.0
Via: SIP/2.0/UDP $LOCAL_IP:$LOCAL_PORT;branch=z9hG4bK74a60ee5
From: <sip:tester@localhost>;tag=as2858a32c
To: <sip:pjsua@localhost>
Contact: <sip:tester@$LOCAL_IP:$LOCAL_PORT>
Call-ID: 123@localhost
CSeq: 1 INVITE
Max-Forwards: 70
Content-Type: application/sdp
Content-Length: 285
v=0
o=root 4236 4236 IN IP4 192.168.1.11
s=session
c=IN IP4 192.168.1.11
t=0 0
m=audio 14390 RTP/AVP 0 3 8 101
a=rtpmap:0 PCMU/8000
a=rtpmap:3 GSM/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=silenceSupp:off - - - -
a=ptime:20
a=sendrecv
"""
sendto_cfg = sip.SendtoCfg( "RTC no rport", "--null-audio --auto-answer 200",
"", 200, complete_msg=complete_msg)
@@ -0,0 +1,25 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
# Ticket http://trac.pjsip.org/repos/ticket/718
# RTC doesn't put rport in Via, and it is reported to have caused segfault.
#
complete_msg = \
"""MESSAGE sip:localhost SIP/2.0
Via: SIP/2.0/UDP localhost:$LOCAL_PORT;branch=z9hG4bK$BRANCH
From: <sip:tester@localhost>;tag=as2858a32c
To: <sip:pjsua@localhost>
Call-ID: 123@localhost
CSeq: 1 MESSAGE
Max-Forwards: 70
Content-Length: 11
Content-Type: text/plain
Hello world
"""
sendto_cfg = sip.SendtoCfg( "RTC no rport", "--null-audio --auto-answer 200",
"", 200, complete_msg=complete_msg)
@@ -0,0 +1,23 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=pjmedia
c=IN IP4 127.0.0.1
t=0 0
m=audio 4000 RTP/AVP 0
"""
pjsua_args = "--null-audio --auto-answer 200"
extra_headers = "Replaces: abcd;from_tag=1\r\nReplaces: efgh;from_tag=2\r\n"
include = []
exclude = []
sendto_cfg = sip.SendtoCfg("Duplicate replaces header", pjsua_args, sdp, 400,
extra_headers=extra_headers,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,23 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=pjmedia
c=IN IP4 127.0.0.1
t=0 0
m=audio 4000 RTP/AVP 0
"""
pjsua_args = "--null-audio --auto-answer 200"
extra_headers = "Replaces: abcd;from_tag=1\r\n"
include = []
exclude = []
sendto_cfg = sip.SendtoCfg("Replaced dialog not found", pjsua_args, sdp, 481,
extra_headers=extra_headers,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,27 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=pjmedia
c=IN IP4 127.0.0.1
t=0 0
m=audio 4000 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=sendrecv
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
"""
pjsua_args = "--null-audio --auto-answer 200 --use-timer 2 --timer-min-se 90 --timer-se 1800"
extra_headers = "Require: timer\nSupported: timer\nSession-Expires: 1800\n"
include = ["Session-Expires: .*;refresher=.*"]
exclude = []
sendto_cfg = sip.SendtoCfg("Session Timer required", pjsua_args, sdp, 200,
extra_headers=extra_headers,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,36 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=pjmedia
c=IN IP4 127.0.0.1
t=0 0
m=audio 4000 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=sendrecv
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
"""
# RFC 4028 Section 9:
# If the incoming request contains a Supported header field with a
# value 'timer' but does not contain a Session-Expires header, it means
# that the UAS is indicating support for timers but is not requesting
# one. The UAS may request a session timer in the 2XX response by
# including a Session-Expires header field. The value MUST NOT be set
# to a duration lower than the value in the Min-SE header field in the
# request, if it is present.
pjsua_args = "--null-audio --auto-answer 200 --use-timer 2 --timer-min-se 90 --timer-se 1800"
extra_headers = "Supported: timer\n"
include = ["Session-Expires: .*;refresher=.*"]
exclude = []
sendto_cfg = sip.SendtoCfg("Session Timer initiated by UAS", pjsua_args, sdp, 200,
extra_headers=extra_headers,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,26 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=pjmedia
c=IN IP4 127.0.0.1
t=0 0
m=audio 4000 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=sendrecv
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
"""
pjsua_args = "--null-audio --auto-answer 200"
extra_headers = "Supported: timer\n"
include = []
exclude = ["Session-Expires:"]
sendto_cfg = sip.SendtoCfg("Session Timer supported but not used", pjsua_args, sdp, 200,
extra_headers=extra_headers,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,26 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=pjmedia
c=IN IP4 127.0.0.1
t=0 0
m=audio 4000 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=sendrecv
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
"""
pjsua_args = "--null-audio --auto-answer 200 --timer-min-se 90"
extra_headers = "Supported: timer\nSession-Expires: 1800\n"
include = ["Session-Expires:.*;refresher=ua[cs]"]
exclude = []
sendto_cfg = sip.SendtoCfg("Session Timer without specifying refresher", pjsua_args, sdp, 200,
extra_headers=extra_headers,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,26 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=pjmedia
c=IN IP4 127.0.0.1
t=0 0
m=audio 4000 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=sendrecv
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
"""
pjsua_args = "--null-audio --auto-answer 200 --timer-min-se 90"
extra_headers = "Supported: timer\nSession-Expires: 1800;refresher=uac\n"
include = ["Session-Expires:.*;refresher=ua[cs]"]
exclude = []
sendto_cfg = sip.SendtoCfg("Session Timer offer refresher uac", pjsua_args, sdp, 200,
extra_headers=extra_headers,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,26 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=pjmedia
c=IN IP4 127.0.0.1
t=0 0
m=audio 4000 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=sendrecv
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
"""
pjsua_args = "--null-audio --auto-answer 200 --timer-min-se 90"
extra_headers = "Supported: timer\nSession-Expires: 1800;refresher=uas\n"
include = ["Session-Expires:.*;refresher=ua[cs]"]
exclude = []
sendto_cfg = sip.SendtoCfg("Session Timer offer refresher uas", pjsua_args, sdp, 200,
extra_headers=extra_headers,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,26 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=pjmedia
c=IN IP4 127.0.0.1
t=0 0
m=audio 4000 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=sendrecv
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
"""
pjsua_args = "--null-audio --auto-answer 200 --timer-min-se 2000 --timer-se 2000"
extra_headers = "Supported: timer\nSession-Expires: 1800\n"
include = ["Min-SE:\s*2000"]
exclude = []
sendto_cfg = sip.SendtoCfg("Session Timer SE too small", pjsua_args, sdp, 422,
extra_headers=extra_headers,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,26 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=pjmedia
c=IN IP4 127.0.0.1
t=0 0
m=audio 4000 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=sendrecv
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
"""
args = "--null-audio --use-ice --auto-answer 200 --max-calls 1"
include = []
exclude = ["a=ice", "a=candidate"]
sendto_cfg = sip.SendtoCfg( "caller has no ice, answer must not have ICE",
pjsua_args=args, sdp=sdp, resp_code=200,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,31 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=pjmedia
c=IN IP4 127.0.0.1
t=0 0
m=audio 4000 RTP/AVP 0 101
a=ice-ufrag:1234
a=ice-pwd:5678
a=rtpmap:0 PCMU/8000
a=sendrecv
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=candidate:XX 1 UDP 1234 127.0.0.1 4000 typ host
"""
args = "--null-audio --use-ice --auto-answer 200 --max-calls 1"
include = ["a=ice-ufrag"] # must have ICE
exclude = ["a=candidate:[0-9a-zA-Z]+ 2 UDP", # must not answer with 2 components
"ice-mismatch" # must not mismatch
]
sendto_cfg = sip.SendtoCfg( "caller sends only one component",
pjsua_args=args, sdp=sdp, resp_code=200,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,35 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=pjmedia
c=IN IP4 127.0.0.1
t=0 0
m=audio 4000 RTP/AVP 0 101
a=rtcp:4382 IN IP4 192.168.0.4
a=ice-ufrag:1234
a=ice-pwd:5678
a=rtpmap:0 PCMU/8000
a=sendrecv
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=candidate:XX 1 UDP 1234 127.0.0.1 4000 typ host
a=candidate:YY 2 UDP 1234 192.168.0.4 4382 typ host
"""
args = "--null-audio --use-ice --auto-answer 200 --max-calls 1"
include = ["a=ice-ufrag", # must have ICE
"a=candidate:[0-9a-zA-Z]+ 2 UDP" # must have RTCP component
]
exclude = [
"ice-mismatch" # must not mismatch
]
sendto_cfg = sip.SendtoCfg( "caller sends only one component",
pjsua_args=args, sdp=sdp, resp_code=200,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,34 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=pjmedia
c=IN IP4 127.0.0.1
t=0 0
m=audio 4000 RTP/AVP 0 101
a=ice-ufrag:1234
a=ice-pwd:5678
a=rtpmap:0 PCMU/8000
a=sendrecv
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=candidate:XX 1 UDP 1234 127.0.0.1 4000 typ host
a=candidate:YY 2 UDP 1234 127.0.0.1 4001 typ host
"""
args = "--null-audio --use-ice --auto-answer 200 --max-calls 1"
include = ["a=ice-ufrag", # must have ICE
"a=candidate:[0-9a-zA-Z]+ 2 UDP" # must have RTCP component
]
exclude = [
"ice-mismatch" # must not mismatch
]
sendto_cfg = sip.SendtoCfg( "caller sends two components without a=rtcp line",
pjsua_args=args, sdp=sdp, resp_code=200,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,34 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=pjmedia
c=IN IP4 127.0.0.1
t=0 0
m=audio 4000 RTP/AVP 0 101
a=rtcp:4382 IN IP4 192.168.0.4
a=ice-ufrag:1234
a=ice-pwd:5678
a=rtpmap:0 PCMU/8000
a=sendrecv
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=candidate:XX 1 UDP 1234 127.0.0.1 4000 typ host
a=candidate:YY 2 UDP 1234 127.0.0.2 4002 typ host
"""
args = "--null-audio --use-ice --auto-answer 200 --max-calls 1 --ice-no-rtcp"
include = ["a=ice-ufrag"] # must have ICE
exclude = [
"ice-mismatch", # must not mismatch
"a=candidate:[0-9a-zA-Z]+ 2 UDP" # must not have RTCP component
]
sendto_cfg = sip.SendtoCfg( "pjsua with --ice-no-rtcp ignores RTCP things in the SDP",
pjsua_args=args, sdp=sdp, resp_code=200,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,29 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=pjmedia
c=IN IP4 127.0.0.1
t=0 0
m=audio 4000 RTP/AVP 0 101
a=ice-ufrag:1234
a=ice-pwd:5678
a=rtpmap:0 PCMU/8000
a=sendrecv
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=candidate:XX 1 UDP 1 1.1.1.1 2222 typ host
"""
args = "--null-audio --use-ice --auto-answer 200 --max-calls 1"
include = ["a=ice-mismatch"]
exclude = []
sendto_cfg = sip.SendtoCfg( "caller sends mismatched offer for comp 1",
pjsua_args=args, sdp=sdp, resp_code=200,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,31 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=pjmedia
c=IN IP4 127.0.0.1
t=0 0
m=audio 4000 RTP/AVP 0 101
a=rtcp:4382 IN IP4 192.168.0.4
a=ice-ufrag:1234
a=ice-pwd:5678
a=rtpmap:0 PCMU/8000
a=sendrecv
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=candidate:XX 1 UDP 1234 127.0.0.1 4000 typ host
a=candidate:XX 2 UDP 1234 127.0.0.1 4000 typ host
"""
args = "--null-audio --use-ice --auto-answer 200 --max-calls 1"
include = ["a=ice-mismatch"]
exclude = []
sendto_cfg = sip.SendtoCfg( "caller sends mismatched offer for comp 2",
pjsua_args=args, sdp=sdp, resp_code=200,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,30 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=pjmedia
c=IN IP4 127.0.0.1
t=0 0
m=audio 4000 RTP/AVP 0 101
a=rtcp:4382 IN IP4 192.168.0.4
a=ice-ufrag:1234
a=ice-pwd:5678
a=rtpmap:0 PCMU/8000
a=sendrecv
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=candidate:XX 1 UDP 1234 127.0.0.1 4000 typ host
"""
args = "--null-audio --use-ice --auto-answer 200 --max-calls 1"
include = ["a=ice-mismatch"]
exclude = []
sendto_cfg = sip.SendtoCfg( "caller sends mismatched offer for comp 2",
pjsua_args=args, sdp=sdp, resp_code=200,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,38 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
body = \
"""
--12345
Content-Type: application/sdp
v=0
o=- 0 0 IN IP4 127.0.0.1
s=pjmedia
c=IN IP4 127.0.0.1
t=0 0
m=audio 4000 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=sendrecv
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
--12345
Content-Type: text/plain
Hi there this is definitely not SDP
--12345--
"""
args = "--null-audio --auto-answer 200 --max-calls 1"
extra_headers = "Content-Type: multipart/mixed; boundary=12345"
include = ["v=0", "m=audio"]
exclude = []
sendto_cfg = sip.SendtoCfg( "Valid multipart/mixed body containing SDP",
pjsua_args=args, sdp="", resp_code=200,
extra_headers=extra_headers, body=body,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,47 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
body = \
"""
This is the preamble. It is to be ignored, though it
is a handy place for composition agents to include an
explanatory note to non-MIME conformant readers.
--123:45
Content-Type: text/plain
The first part is definitely not SDP
--123:45
This is implicitly typed plain US-ASCII text.
It does NOT end with a linebreak.
--123:45
Content-Type: application/sdp
v=0
o=- 0 0 IN IP4 127.0.0.1
s=pjmedia
c=IN IP4 127.0.0.1
t=0 0
m=audio 4000 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=sendrecv
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
--123:45--
This is the epilogue. It is also to be ignored.
"""
args = "--null-audio --auto-answer 200 --max-calls 1"
extra_headers = "Content-Type: multipart/mixed; boundary=\"123:45\""
include = ["v=0", "m=audio"]
exclude = []
sendto_cfg = sip.SendtoCfg( "Valid but cluttered multipart/mixed body containing SDP",
pjsua_args=args, sdp="", resp_code=200,
extra_headers=extra_headers, body=body,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,38 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
body = \
"""
--12345
Content-Type: application/notsdp
v=0
o=- 0 0 IN IP4 127.0.0.1
s=pjmedia
c=IN IP4 127.0.0.1
t=0 0
m=audio 4000 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=sendrecv
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
--12345
Content-Type: text/plain
Hi there this is definitely not SDP
--12345--
"""
args = "--null-audio --auto-answer 200 --max-calls 1"
extra_headers = "Content-Type: multipart/mixed; boundary=12345"
include = []
exclude = []
sendto_cfg = sip.SendtoCfg( "Multipart/mixed body without SDP",
pjsua_args=args, sdp="", resp_code=415,
extra_headers=extra_headers, body=body,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,27 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=tester
c=IN IP4 127.0.0.1
t=0 0
m=audio 4000 RTP/SAVP 0 101
a=rtpmap:0 PCMU/8000
a=sendrecv
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=crypto:1 AeS_Cm_128_HmAC_shA1_80 inline:WnD7c1ksDGs+dIefCEo8omPg4uO8DYIinNGL5yxQ
a=crypto:2 aEs_cM_128_HMaC_ShA1_32 inline:t0r0/apkukU7JjjfR0mY8GEimBq4OiPEm9eKSFOx
"""
args = "--null-audio --auto-answer 200 --max-calls 1 --use-srtp 2 --srtp-secure 0"
include = ["m=audio \d+ RTP/SAVP", "a=crypto"]
exclude = []
sendto_cfg = sip.SendtoCfg( "caller has used mixed case in crypto attr, callee must process that normally",
pjsua_args=args, sdp=sdp, resp_code=200,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,27 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=tester
c=IN IP4 127.0.0.1
t=0 0
m=audio 4000 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=sendrecv
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:WnD7c1ksDGs+dIefCEo8omPg4uO8DYIinNGL5yxQ
a=crypto:1 AES_CM_128_HMAC_SHA1_32 inline:t0r0/apkukU7JjjfR0mY8GEimBq4OiPEm9eKSFOx
"""
args = "--null-audio --auto-answer 200 --max-calls 1 --use-srtp 1 --srtp-secure 0"
include = []
exclude = []
sendto_cfg = sip.SendtoCfg( "caller has used invalid crypto tag, callee must not accept the call",
pjsua_args=args, sdp=sdp, resp_code=406,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,27 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=tester
c=IN IP4 127.0.0.1
t=0 0
m=audio 4000 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=sendrecv
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:WnD7c1ksDGs+dIefCEo8omPg4uO8DYIinNGL5yxQ
a=crypto:x AES_CM_128_HMAC_SHA1_32 inline:t0r0/apkukU7JjjfR0mY8GEimBq4OiPEm9eKSFOx
"""
args = "--null-audio --auto-answer 200 --max-calls 1 --use-srtp 1 --srtp-secure 0"
include = []
exclude = []
sendto_cfg = sip.SendtoCfg( "caller has used invalid crypto tag (non-numeric), callee must not accept the call",
pjsua_args=args, sdp=sdp, resp_code=406,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,26 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=tester
c=IN IP4 127.0.0.1
t=0 0
m=audio 4000 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=sendrecv
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=crypto:0 AES_CM_128_HMAC_SHA1_80 inline:WnD7c1ksDGs+dIefCEo8omPg4uO8DYIinNGL5yxQ
"""
args = "--null-audio --auto-answer 200 --max-calls 1 --use-srtp 1 --srtp-secure 0"
include = []
exclude = []
sendto_cfg = sip.SendtoCfg( "caller has used crypto tag zero, callee must accept the call",
pjsua_args=args, sdp=sdp, resp_code=200,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,26 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=tester
c=IN IP4 127.0.0.1
t=0 0
m=audio 4000 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=sendrecv
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=crypto:0 AES_CM_128_HMAC_SHA1_80
"""
args = "--null-audio --auto-answer 200 --max-calls 1 --use-srtp 1 --srtp-secure 0"
include = []
exclude = []
sendto_cfg = sip.SendtoCfg( "caller send crypto attr without key, callee must not accept the call",
pjsua_args=args, sdp=sdp, resp_code=406,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,26 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=tester
c=IN IP4 127.0.0.1
t=0 0
m=audio 4000 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=sendrecv
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=crypto:0 AES_CM_128_HMAC_SHA1_80 inline
"""
args = "--null-audio --auto-answer 200 --max-calls 1 --use-srtp 1 --srtp-secure 0"
include = []
exclude = []
sendto_cfg = sip.SendtoCfg( "caller send crypto attr without key, callee must not accept the call",
pjsua_args=args, sdp=sdp, resp_code=406,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,26 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=tester
c=IN IP4 127.0.0.1
t=0 0
m=audio 4000 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=sendrecv
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=crypto:0 AES_CM_128_HMAC_SHA1_80 inline:
"""
args = "--null-audio --auto-answer 200 --max-calls 1 --use-srtp 1 --srtp-secure 0"
include = []
exclude = []
sendto_cfg = sip.SendtoCfg( "caller send crypto attr without key, callee must not accept the call",
pjsua_args=args, sdp=sdp, resp_code=406,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,28 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=tester
c=IN IP4 127.0.0.1
t=0 0
m=audio 4000 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=sendrecv
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:WnD7c1ksDGs+dIefCEo8omPg4uO8DYIinNGL5yxQ
a=crypto:2 AES_CM_128_HMAC_SHA1_32 inline:t0r0/apkukU7JjjfR0mY8GEimBq4OiPEm9eKSFOx
"""
args = "--null-audio --auto-answer 200 --max-calls 1 --use-srtp 0 --srtp-secure 0"
include = []
exclude = ["a=crypto"]
sendto_cfg = sip.SendtoCfg( "Callee has SRTP disabled but receive RTP/AVP with crypto, should accept without crypto",
pjsua_args=args, sdp=sdp, resp_code=200,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,28 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=tester
c=IN IP4 127.0.0.1
t=0 0
m=audio 4000 RTP/SAVP 0 101
a=rtpmap:0 PCMU/8000
a=sendrecv
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:WnD7c1ksDGs+dIefCEo8omPg4uO8DYIinNGL5yxQ
a=crypto:2 AES_CM_128_HMAC_SHA1_32 inline:t0r0/apkukU7JjjfR0mY8GEimBq4OiPEm9eKSFOx
"""
args = "--null-audio --auto-answer 200 --max-calls 1 --use-srtp 0 --srtp-secure 0"
include = []
exclude = []
sendto_cfg = sip.SendtoCfg( "Callee has SRTP disabled but receive RTP/SAVP, should reject the call",
pjsua_args=args, sdp=sdp, resp_code=488,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,26 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=tester
c=IN IP4 127.0.0.1
t=0 0
m=audio 4000 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=sendrecv
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
"""
args = "--null-audio --auto-answer 200 --max-calls 1 --use-srtp 1 --srtp-secure 0"
include = ["m=audio \d+ RTP/AVP"]
exclude = ["a=crypto"]
sendto_cfg = sip.SendtoCfg( "caller has no crypto attr, answer must accept without crypto attr",
pjsua_args=args, sdp=sdp, resp_code=200,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,28 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=tester
c=IN IP4 127.0.0.1
t=0 0
m=audio 4000 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=sendrecv
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:WnD7c1ksDGs+dIefCEo8omPg4uO8DYIinNGL5yxQ
a=crypto:2 AES_CM_128_HMAC_SHA1_32 inline:t0r0/apkukU7JjjfR0mY8GEimBq4OiPEm9eKSFOx
"""
args = "--null-audio --auto-answer 200 --max-calls 1 --use-srtp 1 --srtp-secure 0"
include = ["m=audio \d+ RTP/AVP", "a=crypto"]
exclude = []
sendto_cfg = sip.SendtoCfg( "Callee has SRTP optional and receive RTP/AVP with crypto, should accept with RTP/AVP & crypto",
pjsua_args=args, sdp=sdp, resp_code=200,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,28 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=tester
c=IN IP4 127.0.0.1
t=0 0
m=audio 4000 RTP/SAVP 0 101
a=rtpmap:0 PCMU/8000
a=sendrecv
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:WnD7c1ksDGs+dIefCEo8omPg4uO8DYIinNGL5yxQ
a=crypto:2 AES_CM_128_HMAC_SHA1_32 inline:t0r0/apkukU7JjjfR0mY8GEimBq4OiPEm9eKSFOx
"""
args = "--null-audio --auto-answer 200 --max-calls 1 --use-srtp 1 --srtp-secure 0"
include = ["m=audio \d+ RTP/SAVP", "a=crypto"]
exclude = []
sendto_cfg = sip.SendtoCfg( "Callee has SRTP optional receive RTP/SAVP, should answer RTP/SAVP too",
pjsua_args=args, sdp=sdp, resp_code=200,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,26 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=tester
c=IN IP4 127.0.0.1
t=0 0
m=audio 4000 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=sendrecv
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=crypto:1 CRYPTO_X inline:WnD7c1ksDGs+dIefCEo8omPg4uO8DYIinNGL5yxQ
"""
args = "--null-audio --auto-answer 200 --max-calls 1 --use-srtp 1 --srtp-secure 0"
include = []
exclude = ["a=crypto"]
sendto_cfg = sip.SendtoCfg( "caller has used unsupported crypto, callee (SRTP optional) accept the call without crypto",
pjsua_args=args, sdp=sdp, resp_code=200,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,26 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=tester
c=IN IP4 127.0.0.1
t=0 0
m=audio 4000 RTP/SAVP 0 101
a=rtpmap:0 PCMU/8000
a=sendrecv
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
"""
args = "--null-audio --auto-answer 200 --max-calls 1 --use-srtp 2 --srtp-secure 0"
include = []
exclude = []
sendto_cfg = sip.SendtoCfg( "caller has no crypto attr on RTP/SAVP, callee must not accept the call",
pjsua_args=args, sdp=sdp, resp_code=406,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,28 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=-
c=IN IP4 127.0.0.1
t=0 0
m=audio 5000 RTP/AVP 0
a=crypto:1 aes_cm_128_hmac_sha1_80 inline:WnD7c1ksDGs+dIefCEo8omPg4uO8DYIinNGL5yxQ
m=xapplicationx 4000 RTP/AVP 100
a=rtpmap:100 myapp/80000
"""
pjsua_args = "--null-audio --auto-answer 200 --use-srtp 1 --srtp-secure 0"
extra_headers = ""
include = ["Content-Type: application/sdp", # response must include SDP
"m=audio [1-9]+[0-9]* RTP/AVP[\\s\\S]+a=crypto[\\s\\S]+m=xapplicationx 0 RTP/AVP"
]
exclude = []
sendto_cfg = sip.SendtoCfg("SRTP audio and unknown media", pjsua_args, sdp, 200,
extra_headers=extra_headers,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,28 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=-
c=IN IP4 127.0.0.1
t=0 0
m=xapplicationx 4000 RTP/AVP 100
a=rtpmap:100 myapp/80000
m=audio 5000 RTP/AVP 0
a=crypto:1 aes_cm_128_hmac_sha1_80 inline:WnD7c1ksDGs+dIefCEo8omPg4uO8DYIinNGL5yxQ
"""
pjsua_args = "--null-audio --auto-answer 200 --use-srtp 1 --srtp-secure 0"
extra_headers = ""
include = ["Content-Type: application/sdp", # response must include SDP
"m=xapplicationx 0 RTP/AVP[\\s\\S]+m=audio [1-9]+[0-9]* RTP/AVP[\\s\\S]+a=crypto"
]
exclude = []
sendto_cfg = sip.SendtoCfg("Unknown media and SRTP audio", pjsua_args, sdp, 200,
extra_headers=extra_headers,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,27 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=-
c=IN IP4 127.0.0.1
t=0 0
m=audio 5000 RTP/AVP 0
a=crypto:1 aes_cm_128_hmac_sha1_80 inline:WnD7c1ksDGs+dIefCEo8omPg4uO8DYIinNGL5yxQ
m=audio 4000 UNKNOWN 0
"""
pjsua_args = "--null-audio --auto-answer 200 --use-srtp 1 --srtp-secure 0"
extra_headers = ""
include = ["Content-Type: application/sdp", # response must include SDP
"m=audio [1-9]+[0-9]* RTP/AVP[\\s\\S]+a=crypto[\\s\\S]+m=audio 0 UNKNOWN"
]
exclude = []
sendto_cfg = sip.SendtoCfg("SRTP audio and unknown media", pjsua_args, sdp, 200,
extra_headers=extra_headers,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,27 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=-
c=IN IP4 127.0.0.1
t=0 0
m=audio 4000 UNKNOWN 0
m=audio 5000 RTP/AVP 0
a=crypto:1 aes_cm_128_hmac_sha1_80 inline:WnD7c1ksDGs+dIefCEo8omPg4uO8DYIinNGL5yxQ
"""
pjsua_args = "--null-audio --auto-answer 200 --use-srtp 1 --srtp-secure 0"
extra_headers = ""
include = ["Content-Type: application/sdp", # response must include SDP
"m=audio 0 UNKNOWN[\\s\\S]+m=audio [1-9]+[0-9]* RTP/AVP[\\s\\S]+a=crypto"
]
exclude = []
sendto_cfg = sip.SendtoCfg("SRTP audio and unknown media", pjsua_args, sdp, 200,
extra_headers=extra_headers,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,28 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=tester
c=IN IP4 127.0.0.1
t=0 0
m=audio 4000 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=sendrecv
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:WnD7c1ksDGs+dIefCEo8omPg4uO8DYIinNGL5yxQ
a=crypto:2 AES_CM_128_HMAC_SHA1_32 inline:t0r0/apkukU7JjjfR0mY8GEimBq4OiPEm9eKSFOx
"""
args = "--null-audio --auto-answer 200 --max-calls 1 --use-srtp 2 --srtp-secure 0"
include = []
exclude = []
sendto_cfg = sip.SendtoCfg( "Callee has SRTP mandatory and receive RTP/AVP with crypto, should reject the call",
pjsua_args=args, sdp=sdp, resp_code=488,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,28 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=tester
c=IN IP4 127.0.0.1
t=0 0
m=audio 4000 RTP/SAVP 0 101
a=rtpmap:0 PCMU/8000
a=sendrecv
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:WnD7c1ksDGs+dIefCEo8omPg4uO8DYIinNGL5yxQ
a=crypto:2 AES_CM_128_HMAC_SHA1_32 inline:t0r0/apkukU7JjjfR0mY8GEimBq4OiPEm9eKSFOx
"""
args = "--null-audio --auto-answer 200 --max-calls 1 --use-srtp 2 --srtp-secure 0"
include = ["m=audio \d+ RTP/SAVP", "a=crypto"]
exclude = []
sendto_cfg = sip.SendtoCfg( "Callee has SRTP mandatory receive RTP/SAVP, should answer RTP/SAVP too",
pjsua_args=args, sdp=sdp, resp_code=200,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,25 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
# Too long key should be rejected
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=-
c=IN IP4 127.0.0.1
t=0 0
m=audio 5000 RTP/SAVP 0
a=crypto:1 aes_cm_128_hmac_sha1_80 inline:WnD7c1ksDGs+dIefCEo8omPg4uO8DYIinNGL5yxQWnD7c1ksDGs+dIefCEo8omPg4uO8DYIinNGL5yxQ
"""
pjsua_args = "--null-audio --auto-answer 200 --use-srtp 2 --srtp-secure 0"
extra_headers = ""
include = []
exclude = []
sendto_cfg = sip.SendtoCfg("SRTP receive too long key", pjsua_args, sdp, 406,
extra_headers=extra_headers,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,26 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=tester
c=IN IP4 127.0.0.1
t=0 0
m=audio 4000 RTP/SAVP 0 101
a=rtpmap:0 PCMU/8000
a=sendrecv
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=crypto:1 CRYPTO_X inline:WnD7c1ksDGs+dIefCEo8omPg4uO8DYIinNGL5yxQ
"""
args = "--null-audio --auto-answer 200 --max-calls 1 --use-srtp 2 --srtp-secure 0"
include = []
exclude = []
sendto_cfg = sip.SendtoCfg( "caller has used unsupported crypto, callee (SRTP mandatory) must reject the call",
pjsua_args=args, sdp=sdp, resp_code=406,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,30 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
# When SRTP is enabled in pjsua, it should prefer to use
# RTP/SAVP media line if there are multiple m=audio lines
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=-
c=IN IP4 127.0.0.1
t=0 0
m=audio 4000 RTP/AVP 0
a=rtpmap:0 pcmu/8000
m=audio 4000 RTP/SAVP 0
a=crypto:1 aes_cm_128_hmac_sha1_80 inline:WnD7c1ksDGs+dIefCEo8omPg4uO8DYIinNGL5yxQ
"""
pjsua_args = "--null-audio --auto-answer 200 --use-srtp 1 --srtp-secure 0"
extra_headers = ""
include = ["Content-Type: application/sdp", # response must include SDP
"m=audio 0 RTP/AVP[\\s\\S]+m=audio [1-9]+[0-9]* RTP/SAVP[\\s\\S]+a=crypto"
]
exclude = []
sendto_cfg = sip.SendtoCfg("Prefer RTP/SAVP", pjsua_args, sdp, 200,
extra_headers=extra_headers,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,29 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
# When SRTP is NOT enabled in pjsua, it should prefer to use
# RTP/AVP media line if there are multiple m=audio lines
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=-
c=IN IP4 127.0.0.1
t=0 0
m=audio 5000 RTP/SAVP 0
a=crypto:1 aes_cm_128_hmac_sha1_80 inline:WnD7c1ksDGs+dIefCEo8omPg4uO8DYIinNGL5yxQ
m=audio 4000 RTP/AVP 0
"""
pjsua_args = "--null-audio --auto-answer 200 --use-srtp 0"
extra_headers = ""
include = ["Content-Type: application/sdp", # response must include SDP
"m=audio 0 RTP/SAVP[\\s\\S]+m=audio [1-9]+[0-9]* RTP/AVP"
]
exclude = ["a=crypto"]
sendto_cfg = sip.SendtoCfg("Prefer RTP/SAVP", pjsua_args, sdp, 200,
extra_headers=extra_headers,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,27 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
# Some non-SIP URI's in Contact header
#
complete_msg = \
"""INVITE sip:localhost SIP/2.0
Via: SIP/2.0/UDP 192.168.0.14:5060;rport;branch=z9hG4bKPj9db9
Max-Forwards: 70
From: <sip:192.168.0.14>;tag=08cd5bfc2d8a4fddb1f5e59c6961d298
To: <sip:localhost>
Call-ID: 3373d9eb32aa458db7e69c7ea51e0bd7
CSeq: 0 INVITE
Contact: mailto:dontspam@pjsip.org
Contact: <mailto:dontspam@pjsip.org>
Contact: http://www.pjsip.org/the%20path.cgi?pname=pvalue
Contact: <sip:localhost>
User-Agent: PJSUA v0.9.0-trunk/win32
Content-Length: 0
"""
sendto_cfg = sip.SendtoCfg( "Non SIP URI in Contact",
"--null-audio --auto-answer 200",
"", 200, complete_msg=complete_msg)
@@ -0,0 +1,26 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
# No SIP URI in Contact header
#
complete_msg = \
"""INVITE sip:localhost SIP/2.0
Via: SIP/2.0/UDP 192.168.0.14:5060;rport;branch=z9hG4bKPj9db9
Max-Forwards: 70
From: <sip:192.168.0.14>;tag=08cd5bfc2d8a4fddb1f5e59c6961d298
To: <sip:localhost>
Call-ID: 3373d9eb32aa458db7e69c7ea51e0bd7
CSeq: 0 INVITE
Contact: mailto:dontspam@pjsip.org
Contact: <mailto:dontspam@pjsip.org>
Contact: http://www.pjsip.org/the%20path.cgi?pname=pvalue
User-Agent: PJSUA v0.9.0-trunk/win32
Content-Length: 0
"""
sendto_cfg = sip.SendtoCfg( "No SIP URI in Contact",
"--null-audio --auto-answer 200",
"", 500, complete_msg=complete_msg)
@@ -0,0 +1,27 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
# Some non-SIP URI's in Contact header
#
complete_msg = \
"""INVITE sip:localhost SIP/2.0
Via: SIP/2.0/UDP 192.168.0.14:5060;rport;branch=z9hG4bKPj9db9
Max-Forwards: 70
From: <sip:192.168.0.14>;tag=08cd5bfc2d8a4fddb1f5e59c6961d298
To: <sip:localhost>
Call-ID: 3373d9eb32aa458db7e69c7ea51e0bd7
CSeq: 0 INVITE
Contact: <sip:localhost>
Contact: mailto:dontspam@pjsip.org
Contact: <mailto:dontspam@pjsip.org>
Contact: http://www.pjsip.org/the%20path.cgi?pname=pvalue
User-Agent: PJSUA v0.9.0-trunk/win32
Content-Length: 0
"""
sendto_cfg = sip.SendtoCfg( "Non SIP URI in Contact",
"--null-audio --auto-answer 200",
"", 200, complete_msg=complete_msg)
@@ -0,0 +1,31 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
# Some non-SIP URI's in Contact header
#
complete_msg = \
"""SUBSCRIBE sip:localhost SIP/2.0
Via: SIP/2.0/UDP 192.168.0.14:5060;rport;branch=z9hG4bKPj9db9
Max-Forwards: 70
From: <sip:192.168.0.14>;tag=08cd5bfc2d8a4fddb1f5e59c6961d298
To: <sip:localhost>
Call-ID: 3373d9eb32aa458db7e69c7ea51e0bd7
CSeq: 0 SUBSCRIBE
Contact: mailto:dontspam@pjsip.org
Contact: <mailto:dontspam@pjsip.org>
Contact: http://www.pjsip.org/the%20path.cgi?pname=pvalue
Contact: <sip:localhost>
Event: presence
Expires: 600
Accept: application/pidf+xml, application/xpidf+xml
Allow-Events: presence, refer
User-Agent: PJSUA v0.9.0-trunk/win32
Content-Length: 0
"""
sendto_cfg = sip.SendtoCfg( "Non SIP URI in Contact",
"--null-audio --auto-answer 200",
"", 200, complete_msg=complete_msg)
@@ -0,0 +1,30 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
# Some non-SIP URI's in Contact header
#
complete_msg = \
"""SUBSCRIBE sip:localhost SIP/2.0
Via: SIP/2.0/UDP 192.168.0.14:5060;rport;branch=z9hG4bKPj9db9
Max-Forwards: 70
From: <sip:192.168.0.14>;tag=08cd5bfc2d8a4fddb1f5e59c6961d298
To: <sip:localhost>
Call-ID: 3373d9eb32aa458db7e69c7ea51e0bd7
CSeq: 0 SUBSCRIBE
Contact: mailto:dontspam@pjsip.org
Contact: <mailto:dontspam@pjsip.org>
Contact: http://www.pjsip.org/the%20path.cgi?pname=pvalue
Event: presence
Expires: 600
Accept: application/pidf+xml, application/xpidf+xml
Allow-Events: presence, refer
User-Agent: PJSUA v0.9.0-trunk/win32
Content-Length: 0
"""
sendto_cfg = sip.SendtoCfg( "Non SIP URI in Contact",
"--null-audio --auto-answer 200",
"", 400, complete_msg=complete_msg)
@@ -0,0 +1,34 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
# Answer for codec G722.1 should contain fmtp bitrate
sdp = \
"""
v=0
o=- 3428650655 3428650655 IN IP4 192.168.1.9
s=pjmedia
c=IN IP4 192.168.1.9
t=0 0
a=X-nat:0
m=audio 4000 RTP/AVP 99 100 101
a=rtcp:4001 IN IP4 192.168.1.9
a=rtpmap:99 G7221/16000
a=fmtp:99 bitrate=24000
a=rtpmap:100 G7221/16000
a=fmtp:100 bitrate=32000
a=sendrecv
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
"""
pjsua_args = "--null-audio --auto-answer 200 --add-codec G7221"
extra_headers = ""
include = ["fmtp:[\d]+ bitrate="] # response must include fmtp bitrate
exclude = []
sendto_cfg = sip.SendtoCfg("Answer should contain fmtp bitrate for codec G722.1", pjsua_args, sdp, 200,
extra_headers=extra_headers,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,35 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
# Answer with codec G722.1 should choose the same bitrate
# which in this test is 24000
sdp = \
"""
v=0
o=- 3428650655 3428650655 IN IP4 192.168.1.9
s=pjmedia
c=IN IP4 192.168.1.9
t=0 0
a=X-nat:0
m=audio 4000 RTP/AVP 100 101
a=rtcp:4001 IN IP4 192.168.1.9
a=rtpmap:100 G7221/16000
a=fmtp:100 bitrate=24000
a=sendrecv
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
"""
pjsua_args = "--null-audio --auto-answer 200 --add-codec G7221"
extra_headers = ""
include = ["a=rtpmap:[\d]+ G7221/16000", # response must choose G722.1
"fmtp:[\d]+ bitrate=24000" # response must choose the same bitrate
]
exclude = []
sendto_cfg = sip.SendtoCfg("Answer with G722.1 should choose bitrate 24000", pjsua_args, sdp, 200,
extra_headers=extra_headers,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,35 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
# Answer with codec G722.1 should choose the same bitrate
# which in this test is 32000
sdp = \
"""
v=0
o=- 3428650655 3428650655 IN IP4 192.168.1.9
s=pjmedia
c=IN IP4 192.168.1.9
t=0 0
a=X-nat:0
m=audio 4000 RTP/AVP 100 101
a=rtcp:4001 IN IP4 192.168.1.9
a=rtpmap:100 G7221/16000
a=fmtp:100 bitrate=32000
a=sendrecv
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
"""
pjsua_args = "--null-audio --auto-answer 200 --add-codec G7221"
extra_headers = ""
include = ["a=rtpmap:[\d]+ G7221/16000", # response must choose G722.1
"fmtp:[\d]+ bitrate=32000" # response must choose the same bitrate
]
exclude = []
sendto_cfg = sip.SendtoCfg("Answer with G722.1 should choose bitrate 32000", pjsua_args, sdp, 200,
extra_headers=extra_headers,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,32 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
# Answer for codec AMR should contain fmtp octet-align=1
sdp = \
"""
v=0
o=- 3428650655 3428650655 IN IP4 192.168.1.9
s=pjmedia
c=IN IP4 192.168.1.9
t=0 0
a=X-nat:0
m=audio 4000 RTP/AVP 99 101
a=rtcp:4001 IN IP4 192.168.1.9
a=rtpmap:99 AMR/8000
a=fmtp:99 octet-align=1
a=sendrecv
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
"""
pjsua_args = "--null-audio --auto-answer 200 --add-codec AMR"
extra_headers = ""
include = ["octet-align=1"] # response must include 'octet-align=1'
exclude = []
sendto_cfg = sip.SendtoCfg("AMR negotiation should response with fmtp 'octet-align=1'", pjsua_args, sdp, 200,
extra_headers=extra_headers,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,31 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
# Answer for codec AMR should not contain fmtp octet-align=1
sdp = \
"""
v=0
o=- 3428650655 3428650655 IN IP4 192.168.1.9
s=pjmedia
c=IN IP4 192.168.1.9
t=0 0
a=X-nat:0
m=audio 4000 RTP/AVP 99 101
a=rtcp:4001 IN IP4 192.168.1.9
a=rtpmap:99 AMR/8000
a=sendrecv
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
"""
pjsua_args = "--null-audio --auto-answer 200 --add-codec AMR"
extra_headers = ""
include = [""]
exclude = ["octet-align=1"] # response must not include fmtp 'octet-align=1'
sendto_cfg = sip.SendtoCfg("AMR negotiation should not contain 'octet-align=1'", pjsua_args, sdp, 200,
extra_headers=extra_headers,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,32 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
# Answer for codec AMR should not contain fmtp octet-align=1
sdp = \
"""
v=0
o=- 3428650655 3428650655 IN IP4 192.168.1.9
s=pjmedia
c=IN IP4 192.168.1.9
t=0 0
a=X-nat:0
m=audio 4000 RTP/AVP 99 101
a=rtcp:4001 IN IP4 192.168.1.9
a=rtpmap:99 AMR/8000
a=fmtp:99 octet-align=0
a=sendrecv
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
"""
pjsua_args = "--null-audio --auto-answer 200 --add-codec AMR"
extra_headers = ""
include = [""]
exclude = ["octet-align=1"] # response must not include fmtp 'octet-align=1'
sendto_cfg = sip.SendtoCfg("AMR negotiation should not contain 'octet-align=1'", pjsua_args, sdp, 200,
extra_headers=extra_headers,
resp_inc=include, resp_exc=exclude)
@@ -0,0 +1,28 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
# Ticket http://trac.pjsip.org/repos/ticket/623, based on
# http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/2008-September/004709.html:
#
# Assertion when receiving SUBSCRIBE with non-presence Event.
complete_msg = \
"""SUBSCRIBE sip:localhost;transport=UDP SIP/2.0
Call-ID: f20e8783e764cae325dba17be4b8fe19@10.0.2.15
CSeq: 1 SUBSCRIBE
From: <sip:localhost>;tag=1710895
To: <sip:localhost>
Via: SIP/2.0/UDP localhost;rport;branch=z9hG4bKd88a.18c427d2.0
Max-Forwards: 69
Event: message-summary
Contact: <sip:localhost>
Allow: NOTIFY, SUBSCRIBE
Content-Length: 0
"""
sendto_cfg = sip.SendtoCfg( "Incoming SUBSCRIBE with non presence",
"--null-audio",
"", 489, complete_msg=complete_msg)
@@ -0,0 +1,45 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
# http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/2008-June/003426.html:
#
# Report in pjsip mailing list on 27/6/2008 that this message will
# cause pjsip to respond with 500 and then second request will cause
# segfault.
complete_msg = \
"""INVITE sip:5001@192.168.1.200:5060;transport=UDP SIP/2.0
Via: SIP/2.0/UDP 192.168.1.11:5060;branch=z9hG4bK74a60ee5;rport
From: \"A user\" <sip:66660000@192.168.1.11>;tag=as2858a32c
To: <sip:5001@192.168.1.200:5060;transport=UDP>
Contact: <sip:66660000@192.168.1.11>
Call-ID: 0bc7612c665e875a4a46411442b930a6@192.168.1.11
CSeq: 102 INVITE
User-Agent: Asterisk PBX
Max-Forwards: 70
Date: Fri, 27 Jun 2008 08:46:47 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Supported: replaces
Content-Type: application/sdp
Content-Length: 285
v=0
o=root 4236 4236 IN IP4 192.168.1.11
s=session
c=IN IP4 192.168.1.11
t=0 0
m=audio 14390 RTP/AVP 0 3 8 101
a=rtpmap:0 PCMU/8000
a=rtpmap:3 GSM/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=silenceSupp:off - - - -
a=ptime:20
a=sendrecv
"""
sendto_cfg = sip.SendtoCfg( "Asterisk 500", "--null-audio --auto-answer 200",
"", 200, complete_msg=complete_msg)
@@ -0,0 +1,24 @@
# $Id$
import inc_sip as sip
import inc_sdp as sdp
# Incoming MESSAGE without body is now accepted
#
complete_msg = \
"""MESSAGE sip:localhost SIP/2.0
Via: SIP/2.0/UDP 192.168.0.14:5060;rport;branch=z9hG4bKPj9db9
Max-Forwards: 70
From: <sip:192.168.0.14>;tag=08cd5bfc2d8a4fddb1f5e59c6961d298
To: <sip:localhost>
Call-ID: 3373d9eb32aa458db7e69c7ea51e0bd7
CSeq: 23809 MESSAGE
Contact: <sip:192.168.0.14:5060>
User-Agent: PJSUA v0.8.0-trunk/win32
Content-Type: text/plain
Content-Length: 50
"""
sendto_cfg = sip.SendtoCfg( "empty MESSAGE", "--null-audio --auto-answer 200",
"", 200, complete_msg=complete_msg)