Skip to content

Commit b109662

Browse files
AlexisHadjgithub-actions[bot]
authored andcommitted
tests/channels/pjsip/sdp_mandatory_lines: Added test to check the validity of SDP s= and o= lines
This new test verifies that the SDP Session Name (s=) and Origin (o=) lines are present and contain valid data, as required by RFC 8866. 1-Added SIPp scenario to initiate a call with validation on the SDP session (s=) and origin (o) lines. 2-Added Asterisk configuration (pjsip.conf, extensions.conf) to support the test. 3-Registered the new test in the pjsip test suite.
1 parent b529cca commit b109662

5 files changed

Lines changed: 108 additions & 0 deletions

File tree

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[general]
2+
static=yes
3+
writeprotect=no
4+
5+
[default]
6+
exten => 100,1,NoOp(Starting SDP Mandatory Lines Test)
7+
same => n,Dial(PJSIP/testuser)
8+
same => n,Hangup()
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[global]
2+
debug=yes
3+
4+
[transport-udp]
5+
type=transport
6+
protocol=udp
7+
bind=0.0.0.0:5060
8+
9+
[testuser]
10+
type=aor
11+
contact=sip:testuser@127.0.0.1:5061
12+
13+
[testuser]
14+
type=endpoint
15+
context=default
16+
allow=!all,ulaw
17+
aors=testuser
18+
direct_media=no
19+
sdp_session=
20+
sdp_owner=
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?xml version="1.0" encoding="ISO-8859-1" ?>
2+
<!DOCTYPE scenario SYSTEM "sipp.dtd">
3+
4+
<scenario name="Check SDP lines">
5+
6+
<recv request="INVITE">
7+
<!--sdp session s= field cannot be empty-->
8+
<ereg regexp="s=[^\r\n]+"
9+
search_in="body"
10+
check_it="true"
11+
assign_to="1" />
12+
<!--sdp Owner o=<username> <sess-id> <sess-version> <nettype> <addrtype> <address>-->
13+
<ereg regexp="o=\S+ [0-9]+ [0-9]+ IN IP[46] \S+"
14+
search_in="body"
15+
check_it="true"
16+
assign_to="2" />
17+
</recv>
18+
19+
<send>
20+
<![CDATA[
21+
SIP/2.0 200 OK
22+
[last_Via:]
23+
[last_From:]
24+
[last_To:];tag=[call_number]
25+
[last_Call-ID:]
26+
[last_CSeq:]
27+
Contact: <sip:[local_ip]:[local_port];transport=[transport]>
28+
Content-Type: application/sdp
29+
Content-Length: [len]
30+
31+
v=0
32+
o=user1 12345678 1234567890 IN IP[local_ip_type] [local_ip]
33+
s=-
34+
c=IN IP[local_ip_type] [local_ip]
35+
t=0 0
36+
m=audio [media_port] RTP/AVP 0
37+
a=rtpmap:0 PCMU/8000
38+
]]>
39+
</send>
40+
41+
<recv request="ACK" crlf="true">
42+
</recv>
43+
44+
</scenario>
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
testinfo:
2+
summary: 'Verify PJSIP SDP s= and o= lines are non-empty'
3+
description: |
4+
This test ensures that outbound SDP from Asterisk
5+
comply with RFC 8866 by verifying that the Session Name (s=) and
6+
Owner/Creator (o=) lines are present and contain valid data.'
7+
8+
test-modules:
9+
test-object:
10+
config-section: test-config
11+
typename: 'sipp.SIPpTestCase'
12+
modules:
13+
-
14+
config-section: orig-config
15+
typename: 'pluggable_modules.Originator'
16+
17+
test-config:
18+
test-iterations:
19+
-
20+
scenarios:
21+
- { 'key-args': {'scenario': 'check_sdp_lines.xml', '-s': 'testuser', '-p': '5061'}, 'stop-relative': 'True' }
22+
23+
orig-config:
24+
channel: 'PJSIP/testuser'
25+
26+
properties:
27+
dependencies:
28+
- python: 'starpy'
29+
- sipp:
30+
version: 'v3.1'
31+
- asterisk: 'chan_pjsip'
32+
- asterisk: 'res_pjsip'
33+
tags:
34+
- pjsip
35+
- sdp

‎tests/channels/pjsip/tests.yaml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,4 @@ tests:
7575
- test: 'non_negotiated_frame_SSRC_change'
7676
- test: 'content_disposition'
7777
- test: 'reinvite_after_bye'
78+
- test: 'sdp_mandatory_lines'

0 commit comments

Comments
 (0)