示例#1
0
# $Id: 159_no_rport_nit.py 2442 2009-02-06 08:44:23Z bennylp $
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)
示例#2
0
# $Id: 173_timer_offer_refresher_uac.py 369517 2012-07-01 17:28:57Z file $
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)
# $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:[email protected]
Contact: <mailto:[email protected]>
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)
# $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)
# $Id: 001_torture_4475_3_1_1_4.py 2505 2009-03-12 11:25:11Z bennylp $
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-%[email protected]
From: sip:null-%[email protected];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:%[email protected]>
Contact: <sip:%00%[email protected]>
L:0
"""

sendto_cfg = sip.SendtoCfg("RFC 4475 3.1.1.4",
                           "--null-audio --auto-answer 200",
                           "",
                           405,
                           complete_msg=complete_msg)
示例#6
0
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)
示例#7
0
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,
    enable_buffer=True)
示例#8
0
# $Id: 999_message_no_body.py 2884 2009-08-17 08:29:47Z bennylp $
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)

示例#9
0
# $Id: 100_simplecall.py 2036 2008-06-20 17:43:55Z nanang $
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)
示例#10
0
# $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)
示例#11
0
# $Id: 152_err_sdp_no_media.py 2066 2008-06-26 19:51:01Z bennylp $
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) 

# $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)
示例#13
0
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)
# $Id: 313_srtp1_unsupported_crypto.py 2036 2008-06-20 17:43:55Z nanang $
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)
示例#15
0
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)
示例#16
0
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)
示例#17
0
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)
示例#18
0
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)

# $Id: 172_timer_supported_but_not_used.py 369517 2012-07-01 17:28:57Z file $
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)
示例#20
0
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)
示例#21
0
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)
示例#22
0
# 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)
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) 
			   

# $Id: 160_err_duplicate_replaces.py 369517 2012-07-01 17:28:57Z file $
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)
# $Id: 300_srtp_receive_no_key_2.py 2036 2008-06-20 17:43:55Z nanang $
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)
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)
示例#27
0
# $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) 

示例#28
0
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)
示例#29
0
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)
# $Id: 500_pres_subscribe_with_bad_event.py 369517 2012-07-01 17:28:57Z file $
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: [email protected]
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)