Skip to content

Commit 7e1e4ae

Browse files
committed
pjsip/rest_api: Introduce a test for ChannelTransfer event
Test that a SIP REFER is translated into a ChannelTransfer event when TRANSFERHANDLING=ari-only is set on the channel and that transfer_progress generates the necessary SIP NOTIFY messages. Be strict on the first ChannelTransfer event being received. Then only check that the transfer state is changing from not being present, to progress and finally answered. When answered delete all the channels and the bridge and the test wull succeed.
1 parent 464d22a commit 7e1e4ae

File tree

6 files changed

+497
-1
lines changed

6 files changed

+497
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[default]
2+
3+
exten => s,1,NoOp()
4+
same => n,Answer()
5+
same => n,Stasis(testsuite)
6+
same => n,Hangup()
7+
8+
exten => 1000,1,Answer
9+
same => n,Stasis(testsuite,no_bridge)
10+
same => n,Hangup
11+
12+
exten => stasis,1,NoOp()
13+
same => n,Answer()
14+
same => n,Stasis(testsuite,test)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[local]
2+
type=transport
3+
protocol=udp
4+
bind=127.0.0.1:5060
5+
6+
[bob]
7+
type=endpoint
8+
context=default
9+
disallow=all
10+
allow=ulaw
11+
direct_media=no
12+
set_var=PJSIP_TRANSFER_HANDLING=ari-only
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
<?xml version="1.0" encoding="ISO-8859-1" ?>
2+
<!DOCTYPE scenario SYSTEM "sipp.dtd">
3+
4+
<!-- This program is free software; you can redistribute it and/or -->
5+
<!-- modify it under the terms of the GNU General Public License as -->
6+
<!-- published by the Free Software Foundation; either version 2 of the -->
7+
<!-- License, or (at your option) any later version. -->
8+
<!-- -->
9+
<!-- This program is distributed in the hope that it will be useful, -->
10+
<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of -->
11+
<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -->
12+
<!-- GNU General Public License for more details. -->
13+
<!-- -->
14+
<!-- You should have received a copy of the GNU General Public License -->
15+
<!-- along with this program; if not, write to the -->
16+
<!-- Free Software Foundation, Inc., -->
17+
<!-- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -->
18+
<!-- -->
19+
20+
<scenario name="Referee Leg">
21+
22+
<recvCmd>
23+
<action>
24+
<ereg regexp="REMOTE(.*)"
25+
search_in="hdr"
26+
header="Call-ID:"
27+
check_it="true"
28+
assign_to="1,original_callid" />
29+
</action>
30+
</recvCmd>
31+
32+
<send retrans="500">
33+
<![CDATA[
34+
35+
INVITE sip:1000@[remote_ip]:[remote_port] SIP/2.0
36+
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
37+
From: <sip:bob@[local_ip]:[local_port]>;tag=[call_number]
38+
To: <sip:transfer@[remote_ip]:[remote_port]>
39+
Call-ID: [call_id]
40+
CSeq: [cseq] INVITE
41+
Contact: <sip:bob@[local_ip]:[local_port]>
42+
Max-Forwards: 70
43+
Content-Type: application/sdp
44+
Content-Length: [len]
45+
46+
v=0
47+
o=- 1324901698 1324901698 IN IP[local_ip_type] [local_ip]
48+
s=-
49+
c=IN IP[media_ip_type] [media_ip]
50+
t=0 0
51+
m=audio [media_port] RTP/AVP 0 101
52+
a=sendrecv
53+
a=rtpmap:0 PCMU/8000
54+
a=rtpmap:101 telephone-event/8000
55+
56+
]]>
57+
</send>
58+
59+
<recv response="100" optional="true" />
60+
<recv response="101" optional="true" />
61+
<recv response="180" optional="true" />
62+
<recv response="200" rtd="true" crlf="true">
63+
<action>
64+
<ereg regexp="tag=([[:alnum:].\-]*)"
65+
search_in="hdr"
66+
header="To:"
67+
check_it="true"
68+
assign_to="2,to_tag" />
69+
<ereg regexp="tag=([[:alnum:].\-]*)"
70+
search_in="hdr"
71+
header="From:"
72+
check_it="true"
73+
assign_to="3,from_tag" />
74+
</action>
75+
</recv>
76+
<Reference variables="1,2,3" />
77+
78+
<send>
79+
<![CDATA[
80+
81+
ACK sip:1000@[remote_ip]:[remote_port] SIP/2.0
82+
Via: SIP/2.0/[transport] [local_ip]:[local_port];rport;branch=[branch]
83+
[last_From:]
84+
[last_To]
85+
Call-ID: [call_id]
86+
CSeq: [cseq] ACK
87+
Contact: sip:bob@[local_ip]:[local_port]
88+
Max-Forwards: 70
89+
Content-Length: 0
90+
91+
]]>
92+
</send>
93+
94+
<pause milliseconds="1000" />
95+
<sendCmd>
96+
<![CDATA[
97+
Call-ID: [$original_callid]
98+
Remote-To-Tag: [$to_tag]
99+
Remote-From-Tag: [$from_tag]
100+
Remote-URI: sip:1000@[remote_ip]:[remote_port]
101+
]]>
102+
</sendCmd>
103+
104+
<recv request="BYE" />
105+
<send>
106+
<![CDATA[
107+
108+
SIP/2.0 200 OK
109+
[last_Via:]
110+
[last_From:]
111+
[last_To]
112+
[last_Call-ID:]
113+
[last_CSeq:]
114+
Contact: <sip:bob@[local_ip]:[local_port]>
115+
Content-Length:0
116+
117+
]]>
118+
</send>
119+
120+
<!-- definition of the response time repartition table (unit is ms) -->
121+
<ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
122+
123+
<!-- definition of the call length repartition table (unit is ms) -->
124+
<CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
125+
126+
</scenario>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
<?xml version="1.0" encoding="ISO-8859-1" ?>
2+
<!DOCTYPE scenario SYSTEM "sipp.dtd">
3+
4+
<!-- This program is free software; you can redistribute it and/or -->
5+
<!-- modify it under the terms of the GNU General Public License as -->
6+
<!-- published by the Free Software Foundation; either version 2 of the -->
7+
<!-- License, or (at your option) any later version. -->
8+
<!-- -->
9+
<!-- This program is distributed in the hope that it will be useful, -->
10+
<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of -->
11+
<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -->
12+
<!-- GNU General Public License for more details. -->
13+
<!-- -->
14+
<!-- You should have received a copy of the GNU General Public License -->
15+
<!-- along with this program; if not, write to the -->
16+
<!-- Free Software Foundation, Inc., -->
17+
<!-- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -->
18+
<!-- -->
19+
20+
<scenario name="Referer Leg">
21+
22+
<send retrans="500">
23+
<![CDATA[
24+
25+
INVITE sip:stasis@[remote_ip]:[remote_port] SIP/2.0
26+
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
27+
From: <sip:bob@[local_ip]:[local_port]>;tag=[call_number]
28+
To: <sip:transfer@[remote_ip]:[remote_port]>
29+
Call-ID: [call_id]
30+
CSeq: [cseq] INVITE
31+
Contact: <sip:bob@[local_ip]:[local_port]>
32+
Content-Type: application/sdp
33+
Max-Forwards: 70
34+
Content-Length: [len]
35+
36+
v=0
37+
o=- 1324901698 1324901698 IN IP[local_ip_type] [local_ip]
38+
s=-
39+
c=IN IP[media_ip_type] [media_ip]
40+
t=0 0
41+
m=audio [media_port] RTP/AVP 0 101
42+
a=sendrecv
43+
a=rtpmap:0 PCMU/8000
44+
a=rtpmap:101 telephone-event/8000
45+
46+
]]>
47+
</send>
48+
49+
<recv response="100" optional="true" />
50+
<recv response="101" optional="true" />
51+
<recv response="180" optional="true" />
52+
<recv response="200" rtd="true" crlf="true" />
53+
54+
<send>
55+
<![CDATA[
56+
57+
ACK sip:stasis@[remote_ip]:[remote_port] SIP/2.0
58+
Via: SIP/2.0/[transport] [local_ip]:[local_port];rport;branch=[branch]
59+
[last_From:]
60+
[last_To]
61+
Call-ID: [call_id]
62+
CSeq: [cseq] ACK
63+
Contact: sip:bob@[local_ip]:[local_port]
64+
Max-Forwards: 70
65+
Content-Length: 0
66+
67+
]]>
68+
</send>
69+
70+
<sendCmd>
71+
<![CDATA[
72+
Call-ID: REMOTE[call_id]
73+
Start the Echo Leg
74+
]]>
75+
</sendCmd>
76+
77+
<recvCmd>
78+
<action>
79+
<ereg regexp=" (.+)"
80+
search_in="hdr"
81+
header="Remote-URI:"
82+
check_it="true"
83+
assign_to="1,remote_contact" />
84+
<ereg regexp=" (.+)"
85+
search_in="hdr"
86+
header="Remote-To-Tag:"
87+
check_it="true"
88+
assign_to="2,remote_to_tag" />
89+
<ereg regexp=" (.+)"
90+
search_in="hdr"
91+
header="Remote-From-Tag:"
92+
check_it="true"
93+
assign_to="3,remote_from_tag" />
94+
<ereg regexp=" (.+)@(.+)"
95+
search_in="hdr"
96+
header="Call-ID:"
97+
check_it="true"
98+
assign_to="4,callid_chunk_1,callid_chunk_2"/>
99+
</action>
100+
</recvCmd>
101+
<Reference variables="1,2,3,4" />
102+
103+
<send>
104+
<![CDATA[
105+
106+
REFER sip:stasis@[remote_ip]:[remote_port] SIP/2.0
107+
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
108+
[last_From:]
109+
[last_To]
110+
[last_Call-ID:]
111+
CSeq: [cseq] REFER
112+
Contact: <sip:bob@[local_ip]:[local_port]>
113+
Max-Forwards: 70
114+
Refer-to: <[$remote_contact]?Replaces=REMOTE[$callid_chunk_1]%40[$callid_chunk_2]%3Bto-tag%3D[$remote_to_tag]%3Bfrom-tag%3D[$remote_from_tag]>
115+
Referred-By: sip:bob@[local_ip]
116+
Content-Length: 0
117+
118+
]]>
119+
</send>
120+
<recv response="202" rtd="true" crlf="true" />
121+
122+
<recv request="NOTIFY" />
123+
<send>
124+
<![CDATA[
125+
126+
SIP/2.0 200 OK
127+
[last_Via:]
128+
[last_From:]
129+
[last_To]
130+
[last_Call-ID:]
131+
[last_CSeq:]
132+
Contact: <sip:bob@[local_ip]:[local_port]>
133+
Content-Length:0
134+
135+
]]>
136+
</send>
137+
138+
<recv request="NOTIFY" />
139+
<send>
140+
<![CDATA[
141+
142+
SIP/2.0 200 OK
143+
[last_Via:]
144+
[last_From:]
145+
[last_To]
146+
[last_Call-ID:]
147+
[last_CSeq:]
148+
Contact: <sip:bob@[local_ip]:[local_port]>
149+
Content-Length:0
150+
151+
]]>
152+
</send>
153+
154+
<send retrans="500">
155+
<![CDATA[
156+
157+
BYE sip:stasis@[remote_ip]:[remote_port] SIP/2.0
158+
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
159+
From: <sip:bob@[local_ip]:[local_port]>;tag=[call_number]
160+
To: <sip:transfer@[remote_ip]:[remote_port]>[peer_tag_param]
161+
[last_Call-ID:]
162+
CSeq: [cseq] BYE
163+
Contact: sip:bob@[local_ip]:[local_port]
164+
Max-Forwards: 70
165+
Subject: Performance Test
166+
Content-Length: 0
167+
168+
]]>
169+
</send>
170+
<recv response="200" />
171+
172+
<!-- definition of the response time repartition table (unit is ms) -->
173+
<ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
174+
175+
<!-- definition of the call length repartition table (unit is ms) -->
176+
<CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
177+
178+
</scenario>

0 commit comments

Comments
 (0)