[Asterisk-code-review] Change in testsuite[master]: pjsip: Add basic resolver tests covering A/AAAA, SRV, and NA...

Matt Jordan (Code Review) asteriskteam at digium.com
Sun Apr 19 10:55:18 CDT 2015


Matt Jordan has submitted this change and it was merged.

Change subject: pjsip: Add basic resolver tests covering A/AAAA, SRV, and NAPTR.
......................................................................


pjsip: Add basic resolver tests covering A/AAAA, SRV, and NAPTR.

These tests cover the following:

1. Dialing a URI with a hostname that resolves to only an A record
2. Dialing a URI with a hostname that resolves to an AAAA+A record
3. Dialing a URI with a hostname and unspecified transport that resolves using SRV to TCP transport with A record
4. Dialing a URI with a hostname and TCP transport that resolves using SRV to TCP transport with A record
5. Dialing a URI with a hostname and UDP transport that resolves using SRV to UDP transport with A record
6. Dialing a URI with a hostname and unspecified transport that resolves using NAPTR/SRV to TCP transport with A record
7. Dialing a URI with a hostname and TCP transport that resolves using NAPTR/SRV to TCP transport with A record
8. Dialing a URI with a hostname and UDP transport that resolves using NAPTR/SRV to UDP transport with A record

ASTERISK-24947 #close
Reported by: Joshua Colp

Change-Id: I8690d6b2441937ab9d7fea6f1e41c3d6985a1d9e
---
A tests/channels/pjsip/resolver/a/configs/ast1/extensions.conf
A tests/channels/pjsip/resolver/a/configs/ast1/pjsip.conf
A tests/channels/pjsip/resolver/a/configs/ast1/resolver_unbound.conf
A tests/channels/pjsip/resolver/a/dns_zones/example.com
A tests/channels/pjsip/resolver/a/sipp/uas.xml
A tests/channels/pjsip/resolver/a/test-config.yaml
A tests/channels/pjsip/resolver/aaaa/configs/ast1/extensions.conf
A tests/channels/pjsip/resolver/aaaa/configs/ast1/pjsip.conf
A tests/channels/pjsip/resolver/aaaa/configs/ast1/resolver_unbound.conf
A tests/channels/pjsip/resolver/aaaa/dns_zones/example.com
A tests/channels/pjsip/resolver/aaaa/sipp/uas.xml
A tests/channels/pjsip/resolver/aaaa/test-config.yaml
A tests/channels/pjsip/resolver/naptr/tests.yaml
A tests/channels/pjsip/resolver/naptr/transport_tcp/configs/ast1/extensions.conf
A tests/channels/pjsip/resolver/naptr/transport_tcp/configs/ast1/pjsip.conf
A tests/channels/pjsip/resolver/naptr/transport_tcp/configs/ast1/resolver_unbound.conf
A tests/channels/pjsip/resolver/naptr/transport_tcp/dns_zones/example.com
A tests/channels/pjsip/resolver/naptr/transport_tcp/sipp/uas.xml
A tests/channels/pjsip/resolver/naptr/transport_tcp/test-config.yaml
A tests/channels/pjsip/resolver/naptr/transport_udp/configs/ast1/extensions.conf
A tests/channels/pjsip/resolver/naptr/transport_udp/configs/ast1/pjsip.conf
A tests/channels/pjsip/resolver/naptr/transport_udp/configs/ast1/resolver_unbound.conf
A tests/channels/pjsip/resolver/naptr/transport_udp/dns_zones/example.com
A tests/channels/pjsip/resolver/naptr/transport_udp/sipp/uas.xml
A tests/channels/pjsip/resolver/naptr/transport_udp/test-config.yaml
A tests/channels/pjsip/resolver/naptr/transport_unspecified/configs/ast1/extensions.conf
A tests/channels/pjsip/resolver/naptr/transport_unspecified/configs/ast1/pjsip.conf
A tests/channels/pjsip/resolver/naptr/transport_unspecified/configs/ast1/resolver_unbound.conf
A tests/channels/pjsip/resolver/naptr/transport_unspecified/dns_zones/example.com
A tests/channels/pjsip/resolver/naptr/transport_unspecified/sipp/uas.xml
A tests/channels/pjsip/resolver/naptr/transport_unspecified/test-config.yaml
A tests/channels/pjsip/resolver/srv/tests.yaml
A tests/channels/pjsip/resolver/srv/transport_tcp/configs/ast1/extensions.conf
A tests/channels/pjsip/resolver/srv/transport_tcp/configs/ast1/pjsip.conf
A tests/channels/pjsip/resolver/srv/transport_tcp/configs/ast1/resolver_unbound.conf
A tests/channels/pjsip/resolver/srv/transport_tcp/dns_zones/example.com
A tests/channels/pjsip/resolver/srv/transport_tcp/sipp/uas.xml
A tests/channels/pjsip/resolver/srv/transport_tcp/test-config.yaml
A tests/channels/pjsip/resolver/srv/transport_udp/configs/ast1/extensions.conf
A tests/channels/pjsip/resolver/srv/transport_udp/configs/ast1/pjsip.conf
A tests/channels/pjsip/resolver/srv/transport_udp/configs/ast1/resolver_unbound.conf
A tests/channels/pjsip/resolver/srv/transport_udp/dns_zones/example.com
A tests/channels/pjsip/resolver/srv/transport_udp/sipp/uas.xml
A tests/channels/pjsip/resolver/srv/transport_udp/test-config.yaml
A tests/channels/pjsip/resolver/srv/transport_unspecified/configs/ast1/extensions.conf
A tests/channels/pjsip/resolver/srv/transport_unspecified/configs/ast1/pjsip.conf
A tests/channels/pjsip/resolver/srv/transport_unspecified/configs/ast1/resolver_unbound.conf
A tests/channels/pjsip/resolver/srv/transport_unspecified/dns_zones/example.com
A tests/channels/pjsip/resolver/srv/transport_unspecified/sipp/uas.xml
A tests/channels/pjsip/resolver/srv/transport_unspecified/test-config.yaml
A tests/channels/pjsip/resolver/tests.yaml
M tests/channels/pjsip/tests.yaml
52 files changed, 1,338 insertions(+), 1 deletion(-)

Approvals:
  Matt Jordan: Looks good to me, approved; Verified



diff --git a/tests/channels/pjsip/resolver/a/configs/ast1/extensions.conf b/tests/channels/pjsip/resolver/a/configs/ast1/extensions.conf
new file mode 100644
index 0000000..cccaf13
--- /dev/null
+++ b/tests/channels/pjsip/resolver/a/configs/ast1/extensions.conf
@@ -0,0 +1,6 @@
+[default]
+
+exten => s,1,NoOp()
+ same => n,Wait(1)
+ same => n,Dial(PJSIP/jenny/sip:pbx.example.com:5061)
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/resolver/a/configs/ast1/pjsip.conf b/tests/channels/pjsip/resolver/a/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..9277614
--- /dev/null
+++ b/tests/channels/pjsip/resolver/a/configs/ast1/pjsip.conf
@@ -0,0 +1,9 @@
+[transport-udp]
+type=transport
+protocol=udp
+bind=0.0.0.0:5060
+
+[jenny]
+type=endpoint
+context=default
+allow=!all,ulaw,alaw,g722
diff --git a/tests/channels/pjsip/resolver/a/configs/ast1/resolver_unbound.conf b/tests/channels/pjsip/resolver/a/configs/ast1/resolver_unbound.conf
new file mode 100644
index 0000000..38ef153
--- /dev/null
+++ b/tests/channels/pjsip/resolver/a/configs/ast1/resolver_unbound.conf
@@ -0,0 +1,3 @@
+[general]
+nameserver = 127.0.0.1 at 10053
+resolv =
diff --git a/tests/channels/pjsip/resolver/a/dns_zones/example.com b/tests/channels/pjsip/resolver/a/dns_zones/example.com
new file mode 100644
index 0000000..4df76b8
--- /dev/null
+++ b/tests/channels/pjsip/resolver/a/dns_zones/example.com
@@ -0,0 +1,29 @@
+zone = [
+    SOA(
+        # For whom we are the authority
+        'example.com',
+
+        # This nameserver's name
+        mname = "ns1.example.com",
+
+        # Mailbox of individual who handles this
+        rname = "root.example.com",
+
+        # Unique serial identifying this SOA data
+        serial = 2003010601,
+
+        # Time interval before zone should be refreshed
+        refresh = "1H",
+
+        # Interval before failed refresh should be retried
+        retry = "1H",
+
+        # Upper limit on time interval before expiry
+        expire = "1H",
+
+        # Minimum TTL
+        minimum = "1H"
+    ),
+
+    A('pbx.example.com', '127.0.0.1'),
+]
diff --git a/tests/channels/pjsip/resolver/a/sipp/uas.xml b/tests/channels/pjsip/resolver/a/sipp/uas.xml
new file mode 100644
index 0000000..e72519e
--- /dev/null
+++ b/tests/channels/pjsip/resolver/a/sipp/uas.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Receive INVITE with audio, immediately answer, and then hangup">
+  <Global variables="remote_tag" />
+  <recv request="INVITE" crlf="true">
+      <action>
+          <!-- Save the from tag. We'll need it when we send our BYE -->
+          <ereg regexp=".*(;tag=.*)"
+              header="From:"
+              search_in="hdr"
+              check_it="true"
+              assign_to="remote_tag"/>
+      </action>
+  </recv>
+
+  <send retrans="500">
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To:];tag=[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">
+  </recv>
+
+  <send retrans="500">
+    <![CDATA[
+
+      BYE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: ua1 <sip:ua1@[local_ip]:[local_port]>;tag=[call_number]
+      To: [$remote_tag]
+      [last_Call-ID:]
+      CSeq: [cseq] BYE
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv response="200">
+  </recv>
+
+</scenario>
diff --git a/tests/channels/pjsip/resolver/a/test-config.yaml b/tests/channels/pjsip/resolver/a/test-config.yaml
new file mode 100644
index 0000000..d226232
--- /dev/null
+++ b/tests/channels/pjsip/resolver/a/test-config.yaml
@@ -0,0 +1,45 @@
+testinfo:
+    summary: 'Test resolution of an address using an A record'
+    description: |
+        This test verifies that an A record lookup successfully occurs using
+        the resolver and that traffic is sent to the resulting 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.xml', '-i': '127.0.0.1', '-p': '5061'} }
+
+originator:
+    trigger: 'ami_connect'
+    ignore-originate-failure: 'no'
+    id: '0'
+    channel: 'Local/s at default'
+    application: 'Echo'
+    async: 'True'
+
+dns-server-config:
+    port: 10053
+    python-zones:
+        -
+            example.com
+
+properties:
+    minversion: '14.0.0'
+    dependencies:
+        - app : 'sipp'
+        - asterisk : 'res_pjsip'
+    tags:
+        - pjsip
diff --git a/tests/channels/pjsip/resolver/aaaa/configs/ast1/extensions.conf b/tests/channels/pjsip/resolver/aaaa/configs/ast1/extensions.conf
new file mode 100644
index 0000000..31f325c
--- /dev/null
+++ b/tests/channels/pjsip/resolver/aaaa/configs/ast1/extensions.conf
@@ -0,0 +1,5 @@
+[default]
+
+exten => s,1,NoOp()
+ same => n,Dial(PJSIP/jenny/sip:pbx.example.com:5061)
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/resolver/aaaa/configs/ast1/pjsip.conf b/tests/channels/pjsip/resolver/aaaa/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..13a35eb
--- /dev/null
+++ b/tests/channels/pjsip/resolver/aaaa/configs/ast1/pjsip.conf
@@ -0,0 +1,9 @@
+[transport-udp6]
+type=transport
+protocol=udp
+bind=[::1]:5060
+
+[jenny]
+type=endpoint
+context=default
+allow=!all,ulaw,alaw,g722
diff --git a/tests/channels/pjsip/resolver/aaaa/configs/ast1/resolver_unbound.conf b/tests/channels/pjsip/resolver/aaaa/configs/ast1/resolver_unbound.conf
new file mode 100644
index 0000000..38ef153
--- /dev/null
+++ b/tests/channels/pjsip/resolver/aaaa/configs/ast1/resolver_unbound.conf
@@ -0,0 +1,3 @@
+[general]
+nameserver = 127.0.0.1 at 10053
+resolv =
diff --git a/tests/channels/pjsip/resolver/aaaa/dns_zones/example.com b/tests/channels/pjsip/resolver/aaaa/dns_zones/example.com
new file mode 100644
index 0000000..10696eb
--- /dev/null
+++ b/tests/channels/pjsip/resolver/aaaa/dns_zones/example.com
@@ -0,0 +1,29 @@
+zone = [
+    SOA(
+        # For whom we are the authority
+        'example.com',
+
+        # This nameserver's name
+        mname = "ns1.example.com",
+
+        # Mailbox of individual who handles this
+        rname = "root.example.com",
+
+        # Unique serial identifying this SOA data
+        serial = 2003010601,
+
+        # Time interval before zone should be refreshed
+        refresh = "1H",
+
+        # Interval before failed refresh should be retried
+        retry = "1H",
+
+        # Upper limit on time interval before expiry
+        expire = "1H",
+
+        # Minimum TTL
+        minimum = "1H"
+    ),
+
+    AAAA('pbx.example.com', '::1'),
+]
diff --git a/tests/channels/pjsip/resolver/aaaa/sipp/uas.xml b/tests/channels/pjsip/resolver/aaaa/sipp/uas.xml
new file mode 100644
index 0000000..e72519e
--- /dev/null
+++ b/tests/channels/pjsip/resolver/aaaa/sipp/uas.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Receive INVITE with audio, immediately answer, and then hangup">
+  <Global variables="remote_tag" />
+  <recv request="INVITE" crlf="true">
+      <action>
+          <!-- Save the from tag. We'll need it when we send our BYE -->
+          <ereg regexp=".*(;tag=.*)"
+              header="From:"
+              search_in="hdr"
+              check_it="true"
+              assign_to="remote_tag"/>
+      </action>
+  </recv>
+
+  <send retrans="500">
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To:];tag=[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">
+  </recv>
+
+  <send retrans="500">
+    <![CDATA[
+
+      BYE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: ua1 <sip:ua1@[local_ip]:[local_port]>;tag=[call_number]
+      To: [$remote_tag]
+      [last_Call-ID:]
+      CSeq: [cseq] BYE
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv response="200">
+  </recv>
+
+</scenario>
diff --git a/tests/channels/pjsip/resolver/aaaa/test-config.yaml b/tests/channels/pjsip/resolver/aaaa/test-config.yaml
new file mode 100644
index 0000000..734ed82
--- /dev/null
+++ b/tests/channels/pjsip/resolver/aaaa/test-config.yaml
@@ -0,0 +1,45 @@
+testinfo:
+    summary: 'Test resolution of an address using an AAAA record'
+    description: |
+        This test verifies that an AAAA record lookup successfully occurs using
+        the resolver and that traffic is sent to the resulting 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.xml', '-i': '[::1]', '-p': '5061'} }
+
+originator:
+    trigger: 'ami_connect'
+    ignore-originate-failure: 'no'
+    id: '0'
+    channel: 'Local/s at default'
+    application: 'Echo'
+    async: 'True'
+
+dns-server-config:
+    port: 10053
+    python-zones:
+        -
+            example.com
+
+properties:
+    minversion: '14.0.0'
+    dependencies:
+        - app : 'sipp'
+        - asterisk : 'res_pjsip'
+    tags:
+        - pjsip
diff --git a/tests/channels/pjsip/resolver/naptr/tests.yaml b/tests/channels/pjsip/resolver/naptr/tests.yaml
new file mode 100644
index 0000000..633aa1d
--- /dev/null
+++ b/tests/channels/pjsip/resolver/naptr/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/naptr/transport_tcp/configs/ast1/extensions.conf b/tests/channels/pjsip/resolver/naptr/transport_tcp/configs/ast1/extensions.conf
new file mode 100644
index 0000000..6ae1e83
--- /dev/null
+++ b/tests/channels/pjsip/resolver/naptr/transport_tcp/configs/ast1/extensions.conf
@@ -0,0 +1,6 @@
+[default]
+
+exten => s,1,NoOp()
+ same => n,Wait(1)
+ same => n,Dial(PJSIP/jenny/sip:naptr.example.com\;transport=tcp)
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/resolver/naptr/transport_tcp/configs/ast1/pjsip.conf b/tests/channels/pjsip/resolver/naptr/transport_tcp/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..3355d03
--- /dev/null
+++ b/tests/channels/pjsip/resolver/naptr/transport_tcp/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:5060
+
+[jenny]
+type=endpoint
+context=default
+allow=!all,ulaw,alaw,g722
diff --git a/tests/channels/pjsip/resolver/naptr/transport_tcp/configs/ast1/resolver_unbound.conf b/tests/channels/pjsip/resolver/naptr/transport_tcp/configs/ast1/resolver_unbound.conf
new file mode 100644
index 0000000..38ef153
--- /dev/null
+++ b/tests/channels/pjsip/resolver/naptr/transport_tcp/configs/ast1/resolver_unbound.conf
@@ -0,0 +1,3 @@
+[general]
+nameserver = 127.0.0.1 at 10053
+resolv =
diff --git a/tests/channels/pjsip/resolver/naptr/transport_tcp/dns_zones/example.com b/tests/channels/pjsip/resolver/naptr/transport_tcp/dns_zones/example.com
new file mode 100644
index 0000000..c0baf68
--- /dev/null
+++ b/tests/channels/pjsip/resolver/naptr/transport_tcp/dns_zones/example.com
@@ -0,0 +1,33 @@
+zone = [
+    SOA(
+        # For whom we are the authority
+        'example.com',
+
+        # This nameserver's name
+        mname = "ns1.example.com",
+
+        # Mailbox of individual who handles this
+        rname = "root.example.com",
+
+        # Unique serial identifying this SOA data
+        serial = 2003010601,
+
+        # Time interval before zone should be refreshed
+        refresh = "1H",
+
+        # Interval before failed refresh should be retried
+        retry = "1H",
+
+        # Upper limit on time interval before expiry
+        expire = "1H",
+
+        # Minimum TTL
+        minimum = "1H"
+    ),
+
+    NAPTR('naptr.example.com', 0, 1, 'S', 'SIP+D2T', '', '_sip._tcp.example.com'),
+    NAPTR('naptr.example.com', 0, 2, 'S', 'SIP+D2U', '', '_sip._udp.example.com'),
+    SRV('_sip._tcp.example.com', 0, 1, 5061, 'pbx.example.com'),
+    SRV('_sip._udp.example.com', 0, 1, 5061, 'pbx.example.com'),
+    A('pbx.example.com', '127.0.0.1'),
+]
diff --git a/tests/channels/pjsip/resolver/naptr/transport_tcp/sipp/uas.xml b/tests/channels/pjsip/resolver/naptr/transport_tcp/sipp/uas.xml
new file mode 100644
index 0000000..e72519e
--- /dev/null
+++ b/tests/channels/pjsip/resolver/naptr/transport_tcp/sipp/uas.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Receive INVITE with audio, immediately answer, and then hangup">
+  <Global variables="remote_tag" />
+  <recv request="INVITE" crlf="true">
+      <action>
+          <!-- Save the from tag. We'll need it when we send our BYE -->
+          <ereg regexp=".*(;tag=.*)"
+              header="From:"
+              search_in="hdr"
+              check_it="true"
+              assign_to="remote_tag"/>
+      </action>
+  </recv>
+
+  <send retrans="500">
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To:];tag=[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">
+  </recv>
+
+  <send retrans="500">
+    <![CDATA[
+
+      BYE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: ua1 <sip:ua1@[local_ip]:[local_port]>;tag=[call_number]
+      To: [$remote_tag]
+      [last_Call-ID:]
+      CSeq: [cseq] BYE
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv response="200">
+  </recv>
+
+</scenario>
diff --git a/tests/channels/pjsip/resolver/naptr/transport_tcp/test-config.yaml b/tests/channels/pjsip/resolver/naptr/transport_tcp/test-config.yaml
new file mode 100644
index 0000000..e3e7fd1
--- /dev/null
+++ b/tests/channels/pjsip/resolver/naptr/transport_tcp/test-config.yaml
@@ -0,0 +1,48 @@
+testinfo:
+    summary: 'Test NAPTR resolution of an address with TCP transport specified'
+    description: |
+        This test verifies that a NAPTR and SRV record lookup successfully occurs using
+        the resolver and that traffic is sent to the resulting address. Since the
+        TCP transport is explicitly provided the only records that should be looked
+        up and used are TCP. Since sipp is listening only on TCP if UDP records are used
+        instead the call will fail.
+
+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.xml', '-i': '127.0.0.1', '-p': '5061', '-t': 't1'} }
+
+originator:
+    trigger: 'ami_connect'
+    ignore-originate-failure: 'no'
+    id: '0'
+    channel: 'Local/s at default'
+    application: 'Echo'
+    async: 'True'
+
+dns-server-config:
+    port: 10053
+    python-zones:
+        -
+            example.com
+
+properties:
+    minversion: '14.0.0'
+    dependencies:
+        - app : 'sipp'
+        - asterisk : 'res_pjsip'
+    tags:
+        - pjsip
diff --git a/tests/channels/pjsip/resolver/naptr/transport_udp/configs/ast1/extensions.conf b/tests/channels/pjsip/resolver/naptr/transport_udp/configs/ast1/extensions.conf
new file mode 100644
index 0000000..6bab124
--- /dev/null
+++ b/tests/channels/pjsip/resolver/naptr/transport_udp/configs/ast1/extensions.conf
@@ -0,0 +1,6 @@
+[default]
+
+exten => s,1,NoOp()
+ same => n,Wait(1)
+ same => n,Dial(PJSIP/jenny/sip:naptr.example.com\;transport=udp)
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/resolver/naptr/transport_udp/configs/ast1/pjsip.conf b/tests/channels/pjsip/resolver/naptr/transport_udp/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..3355d03
--- /dev/null
+++ b/tests/channels/pjsip/resolver/naptr/transport_udp/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:5060
+
+[jenny]
+type=endpoint
+context=default
+allow=!all,ulaw,alaw,g722
diff --git a/tests/channels/pjsip/resolver/naptr/transport_udp/configs/ast1/resolver_unbound.conf b/tests/channels/pjsip/resolver/naptr/transport_udp/configs/ast1/resolver_unbound.conf
new file mode 100644
index 0000000..38ef153
--- /dev/null
+++ b/tests/channels/pjsip/resolver/naptr/transport_udp/configs/ast1/resolver_unbound.conf
@@ -0,0 +1,3 @@
+[general]
+nameserver = 127.0.0.1 at 10053
+resolv =
diff --git a/tests/channels/pjsip/resolver/naptr/transport_udp/dns_zones/example.com b/tests/channels/pjsip/resolver/naptr/transport_udp/dns_zones/example.com
new file mode 100644
index 0000000..c0baf68
--- /dev/null
+++ b/tests/channels/pjsip/resolver/naptr/transport_udp/dns_zones/example.com
@@ -0,0 +1,33 @@
+zone = [
+    SOA(
+        # For whom we are the authority
+        'example.com',
+
+        # This nameserver's name
+        mname = "ns1.example.com",
+
+        # Mailbox of individual who handles this
+        rname = "root.example.com",
+
+        # Unique serial identifying this SOA data
+        serial = 2003010601,
+
+        # Time interval before zone should be refreshed
+        refresh = "1H",
+
+        # Interval before failed refresh should be retried
+        retry = "1H",
+
+        # Upper limit on time interval before expiry
+        expire = "1H",
+
+        # Minimum TTL
+        minimum = "1H"
+    ),
+
+    NAPTR('naptr.example.com', 0, 1, 'S', 'SIP+D2T', '', '_sip._tcp.example.com'),
+    NAPTR('naptr.example.com', 0, 2, 'S', 'SIP+D2U', '', '_sip._udp.example.com'),
+    SRV('_sip._tcp.example.com', 0, 1, 5061, 'pbx.example.com'),
+    SRV('_sip._udp.example.com', 0, 1, 5061, 'pbx.example.com'),
+    A('pbx.example.com', '127.0.0.1'),
+]
diff --git a/tests/channels/pjsip/resolver/naptr/transport_udp/sipp/uas.xml b/tests/channels/pjsip/resolver/naptr/transport_udp/sipp/uas.xml
new file mode 100644
index 0000000..e72519e
--- /dev/null
+++ b/tests/channels/pjsip/resolver/naptr/transport_udp/sipp/uas.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Receive INVITE with audio, immediately answer, and then hangup">
+  <Global variables="remote_tag" />
+  <recv request="INVITE" crlf="true">
+      <action>
+          <!-- Save the from tag. We'll need it when we send our BYE -->
+          <ereg regexp=".*(;tag=.*)"
+              header="From:"
+              search_in="hdr"
+              check_it="true"
+              assign_to="remote_tag"/>
+      </action>
+  </recv>
+
+  <send retrans="500">
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To:];tag=[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">
+  </recv>
+
+  <send retrans="500">
+    <![CDATA[
+
+      BYE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: ua1 <sip:ua1@[local_ip]:[local_port]>;tag=[call_number]
+      To: [$remote_tag]
+      [last_Call-ID:]
+      CSeq: [cseq] BYE
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv response="200">
+  </recv>
+
+</scenario>
diff --git a/tests/channels/pjsip/resolver/naptr/transport_udp/test-config.yaml b/tests/channels/pjsip/resolver/naptr/transport_udp/test-config.yaml
new file mode 100644
index 0000000..72c9535
--- /dev/null
+++ b/tests/channels/pjsip/resolver/naptr/transport_udp/test-config.yaml
@@ -0,0 +1,48 @@
+testinfo:
+    summary: 'Test NAPTR resolution of an address with UDP transport specified'
+    description: |
+        This test verifies that a NAPTR and SRV record lookup successfully occurs using
+        the resolver and that traffic is sent to the resulting address. Since the
+        UDP transport is explicitly provided the only records that should be looked
+        up and used are UDP. Since sipp is listening only on UDP if TCP records are used
+        instead the call will fail.
+
+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.xml', '-i': '127.0.0.1', '-p': '5061'} }
+
+originator:
+    trigger: 'ami_connect'
+    ignore-originate-failure: 'no'
+    id: '0'
+    channel: 'Local/s at default'
+    application: 'Echo'
+    async: 'True'
+
+dns-server-config:
+    port: 10053
+    python-zones:
+        -
+            example.com
+
+properties:
+    minversion: '14.0.0'
+    dependencies:
+        - app : 'sipp'
+        - asterisk : 'res_pjsip'
+    tags:
+        - pjsip
diff --git a/tests/channels/pjsip/resolver/naptr/transport_unspecified/configs/ast1/extensions.conf b/tests/channels/pjsip/resolver/naptr/transport_unspecified/configs/ast1/extensions.conf
new file mode 100644
index 0000000..4cac461
--- /dev/null
+++ b/tests/channels/pjsip/resolver/naptr/transport_unspecified/configs/ast1/extensions.conf
@@ -0,0 +1,6 @@
+[default]
+
+exten => s,1,NoOp()
+ same => n,Wait(1)
+ same => n,Dial(PJSIP/jenny/sip:naptr.example.com)
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/resolver/naptr/transport_unspecified/configs/ast1/pjsip.conf b/tests/channels/pjsip/resolver/naptr/transport_unspecified/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..3355d03
--- /dev/null
+++ b/tests/channels/pjsip/resolver/naptr/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:5060
+
+[jenny]
+type=endpoint
+context=default
+allow=!all,ulaw,alaw,g722
diff --git a/tests/channels/pjsip/resolver/naptr/transport_unspecified/configs/ast1/resolver_unbound.conf b/tests/channels/pjsip/resolver/naptr/transport_unspecified/configs/ast1/resolver_unbound.conf
new file mode 100644
index 0000000..38ef153
--- /dev/null
+++ b/tests/channels/pjsip/resolver/naptr/transport_unspecified/configs/ast1/resolver_unbound.conf
@@ -0,0 +1,3 @@
+[general]
+nameserver = 127.0.0.1 at 10053
+resolv =
diff --git a/tests/channels/pjsip/resolver/naptr/transport_unspecified/dns_zones/example.com b/tests/channels/pjsip/resolver/naptr/transport_unspecified/dns_zones/example.com
new file mode 100644
index 0000000..c0baf68
--- /dev/null
+++ b/tests/channels/pjsip/resolver/naptr/transport_unspecified/dns_zones/example.com
@@ -0,0 +1,33 @@
+zone = [
+    SOA(
+        # For whom we are the authority
+        'example.com',
+
+        # This nameserver's name
+        mname = "ns1.example.com",
+
+        # Mailbox of individual who handles this
+        rname = "root.example.com",
+
+        # Unique serial identifying this SOA data
+        serial = 2003010601,
+
+        # Time interval before zone should be refreshed
+        refresh = "1H",
+
+        # Interval before failed refresh should be retried
+        retry = "1H",
+
+        # Upper limit on time interval before expiry
+        expire = "1H",
+
+        # Minimum TTL
+        minimum = "1H"
+    ),
+
+    NAPTR('naptr.example.com', 0, 1, 'S', 'SIP+D2T', '', '_sip._tcp.example.com'),
+    NAPTR('naptr.example.com', 0, 2, 'S', 'SIP+D2U', '', '_sip._udp.example.com'),
+    SRV('_sip._tcp.example.com', 0, 1, 5061, 'pbx.example.com'),
+    SRV('_sip._udp.example.com', 0, 1, 5061, 'pbx.example.com'),
+    A('pbx.example.com', '127.0.0.1'),
+]
diff --git a/tests/channels/pjsip/resolver/naptr/transport_unspecified/sipp/uas.xml b/tests/channels/pjsip/resolver/naptr/transport_unspecified/sipp/uas.xml
new file mode 100644
index 0000000..e72519e
--- /dev/null
+++ b/tests/channels/pjsip/resolver/naptr/transport_unspecified/sipp/uas.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Receive INVITE with audio, immediately answer, and then hangup">
+  <Global variables="remote_tag" />
+  <recv request="INVITE" crlf="true">
+      <action>
+          <!-- Save the from tag. We'll need it when we send our BYE -->
+          <ereg regexp=".*(;tag=.*)"
+              header="From:"
+              search_in="hdr"
+              check_it="true"
+              assign_to="remote_tag"/>
+      </action>
+  </recv>
+
+  <send retrans="500">
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To:];tag=[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">
+  </recv>
+
+  <send retrans="500">
+    <![CDATA[
+
+      BYE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: ua1 <sip:ua1@[local_ip]:[local_port]>;tag=[call_number]
+      To: [$remote_tag]
+      [last_Call-ID:]
+      CSeq: [cseq] BYE
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv response="200">
+  </recv>
+
+</scenario>
diff --git a/tests/channels/pjsip/resolver/naptr/transport_unspecified/test-config.yaml b/tests/channels/pjsip/resolver/naptr/transport_unspecified/test-config.yaml
new file mode 100644
index 0000000..c3b74a3
--- /dev/null
+++ b/tests/channels/pjsip/resolver/naptr/transport_unspecified/test-config.yaml
@@ -0,0 +1,48 @@
+testinfo:
+    summary: 'Test NAPTR resolution of an address with no transport specified'
+    description: |
+        This test verifies that a NAPTR and SRV record lookup successfully occurs using
+        the resolver and that traffic is sent to the resulting address. Since no
+        transport is explicitly provided the resolver will look up both TCP and UDP
+        and favor TCP. Since sipp is listening only on TCP if UDP records are used instead
+        the call will fail.
+
+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.xml', '-i': '127.0.0.1', '-p': '5061', '-t': 't1'} }
+
+originator:
+    trigger: 'ami_connect'
+    ignore-originate-failure: 'no'
+    id: '0'
+    channel: 'Local/s at default'
+    application: 'Echo'
+    async: 'True'
+
+dns-server-config:
+    port: 10053
+    python-zones:
+        -
+            example.com
+
+properties:
+    minversion: '14.0.0'
+    dependencies:
+        - app : 'sipp'
+        - asterisk : 'res_pjsip'
+    tags:
+        - pjsip
diff --git a/tests/channels/pjsip/resolver/srv/tests.yaml b/tests/channels/pjsip/resolver/srv/tests.yaml
new file mode 100644
index 0000000..633aa1d
--- /dev/null
+++ b/tests/channels/pjsip/resolver/srv/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/transport_tcp/configs/ast1/extensions.conf b/tests/channels/pjsip/resolver/srv/transport_tcp/configs/ast1/extensions.conf
new file mode 100644
index 0000000..4b8ffeb
--- /dev/null
+++ b/tests/channels/pjsip/resolver/srv/transport_tcp/configs/ast1/extensions.conf
@@ -0,0 +1,6 @@
+[default]
+
+exten => s,1,NoOp()
+ same => n,Wait(1)
+ same => n,Dial(PJSIP/jenny/sip:example.com\;transport=tcp)
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/resolver/srv/transport_tcp/configs/ast1/pjsip.conf b/tests/channels/pjsip/resolver/srv/transport_tcp/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..3355d03
--- /dev/null
+++ b/tests/channels/pjsip/resolver/srv/transport_tcp/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:5060
+
+[jenny]
+type=endpoint
+context=default
+allow=!all,ulaw,alaw,g722
diff --git a/tests/channels/pjsip/resolver/srv/transport_tcp/configs/ast1/resolver_unbound.conf b/tests/channels/pjsip/resolver/srv/transport_tcp/configs/ast1/resolver_unbound.conf
new file mode 100644
index 0000000..38ef153
--- /dev/null
+++ b/tests/channels/pjsip/resolver/srv/transport_tcp/configs/ast1/resolver_unbound.conf
@@ -0,0 +1,3 @@
+[general]
+nameserver = 127.0.0.1 at 10053
+resolv =
diff --git a/tests/channels/pjsip/resolver/srv/transport_tcp/dns_zones/example.com b/tests/channels/pjsip/resolver/srv/transport_tcp/dns_zones/example.com
new file mode 100644
index 0000000..7ef89bf
--- /dev/null
+++ b/tests/channels/pjsip/resolver/srv/transport_tcp/dns_zones/example.com
@@ -0,0 +1,31 @@
+zone = [
+    SOA(
+        # For whom we are the authority
+        'example.com',
+
+        # This nameserver's name
+        mname = "ns1.example.com",
+
+        # Mailbox of individual who handles this
+        rname = "root.example.com",
+
+        # Unique serial identifying this SOA data
+        serial = 2003010601,
+
+        # Time interval before zone should be refreshed
+        refresh = "1H",
+
+        # Interval before failed refresh should be retried
+        retry = "1H",
+
+        # Upper limit on time interval before expiry
+        expire = "1H",
+
+        # Minimum TTL
+        minimum = "1H"
+    ),
+
+    SRV('_sip._tcp.example.com', 0, 1, 5061, 'pbx.example.com'),
+    SRV('_sip._udp.example.com', 0, 1, 5061, 'pbx.example.com'),
+    A('pbx.example.com', '127.0.0.1'),
+]
diff --git a/tests/channels/pjsip/resolver/srv/transport_tcp/sipp/uas.xml b/tests/channels/pjsip/resolver/srv/transport_tcp/sipp/uas.xml
new file mode 100644
index 0000000..e72519e
--- /dev/null
+++ b/tests/channels/pjsip/resolver/srv/transport_tcp/sipp/uas.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Receive INVITE with audio, immediately answer, and then hangup">
+  <Global variables="remote_tag" />
+  <recv request="INVITE" crlf="true">
+      <action>
+          <!-- Save the from tag. We'll need it when we send our BYE -->
+          <ereg regexp=".*(;tag=.*)"
+              header="From:"
+              search_in="hdr"
+              check_it="true"
+              assign_to="remote_tag"/>
+      </action>
+  </recv>
+
+  <send retrans="500">
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To:];tag=[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">
+  </recv>
+
+  <send retrans="500">
+    <![CDATA[
+
+      BYE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: ua1 <sip:ua1@[local_ip]:[local_port]>;tag=[call_number]
+      To: [$remote_tag]
+      [last_Call-ID:]
+      CSeq: [cseq] BYE
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv response="200">
+  </recv>
+
+</scenario>
diff --git a/tests/channels/pjsip/resolver/srv/transport_tcp/test-config.yaml b/tests/channels/pjsip/resolver/srv/transport_tcp/test-config.yaml
new file mode 100644
index 0000000..d81736f
--- /dev/null
+++ b/tests/channels/pjsip/resolver/srv/transport_tcp/test-config.yaml
@@ -0,0 +1,48 @@
+testinfo:
+    summary: 'Test SRV resolution of an address with TCP transport specified'
+    description: |
+        This test verifies that an SRV record lookup successfully occurs using
+        the resolver and that traffic is sent to the resulting address. Since the
+        TCP transport is explicitly provided the only records that should be looked
+        up and used are TCP. Since sipp is listening only on TCP if UDP records are used
+        instead the call will fail.
+
+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.xml', '-i': '127.0.0.1', '-p': '5061', '-t': 't1'} }
+
+originator:
+    trigger: 'ami_connect'
+    ignore-originate-failure: 'no'
+    id: '0'
+    channel: 'Local/s at default'
+    application: 'Echo'
+    async: 'True'
+
+dns-server-config:
+    port: 10053
+    python-zones:
+        -
+            example.com
+
+properties:
+    minversion: '14.0.0'
+    dependencies:
+        - app : 'sipp'
+        - asterisk : 'res_pjsip'
+    tags:
+        - pjsip
diff --git a/tests/channels/pjsip/resolver/srv/transport_udp/configs/ast1/extensions.conf b/tests/channels/pjsip/resolver/srv/transport_udp/configs/ast1/extensions.conf
new file mode 100644
index 0000000..dafe092
--- /dev/null
+++ b/tests/channels/pjsip/resolver/srv/transport_udp/configs/ast1/extensions.conf
@@ -0,0 +1,6 @@
+[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/transport_udp/configs/ast1/pjsip.conf b/tests/channels/pjsip/resolver/srv/transport_udp/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..3355d03
--- /dev/null
+++ b/tests/channels/pjsip/resolver/srv/transport_udp/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:5060
+
+[jenny]
+type=endpoint
+context=default
+allow=!all,ulaw,alaw,g722
diff --git a/tests/channels/pjsip/resolver/srv/transport_udp/configs/ast1/resolver_unbound.conf b/tests/channels/pjsip/resolver/srv/transport_udp/configs/ast1/resolver_unbound.conf
new file mode 100644
index 0000000..38ef153
--- /dev/null
+++ b/tests/channels/pjsip/resolver/srv/transport_udp/configs/ast1/resolver_unbound.conf
@@ -0,0 +1,3 @@
+[general]
+nameserver = 127.0.0.1 at 10053
+resolv =
diff --git a/tests/channels/pjsip/resolver/srv/transport_udp/dns_zones/example.com b/tests/channels/pjsip/resolver/srv/transport_udp/dns_zones/example.com
new file mode 100644
index 0000000..7ef89bf
--- /dev/null
+++ b/tests/channels/pjsip/resolver/srv/transport_udp/dns_zones/example.com
@@ -0,0 +1,31 @@
+zone = [
+    SOA(
+        # For whom we are the authority
+        'example.com',
+
+        # This nameserver's name
+        mname = "ns1.example.com",
+
+        # Mailbox of individual who handles this
+        rname = "root.example.com",
+
+        # Unique serial identifying this SOA data
+        serial = 2003010601,
+
+        # Time interval before zone should be refreshed
+        refresh = "1H",
+
+        # Interval before failed refresh should be retried
+        retry = "1H",
+
+        # Upper limit on time interval before expiry
+        expire = "1H",
+
+        # Minimum TTL
+        minimum = "1H"
+    ),
+
+    SRV('_sip._tcp.example.com', 0, 1, 5061, 'pbx.example.com'),
+    SRV('_sip._udp.example.com', 0, 1, 5061, 'pbx.example.com'),
+    A('pbx.example.com', '127.0.0.1'),
+]
diff --git a/tests/channels/pjsip/resolver/srv/transport_udp/sipp/uas.xml b/tests/channels/pjsip/resolver/srv/transport_udp/sipp/uas.xml
new file mode 100644
index 0000000..e72519e
--- /dev/null
+++ b/tests/channels/pjsip/resolver/srv/transport_udp/sipp/uas.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Receive INVITE with audio, immediately answer, and then hangup">
+  <Global variables="remote_tag" />
+  <recv request="INVITE" crlf="true">
+      <action>
+          <!-- Save the from tag. We'll need it when we send our BYE -->
+          <ereg regexp=".*(;tag=.*)"
+              header="From:"
+              search_in="hdr"
+              check_it="true"
+              assign_to="remote_tag"/>
+      </action>
+  </recv>
+
+  <send retrans="500">
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To:];tag=[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">
+  </recv>
+
+  <send retrans="500">
+    <![CDATA[
+
+      BYE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: ua1 <sip:ua1@[local_ip]:[local_port]>;tag=[call_number]
+      To: [$remote_tag]
+      [last_Call-ID:]
+      CSeq: [cseq] BYE
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv response="200">
+  </recv>
+
+</scenario>
diff --git a/tests/channels/pjsip/resolver/srv/transport_udp/test-config.yaml b/tests/channels/pjsip/resolver/srv/transport_udp/test-config.yaml
new file mode 100644
index 0000000..55c0285
--- /dev/null
+++ b/tests/channels/pjsip/resolver/srv/transport_udp/test-config.yaml
@@ -0,0 +1,48 @@
+testinfo:
+    summary: 'Test SRV resolution of an address with UDP transport specified'
+    description: |
+        This test verifies that an SRV record lookup successfully occurs using
+        the resolver and that traffic is sent to the resulting address. Since the
+        UDP transport is explicitly provided the only records that should be looked
+        up and used are UDP. Since sipp is listening only on UDP if TCP records are used
+        instead the call will fail.
+
+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.xml', '-i': '127.0.0.1', '-p': '5061'} }
+
+originator:
+    trigger: 'ami_connect'
+    ignore-originate-failure: 'no'
+    id: '0'
+    channel: 'Local/s at default'
+    application: 'Echo'
+    async: 'True'
+
+dns-server-config:
+    port: 10053
+    python-zones:
+        -
+            example.com
+
+properties:
+    minversion: '14.0.0'
+    dependencies:
+        - app : 'sipp'
+        - asterisk : 'res_pjsip'
+    tags:
+        - pjsip
diff --git a/tests/channels/pjsip/resolver/srv/transport_unspecified/configs/ast1/extensions.conf b/tests/channels/pjsip/resolver/srv/transport_unspecified/configs/ast1/extensions.conf
new file mode 100644
index 0000000..6c474d0
--- /dev/null
+++ b/tests/channels/pjsip/resolver/srv/transport_unspecified/configs/ast1/extensions.conf
@@ -0,0 +1,6 @@
+[default]
+
+exten => s,1,NoOp()
+ same => n,Wait(1)
+ same => n,Dial(PJSIP/jenny/sip:example.com)
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/resolver/srv/transport_unspecified/configs/ast1/pjsip.conf b/tests/channels/pjsip/resolver/srv/transport_unspecified/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..3355d03
--- /dev/null
+++ b/tests/channels/pjsip/resolver/srv/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:5060
+
+[jenny]
+type=endpoint
+context=default
+allow=!all,ulaw,alaw,g722
diff --git a/tests/channels/pjsip/resolver/srv/transport_unspecified/configs/ast1/resolver_unbound.conf b/tests/channels/pjsip/resolver/srv/transport_unspecified/configs/ast1/resolver_unbound.conf
new file mode 100644
index 0000000..38ef153
--- /dev/null
+++ b/tests/channels/pjsip/resolver/srv/transport_unspecified/configs/ast1/resolver_unbound.conf
@@ -0,0 +1,3 @@
+[general]
+nameserver = 127.0.0.1 at 10053
+resolv =
diff --git a/tests/channels/pjsip/resolver/srv/transport_unspecified/dns_zones/example.com b/tests/channels/pjsip/resolver/srv/transport_unspecified/dns_zones/example.com
new file mode 100644
index 0000000..7ef89bf
--- /dev/null
+++ b/tests/channels/pjsip/resolver/srv/transport_unspecified/dns_zones/example.com
@@ -0,0 +1,31 @@
+zone = [
+    SOA(
+        # For whom we are the authority
+        'example.com',
+
+        # This nameserver's name
+        mname = "ns1.example.com",
+
+        # Mailbox of individual who handles this
+        rname = "root.example.com",
+
+        # Unique serial identifying this SOA data
+        serial = 2003010601,
+
+        # Time interval before zone should be refreshed
+        refresh = "1H",
+
+        # Interval before failed refresh should be retried
+        retry = "1H",
+
+        # Upper limit on time interval before expiry
+        expire = "1H",
+
+        # Minimum TTL
+        minimum = "1H"
+    ),
+
+    SRV('_sip._tcp.example.com', 0, 1, 5061, 'pbx.example.com'),
+    SRV('_sip._udp.example.com', 0, 1, 5061, 'pbx.example.com'),
+    A('pbx.example.com', '127.0.0.1'),
+]
diff --git a/tests/channels/pjsip/resolver/srv/transport_unspecified/sipp/uas.xml b/tests/channels/pjsip/resolver/srv/transport_unspecified/sipp/uas.xml
new file mode 100644
index 0000000..e72519e
--- /dev/null
+++ b/tests/channels/pjsip/resolver/srv/transport_unspecified/sipp/uas.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Receive INVITE with audio, immediately answer, and then hangup">
+  <Global variables="remote_tag" />
+  <recv request="INVITE" crlf="true">
+      <action>
+          <!-- Save the from tag. We'll need it when we send our BYE -->
+          <ereg regexp=".*(;tag=.*)"
+              header="From:"
+              search_in="hdr"
+              check_it="true"
+              assign_to="remote_tag"/>
+      </action>
+  </recv>
+
+  <send retrans="500">
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To:];tag=[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">
+  </recv>
+
+  <send retrans="500">
+    <![CDATA[
+
+      BYE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: ua1 <sip:ua1@[local_ip]:[local_port]>;tag=[call_number]
+      To: [$remote_tag]
+      [last_Call-ID:]
+      CSeq: [cseq] BYE
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv response="200">
+  </recv>
+
+</scenario>
diff --git a/tests/channels/pjsip/resolver/srv/transport_unspecified/test-config.yaml b/tests/channels/pjsip/resolver/srv/transport_unspecified/test-config.yaml
new file mode 100644
index 0000000..29e81e2
--- /dev/null
+++ b/tests/channels/pjsip/resolver/srv/transport_unspecified/test-config.yaml
@@ -0,0 +1,48 @@
+testinfo:
+    summary: 'Test SRV resolution of an address with an unspecified transport'
+    description: |
+        This test verifies that an SRV record lookup successfully occurs using
+        the resolver and that traffic is sent to the resulting address. Since no
+        transport is specified the resolver should favor TCP despite UDP records
+        being available. Since sipp is listening only on TCP if UDP records are used
+        instead the call will fail.
+
+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.xml', '-i': '127.0.0.1', '-p': '5061', '-t': 't1'} }
+
+originator:
+    trigger: 'ami_connect'
+    ignore-originate-failure: 'no'
+    id: '0'
+    channel: 'Local/s at default'
+    application: 'Echo'
+    async: 'True'
+
+dns-server-config:
+    port: 10053
+    python-zones:
+        -
+            example.com
+
+properties:
+    minversion: '14.0.0'
+    dependencies:
+        - app : 'sipp'
+        - asterisk : 'res_pjsip'
+    tags:
+        - pjsip
diff --git a/tests/channels/pjsip/resolver/tests.yaml b/tests/channels/pjsip/resolver/tests.yaml
new file mode 100644
index 0000000..57b8914
--- /dev/null
+++ b/tests/channels/pjsip/resolver/tests.yaml
@@ -0,0 +1,6 @@
+# Enter tests here in the order they should be considered for execution:
+tests:
+    - dir: 'naptr'
+    - dir: 'srv'
+    - test: 'aaaa'
+    - test: 'a'
diff --git a/tests/channels/pjsip/tests.yaml b/tests/channels/pjsip/tests.yaml
index ddc655a..20adb5d 100644
--- a/tests/channels/pjsip/tests.yaml
+++ b/tests/channels/pjsip/tests.yaml
@@ -36,4 +36,4 @@
     - test: 'endpoint_identify'
     - test: 'rpid_immediate'
     - test: 'in_dialog_options'
-
+    - dir: 'resolver'

-- 
To view, visit https://gerrit.asterisk.org/31
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I8690d6b2441937ab9d7fea6f1e41c3d6985a1d9e
Gerrit-PatchSet: 2
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Jared K. Smith <jaredsmith at jaredsmith.net>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>



More information about the asterisk-code-review mailing list