-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pjsip: Add tests for Advanced Codec Negotiation (ACN)
- Loading branch information
1 parent
3d44265
commit a6f7b23
Showing
256 changed files
with
13,533 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
...channels/pjsip/codec_negotiation/audio/common_codecs_default/configs/ast1/extensions.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[general] | ||
|
||
[globals] | ||
|
||
[calling] | ||
exten => bob,1,NoOp() | ||
same => n,Dial(PJSIP/bob) | ||
same => n,Hangup() |
38 changes: 38 additions & 0 deletions
38
tests/channels/pjsip/codec_negotiation/audio/common_codecs_default/configs/ast1/pjsip.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
[system] | ||
type=system | ||
timer_t1=100 | ||
timer_b=6400 | ||
|
||
[global] | ||
type=global | ||
debug=yes | ||
|
||
[local-transport] | ||
type=transport | ||
bind=127.0.0.1 | ||
protocol=udp | ||
|
||
|
||
|
||
[endpoint-template](!) | ||
|
||
[alice](endpoint-template) | ||
type=endpoint | ||
allow=opus,g722,ulaw,alaw,h264 | ||
context=calling | ||
direct_media=no | ||
media_address=127.0.0.1 | ||
aors=alice | ||
|
||
[bob](endpoint-template) | ||
type=endpoint | ||
allow=opus,g722,ulaw,alaw,h264 | ||
context=calling | ||
direct_media=no | ||
media_address=127.0.0.1 | ||
aors=bob | ||
|
||
[bob] | ||
type=aor | ||
max_contacts=1 | ||
contact=sip:[email protected]:5060\;transport=udp |
101 changes: 101 additions & 0 deletions
101
tests/channels/pjsip/codec_negotiation/audio/common_codecs_default/sipp/alice.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
<?xml version="1.0" encoding="ISO-8859-1" ?> | ||
|
||
<scenario name="Send Call"> | ||
|
||
<send retrans="500"> | ||
<![CDATA[ | ||
INVITE sip:[service]@[remote_ip]:[remote_port] SIP/2.0 | ||
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] | ||
From: <sip:alice@[local_ip]:[local_port]>;tag=[pid]SIPpTag[call_number] | ||
To: <sip:[service]@[remote_ip]:[remote_port]> | ||
Call-ID: [call_id] | ||
CSeq: [cseq] INVITE | ||
Contact: <sip:alice@[local_ip]:[local_port];transport=[transport]> | ||
Max-Forwards: 70 | ||
Content-Type: application/sdp | ||
Content-Length: [len] | ||
v=0 | ||
o=- 53655765 2353687637 IN IP[local_ip_type] [local_ip] | ||
s=- | ||
c=IN IP[media_ip_type] [media_ip] | ||
t=0 0 | ||
m=audio [custom_media_port] RTP/AVP 107 9 8 0 | ||
a=rtpmap:107 opus/48000/2 | ||
a=fmtp:107 maxaveragebitrate=64000;sprop-stereo=1 | ||
a=rtpmap:9 G722/8000 | ||
a=rtpmap:8 PCMA/8000 | ||
a=rtpmap:0 PCMU/8000 | ||
a=ptime:20 | ||
a=maxptime:20 | ||
a=sendrecv | ||
a=rtcp-mux | ||
]]> | ||
</send> | ||
|
||
<recv response="100" optional="true" /> | ||
<recv response="180" /> | ||
|
||
<recv response="200" rtd="true"> | ||
<!-- Save the To tag. --> | ||
<action> | ||
<ereg regexp="(;tag=.*)" | ||
header="To:" | ||
search_in="hdr" | ||
check_it="true" | ||
assign_to="remote_tag"/> | ||
<ereg regexp="m=audio [0-9]{1,5} RTP/AVP 9 8 0" | ||
search_in="body" check_it="true" assign_to="1"/> | ||
<test assign_to="1" variable="1" compare="equal" value=""/> | ||
<ereg regexp="G722" | ||
search_in="body" check_it_inverse="false" assign_to="2"/> | ||
<test assign_to="2" variable="2" compare="equal" value=""/> | ||
<ereg regexp="PCMA" | ||
search_in="body" check_it_inverse="false" assign_to="3"/> | ||
<test assign_to="3" variable="3" compare="equal" value=""/> | ||
<ereg regexp="OPUS" | ||
search_in="body" check_it_inverse="true" assign_to="4"/> | ||
<test assign_to="4" variable="4" compare="equal" value=""/> | ||
</action> | ||
</recv> | ||
|
||
<send> | ||
<![CDATA[ | ||
ACK sip:[service]@[remote_ip]:[remote_port] SIP/2.0 | ||
[last_Via:] | ||
[last_From:] | ||
[last_To:] | ||
Call-ID: [call_id] | ||
CSeq: [cseq] ACK | ||
Contact: <sip:alice@[local_ip]:[local_port];transport=[transport]> | ||
Max-Forwards: 70 | ||
Content-Length: 0 | ||
]]> | ||
</send> | ||
|
||
<pause milliseconds="1000" /> | ||
|
||
<send retrans="500"> | ||
<![CDATA[ | ||
BYE sip:[service]@[remote_ip]:[remote_port] SIP/2.0 | ||
[last_Via:]4 | ||
From: <sip:alice@[local_ip]:[local_port]>;tag=[pid]SIPpTag[call_number] | ||
To: <sip:[service]@[remote_ip]:[remote_port]>[$remote_tag] | ||
Call-ID: [call_id] | ||
CSeq: [cseq] BYE | ||
Contact: sip:alice@[local_ip]:[local_port] | ||
Max-Forwards: 70 | ||
Subject: Codec Negotiation Test | ||
Content-Length: 0 | ||
]]> | ||
</send> | ||
|
||
<recv response="200" crlf="true"> | ||
</recv> | ||
|
||
</scenario> |
79 changes: 79 additions & 0 deletions
79
tests/channels/pjsip/codec_negotiation/audio/common_codecs_default/sipp/bob.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
<?xml version="1.0" encoding="ISO-8859-1" ?> | ||
<!DOCTYPE scenario SYSTEM "sipp.dtd"> | ||
|
||
<scenario name="Basic UAS responder"> | ||
|
||
<recv request="INVITE" crlf="true" /> | ||
|
||
<send> | ||
<![CDATA[ | ||
SIP/2.0 180 Ringing | ||
[last_Via:] | ||
[last_From:] | ||
[last_To:];tag=[pid]SIPpTag[call_number] | ||
[last_Call-ID:] | ||
[last_CSeq:] | ||
Contact: <sip:bob@[local_ip]:[local_port];transport=[transport]> | ||
Content-Length: 0 | ||
]]> | ||
</send> | ||
|
||
<pause milliseconds="100" /> | ||
|
||
<send retrans="500"> | ||
<![CDATA[ | ||
SIP/2.0 200 OK | ||
[last_Via:] | ||
[last_From:] | ||
[last_To:];tag=[pid]SIPpTag[call_number] | ||
[last_Call-ID:] | ||
[last_CSeq:] | ||
Contact: <sip:bob@[local_ip]:[local_port];transport=[transport]> | ||
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 [custom_media_port] RTP/AVP 9 8 0 | ||
a=rtpmap:9 G722/8000 | ||
a=rtpmap:8 PCMA/8000 | ||
a=rtpmap:0 PCMU/8000 | ||
a=ptime:20 | ||
a=maxptime:20 | ||
a=sendrecv | ||
]]> | ||
</send> | ||
|
||
<recv request="ACK" | ||
rtd="true" | ||
crlf="true"> | ||
</recv> | ||
|
||
<recv request="BYE" /> | ||
|
||
<send> | ||
<![CDATA[ | ||
SIP/2.0 200 OK | ||
[last_Via:] | ||
[last_From:] | ||
[last_To:] | ||
[last_Call-ID:] | ||
[last_CSeq:] | ||
Content-Length: 0 | ||
]]> | ||
</send> | ||
|
||
<ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/> | ||
|
||
<CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/> | ||
|
||
</scenario> | ||
|
52 changes: 52 additions & 0 deletions
52
tests/channels/pjsip/codec_negotiation/audio/common_codecs_default/test-config.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
--- | ||
testinfo: | ||
summary: | ||
'Test advanced codec negotiation in a call between two parties | ||
with 3 common codecs ' | ||
description: | | ||
'Two PJSIP endpoints are configured to support many codecs. | ||
Alice client is configured with Opus as additional codec. | ||
All endpoints share the same codec settings in pjsip.conf | ||
Alice calls Bob and in Bob\'s SDP answer he provides 3 codecs that Alice except Opus. | ||
The common codecs are g722,pcma,pcmu. | ||
Asterisk should not transcode in this case as the parties share at least one common codec.' | ||
properties: | ||
dependencies: | ||
- python: 'twisted' | ||
- python: 'starpy' | ||
- asterisk: 'app_dial' | ||
- asterisk: 'res_pjsip' | ||
- sipp: | ||
version: 'v3.6.0' | ||
tags: | ||
- pjsip | ||
|
||
test-modules: | ||
add-test-to-search-path: 'True' | ||
test-object: | ||
config-section: test-case-config | ||
typename: 'sipp.SIPpTestCase' | ||
|
||
test-case-config: | ||
memcheck-delay-stop: 7 | ||
# connect-ami: 'False' | ||
fail-on-any: false | ||
test-iterations: | ||
# First iteration | ||
- | ||
scenarios: | ||
# Bob receives call from Alice | ||
- {'key-args': | ||
{'scenario': 'bob.xml', '-p': '5060', '-i': '127.0.0.3', | ||
'-s': 'alice', '-timeout': '20s', '-mi': '127.0.0.3' | ||
}, | ||
'ordered-args': | ||
['-timeout_error', '-key', 'custom_media_port', '6004']} | ||
# Alice calls Bob | ||
- {'key-args': | ||
{'scenario': 'alice.xml', '-p': '5060', | ||
'-i': '127.0.0.2', '-s': 'bob', '-timeout': '20s', | ||
'-mi': '127.0.0.2'}, | ||
'ordered-args': | ||
['-timeout_error', '-key', 'custom_media_port', '6004']} |
8 changes: 8 additions & 0 deletions
8
...s/channels/pjsip/codec_negotiation/audio/common_codecs_union/configs/ast1/extensions.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[general] | ||
|
||
[globals] | ||
|
||
[calling] | ||
exten => bob,1,NoOp() | ||
same => n,Dial(PJSIP/bob) | ||
same => n,Hangup() |
39 changes: 39 additions & 0 deletions
39
tests/channels/pjsip/codec_negotiation/audio/common_codecs_union/configs/ast1/pjsip.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
[system] | ||
type=system | ||
timer_t1=100 | ||
timer_b=6400 | ||
|
||
[global] | ||
type=global | ||
debug=yes | ||
|
||
[local-transport] | ||
type=transport | ||
bind=127.0.0.1 | ||
protocol=udp | ||
|
||
|
||
|
||
[endpoint-template](!) | ||
codec_prefs_outgoing_answer = prefer: pending, operation: union, keep: all, transcode: allow | ||
|
||
[alice](endpoint-template) | ||
type=endpoint | ||
allow=opus,g722,ulaw,alaw,h264 | ||
context=calling | ||
direct_media=no | ||
media_address=127.0.0.1 | ||
aors=alice | ||
|
||
[bob](endpoint-template) | ||
type=endpoint | ||
allow=opus,g722,ulaw,alaw,h264 | ||
context=calling | ||
direct_media=no | ||
media_address=127.0.0.1 | ||
aors=bob | ||
|
||
[bob] | ||
type=aor | ||
max_contacts=1 | ||
contact=sip:[email protected]:5060\;transport=udp |
Oops, something went wrong.