[Asterisk-code-review] res pjsip: Test failover when server is not available (testsuite[master])
Kevin Harwell
asteriskteam at digium.com
Tue Jun 30 17:03:06 CDT 2015
Kevin Harwell has uploaded a new change for review.
https://gerrit.asterisk.org/751
Change subject: res_pjsip: Test failover when server is not available
......................................................................
res_pjsip: Test failover when server is not available
Made a few changes to the existing udp failover test. Added several more
tests that check in/out of dialog udp and tcp scenarios. Also added tests
to test when the transport is unspecified and changes on failover.
ASTERISK-25076 #close
Reported by: Joshua Colp
Change-Id: Ic600198f496bb0f6d9522ceda6d84b77eed31395
---
A tests/channels/pjsip/resolver/srv/failover/in_dialog/tests.yaml
A tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_tcp/configs/ast1/extensions.conf
A tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_tcp/configs/ast1/pjsip.conf
C tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_tcp/configs/ast1/resolver_unbound.conf
C tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_tcp/dns_zones/example.com
C tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_tcp/sipp/uas-503.xml
A tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_tcp/sipp/uas-ignore.xml
C tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_tcp/test-config.yaml
A tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_udp/configs/ast1/extensions.conf
R tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_udp/configs/ast1/pjsip.conf
R tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_udp/configs/ast1/resolver_unbound.conf
C tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_udp/dns_zones/example.com
R tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_udp/sipp/uas-503.xml
A tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_udp/sipp/uas-ignore.xml
R tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_udp/test-config.yaml
A tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_unspecified/configs/ast1/extensions.conf
A tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_unspecified/configs/ast1/pjsip.conf
C tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_unspecified/configs/ast1/resolver_unbound.conf
R tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_unspecified/dns_zones/example.com
C tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_unspecified/sipp/uas-503.xml
A tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_unspecified/sipp/uas-ignore.xml
A tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_unspecified/test-config.yaml
A tests/channels/pjsip/resolver/srv/failover/out_of_dialog/tests.yaml
A tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_tcp/configs/ast1/extensions.conf
A tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_tcp/configs/ast1/pjsip.conf
C tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_tcp/configs/ast1/resolver_unbound.conf
C tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_tcp/dns_zones/example.com
A tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_tcp/sipp/uas-503.xml
A tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_tcp/sipp/uas-ignore.xml
C tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_tcp/test-config.yaml
A tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_udp/configs/ast1/extensions.conf
A tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_udp/configs/ast1/pjsip.conf
C tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_udp/configs/ast1/resolver_unbound.conf
C tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_udp/dns_zones/example.com
A tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_udp/sipp/uas-503.xml
A tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_udp/sipp/uas-ignore.xml
C tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_udp/test-config.yaml
A tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_unspecified/configs/ast1/extensions.conf
A tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_unspecified/configs/ast1/pjsip.conf
C tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_unspecified/configs/ast1/resolver_unbound.conf
C tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_unspecified/dns_zones/example.com
A tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_unspecified/sipp/uas-503.xml
A tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_unspecified/sipp/uas-ignore.xml
A tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_unspecified/test-config.yaml
A tests/channels/pjsip/resolver/srv/failover/tests.yaml
D tests/channels/pjsip/resolver/srv/failover_udp/configs/ast1/extensions.conf
D tests/channels/pjsip/resolver/srv/failover_udp/sipp/uas-ignore.xml
M tests/channels/pjsip/resolver/srv/tests.yaml
48 files changed, 574 insertions(+), 72 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/51/751/1
diff --git a/tests/channels/pjsip/resolver/srv/failover/in_dialog/tests.yaml b/tests/channels/pjsip/resolver/srv/failover/in_dialog/tests.yaml
new file mode 100644
index 0000000..633aa1d
--- /dev/null
+++ b/tests/channels/pjsip/resolver/srv/failover/in_dialog/tests.yaml
@@ -0,0 +1,5 @@
+# Enter tests here in the order they should be considered for execution:
+tests:
+ - test: 'transport_tcp'
+ - test: 'transport_udp'
+ - test: 'transport_unspecified'
diff --git a/tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_tcp/configs/ast1/extensions.conf b/tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_tcp/configs/ast1/extensions.conf
new file mode 100644
index 0000000..1de5b55
--- /dev/null
+++ b/tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_tcp/configs/ast1/extensions.conf
@@ -0,0 +1,5 @@
+[default]
+exten => s,1,NoOp()
+ same => n,Dial(PJSIP/jenny/sip:example.com\;transport=tcp,5)
+ same => n,Hangup()
+
diff --git a/tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_tcp/configs/ast1/pjsip.conf b/tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_tcp/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..9f2e92b
--- /dev/null
+++ b/tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_tcp/configs/ast1/pjsip.conf
@@ -0,0 +1,9 @@
+[transport=tcp]
+type=transport
+protocol=tcp
+bind=0.0.0.0:5060
+
+[jenny]
+type=endpoint
+context=default
+allow=!all,ulaw,alaw,g722
diff --git a/tests/channels/pjsip/resolver/srv/failover_udp/configs/ast1/resolver_unbound.conf b/tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_tcp/configs/ast1/resolver_unbound.conf
similarity index 100%
copy from tests/channels/pjsip/resolver/srv/failover_udp/configs/ast1/resolver_unbound.conf
copy to tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_tcp/configs/ast1/resolver_unbound.conf
diff --git a/tests/channels/pjsip/resolver/srv/failover_udp/dns_zones/example.com b/tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_tcp/dns_zones/example.com
similarity index 72%
copy from tests/channels/pjsip/resolver/srv/failover_udp/dns_zones/example.com
copy to tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_tcp/dns_zones/example.com
index 66f0745..9ac96ee 100644
--- a/tests/channels/pjsip/resolver/srv/failover_udp/dns_zones/example.com
+++ b/tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_tcp/dns_zones/example.com
@@ -25,9 +25,12 @@
minimum = "1H"
),
- SRV('_sip._udp.example.com', 0, 3, 5061, 'fast.pbx.example.com'),
- SRV('_sip._udp.example.com', 0, 1, 5062, 'slow.pbx.example.com'),
- SRV('_sip._udp.example.com', 1, 100, 5063, 'backup.pbx.example.com'),
+ SRV('_sip._udp.example.com', 0, 10, 5061, 'fast.pbx.example.com'),
+ SRV('_sip._udp.example.com', 1, 0, 5062, 'slow.pbx.example.com'),
+
+ SRV('_sip._tcp.example.com', 0, 0, 5061, 'fast.pbx.example.com'),
+ SRV('_sip._tcp.example.com', 1, 10, 5062, 'slow.pbx.example.com'),
+
A('fast.pbx.example.com', '127.0.0.1'),
A('slow.pbx.example.com', '127.0.0.1'),
]
diff --git a/tests/channels/pjsip/resolver/srv/failover_udp/sipp/uas-503.xml b/tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_tcp/sipp/uas-503.xml
similarity index 100%
copy from tests/channels/pjsip/resolver/srv/failover_udp/sipp/uas-503.xml
copy to tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_tcp/sipp/uas-503.xml
diff --git a/tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_tcp/sipp/uas-ignore.xml b/tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_tcp/sipp/uas-ignore.xml
new file mode 100644
index 0000000..c375373
--- /dev/null
+++ b/tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_tcp/sipp/uas-ignore.xml
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Receive INVITE with audio, ignore">
+ <Global variables="remote_tag" />
+ <recv request="INVITE" crlf="true">
+ <!-- Save the from tag. We'll need it when we send our BYE -->
+ <action>
+ <ereg regexp=".*(;tag=.*)"
+ header="From:"
+ search_in="hdr"
+ check_it="true"
+ assign_to="remote_tag"/>
+ </action>
+ </recv>
+
+ <send>
+ <![CDATA[
+
+ SIP/2.0 180 Ringing
+ [last_Via:]
+ [last_From:]
+ [last_To:];tag=[pid]SIPpTag01[call_number]
+ [last_Call-ID:]
+ [last_CSeq:]
+ Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+ Content-Length: 0
+
+ ]]>
+ </send>
+
+ <send retrans="500">
+ <![CDATA[
+
+ SIP/2.0 200 OK
+ [last_Via:]
+ [last_From:]
+ [last_To:];tag=[pid]SIPpTag01[call_number]
+ [last_Call-ID:]
+ [last_CSeq:]
+ Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=- 1324901698 1324901698 IN IP4 [local_ip]
+ s=-
+ c=IN IP4 [local_ip]
+ t=0 0
+ m=audio 2226 RTP/AVP 0 101
+ a=sendrecv
+ a=rtpmap:0 PCMU/8000
+ a=rtpmap:101 telephone-event/8000
+ ]]>
+ </send>
+
+ <recv request="ACK" rtd="true" crlf="true" />
+
+ <send retrans="500">
+ <![CDATA[
+
+ BYE sip:jenny@[remote_ip]:[remote_port] SIP/2.0
+ Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+ From: <sip:jenny@[local_ip]:[local_port]>;tag=[pid]SIPpTag01[call_number]
+ To: [$remote_tag]
+ [last_Call-ID:]
+ CSeq: [cseq] BYE
+ Contact: sip:jenny@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Content-Length: 0
+
+ ]]>
+ </send>
+
+ <recv response="200" />
+</scenario>
diff --git a/tests/channels/pjsip/resolver/srv/failover_udp/test-config.yaml b/tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_tcp/test-config.yaml
similarity index 65%
copy from tests/channels/pjsip/resolver/srv/failover_udp/test-config.yaml
copy to tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_tcp/test-config.yaml
index 9d9e56f..886c25f 100644
--- a/tests/channels/pjsip/resolver/srv/failover_udp/test-config.yaml
+++ b/tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_tcp/test-config.yaml
@@ -1,9 +1,10 @@
testinfo:
- skip: 'See ASTERISK-25076'
- summary: 'Test SRV failover using a UDP transport'
+ summary: 'Test in-dialog SRV failover using a TCP transport'
description: |
- This test verifies that an SRV record lookup resulting in multiple results
- will successfully fail over to other records if previous ones do not respond.
+ Using an in-dialog SIP message (in this case a SIP INVITE) over a TCP
+ transport, this test verifies that an SRV record lookup resulting in
+ multiple results will successfully fail over to other records if
+ previous ones do not respond.
test-modules:
test-object:
@@ -21,19 +22,15 @@
test-iterations:
-
scenarios:
- - { 'key-args': {'scenario': 'uas-503.xml', '-i': '127.0.0.1', '-p': '5061'} }
- - { 'key-args': {'scenario': 'uas-ignore.xml', '-i': '127.0.0.1', '-p': '5062'} }
+ - { 'key-args': {'scenario': 'uas-503.xml', '-i': '127.0.0.1', '-p': '5061', '-t': 't1'} }
+ - { 'key-args': {'scenario': 'uas-ignore.xml', '-i': '127.0.0.1', '-p': '5062', '-t': 't1'} }
originator:
- trigger: 'ami_connect'
- ignore-originate-failure: 'no'
- id: '0'
+ scenario-trigger-after: '2'
channel: 'Local/s at default'
- application: 'Echo'
async: 'True'
dns-server-config:
- port: 10053
python-zones:
-
example.com
diff --git a/tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_udp/configs/ast1/extensions.conf b/tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_udp/configs/ast1/extensions.conf
new file mode 100644
index 0000000..f344a1d
--- /dev/null
+++ b/tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_udp/configs/ast1/extensions.conf
@@ -0,0 +1,4 @@
+[default]
+exten => s,1,NoOp()
+ same => n,Dial(PJSIP/jenny/sip:example.com\;transport=udp,5)
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/resolver/srv/failover_udp/configs/ast1/pjsip.conf b/tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_udp/configs/ast1/pjsip.conf
similarity index 100%
rename from tests/channels/pjsip/resolver/srv/failover_udp/configs/ast1/pjsip.conf
rename to tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_udp/configs/ast1/pjsip.conf
diff --git a/tests/channels/pjsip/resolver/srv/failover_udp/configs/ast1/resolver_unbound.conf b/tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_udp/configs/ast1/resolver_unbound.conf
similarity index 100%
rename from tests/channels/pjsip/resolver/srv/failover_udp/configs/ast1/resolver_unbound.conf
rename to tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_udp/configs/ast1/resolver_unbound.conf
diff --git a/tests/channels/pjsip/resolver/srv/failover_udp/dns_zones/example.com b/tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_udp/dns_zones/example.com
similarity index 72%
copy from tests/channels/pjsip/resolver/srv/failover_udp/dns_zones/example.com
copy to tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_udp/dns_zones/example.com
index 66f0745..9ac96ee 100644
--- a/tests/channels/pjsip/resolver/srv/failover_udp/dns_zones/example.com
+++ b/tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_udp/dns_zones/example.com
@@ -25,9 +25,12 @@
minimum = "1H"
),
- SRV('_sip._udp.example.com', 0, 3, 5061, 'fast.pbx.example.com'),
- SRV('_sip._udp.example.com', 0, 1, 5062, 'slow.pbx.example.com'),
- SRV('_sip._udp.example.com', 1, 100, 5063, 'backup.pbx.example.com'),
+ SRV('_sip._udp.example.com', 0, 10, 5061, 'fast.pbx.example.com'),
+ SRV('_sip._udp.example.com', 1, 0, 5062, 'slow.pbx.example.com'),
+
+ SRV('_sip._tcp.example.com', 0, 0, 5061, 'fast.pbx.example.com'),
+ SRV('_sip._tcp.example.com', 1, 10, 5062, 'slow.pbx.example.com'),
+
A('fast.pbx.example.com', '127.0.0.1'),
A('slow.pbx.example.com', '127.0.0.1'),
]
diff --git a/tests/channels/pjsip/resolver/srv/failover_udp/sipp/uas-503.xml b/tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_udp/sipp/uas-503.xml
similarity index 100%
rename from tests/channels/pjsip/resolver/srv/failover_udp/sipp/uas-503.xml
rename to tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_udp/sipp/uas-503.xml
diff --git a/tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_udp/sipp/uas-ignore.xml b/tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_udp/sipp/uas-ignore.xml
new file mode 100644
index 0000000..c375373
--- /dev/null
+++ b/tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_udp/sipp/uas-ignore.xml
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Receive INVITE with audio, ignore">
+ <Global variables="remote_tag" />
+ <recv request="INVITE" crlf="true">
+ <!-- Save the from tag. We'll need it when we send our BYE -->
+ <action>
+ <ereg regexp=".*(;tag=.*)"
+ header="From:"
+ search_in="hdr"
+ check_it="true"
+ assign_to="remote_tag"/>
+ </action>
+ </recv>
+
+ <send>
+ <![CDATA[
+
+ SIP/2.0 180 Ringing
+ [last_Via:]
+ [last_From:]
+ [last_To:];tag=[pid]SIPpTag01[call_number]
+ [last_Call-ID:]
+ [last_CSeq:]
+ Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+ Content-Length: 0
+
+ ]]>
+ </send>
+
+ <send retrans="500">
+ <![CDATA[
+
+ SIP/2.0 200 OK
+ [last_Via:]
+ [last_From:]
+ [last_To:];tag=[pid]SIPpTag01[call_number]
+ [last_Call-ID:]
+ [last_CSeq:]
+ Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=- 1324901698 1324901698 IN IP4 [local_ip]
+ s=-
+ c=IN IP4 [local_ip]
+ t=0 0
+ m=audio 2226 RTP/AVP 0 101
+ a=sendrecv
+ a=rtpmap:0 PCMU/8000
+ a=rtpmap:101 telephone-event/8000
+ ]]>
+ </send>
+
+ <recv request="ACK" rtd="true" crlf="true" />
+
+ <send retrans="500">
+ <![CDATA[
+
+ BYE sip:jenny@[remote_ip]:[remote_port] SIP/2.0
+ Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+ From: <sip:jenny@[local_ip]:[local_port]>;tag=[pid]SIPpTag01[call_number]
+ To: [$remote_tag]
+ [last_Call-ID:]
+ CSeq: [cseq] BYE
+ Contact: sip:jenny@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Content-Length: 0
+
+ ]]>
+ </send>
+
+ <recv response="200" />
+</scenario>
diff --git a/tests/channels/pjsip/resolver/srv/failover_udp/test-config.yaml b/tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_udp/test-config.yaml
similarity index 71%
rename from tests/channels/pjsip/resolver/srv/failover_udp/test-config.yaml
rename to tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_udp/test-config.yaml
index 9d9e56f..f7e9c83 100644
--- a/tests/channels/pjsip/resolver/srv/failover_udp/test-config.yaml
+++ b/tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_udp/test-config.yaml
@@ -1,9 +1,10 @@
testinfo:
- skip: 'See ASTERISK-25076'
- summary: 'Test SRV failover using a UDP transport'
+ summary: 'Test in-dialog SRV failover using a UDP transport'
description: |
- This test verifies that an SRV record lookup resulting in multiple results
- will successfully fail over to other records if previous ones do not respond.
+ Using an in-dialog SIP message (in this case a SIP INVITE) over a UDP
+ transport, this test verifies that an SRV record lookup resulting in
+ multiple results will successfully fail over to other records if
+ previous ones do not respond.
test-modules:
test-object:
@@ -25,15 +26,11 @@
- { 'key-args': {'scenario': 'uas-ignore.xml', '-i': '127.0.0.1', '-p': '5062'} }
originator:
- trigger: 'ami_connect'
- ignore-originate-failure: 'no'
- id: '0'
+ scenario-trigger-after: '2'
channel: 'Local/s at default'
- application: 'Echo'
async: 'True'
dns-server-config:
- port: 10053
python-zones:
-
example.com
diff --git a/tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_unspecified/configs/ast1/extensions.conf b/tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_unspecified/configs/ast1/extensions.conf
new file mode 100644
index 0000000..23a76e1
--- /dev/null
+++ b/tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_unspecified/configs/ast1/extensions.conf
@@ -0,0 +1,4 @@
+[default]
+exten => s,1,NoOp()
+ same => n,Dial(PJSIP/jenny/sip:example.com,5)
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_unspecified/configs/ast1/pjsip.conf b/tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_unspecified/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..ecded1b
--- /dev/null
+++ b/tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_unspecified/configs/ast1/pjsip.conf
@@ -0,0 +1,14 @@
+[transport=tcp]
+type=transport
+protocol=tcp
+bind=0.0.0.0:5060
+
+[transport=udp]
+type=transport
+protocol=udp
+bind=0.0.0.0:5061
+
+[jenny]
+type=endpoint
+context=default
+allow=!all,ulaw,alaw,g722
diff --git a/tests/channels/pjsip/resolver/srv/failover_udp/configs/ast1/resolver_unbound.conf b/tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_unspecified/configs/ast1/resolver_unbound.conf
similarity index 100%
copy from tests/channels/pjsip/resolver/srv/failover_udp/configs/ast1/resolver_unbound.conf
copy to tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_unspecified/configs/ast1/resolver_unbound.conf
diff --git a/tests/channels/pjsip/resolver/srv/failover_udp/dns_zones/example.com b/tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_unspecified/dns_zones/example.com
similarity index 77%
rename from tests/channels/pjsip/resolver/srv/failover_udp/dns_zones/example.com
rename to tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_unspecified/dns_zones/example.com
index 66f0745..c0a6669 100644
--- a/tests/channels/pjsip/resolver/srv/failover_udp/dns_zones/example.com
+++ b/tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_unspecified/dns_zones/example.com
@@ -25,9 +25,9 @@
minimum = "1H"
),
- SRV('_sip._udp.example.com', 0, 3, 5061, 'fast.pbx.example.com'),
- SRV('_sip._udp.example.com', 0, 1, 5062, 'slow.pbx.example.com'),
- SRV('_sip._udp.example.com', 1, 100, 5063, 'backup.pbx.example.com'),
+ SRV('_sip._udp.example.com', 1, 0, 5063, 'slow.pbx.example.com'),
+ SRV('_sip._tcp.example.com', 0, 0, 5062, 'fast.pbx.example.com'),
+
A('fast.pbx.example.com', '127.0.0.1'),
A('slow.pbx.example.com', '127.0.0.1'),
]
diff --git a/tests/channels/pjsip/resolver/srv/failover_udp/sipp/uas-503.xml b/tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_unspecified/sipp/uas-503.xml
similarity index 100%
copy from tests/channels/pjsip/resolver/srv/failover_udp/sipp/uas-503.xml
copy to tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_unspecified/sipp/uas-503.xml
diff --git a/tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_unspecified/sipp/uas-ignore.xml b/tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_unspecified/sipp/uas-ignore.xml
new file mode 100644
index 0000000..c375373
--- /dev/null
+++ b/tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_unspecified/sipp/uas-ignore.xml
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Receive INVITE with audio, ignore">
+ <Global variables="remote_tag" />
+ <recv request="INVITE" crlf="true">
+ <!-- Save the from tag. We'll need it when we send our BYE -->
+ <action>
+ <ereg regexp=".*(;tag=.*)"
+ header="From:"
+ search_in="hdr"
+ check_it="true"
+ assign_to="remote_tag"/>
+ </action>
+ </recv>
+
+ <send>
+ <![CDATA[
+
+ SIP/2.0 180 Ringing
+ [last_Via:]
+ [last_From:]
+ [last_To:];tag=[pid]SIPpTag01[call_number]
+ [last_Call-ID:]
+ [last_CSeq:]
+ Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+ Content-Length: 0
+
+ ]]>
+ </send>
+
+ <send retrans="500">
+ <![CDATA[
+
+ SIP/2.0 200 OK
+ [last_Via:]
+ [last_From:]
+ [last_To:];tag=[pid]SIPpTag01[call_number]
+ [last_Call-ID:]
+ [last_CSeq:]
+ Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=- 1324901698 1324901698 IN IP4 [local_ip]
+ s=-
+ c=IN IP4 [local_ip]
+ t=0 0
+ m=audio 2226 RTP/AVP 0 101
+ a=sendrecv
+ a=rtpmap:0 PCMU/8000
+ a=rtpmap:101 telephone-event/8000
+ ]]>
+ </send>
+
+ <recv request="ACK" rtd="true" crlf="true" />
+
+ <send retrans="500">
+ <![CDATA[
+
+ BYE sip:jenny@[remote_ip]:[remote_port] SIP/2.0
+ Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+ From: <sip:jenny@[local_ip]:[local_port]>;tag=[pid]SIPpTag01[call_number]
+ To: [$remote_tag]
+ [last_Call-ID:]
+ CSeq: [cseq] BYE
+ Contact: sip:jenny@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Content-Length: 0
+
+ ]]>
+ </send>
+
+ <recv response="200" />
+</scenario>
diff --git a/tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_unspecified/test-config.yaml b/tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_unspecified/test-config.yaml
new file mode 100644
index 0000000..c5c8f80
--- /dev/null
+++ b/tests/channels/pjsip/resolver/srv/failover/in_dialog/transport_unspecified/test-config.yaml
@@ -0,0 +1,50 @@
+testinfo:
+ summary: 'Test in-dialog SRV failover using an unspecified transport'
+ description: |
+ Using an in-dialog SIP message (in this case a SIP INVITE) with an
+ unspecified transport, this test verifies that an SRV record lookup
+ resulting in multiple results will successfully fail over to other
+ records if previous ones do not respond.
+
+ Since the transport is unspecified TCP is given priority and should
+ be selected first. Once this fails the only option left is UDP, so it
+ should then switch transport types when attempting the secondary
+ failover address.
+
+test-modules:
+ test-object:
+ config-section: test-object-config
+ typename: 'sipp.SIPpTestCase'
+ modules:
+ -
+ config-section: originator
+ typename: 'pluggable_modules.Originator'
+ -
+ config-section: dns-server-config
+ typename: 'dns_server.DNSServer'
+
+test-object-config:
+ test-iterations:
+ -
+ scenarios:
+ - { 'key-args': {'scenario': 'uas-503.xml', '-i': '127.0.0.1', '-p': '5062', '-t': 't1'} }
+ - { 'key-args': {'scenario': 'uas-ignore.xml', '-i': '127.0.0.1', '-p': '5063'} }
+
+originator:
+ scenario-trigger-after: '2'
+ channel: 'Local/s at default'
+ async: 'True'
+
+dns-server-config:
+ python-zones:
+ -
+ example.com
+
+properties:
+ minversion: '14.0.0'
+ dependencies:
+ - app : 'sipp'
+ - asterisk : 'res_pjsip'
+ - asterisk : 'res_resolver_unbound'
+ tags:
+ - pjsip
diff --git a/tests/channels/pjsip/resolver/srv/failover/out_of_dialog/tests.yaml b/tests/channels/pjsip/resolver/srv/failover/out_of_dialog/tests.yaml
new file mode 100644
index 0000000..633aa1d
--- /dev/null
+++ b/tests/channels/pjsip/resolver/srv/failover/out_of_dialog/tests.yaml
@@ -0,0 +1,5 @@
+# Enter tests here in the order they should be considered for execution:
+tests:
+ - test: 'transport_tcp'
+ - test: 'transport_udp'
+ - test: 'transport_unspecified'
diff --git a/tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_tcp/configs/ast1/extensions.conf b/tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_tcp/configs/ast1/extensions.conf
new file mode 100644
index 0000000..ee1a687
--- /dev/null
+++ b/tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_tcp/configs/ast1/extensions.conf
@@ -0,0 +1,5 @@
+[default]
+exten => s,1,NoOp()
+ same => n,Set(MESSAGE(body)=call me, maybe)
+ same => n,MessageSend(pjsip:example.com;transport=tcp,sip:127.0.0.1)
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_tcp/configs/ast1/pjsip.conf b/tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_tcp/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..855a008
--- /dev/null
+++ b/tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_tcp/configs/ast1/pjsip.conf
@@ -0,0 +1,12 @@
+[global]
+type=global
+debug=yes
+default_outbound_endpoint=outbound_endpoint
+
+[transport=tcp]
+type=transport
+protocol=tcp
+bind=0.0.0.0:5060
+
+[outbound_endpoint]
+type=endpoint
diff --git a/tests/channels/pjsip/resolver/srv/failover_udp/configs/ast1/resolver_unbound.conf b/tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_tcp/configs/ast1/resolver_unbound.conf
similarity index 100%
copy from tests/channels/pjsip/resolver/srv/failover_udp/configs/ast1/resolver_unbound.conf
copy to tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_tcp/configs/ast1/resolver_unbound.conf
diff --git a/tests/channels/pjsip/resolver/srv/failover_udp/dns_zones/example.com b/tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_tcp/dns_zones/example.com
similarity index 72%
copy from tests/channels/pjsip/resolver/srv/failover_udp/dns_zones/example.com
copy to tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_tcp/dns_zones/example.com
index 66f0745..9ac96ee 100644
--- a/tests/channels/pjsip/resolver/srv/failover_udp/dns_zones/example.com
+++ b/tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_tcp/dns_zones/example.com
@@ -25,9 +25,12 @@
minimum = "1H"
),
- SRV('_sip._udp.example.com', 0, 3, 5061, 'fast.pbx.example.com'),
- SRV('_sip._udp.example.com', 0, 1, 5062, 'slow.pbx.example.com'),
- SRV('_sip._udp.example.com', 1, 100, 5063, 'backup.pbx.example.com'),
+ SRV('_sip._udp.example.com', 0, 10, 5061, 'fast.pbx.example.com'),
+ SRV('_sip._udp.example.com', 1, 0, 5062, 'slow.pbx.example.com'),
+
+ SRV('_sip._tcp.example.com', 0, 0, 5061, 'fast.pbx.example.com'),
+ SRV('_sip._tcp.example.com', 1, 10, 5062, 'slow.pbx.example.com'),
+
A('fast.pbx.example.com', '127.0.0.1'),
A('slow.pbx.example.com', '127.0.0.1'),
]
diff --git a/tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_tcp/sipp/uas-503.xml b/tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_tcp/sipp/uas-503.xml
new file mode 100644
index 0000000..5d6864a
--- /dev/null
+++ b/tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_tcp/sipp/uas-503.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Receive MESSAGE, immediately reject with a 503">
+ <recv request="MESSAGE" crlf="true">
+ </recv>
+
+ <send retrans="500">
+ <![CDATA[
+
+ SIP/2.0 503 Service Unavailable
+ [last_Via:]
+ [last_From:]
+ [last_To:];tag=[call_number]
+ [last_Call-ID:]
+ [last_CSeq:]
+ Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+ ]]>
+ </send>
+</scenario>
diff --git a/tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_tcp/sipp/uas-ignore.xml b/tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_tcp/sipp/uas-ignore.xml
new file mode 100644
index 0000000..f9908a1
--- /dev/null
+++ b/tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_tcp/sipp/uas-ignore.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Receive MESSAGE, ignore">
+ <recv request="MESSAGE" crlf="true">
+ </recv>
+</scenario>
diff --git a/tests/channels/pjsip/resolver/srv/failover_udp/test-config.yaml b/tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_tcp/test-config.yaml
similarity index 65%
copy from tests/channels/pjsip/resolver/srv/failover_udp/test-config.yaml
copy to tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_tcp/test-config.yaml
index 9d9e56f..ee873fd 100644
--- a/tests/channels/pjsip/resolver/srv/failover_udp/test-config.yaml
+++ b/tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_tcp/test-config.yaml
@@ -1,9 +1,10 @@
testinfo:
- skip: 'See ASTERISK-25076'
- summary: 'Test SRV failover using a UDP transport'
+ summary: 'Test out of dialog SRV failover using a TCP transport'
description: |
- This test verifies that an SRV record lookup resulting in multiple results
- will successfully fail over to other records if previous ones do not respond.
+ Using an out of dialog SIP message (in this case a SIP MESSAGE) over a
+ TCP transport, this test verifies that an SRV record lookup resulting in
+ multiple results will successfully fail over to other records if
+ previous ones do not respond.
test-modules:
test-object:
@@ -21,19 +22,15 @@
test-iterations:
-
scenarios:
- - { 'key-args': {'scenario': 'uas-503.xml', '-i': '127.0.0.1', '-p': '5061'} }
- - { 'key-args': {'scenario': 'uas-ignore.xml', '-i': '127.0.0.1', '-p': '5062'} }
+ - { 'key-args': {'scenario': 'uas-503.xml', '-i': '127.0.0.1', '-p': '5061', '-t': 't1'} }
+ - { 'key-args': {'scenario': 'uas-ignore.xml', '-i': '127.0.0.1', '-p': '5062', '-t': 't1'} }
originator:
- trigger: 'ami_connect'
- ignore-originate-failure: 'no'
- id: '0'
+ scenario-trigger-after: '2'
channel: 'Local/s at default'
- application: 'Echo'
async: 'True'
dns-server-config:
- port: 10053
python-zones:
-
example.com
diff --git a/tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_udp/configs/ast1/extensions.conf b/tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_udp/configs/ast1/extensions.conf
new file mode 100644
index 0000000..3c9205a
--- /dev/null
+++ b/tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_udp/configs/ast1/extensions.conf
@@ -0,0 +1,5 @@
+[default]
+exten => s,1,NoOp()
+ same => n,Set(MESSAGE(body)=call me, maybe)
+ same => n,MessageSend(pjsip:example.com;transport=udp,sip:127.0.0.1)
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_udp/configs/ast1/pjsip.conf b/tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_udp/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..de62da7
--- /dev/null
+++ b/tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_udp/configs/ast1/pjsip.conf
@@ -0,0 +1,12 @@
+[global]
+type=global
+debug=yes
+default_outbound_endpoint=outbound_endpoint
+
+[transport=udp]
+type=transport
+protocol=udp
+bind=0.0.0.0:5060
+
+[outbound_endpoint]
+type=endpoint
diff --git a/tests/channels/pjsip/resolver/srv/failover_udp/configs/ast1/resolver_unbound.conf b/tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_udp/configs/ast1/resolver_unbound.conf
similarity index 100%
copy from tests/channels/pjsip/resolver/srv/failover_udp/configs/ast1/resolver_unbound.conf
copy to tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_udp/configs/ast1/resolver_unbound.conf
diff --git a/tests/channels/pjsip/resolver/srv/failover_udp/dns_zones/example.com b/tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_udp/dns_zones/example.com
similarity index 72%
copy from tests/channels/pjsip/resolver/srv/failover_udp/dns_zones/example.com
copy to tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_udp/dns_zones/example.com
index 66f0745..9ac96ee 100644
--- a/tests/channels/pjsip/resolver/srv/failover_udp/dns_zones/example.com
+++ b/tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_udp/dns_zones/example.com
@@ -25,9 +25,12 @@
minimum = "1H"
),
- SRV('_sip._udp.example.com', 0, 3, 5061, 'fast.pbx.example.com'),
- SRV('_sip._udp.example.com', 0, 1, 5062, 'slow.pbx.example.com'),
- SRV('_sip._udp.example.com', 1, 100, 5063, 'backup.pbx.example.com'),
+ SRV('_sip._udp.example.com', 0, 10, 5061, 'fast.pbx.example.com'),
+ SRV('_sip._udp.example.com', 1, 0, 5062, 'slow.pbx.example.com'),
+
+ SRV('_sip._tcp.example.com', 0, 0, 5061, 'fast.pbx.example.com'),
+ SRV('_sip._tcp.example.com', 1, 10, 5062, 'slow.pbx.example.com'),
+
A('fast.pbx.example.com', '127.0.0.1'),
A('slow.pbx.example.com', '127.0.0.1'),
]
diff --git a/tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_udp/sipp/uas-503.xml b/tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_udp/sipp/uas-503.xml
new file mode 100644
index 0000000..5d6864a
--- /dev/null
+++ b/tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_udp/sipp/uas-503.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Receive MESSAGE, immediately reject with a 503">
+ <recv request="MESSAGE" crlf="true">
+ </recv>
+
+ <send retrans="500">
+ <![CDATA[
+
+ SIP/2.0 503 Service Unavailable
+ [last_Via:]
+ [last_From:]
+ [last_To:];tag=[call_number]
+ [last_Call-ID:]
+ [last_CSeq:]
+ Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+ ]]>
+ </send>
+</scenario>
diff --git a/tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_udp/sipp/uas-ignore.xml b/tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_udp/sipp/uas-ignore.xml
new file mode 100644
index 0000000..f9908a1
--- /dev/null
+++ b/tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_udp/sipp/uas-ignore.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Receive MESSAGE, ignore">
+ <recv request="MESSAGE" crlf="true">
+ </recv>
+</scenario>
diff --git a/tests/channels/pjsip/resolver/srv/failover_udp/test-config.yaml b/tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_udp/test-config.yaml
similarity index 71%
copy from tests/channels/pjsip/resolver/srv/failover_udp/test-config.yaml
copy to tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_udp/test-config.yaml
index 9d9e56f..dbab4d5 100644
--- a/tests/channels/pjsip/resolver/srv/failover_udp/test-config.yaml
+++ b/tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_udp/test-config.yaml
@@ -1,9 +1,10 @@
testinfo:
- skip: 'See ASTERISK-25076'
- summary: 'Test SRV failover using a UDP transport'
+ summary: 'Test out of dialog SRV failover using a UDP transport'
description: |
- This test verifies that an SRV record lookup resulting in multiple results
- will successfully fail over to other records if previous ones do not respond.
+ Using an out of dialog SIP message (in this case a SIP MESSAGE) over a
+ UDP transport, this test verifies that an SRV record lookup resulting in
+ multiple results will successfully fail over to other records if
+ previous ones do not respond.
test-modules:
test-object:
@@ -25,15 +26,11 @@
- { 'key-args': {'scenario': 'uas-ignore.xml', '-i': '127.0.0.1', '-p': '5062'} }
originator:
- trigger: 'ami_connect'
- ignore-originate-failure: 'no'
- id: '0'
+ scenario-trigger-after: '2'
channel: 'Local/s at default'
- application: 'Echo'
async: 'True'
dns-server-config:
- port: 10053
python-zones:
-
example.com
diff --git a/tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_unspecified/configs/ast1/extensions.conf b/tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_unspecified/configs/ast1/extensions.conf
new file mode 100644
index 0000000..ae3a8c2
--- /dev/null
+++ b/tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_unspecified/configs/ast1/extensions.conf
@@ -0,0 +1,5 @@
+[default]
+exten => s,1,NoOp()
+ same => n,Set(MESSAGE(body)=call me, maybe)
+ same => n,MessageSend(pjsip:example.com,sip:127.0.0.1)
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_unspecified/configs/ast1/pjsip.conf b/tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_unspecified/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..9ac2d29
--- /dev/null
+++ b/tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_unspecified/configs/ast1/pjsip.conf
@@ -0,0 +1,17 @@
+[global]
+type=global
+debug=yes
+default_outbound_endpoint=outbound_endpoint
+
+[transport=tcp]
+type=transport
+protocol=tcp
+bind=0.0.0.0:5060
+
+[transport=udp]
+type=transport
+protocol=udp
+bind=0.0.0.0:5061
+
+[outbound_endpoint]
+type=endpoint
diff --git a/tests/channels/pjsip/resolver/srv/failover_udp/configs/ast1/resolver_unbound.conf b/tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_unspecified/configs/ast1/resolver_unbound.conf
similarity index 100%
copy from tests/channels/pjsip/resolver/srv/failover_udp/configs/ast1/resolver_unbound.conf
copy to tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_unspecified/configs/ast1/resolver_unbound.conf
diff --git a/tests/channels/pjsip/resolver/srv/failover_udp/dns_zones/example.com b/tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_unspecified/dns_zones/example.com
similarity index 77%
copy from tests/channels/pjsip/resolver/srv/failover_udp/dns_zones/example.com
copy to tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_unspecified/dns_zones/example.com
index 66f0745..c0a6669 100644
--- a/tests/channels/pjsip/resolver/srv/failover_udp/dns_zones/example.com
+++ b/tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_unspecified/dns_zones/example.com
@@ -25,9 +25,9 @@
minimum = "1H"
),
- SRV('_sip._udp.example.com', 0, 3, 5061, 'fast.pbx.example.com'),
- SRV('_sip._udp.example.com', 0, 1, 5062, 'slow.pbx.example.com'),
- SRV('_sip._udp.example.com', 1, 100, 5063, 'backup.pbx.example.com'),
+ SRV('_sip._udp.example.com', 1, 0, 5063, 'slow.pbx.example.com'),
+ SRV('_sip._tcp.example.com', 0, 0, 5062, 'fast.pbx.example.com'),
+
A('fast.pbx.example.com', '127.0.0.1'),
A('slow.pbx.example.com', '127.0.0.1'),
]
diff --git a/tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_unspecified/sipp/uas-503.xml b/tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_unspecified/sipp/uas-503.xml
new file mode 100644
index 0000000..5d6864a
--- /dev/null
+++ b/tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_unspecified/sipp/uas-503.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Receive MESSAGE, immediately reject with a 503">
+ <recv request="MESSAGE" crlf="true">
+ </recv>
+
+ <send retrans="500">
+ <![CDATA[
+
+ SIP/2.0 503 Service Unavailable
+ [last_Via:]
+ [last_From:]
+ [last_To:];tag=[call_number]
+ [last_Call-ID:]
+ [last_CSeq:]
+ Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+ ]]>
+ </send>
+</scenario>
diff --git a/tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_unspecified/sipp/uas-ignore.xml b/tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_unspecified/sipp/uas-ignore.xml
new file mode 100644
index 0000000..f9908a1
--- /dev/null
+++ b/tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_unspecified/sipp/uas-ignore.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Receive MESSAGE, ignore">
+ <recv request="MESSAGE" crlf="true">
+ </recv>
+</scenario>
diff --git a/tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_unspecified/test-config.yaml b/tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_unspecified/test-config.yaml
new file mode 100644
index 0000000..cdfc6b3
--- /dev/null
+++ b/tests/channels/pjsip/resolver/srv/failover/out_of_dialog/transport_unspecified/test-config.yaml
@@ -0,0 +1,50 @@
+testinfo:
+ summary: 'Test out of dialog SRV failover using an unspecified transport'
+ description: |
+ Using an out of dialog SIP message (in this case a SIP MESSAGE) with an
+ unspecified transport, this test verifies that an SRV record lookup
+ resulting in multiple results will successfully fail over to other
+ records if previous ones do not respond.
+
+ Since the transport is unspecified TCP is given priority and should
+ be selected first. Once this fails the only option left is UDP, so it
+ should then switch transport types when attempting the secondary
+ failover address.
+
+test-modules:
+ test-object:
+ config-section: test-object-config
+ typename: 'sipp.SIPpTestCase'
+ modules:
+ -
+ config-section: originator
+ typename: 'pluggable_modules.Originator'
+ -
+ config-section: dns-server-config
+ typename: 'dns_server.DNSServer'
+
+test-object-config:
+ test-iterations:
+ -
+ scenarios:
+ - { 'key-args': {'scenario': 'uas-503.xml', '-i': '127.0.0.1', '-p': '5062', '-t': 't1'} }
+ - { 'key-args': {'scenario': 'uas-ignore.xml', '-i': '127.0.0.1', '-p': '5063'} }
+
+originator:
+ scenario-trigger-after: '2'
+ channel: 'Local/s at default'
+ async: 'True'
+
+dns-server-config:
+ python-zones:
+ -
+ example.com
+
+properties:
+ minversion: '14.0.0'
+ dependencies:
+ - app : 'sipp'
+ - asterisk : 'res_pjsip'
+ - asterisk : 'res_resolver_unbound'
+ tags:
+ - pjsip
diff --git a/tests/channels/pjsip/resolver/srv/failover/tests.yaml b/tests/channels/pjsip/resolver/srv/failover/tests.yaml
new file mode 100644
index 0000000..219cb8b
--- /dev/null
+++ b/tests/channels/pjsip/resolver/srv/failover/tests.yaml
@@ -0,0 +1,4 @@
+# Enter tests here in the order they should be considered for execution:
+tests:
+ - dir: 'in_dialog'
+ - dir: 'out_of_dialog'
diff --git a/tests/channels/pjsip/resolver/srv/failover_udp/configs/ast1/extensions.conf b/tests/channels/pjsip/resolver/srv/failover_udp/configs/ast1/extensions.conf
deleted file mode 100644
index dafe092..0000000
--- a/tests/channels/pjsip/resolver/srv/failover_udp/configs/ast1/extensions.conf
+++ /dev/null
@@ -1,6 +0,0 @@
-[default]
-
-exten => s,1,NoOp()
- same => n,Wait(1)
- same => n,Dial(PJSIP/jenny/sip:example.com\;transport=udp)
- same => n,Hangup()
diff --git a/tests/channels/pjsip/resolver/srv/failover_udp/sipp/uas-ignore.xml b/tests/channels/pjsip/resolver/srv/failover_udp/sipp/uas-ignore.xml
deleted file mode 100644
index 6645ea6..0000000
--- a/tests/channels/pjsip/resolver/srv/failover_udp/sipp/uas-ignore.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-<!DOCTYPE scenario SYSTEM "sipp.dtd">
-
-<scenario name="Receive INVITE with audio, ignore">
- <recv request="INVITE" crlf="true">
- </recv>
-</scenario>
diff --git a/tests/channels/pjsip/resolver/srv/tests.yaml b/tests/channels/pjsip/resolver/srv/tests.yaml
index 06274f0..2aecba4 100644
--- a/tests/channels/pjsip/resolver/srv/tests.yaml
+++ b/tests/channels/pjsip/resolver/srv/tests.yaml
@@ -3,5 +3,5 @@
- test: 'transport_tcp'
- test: 'transport_udp'
- test: 'transport_unspecified'
- - test: 'failover_udp'
- test: 'priority'
+ - dir: 'failover'
--
To view, visit https://gerrit.asterisk.org/751
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic600198f496bb0f6d9522ceda6d84b77eed31395
Gerrit-PatchSet: 1
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Kevin Harwell <kharwell at digium.com>
More information about the asterisk-code-review
mailing list