Skip to content

Commit

Permalink
chan_pjsip: Test Session Timer
Browse files Browse the repository at this point in the history
Test if chan_pjsip replies w/ 422 (Session Interval Too Small) response
to an INVITE request w/ Session-Expires lower than timers_min_se
setting.
  • Loading branch information
btriller committed Sep 22, 2023
1 parent affbb90 commit 5e42caa
Show file tree
Hide file tree
Showing 6 changed files with 105 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[default]
exten => test,1,Answer()
same => n,Wait(10)
same => n,Hangup
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[system]
type=system
timer_t1=100
timer_b=6400

[local-transport-udp]
type=transport
protocol=udp
bind=127.0.0.1

[sipp]
type=endpoint
context=default
timers_min_se=180
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE scenario SYSTEM "sipp.dtd">

<scenario name="empty reinvite all codecs">
<!-- In client mode (sipp placing calls), the Call-ID MUST be -->
<!-- generated by sipp. To do so, use [call_id] keyword. -->
<send retrans="500">
<![CDATA[
INVITE sip:test@[remote_ip]:[remote_port] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
To: sut <sip:[service]@[remote_ip]>
Call-ID: [call_id]
CSeq: 1 INVITE
Contact: sip:sipp@[local_ip]:[local_port]
Max-Forwards: 70
Supported: timer
Session-Expires: 120;refresher=uac
Content-Type: application/sdp
Content-Length: [len]
v=0
o=user1 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 8
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=ptime:20
]]>
</send>

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

<recv response="422"/>

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

</scenario>
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
testinfo:
summary: 'Ensure Session Interval Too Small response'
description: |
'A SIPp scenario places a call into Asterisk w/ Session-Expires smaller than
configured Min-SE. Asterisk should respond w/ 422.'
test-modules:
test-object:
config-section: sipp-config
typename: 'sipp.SIPpTestCase'

sipp-config:
memcheck-delay-stop: 7
test-iterations:
-
scenarios:
- { 'key-args': {'scenario': 'session-timer-minse.xml'}}

properties:
dependencies:
- python: 'twisted'
- python: 'starpy'
- app: 'sipp'
- asterisk: 'res_pjsip'
- asterisk: 'res_pjsip_session'
tags:
- pjsip
2 changes: 2 additions & 0 deletions tests/channels/pjsip/session_timers/tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
tests:
- test: 'session-timer-minse'
1 change: 1 addition & 0 deletions tests/channels/pjsip/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ tests:
- dir: 'rtp_ptime'
- dir: 'ignore_183_wo_sdp'
- dir: 'all_codecs_on_empty_reinvite'
- dir: 'session_timers'
- test: 'accountcode'
- test: 'acl_call'
- test: 'allow_overlap'
Expand Down

0 comments on commit 5e42caa

Please sign in to comment.