Skip to content

Commit

Permalink
Tests for new PJSIPHangup app
Browse files Browse the repository at this point in the history
  • Loading branch information
gtjoseph committed Nov 8, 2023
1 parent b9e8f1f commit 6a1a91c
Show file tree
Hide file tree
Showing 7 changed files with 288 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[default]

exten = expect_437_1,1,NoOp()
same = n,Wait(1)
same = n,Progress()
same = n,Wait(1)
same = n,PJSIPHangup(437)

exten = expect_437_2,1,NoOp()
same = n,Wait(1)
same = n,Progress()
same = n,Wait(1)
same = n,PJSIPHangup(UNSUPPORTED_CERTIFICATE)

exten = expect_200,1,NoOp()
same = n,Wait(1)
same = n,Progress()
same = n,Wait(1)
same = n,Answer()
same = n,PJSIPHangup(437)

exten = expect_603_1,1,NoOp()
same = n,Wait(1)
same = n,Progress()
same = n,Wait(1)
same = n,PJSIPHangup(999)

exten = expect_603_2,1,NoOp()
same = n,Wait(1)
same = n,Progress()
same = n,Wait(1)
same = n,PJSIPHangup(SOMETHINGOROTHER)



Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[system]
type=system
timer_t1=100
timer_b=6400

[local]
type=transport
protocol=udp
bind=0.0.0.0

[endpoint_t](!)
type=endpoint
context=default
transport=local
direct_media=no
disallow=all
allow=ulaw

[aor_t](!)
type=aor
max_contacts=1

[alice](endpoint_t)
aors=alice

[alice](aor_t)
contact=sip:[email protected]:5061

Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE scenario SYSTEM "sipp.dtd">

<scenario name="Send INVITE from an inbound channel">
<send retrans="500">
<![CDATA[
INVITE sip:[dest]@[remote_ip]:[remote_port] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: sipp <sip:[service]@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
To: sut <sip:[dest]@[remote_ip]:[remote_port]>
Call-ID: [call_id]
CSeq: 1 INVITE
Contact: sip:sipp@[local_ip]:[local_port]
Max-Forwards: 70
Subject: Test
Content-Type: application/sdp
Content-Length: [len]
v=0
o=phoneA 53655765 2353687637 IN IP[local_ip_type] [local_ip]
s=-
c=IN IP[media_ip_type] [media_ip]
t=0 0
m=audio [media_port] RTP/AVP 0
a=rtpmap:0 PCMU/8000
]]>
</send>

<recv response="100" optional="true">
</recv>

<recv response="183" optional="true">
</recv>

<recv response="200" rtd="true">
</recv>

<send>
<![CDATA[
ACK sip:[dest]@[remote_ip]:[remote_port] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: sipp <sip:[service]@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
To: sut <sip:[dest]@[remote_ip]:[remote_port]>[peer_tag_param]
Call-ID: [call_id]
CSeq: 1 ACK
Contact: sip:sipp@[local_ip]:[local_port]
Max-Forwards: 70
Subject: Test
Content-Length: 0
]]>
</send>

<recv request="BYE" crlf="true" />

<send retrans="500">
<![CDATA[
SIP/2.0 200 OK
[last_Via:]
[last_From:]
[last_To:];tag=[call_number]
[last_Call-ID:]
[last_CSeq:]
Contact: <sip:sipp@[local_ip]:[local_port];transport=[transport]>
Allow: INVITE, ACK, MESSAGE, BYE
Content-Lnegth: 0
]]>
</send>


</scenario>
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE scenario SYSTEM "sipp.dtd">

<scenario name="Send INVITE from an inbound channel">
<send retrans="500">
<![CDATA[
INVITE sip:[dest]@[remote_ip]:[remote_port] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: sipp <sip:[service]@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
To: sut <sip:[dest]@[remote_ip]:[remote_port]>
Call-ID: [call_id]
CSeq: 1 INVITE
Contact: sip:sipp@[local_ip]:[local_port]
Max-Forwards: 70
Subject: Test
Content-Type: application/sdp
Content-Length: [len]
v=0
o=phoneA 53655765 2353687637 IN IP[local_ip_type] [local_ip]
s=-
c=IN IP[media_ip_type] [media_ip]
t=0 0
m=audio [media_port] RTP/AVP 0
a=rtpmap:0 PCMU/8000
]]>
</send>

<recv response="100">
</recv>

<recv response="183">
</recv>

<recv response="437">
</recv>

<send>
<![CDATA[
ACK sip:[dest]@[remote_ip]:[remote_port] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: sipp <sip:[service]@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
To: sut <sip:[dest]@[remote_ip]:[remote_port]>[peer_tag_param]
Call-ID: [call_id]
CSeq: 1 ACK
Contact: sip:sipp@[local_ip]:[local_port]
Max-Forwards: 70
Subject: Test
Content-Length: 0
]]>
</send>

</scenario>
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE scenario SYSTEM "sipp.dtd">

<scenario name="Send INVITE from an inbound channel">
<send retrans="500">
<![CDATA[
INVITE sip:[dest]@[remote_ip]:[remote_port] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: sipp <sip:[service]@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
To: sut <sip:[dest]@[remote_ip]:[remote_port]>
Call-ID: [call_id]
CSeq: 1 INVITE
Contact: sip:sipp@[local_ip]:[local_port]
Max-Forwards: 70
Subject: Test
Content-Type: application/sdp
Content-Length: [len]
v=0
o=phoneA 53655765 2353687637 IN IP[local_ip_type] [local_ip]
s=-
c=IN IP[media_ip_type] [media_ip]
t=0 0
m=audio [media_port] RTP/AVP 0
a=rtpmap:0 PCMU/8000
]]>
</send>

<recv response="100">
</recv>

<recv response="183">
</recv>

<recv response="603">
</recv>

<send>
<![CDATA[
ACK sip:[dest]@[remote_ip]:[remote_port] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: sipp <sip:[service]@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
To: sut <sip:[dest]@[remote_ip]:[remote_port]>[peer_tag_param]
Call-ID: [call_id]
CSeq: 1 ACK
Contact: sip:sipp@[local_ip]:[local_port]
Max-Forwards: 70
Subject: Test
Content-Length: 0
]]>
</send>

</scenario>
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
testinfo:
summary: 'Tests PJSIPHangup'
description:
'Checks PJSIPHangup with good parameters (437 and UNSUPPORTED_CERTIFICATE)
which should return 437, and with bad parameters (999 and SOMETHINGOROTHER),
which should return 603. Also test PJSIPHangup after an Answer() which should
be ignored and return a 200, then a BYE.'

test-modules:
test-object:
config-section: test-object-config
typename: 'sipp.SIPpTestCase'

test-object-config:
memcheck-delay-stop: 7
fail-on-any: True
test-iterations:
-
scenarios:
- { 'key-args': { 'scenario':'invite-expects-200-then-bye.xml', '-i':'127.0.0.1',
'-p':'5061', '-s':'alice' },
'ordered-args': [ '-bind_local', '-key', 'dest', 'expect_200']}

- { 'key-args': { 'scenario':'invite-expects-437.xml', '-i':'127.0.0.1',
'-p':'5062', '-s':'alice' },
'ordered-args': [ '-bind_local', '-key', 'dest', 'expect_437_1']}

- { 'key-args': { 'scenario':'invite-expects-437.xml', '-i':'127.0.0.1',
'-p':'5063', '-s':'alice' },
'ordered-args': [ '-bind_local', '-key', 'dest', 'expect_437_2']}

- { 'key-args': { 'scenario':'invite-expects-603.xml', '-i':'127.0.0.1',
'-p':'5064', '-s':'alice' },
'ordered-args': [ '-bind_local', '-key', 'dest', 'expect_603_1']}

- { 'key-args': { 'scenario':'invite-expects-603.xml', '-i':'127.0.0.1',
'-p':'5065', '-s':'alice' },
'ordered-args': [ '-bind_local', '-key', 'dest', 'expect_603_2']}


properties:
dependencies:
- app : 'sipp'
- asterisk : 'chan_pjsip'
- asterisk : 'res_pjsip'
tags:
- pjsip
2 changes: 2 additions & 0 deletions tests/channels/pjsip/dialplan_functions/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ tests:
- test: 'pjsip_header'
- test: 'pjsip_parse_uri'
- test: 'pjsip_session_refresh'
- test: 'pjsip_hangup'

0 comments on commit 6a1a91c

Please sign in to comment.