Skip to content

Commit 2c1ca27

Browse files
committed
res_pjsip_rfc7329: add tests for new module res_pjsip_rfc7329
Add a dedicated rfc7329 test suite under tests/channels/pjsip for asterisk/asterisk#1713 UserNote: The suite covers options , registration, invite/refer scenarios. rfc7329 enabled and disabled behavior. Module loaded and unloaded variants. Caller/callee dialogs across active scenarios . REFER flows including Refer-To Session-ID storage (alice/bob/charlie)
1 parent 9e53419 commit 2c1ca27

File tree

67 files changed

+2778
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+2778
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[default]
2+
3+
exten => bob,1,Dial(PJSIP/bob)
4+
same => n,Hangup()
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
; Do not delete -
2+
; May be appended with noloads due to conflicts (see conflicts.txt)
3+
4+
[modules]
5+
autoload=yes
6+
7+
noload => chan_alsa.so
8+
noload => chan_oss.so
9+
noload => chan_console.so
10+
load => res_pjsip_rfc7329.so
11+
#include "modules.conf.inc"
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
[global]
2+
type=global
3+
rfc7329_enable=no
4+
5+
[transport-udp]
6+
type=transport
7+
protocol=udp
8+
bind=127.0.0.1:5060
9+
10+
[endpoint-template](!)
11+
type=endpoint
12+
transport=transport-udp
13+
context=default
14+
identify_by=ip
15+
direct_media=no
16+
disallow=all
17+
allow=ulaw
18+
19+
[aor-template](!)
20+
type=aor
21+
max_contacts=1
22+
23+
[alice](aor-template)
24+
contact=sip:alice@127.0.0.1:5061
25+
26+
[alice](endpoint-template)
27+
aors=alice
28+
29+
[bob](aor-template)
30+
contact=sip:bob@127.0.0.1:5062
31+
32+
[bob](endpoint-template)
33+
aors=bob
34+
35+
[alice-identify]
36+
type=identify
37+
endpoint=alice
38+
match=127.0.0.1:5061
39+
40+
[bob-identify]
41+
type=identify
42+
endpoint=bob
43+
match=127.0.0.1:5062
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
<?xml version="1.0" encoding="ISO-8859-1" ?>
2+
<!DOCTYPE scenario SYSTEM "sipp.dtd">
3+
4+
<scenario name="RFC7329 disabled caller with Session-ID">
5+
<User variables="nosid_180,nosid_200,nosid_bye_200" />
6+
7+
<send retrans="500">
8+
<![CDATA[
9+
10+
INVITE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
11+
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
12+
From: alice <sip:alice@[local_ip]:[local_port]>;tag=[call_number]
13+
To: bob <sip:[service]@[remote_ip]:[remote_port]>
14+
Call-ID: [call_id]
15+
CSeq: 1 INVITE
16+
Session-ID: 13579bdf2468ace013579bdf2468ace0
17+
Contact: <sip:alice@[local_ip]:[local_port];transport=[transport]>
18+
Max-Forwards: 70
19+
Subject: Test
20+
Content-Type: application/sdp
21+
Content-Length: [len]
22+
23+
v=0
24+
o=alice 53655765 2353687637 IN IP[local_ip_type] [local_ip]
25+
s=-
26+
c=IN IP[media_ip_type] [media_ip]
27+
t=0 0
28+
m=audio [media_port] RTP/AVP 0
29+
a=rtpmap:0 PCMU/8000
30+
31+
]]>
32+
</send>
33+
34+
<recv response="100" optional="true" />
35+
36+
<recv response="180" crlf="true">
37+
<action>
38+
<ereg regexp="Session-ID: .*"
39+
search_in="msg"
40+
check_it_inverse="true"
41+
assign_to="nosid_180" />
42+
</action>
43+
</recv>
44+
45+
<recv response="200" rtd="true" crlf="true">
46+
<action>
47+
<ereg regexp="Session-ID: .*"
48+
search_in="msg"
49+
check_it_inverse="true"
50+
assign_to="nosid_200" />
51+
</action>
52+
</recv>
53+
54+
<send>
55+
<![CDATA[
56+
57+
ACK sip:[service]@[remote_ip]:[remote_port] SIP/2.0
58+
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
59+
From: alice <sip:alice@[local_ip]:[local_port]>;tag=[call_number]
60+
To: bob <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
61+
Call-ID: [call_id]
62+
CSeq: 1 ACK
63+
Session-ID: 13579bdf2468ace013579bdf2468ace0
64+
Contact: <sip:alice@[local_ip]:[local_port];transport=[transport]>
65+
Max-Forwards: 70
66+
Content-Length: 0
67+
68+
]]>
69+
</send>
70+
71+
<pause milliseconds="1000"/>
72+
73+
<send retrans="500">
74+
<![CDATA[
75+
76+
BYE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
77+
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
78+
From: alice <sip:alice@[local_ip]:[local_port]>;tag=[call_number]
79+
To: bob <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
80+
Call-ID: [call_id]
81+
CSeq: 2 BYE
82+
Session-ID: 13579bdf2468ace013579bdf2468ace0
83+
Contact: <sip:alice@[local_ip]:[local_port];transport=[transport]>
84+
Max-Forwards: 70
85+
Content-Length: 0
86+
87+
]]>
88+
</send>
89+
90+
<recv response="200" crlf="true">
91+
<action>
92+
<ereg regexp="Session-ID: .*"
93+
search_in="msg"
94+
check_it_inverse="true"
95+
assign_to="nosid_bye_200" />
96+
</action>
97+
</recv>
98+
99+
<Reference variables="nosid_180,nosid_200,nosid_bye_200" />
100+
</scenario>
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
<?xml version="1.0" encoding="ISO-8859-1" ?>
2+
<!DOCTYPE scenario SYSTEM "sipp.dtd">
3+
4+
<scenario name="RFC7329 disabled callee with Session-ID">
5+
<User variables="nosid_invite,nosid_ack,nosid_bye" />
6+
7+
<recv request="INVITE" crlf="true">
8+
<action>
9+
<ereg regexp="Session-ID: .*"
10+
search_in="msg"
11+
check_it_inverse="true"
12+
assign_to="nosid_invite" />
13+
</action>
14+
</recv>
15+
16+
<send>
17+
<![CDATA[
18+
19+
SIP/2.0 180 Ringing
20+
[last_Via:]
21+
[last_From:]
22+
[last_To:];tag=[pid]SIPpTag01[call_number]
23+
[last_Call-ID:]
24+
[last_CSeq:]
25+
Session-ID: abcdefabcdefabcdefabcdefabcdefab
26+
Contact: <sip:[local_ip]:[local_port];transport=[transport]>
27+
Content-Length: 0
28+
29+
]]>
30+
</send>
31+
32+
<send retrans="500">
33+
<![CDATA[
34+
35+
SIP/2.0 200 OK
36+
[last_Via:]
37+
[last_From:]
38+
[last_To:];tag=[pid]SIPpTag01[call_number]
39+
[last_Call-ID:]
40+
[last_CSeq:]
41+
Session-ID: abcdefabcdefabcdefabcdefabcdefab
42+
Contact: <sip:[local_ip]:[local_port];transport=[transport]>
43+
Content-Type: application/sdp
44+
Content-Length: [len]
45+
46+
v=0
47+
o=bob 53655765 2353687637 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
52+
a=rtpmap:0 PCMU/8000
53+
54+
]]>
55+
</send>
56+
57+
<recv request="ACK" crlf="true">
58+
<action>
59+
<ereg regexp="Session-ID: .*"
60+
search_in="msg"
61+
check_it_inverse="true"
62+
assign_to="nosid_ack" />
63+
</action>
64+
</recv>
65+
66+
<recv request="BYE" crlf="true">
67+
<action>
68+
<ereg regexp="Session-ID: .*"
69+
search_in="msg"
70+
check_it_inverse="true"
71+
assign_to="nosid_bye" />
72+
</action>
73+
</recv>
74+
75+
<send retrans="500">
76+
<![CDATA[
77+
78+
SIP/2.0 200 OK
79+
[last_Via:]
80+
[last_From:]
81+
[last_To:]
82+
[last_Call-ID:]
83+
[last_CSeq:]
84+
Content-Length: 0
85+
86+
]]>
87+
</send>
88+
89+
<Reference variables="nosid_invite,nosid_ack,nosid_bye" />
90+
</scenario>
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
testinfo:
2+
summary: 'RFC7329 disabled: with_sid caller/callee only'
3+
description: |
4+
'With rfc7329_enable=no, both caller and callee send Session-ID,
5+
but Asterisk must not inject Session-ID on forwarded in-dialog
6+
requests and responses.'
7+
8+
test-modules:
9+
test-object:
10+
config-section: test-object-config
11+
typename: 'sipp.SIPpTestCase'
12+
13+
test-object-config:
14+
memcheck-delay-stop: 7
15+
test-iterations:
16+
-
17+
scenarios:
18+
- { 'key-args': {'scenario': 'bob_with_sid.xml', '-i': '127.0.0.1', '-p': '5062'} }
19+
- { 'key-args': {'scenario': 'alice_with_sid.xml', '-i': '127.0.0.1', '-p': '5061', '-s': 'bob'} }
20+
21+
properties:
22+
dependencies:
23+
- app: 'sipp'
24+
- asterisk: 'app_dial'
25+
- asterisk: 'chan_pjsip'
26+
- asterisk: 'res_pjsip'
27+
- asterisk: 'res_pjsip_session'
28+
- asterisk: 'res_pjsip_rfc7329'
29+
tags:
30+
- pjsip
31+
- rfc7329
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[default]
2+
3+
exten => bob,1,Dial(PJSIP/bob)
4+
same => n,Hangup()
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
; Do not delete -
2+
; May be appended with noloads due to conflicts (see conflicts.txt)
3+
4+
[modules]
5+
autoload=yes
6+
7+
noload => chan_alsa.so
8+
noload => chan_oss.so
9+
noload => chan_console.so
10+
load => res_pjsip_rfc7329.so
11+
#include "modules.conf.inc"
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
[global]
2+
type=global
3+
rfc7329_enable=no
4+
5+
[transport-udp]
6+
type=transport
7+
protocol=udp
8+
bind=127.0.0.1:5060
9+
10+
[endpoint-template](!)
11+
type=endpoint
12+
transport=transport-udp
13+
context=default
14+
identify_by=username
15+
direct_media=no
16+
disallow=all
17+
allow=ulaw
18+
19+
[aor-template](!)
20+
type=aor
21+
max_contacts=1
22+
23+
[auth-template](!)
24+
type=auth
25+
auth_type=userpass
26+
27+
[alice](aor-template)
28+
29+
[alice](endpoint-template)
30+
aors=alice
31+
auth=alice-auth
32+
33+
[alice-auth](auth-template)
34+
username=alice
35+
password=alicepass
36+
37+
[bob](aor-template)
38+
39+
[bob](endpoint-template)
40+
aors=bob
41+
auth=bob-auth
42+
43+
[bob-auth](auth-template)
44+
username=bob
45+
password=bobpass
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?xml version="1.0" encoding="ISO-8859-1" ?>
2+
<!DOCTYPE scenario SYSTEM "sipp.dtd">
3+
4+
<scenario name="RFC7329 alice register">
5+
<send retrans="500">
6+
<![CDATA[
7+
8+
REGISTER sip:[remote_ip]:[remote_port] SIP/2.0
9+
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
10+
From: alice <sip:alice@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
11+
To: alice <sip:alice@[remote_ip]:[remote_port]>
12+
Call-ID: [call_id]
13+
CSeq: 1 REGISTER
14+
Session-ID: 13579bdf2468ace013579bdf2468ace0
15+
Contact: <sip:alice@[local_ip]:[local_port];transport=[transport]>
16+
Max-Forwards: 70
17+
Expires: 300
18+
Content-Length: 0
19+
20+
]]>
21+
</send>
22+
23+
<recv response="401" auth="true" />
24+
25+
<send retrans="500">
26+
<![CDATA[
27+
28+
REGISTER sip:[remote_ip]:[remote_port] SIP/2.0
29+
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
30+
From: alice <sip:alice@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
31+
To: alice <sip:alice@[remote_ip]:[remote_port]>
32+
Call-ID: [call_id]
33+
CSeq: 2 REGISTER
34+
Session-ID: 13579bdf2468ace013579bdf2468ace0
35+
Contact: <sip:alice@[local_ip]:[local_port];transport=[transport]>
36+
Max-Forwards: 70
37+
Expires: 300
38+
[authentication username=alice password=alicepass]
39+
Content-Length: 0
40+
41+
]]>
42+
</send>
43+
44+
<recv response="200" />
45+
</scenario>

0 commit comments

Comments
 (0)