Skip to content

Commit

Permalink
pjsip: add tests for multirate 2833
Browse files Browse the repository at this point in the history
DRAFT PR - demonstrate appropriate handling of non 8K
2833 digit sdp offers.

Four categories of tests

Test that Asterisk offers the correct sdp for opus and ulaw when
2833 is enabled

Test that Asterisk creates the correct responses for opus and ulaw
when 2833 is enabled

Test that Asterisk is able to read 2833 digits embedded in both an
opus stream and ulaw stream.

Test that Asterisk generates the correct payload type for the dtmf
digits in the rtp stream
  • Loading branch information
mbradeen committed Jan 25, 2024
1 parent d9b7d1d commit b3d3a8e
Show file tree
Hide file tree
Showing 80 changed files with 6,063 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[general]
static=yes
writeprotect=yes
autofallthrough=yes
clearglobalvars=no
priorityjumping=yes

[globals]

[default]
exten => 555,1,noOp()
same => n,Answer()
same => n,SendDTMF(1)
same => n,SendDTMF(2)
same => n,SendDTMF(3)
same => n,SendDTMF(4)
same => n,SendDTMF(5)
same => n,SendDTMF(6)
same => n,SendDTMF(7)
same => n,SendDTMF(8)
same => n,SendDTMF(9)
same => n,SendDTMF(0)
same => n,Hangup()
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[global]
type = global
debug = yes

[transport-udp]
type = transport
protocol = udp
bind = 0.0.0.0:5060

[endpoint](!)
type = endpoint
dtmf_mode = auto_info
allow = !all,ulaw,alaw,opus
direct_media = no

[alicepriorityopus](endpoint)
allow = !all,opus,ulaw

[alicepriorityopus]
type=aor
max_contacts = 10
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
<?xml version="1.0" encoding="ISO-8859-1"?>

<scenario name="DTMF_SDP_NEGOTIATON_ALICE">
<!-- Multiple offers, ulaw prioritized with opus and Alaw as options. Asterisk accepts opus with ulaw. -->

<send retrans="500">
<![CDATA[
INVITE sip:555@[remote_ip] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: [service] <sip:[service]@[local_ip]>;tag=[call_number]
To: 555 <sip:555@[remote_ip]:[remote_port]>
Call-ID: [call_id]
CSeq: 1 INVITE
Contact: sip:[service]@[local_ip]:[local_port]
Max-Forwards: 70
Subject: Performance Test
Content-Type: application/sdp
Content-Length: [len]
v=0
o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
s=-
c=IN IP[local_ip_type] [local_ip]
t=0 0
m=audio 9000 RTP/AVP 0 96 97 101 102 103
a=sendrecv
a=rtpmap:0 PCMU/8000
a=rtpmap:96 AMR-WB/16000
a=fmtp:96 octet-align=1
a=rtpmap:97 opus/48000/2
a=fmtp:97 maxplaybackrate=24000;sprop-maxcapturerate=24000;maxaveragebitrate=96000;useinbandfec=1
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=rtpmap:102 telephone-event/16000
a=fmtp:102 0-16
a=rtpmap:103 telephone-event/48000
a=fmtp:103 0-16
]]>
</send>

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

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

<recv response="200" crlf="true">
<action>
<ereg regexp="RTP/AVP 97 0 103 101" search_in="body" check_it="true" assign_to = "1" />
<ereg regexp="a=rtpmap:97 opus/48000/2" search_in="body" check_it="true" assign_to = "2" />
<ereg regexp="a=fmtp:97 maxplaybackrate=24000;sprop-maxcapturerate=24000;maxaveragebitrate=96000" search_in="body" check_it="true" assign_to = "3" />
<ereg regexp="a=rtpmap:103 telephone-event/48000" search_in="body" check_it="true" assign_to = "4" />
<ereg regexp="a=fmtp:103 0-16" search_in="body" check_it="true" assign_to = "5" />
<ereg regexp="a=rtpmap:101 telephone-event/8000" search_in="body" check_it="true" assign_to = "6" />
<ereg regexp="a=fmtp:101 0-16" search_in="body" check_it="true" assign_to = "7" />
<ereg regexp="a=rtpmap:0 PCMU/8000" search_in="body" check_it="true" assign_to = "8" />
</action>
</recv>

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


<recv request="BYE" timeout="15000" ontimeout="sendbye" next="respond">
</recv>

<label id="sendbye"/>

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

<recv response="200" crlf="true" next="end"/>

<label id="respond"/>

<send>
<![CDATA[
SIP/2.0 200 OK
[last_Via:]
[last_From:]
[last_To:]
[last_Call-ID:]
[last_CSeq:]
Contact: <sip:[local_ip]:[local_port];transport=[transport]>
Content-Length: 0
]]>
</send>

<label id="end"/>

<Reference variables="1,2,3,4,5,6,7,8"/>

</scenario>
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
testinfo:
summary: 'This test case verifies the use of 2833 digits with multiple bitrate codecs'
description: |
'This test case verifies the use of 2833 digits with multiple bitrate codecs in different combinations'
properties:
dependencies:
- app : 'sipp'
- asterisk : 'res_pjsip'
- asterisk : 'app_dial'
tags:
- pjsip

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

sipp-config:
connect-ami: True
reactor-timeout: 90
fail-on-any: False
test-iterations:
-
scenarios:
- { 'key-args': {'scenario': 'alice_ulaw-amr16-opus_opus-ulaw.xml', '-p': '5061', '-s': 'alicepriorityopus'} }

ami-events:
-
type: 'headermatch'
conditions:
match:
Event: 'TestEvent'
state: 'DTMF_BEGIN'
Digit: '1'
Payload: '103'
rate: '48000'
count: 1
-
type: 'headermatch'
conditions:
match:
Event: 'TestEvent'
state: 'DTMF_BEGIN'
Digit: '2'
Payload: '103'
rate: '48000'
count: 1
-
type: 'headermatch'
conditions:
match:
Event: 'TestEvent'
state: 'DTMF_BEGIN'
Digit: '3'
Payload: '103'
rate: '48000'
count: 1
-
type: 'headermatch'
conditions:
match:
Event: 'TestEvent'
state: 'DTMF_BEGIN'
Digit: '4'
Payload: '103'
rate: '48000'
count: 1
-
type: 'headermatch'
conditions:
match:
Event: 'TestEvent'
state: 'DTMF_BEGIN'
Digit: '5'
Payload: '103'
rate: '48000'
count: 1
-
type: 'headermatch'
conditions:
match:
Event: 'TestEvent'
state: 'DTMF_BEGIN'
Digit: '6'
Payload: '103'
rate: '48000'
count: 1
-
type: 'headermatch'
conditions:
match:
Event: 'TestEvent'
state: 'DTMF_BEGIN'
Digit: '7'
Payload: '103'
rate: '48000'
count: 1
-
type: 'headermatch'
conditions:
match:
Event: 'TestEvent'
state: 'DTMF_BEGIN'
Digit: '8'
Payload: '103'
rate: '48000'
count: 1
-
type: 'headermatch'
conditions:
match:
Event: 'TestEvent'
state: 'DTMF_BEGIN'
Digit: '9'
Payload: '103'
rate: '48000'
count: 1
-
type: 'headermatch'
conditions:
match:
Event: 'TestEvent'
state: 'DTMF_BEGIN'
Digit: '0'
Payload: '103'
rate: '48000'
count: 1

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[general]
static=yes
writeprotect=yes
autofallthrough=yes
clearglobalvars=no
priorityjumping=yes

[globals]

[default]
exten => 555,1,noOp()
same => n,Answer()
same => n,SendDTMF(1)
same => n,SendDTMF(2)
same => n,SendDTMF(3)
same => n,SendDTMF(4)
same => n,SendDTMF(5)
same => n,SendDTMF(6)
same => n,SendDTMF(7)
same => n,SendDTMF(8)
same => n,SendDTMF(9)
same => n,SendDTMF(0)
same => n,Hangup()
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[global]
type = global
debug = yes

[transport-udp]
type = transport
protocol = udp
bind = 0.0.0.0:5060

[endpoint](!)
type = endpoint
dtmf_mode = auto_info
allow = !all,ulaw,alaw,opus
direct_media = no

[alicepriorityopus](endpoint)
allow = !all,opus,ulaw

[alicepriorityopus]
type=aor
max_contacts = 10
Loading

0 comments on commit b3d3a8e

Please sign in to comment.