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.

Three 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.
  • Loading branch information
mbradeen committed Nov 28, 2023
1 parent 90ec44a commit 09a024c
Show file tree
Hide file tree
Showing 33 changed files with 2,066 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[general]
static=yes
writeprotect=yes
autofallthrough=yes
clearglobalvars=no
priorityjumping=yes

[globals]

[default]
exten => 555,1,noOp()
same => n,Answer()
same => n,Echo()
same => n,Hangup()
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[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

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

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

[aliceonlyulaw](endpoint)
allow = !all,ulaw

[aliceonlyopus](endpoint)
allow = !all,opus
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<?xml version="1.0" encoding="ISO-8859-1"?>

<scenario name="DTMF_SDP_NEGOTIATON_ALICE_B">
<!-- Agent offers ulaw and Alaw with telephone-event. Asterisk answers. -->

<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 8 101
a=sendrecv
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
]]>
</send>

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

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

<recv response="200" crlf="true">
<action>
<ereg regexp="RTP/AVP 0 8 101" search_in="body" check_it="true" assign_to = "1" />
<ereg regexp="a=rtpmap:0 PCMU/8000" search_in="body" check_it="true" assign_to = "2" />
<ereg regexp="a=rtpmap:8 PCMA/8000" search_in="body" check_it="true" assign_to = "3" />
<ereg regexp="a=rtpmap:101 telephone-event/8000" search_in="body" check_it="true" assign_to = "4" />
<ereg regexp="a=fmtp:101 0-16" search_in="body" check_it="true" assign_to = "5" />
</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>


<send retrans="500">
<![CDATA[
BYE 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: 2 BYE
Contact: sip:[service]@[local_ip]:[local_port]
Max-Forwards: 70
Subject: Performance Test
Content-Length: 0
]]>
</send>

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

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

</scenario>
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<?xml version="1.0" encoding="ISO-8859-1"?>

<scenario name="DTMF_SDP_NEGOTIATON_ALICE_D">
<!-- Agent offers opus with telephone-event. Asterisk answers. -->

<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 96 101
a=sendrecv
a=rtpmap:96 opus/48000/2
a=fmtp:96 maxplaybackrate=24000;sprop-maxcapturerate=24000;maxaveragebitrate=96000;useinbandfec=1;stereo=1
a=rtpmap:101 telephone-event/48000
a=fmtp:101 0-16
]]>
</send>

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

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

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


<send retrans="500">
<![CDATA[
BYE sip:[service]@[remote_ip] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: [service] <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"/>

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

</scenario>
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
<?xml version="1.0" encoding="ISO-8859-1"?>

<scenario name="DTMF_SDP_NEGOTIATON_ALICE_F_1">
<!-- Agent offers multiple codecs, opus prioritized with ulaw and Alaw as options. Asterisk prioritizes opus. -->

<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 96 0 8 101 102
a=sendrecv
a=rtpmap:96 opus/48000/2
a=fmtp:96 maxplaybackrate=24000;sprop-maxcapturerate=24000;maxaveragebitrate=96000;useinbandfec=1;stereo=1
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/48000
a=fmtp:101 0-16
a=rtpmap:102 telephone-event/8000
a=fmtp:102 0-16
]]>
</send>

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

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

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


<send retrans="500">
<![CDATA[
BYE sip:[service]@[remote_ip] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: [service] <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"/>

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

</scenario>
Loading

0 comments on commit 09a024c

Please sign in to comment.