[asterisk-commits] pjsip: Add test for global/regcontext (testsuite[master])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jan 14 06:34:23 CST 2016


Anonymous Coward #1000019 has submitted this change and it was merged.

Change subject: pjsip:  Add test for global/regcontext
......................................................................


pjsip:  Add test for global/regcontext

Tests that (regcontext) in pjsip global causes Asterisk to
dynamically create and destroy a NoOp priority 1 extension
for a given endpoint who registers or unregisters with us.

ASTERISK-25670 #close
Reported-by: Daniel Journo

Change-Id: I1ee88e0acd3d58bdaaf3b808029a8bd97432b4f3
---
A tests/channels/pjsip/registration/inbound/nominal/regcontext/configs/ast1/extensions.conf
A tests/channels/pjsip/registration/inbound/nominal/regcontext/configs/ast1/pjsip.conf
A tests/channels/pjsip/registration/inbound/nominal/regcontext/sipp/register-noauth.xml
A tests/channels/pjsip/registration/inbound/nominal/regcontext/test-config.yaml
M tests/channels/pjsip/registration/inbound/nominal/tests.yaml
5 files changed, 218 insertions(+), 0 deletions(-)

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



diff --git a/tests/channels/pjsip/registration/inbound/nominal/regcontext/configs/ast1/extensions.conf b/tests/channels/pjsip/registration/inbound/nominal/regcontext/configs/ast1/extensions.conf
new file mode 100644
index 0000000..2a8a275
--- /dev/null
+++ b/tests/channels/pjsip/registration/inbound/nominal/regcontext/configs/ast1/extensions.conf
@@ -0,0 +1 @@
+[sipregs]
diff --git a/tests/channels/pjsip/registration/inbound/nominal/regcontext/configs/ast1/pjsip.conf b/tests/channels/pjsip/registration/inbound/nominal/regcontext/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..bd1d96b
--- /dev/null
+++ b/tests/channels/pjsip/registration/inbound/nominal/regcontext/configs/ast1/pjsip.conf
@@ -0,0 +1,57 @@
+[global]
+type=global
+regcontext=sipregs
+
+[local-transport-template](!)
+type=transport
+bind=127.0.0.1
+
+[local-transport6-template](!)
+type=transport
+bind=[::1]
+
+[local-transport-udp](local-transport-template)
+protocol=udp
+
+[local-transport-udp6](local-transport6-template)
+protocol=udp
+
+[local-transport-tcp](local-transport-template)
+protocol=tcp
+
+[local-transport-tcp6](local-transport6-template)
+protocol=tcp
+
+[endpoint-template](!)
+type=endpoint
+context=default
+allow=!all,ulaw
+
+[alice](endpoint-template)
+aors=alice
+
+[alice]
+type=aor
+max_contacts=1
+
+[bob](endpoint-template)
+aors=bob
+
+[bob]
+type=aor
+max_contacts=1
+
+[charlie](endpoint-template)
+aors=charlie
+
+[charlie]
+type=aor
+max_contacts=1
+
+[carol](endpoint-template)
+aors=carol
+
+[carol]
+type=aor
+max_contacts=1
+
diff --git a/tests/channels/pjsip/registration/inbound/nominal/regcontext/sipp/register-noauth.xml b/tests/channels/pjsip/registration/inbound/nominal/regcontext/sipp/register-noauth.xml
new file mode 100644
index 0000000..b5386f4
--- /dev/null
+++ b/tests/channels/pjsip/registration/inbound/nominal/regcontext/sipp/register-noauth.xml
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Basic Sipstone UAC">
+    <!-- register -->
+    <send retrans="500">
+        <![CDATA[
+
+        REGISTER sip:[remote_ip]:[remote_port] SIP/2.0
+        Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+        From: "[service]" <sip:[service]@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
+        To: "[service]" <sip:[service]@[remote_ip]:[remote_port]>
+        Call-ID: [call_id]
+        CSeq: 1 REGISTER
+        Max-Forwards: 70
+        Contact: <sip:[service]@[local_ip]:[local_port]>;transport=[transport]
+        Subject: Performance Test
+        Expires: 60
+        Content-Length: 0
+
+        ]]>
+    </send>
+
+    <recv response="200" rtd="true">
+        <action>
+            <!--
+	    Ensure the received expires parameter is ~60 as no expiration config options are set with a 5 second tolerance
+            -->
+            <ereg regexp="sip:((alice|bob)@127.0.0.1:506[1-2]>;expires=(60|5[5-9])|(charlie|carol)@.::1.:506[3-4]>;expires=(60|5[5-9]))" search_in="hdr" header="Contact:" check_it="true" assign_to="1" />
+	</action>
+    </recv>
+
+    <pause milliseconds="5000"/>
+
+    <!-- unregister -->
+    <send retrans="500">
+        <![CDATA[
+
+        REGISTER sip:[remote_ip]:[remote_port] SIP/2.0
+        Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+        From: "[service]" <sip:[service]@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
+        To: "[service]" <sip:[service]@[remote_ip]:[remote_port]>
+        Call-ID: [call_id]
+        CSeq: 1 REGISTER
+        Max-Forwards: 70
+        Contact: <sip:[service]@[local_ip]:[local_port]>;transport=[transport]
+        Subject: Performance Test
+        Expires: 0
+        Content-Length: 0
+
+        ]]>
+    </send>
+
+    <recv response="200" rtd="true">
+        <action>
+            <!-- Ensure the contact is *not* present -->
+	    <ereg regexp="Contact" search_in="msg" check_it_inverse="true" assign_to="2" />
+	</action>
+    </recv>
+
+    <Reference variables="1" />
+    <Reference variables="2" />
+
+</scenario>
diff --git a/tests/channels/pjsip/registration/inbound/nominal/regcontext/test-config.yaml b/tests/channels/pjsip/registration/inbound/nominal/regcontext/test-config.yaml
new file mode 100644
index 0000000..525bfef
--- /dev/null
+++ b/tests/channels/pjsip/registration/inbound/nominal/regcontext/test-config.yaml
@@ -0,0 +1,95 @@
+testinfo:
+    summary:     'Check regcontext causes Asterisk to create and destroy an extension
+                  when an endpoint registers and unregisters.'
+    description: |
+       'Set regcontext=sipregs and check that, when an endpoint registers, an extension
+        is created in the sipregs context with the name of the endpoint. Then check that the
+        extension is removed when the endpoint unregisters.'
+
+test-modules:
+    test-object:
+        config-section: test-object-config
+        typename: 'sipp.SIPpTestCase'
+    modules:
+        -
+            config-section: 'ami-config'
+            typename: 'pluggable_modules.EventActionModule'
+
+test-object-config:
+    connect-ami: True
+    fail-on-any: False
+    test-iterations:
+        -
+            scenarios:
+                # IPv4 & UDP
+                - { 'key-args': {'scenario': 'register-noauth.xml', '-i': '127.0.0.1', '-p': '5061', '-s': 'alice'} }
+
+ami-config:
+    -
+        ami-start:
+    -
+        ami-events:
+            conditions:
+                match:
+                     Event: 'TestEvent'
+                     State: 'AOR_CONTACT_ADDED'
+                     AOR: 'alice'
+            requirements:
+                match:
+                     Contact: 'sip:alice at 127.0.0.1:5061'
+                     Expiration: '60'
+            count: '1'
+        ami-actions:
+            action:
+                Action: 'ShowDialPlan'
+                ActionID: '12345'
+                Context: 'sipregs'
+    -
+        ami-events:
+            conditions:
+                match:
+                     Event: 'ListDialplan'
+                     ActionID: '12345'
+            requirements:
+                match:
+                     Extension: 'alice'
+            count: '1'
+    -
+        ami-events:
+            conditions:
+                match:
+                     Event: 'PeerStatus'
+                     PeerStatus: 'Unreachable'
+            requirements:
+                match:
+                     Peer: 'PJSIP/alice'
+            count: '1'
+        ami-actions:
+            action:
+                Action: 'ShowDialPlan'
+                ActionID: '12346'
+                Context: 'sipregs'
+    -
+        ami-events:
+            conditions:
+                match:
+                     Event: 'ListDialplan'
+                     ActionID: '12346'
+            requirements:
+                match:
+                     Extension: 'alice'
+            count: '0'
+        stop_test:
+
+properties:
+    minversion: '13.8.0'
+    dependencies:
+        - buildoption: 'TEST_FRAMEWORK'
+        - python: 'twisted'
+        - python: 'starpy'
+        - sipp:
+            version: 'v3.3'
+        - asterisk: 'res_pjsip'
+    tags:
+        - pjsip
+
diff --git a/tests/channels/pjsip/registration/inbound/nominal/tests.yaml b/tests/channels/pjsip/registration/inbound/nominal/tests.yaml
index ad7b8f0..c15b95c 100644
--- a/tests/channels/pjsip/registration/inbound/nominal/tests.yaml
+++ b/tests/channels/pjsip/registration/inbound/nominal/tests.yaml
@@ -6,6 +6,7 @@
     - dir: 'single_contact'
     - dir: 'unregister'
     - dir: 'contact_acl'
+    - test: 'regcontext'
     - test: 'path'
     - test: 'user_agent'
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I1ee88e0acd3d58bdaaf3b808029a8bd97432b4f3
Gerrit-PatchSet: 4
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Daniel Journo <dan at keshercommunications.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: George Joseph <george.joseph at fairview5.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>



More information about the asterisk-commits mailing list