[Asterisk-code-review] Testsuite: Check outbound registration handling of 423 respo... (testsuite[master])

Mark Michelson asteriskteam at digium.com
Fri Nov 20 14:21:29 CST 2015


Mark Michelson has submitted this change and it was merged.

Change subject: Testsuite: Check outbound registration handling of 423 response.
......................................................................


Testsuite: Check outbound registration handling of 423 response.

Asterisk attempts to register with a short expiration time that the
registration server rejects with a 423 Interval Too Brief response.
Asterisk should then attempt to register with the requested expiration
time.

There are two scenarios:
1) The 423 response is sent before authentication.
2) The 423 response is sent after authentication.

Change-Id: Iedf6a61ed89c5480cec4e55ce6a0b834377cd7b0
---
A tests/channels/pjsip/registration/outbound/interval_too_brief/configs/ast1/pjsip.conf
A tests/channels/pjsip/registration/outbound/interval_too_brief/sipp/uas-reg-423-scenario1.xml
A tests/channels/pjsip/registration/outbound/interval_too_brief/sipp/uas-reg-423-scenario2.xml
A tests/channels/pjsip/registration/outbound/interval_too_brief/test-config.yaml
M tests/channels/pjsip/registration/outbound/tests.yaml
5 files changed, 229 insertions(+), 2 deletions(-)

Approvals:
  Mark Michelson: Looks good to me, approved
  Anonymous Coward #1000019: Verified
  Joshua Colp: Looks good to me, but someone else must approve



diff --git a/tests/channels/pjsip/registration/outbound/interval_too_brief/configs/ast1/pjsip.conf b/tests/channels/pjsip/registration/outbound/interval_too_brief/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..ef912cb
--- /dev/null
+++ b/tests/channels/pjsip/registration/outbound/interval_too_brief/configs/ast1/pjsip.conf
@@ -0,0 +1,28 @@
+[global]
+type = global
+debug = yes
+
+[trans]
+type = transport
+protocol = udp
+bind = 127.0.0.1:5060
+
+[outreg-1]
+type = registration
+server_uri = sip:them at 127.0.0.1:5061
+client_uri = sip:us at 127.0.0.1
+outbound_auth = regauth
+expiration=10
+
+[outreg-2]
+type = registration
+server_uri = sip:them at 127.0.0.1:5062
+client_uri = sip:us at 127.0.0.1
+outbound_auth = regauth
+expiration=10
+
+[regauth]
+type = auth
+auth_type = userpass
+username = myself
+password = me-me
diff --git a/tests/channels/pjsip/registration/outbound/interval_too_brief/sipp/uas-reg-423-scenario1.xml b/tests/channels/pjsip/registration/outbound/interval_too_brief/sipp/uas-reg-423-scenario1.xml
new file mode 100644
index 0000000..1d22fff
--- /dev/null
+++ b/tests/channels/pjsip/registration/outbound/interval_too_brief/sipp/uas-reg-423-scenario1.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Register interval too brief scenario 1: 423 response before authentication">
+    <recv request="REGISTER" crlf="true">
+    </recv>
+
+    <send>
+        <![CDATA[
+            SIP/2.0 423 Interval Too Brief
+            [last_Via:]
+            [last_From:]
+            [last_To:];tag=[pid]SIPpTag01[call_number]
+            [last_Call-ID:]
+            [last_CSeq:]
+            Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+            Min-Expires: 20
+            Content-Length: 0
+        ]]>
+    </send>
+
+    <recv request="REGISTER" crlf="true">
+    </recv>
+
+    <send>
+        <![CDATA[
+            SIP/2.0 401 Unauthorized
+            [last_Via:]
+            [last_From:]
+            [last_To:];tag=[pid]SIPpTag01[call_number]
+            [last_Call-ID:]
+            [last_CSeq:]
+            Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+            WWW-Authenticate: Digest realm="asterisk", nonce="47ebe028cda119c35d4877b383027d28da013815"
+            Content-Length: 0
+        ]]>
+    </send>
+
+    <recv request="REGISTER" crlf="true">
+    </recv>
+
+    <send>
+        <![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]>
+            Expires: 20
+            Content-Length: 0
+        ]]>
+    </send>
+
+    <!-- Keep the scenario going for a while to ensure that no further messages are sent -->
+    <timewait milliseconds="5000" />
+</scenario>
diff --git a/tests/channels/pjsip/registration/outbound/interval_too_brief/sipp/uas-reg-423-scenario2.xml b/tests/channels/pjsip/registration/outbound/interval_too_brief/sipp/uas-reg-423-scenario2.xml
new file mode 100644
index 0000000..a19ddfe
--- /dev/null
+++ b/tests/channels/pjsip/registration/outbound/interval_too_brief/sipp/uas-reg-423-scenario2.xml
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Register interval too brief scenario 2: 423 response after authentication">
+    <recv request="REGISTER" crlf="true">
+    </recv>
+
+    <send>
+        <![CDATA[
+            SIP/2.0 401 Unauthorized
+            [last_Via:]
+            [last_From:]
+            [last_To:];tag=[pid]SIPpTag01[call_number]
+            [last_Call-ID:]
+            [last_CSeq:]
+            Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+            WWW-Authenticate: Digest realm="asterisk", nonce="47ebe028cda119c35d4877b383027d28da013815"
+            Content-Length: 0
+        ]]>
+    </send>
+
+    <recv request="REGISTER" crlf="true">
+    </recv>
+
+    <send>
+        <![CDATA[
+            SIP/2.0 423 Interval Too Brief
+            [last_Via:]
+            [last_From:]
+            [last_To:];tag=[pid]SIPpTag01[call_number]
+            [last_Call-ID:]
+            [last_CSeq:]
+            Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+            Min-Expires: 20
+            Content-Length: 0
+        ]]>
+    </send>
+
+    <recv request="REGISTER" crlf="true">
+    </recv>
+
+    <send>
+        <![CDATA[
+            SIP/2.0 401 Unauthorized
+            [last_Via:]
+            [last_From:]
+            [last_To:];tag=[pid]SIPpTag01[call_number]
+            [last_Call-ID:]
+            [last_CSeq:]
+            Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+            WWW-Authenticate: Digest realm="asterisk", nonce="47ebe028cda119c35d4877b383027d28da014233"
+            Content-Length: 0
+        ]]>
+    </send>
+
+    <recv request="REGISTER" crlf="true">
+    </recv>
+
+    <send>
+        <![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]>
+            Expires: 20
+            Content-Length: 0
+        ]]>
+    </send>
+
+    <!-- Keep the scenario going for a while to ensure that no further messages are sent -->
+    <timewait milliseconds="5000" />
+</scenario>
diff --git a/tests/channels/pjsip/registration/outbound/interval_too_brief/test-config.yaml b/tests/channels/pjsip/registration/outbound/interval_too_brief/test-config.yaml
new file mode 100644
index 0000000..acb986d
--- /dev/null
+++ b/tests/channels/pjsip/registration/outbound/interval_too_brief/test-config.yaml
@@ -0,0 +1,65 @@
+testinfo:
+    summary: 'Check handling of 423 response'
+    description: |
+        'Asterisk attempts to register with a short expiration time that the
+        registration server rejects with a 423 Interval Too Brief response.
+        Asterisk should then attempt to register with the requested expiration
+        time.
+
+        There are two scenarios:
+        1) The 423 response is sent before authentication.
+        2) The 423 response is sent after authentication.'
+
+test-modules:
+    test-object:
+        config-section: sipp-config
+        typename: 'sipp.SIPpTestCase'
+    modules:
+        -
+            typename: 'ami.AMIEventModule'
+            config-section: ami-config
+
+sipp-config:
+    test-iterations:
+        -
+            scenarios:
+                - { 'key-args': { 'scenario': 'uas-reg-423-scenario1.xml', '-p': '5061'} }
+                - { 'key-args': { 'scenario': 'uas-reg-423-scenario2.xml', '-p': '5062'} }
+
+ami-config:
+    -
+        type: 'headermatch'
+        conditions:
+            match:
+                Event: 'Registry'
+                ChannelType: 'PJSIP'
+                Username: 'sip:us at 127.0.0.1'
+                Domain: 'sip:them at 127.0.0.1:5061'
+        requirements:
+            match:
+                Status: 'Registered'
+        count: '1'
+    -
+        type: 'headermatch'
+        conditions:
+            match:
+                Event: 'Registry'
+                ChannelType: 'PJSIP'
+                Username: 'sip:us at 127.0.0.1'
+                Domain: 'sip:them at 127.0.0.1:5062'
+        requirements:
+            match:
+                Status: 'Registered'
+        count: '1'
+
+properties:
+    minversion: '13.7.0'
+    dependencies:
+        - python: 'starpy'
+        - sipp:
+            version: 'v3.1'
+        - asterisk: 'res_pjsip'
+        - asterisk: 'res_pjsip_outbound_authenticator_digest'
+        - asterisk: 'res_pjsip_outbound_registration'
+    tags:
+        - pjsip
diff --git a/tests/channels/pjsip/registration/outbound/tests.yaml b/tests/channels/pjsip/registration/outbound/tests.yaml
index 8138ea2..07e2fd9 100644
--- a/tests/channels/pjsip/registration/outbound/tests.yaml
+++ b/tests/channels/pjsip/registration/outbound/tests.yaml
@@ -1,7 +1,8 @@
 # Enter tests here in the order they should be considered for execution:
 tests:
-    - test: 'forbidden_retry'
-    - test: 'fatal_retry'
     - dir: 'unregister'
     - test: 'auth_loop'
+    - test: 'fatal_retry'
+    - test: 'forbidden_retry'
+    - test: 'interval_too_brief'
     - test: 'line_parameter'

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Iedf6a61ed89c5480cec4e55ce6a0b834377cd7b0
Gerrit-PatchSet: 2
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>



More information about the asterisk-code-review mailing list