[asterisk-commits] Add test for pjsip session cleanup during ChanIsAvail (testsuite[master])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue May 2 05:19:00 CDT 2017


Joshua Colp has submitted this change and it was merged. ( https://gerrit.asterisk.org/5549 )

Change subject: Add test for pjsip session cleanup during ChanIsAvail
......................................................................


Add test for pjsip session cleanup during ChanIsAvail

Change-Id: I9a64f1f51b17fc47b6d3fb21b501fb08d0636bfc
---
A tests/channels/pjsip/dialplan_functions/chan_is_avail/configs/ast1/extensions.conf
A tests/channels/pjsip/dialplan_functions/chan_is_avail/configs/ast1/pjsip.conf
A tests/channels/pjsip/dialplan_functions/chan_is_avail/sipp/register.xml
A tests/channels/pjsip/dialplan_functions/chan_is_avail/test-config.yaml
M tests/channels/pjsip/dialplan_functions/tests.yaml
5 files changed, 136 insertions(+), 0 deletions(-)

Approvals:
  Mark Michelson: Looks good to me, but someone else must approve
  Jenkins2: Verified
  Joshua Colp: Looks good to me, approved; Approved for Submit



diff --git a/tests/channels/pjsip/dialplan_functions/chan_is_avail/configs/ast1/extensions.conf b/tests/channels/pjsip/dialplan_functions/chan_is_avail/configs/ast1/extensions.conf
new file mode 100644
index 0000000..c2fa928
--- /dev/null
+++ b/tests/channels/pjsip/dialplan_functions/chan_is_avail/configs/ast1/extensions.conf
@@ -0,0 +1,8 @@
+[default]
+
+exten = check,1,Answer()
+ same = n,Hangup()
+
+exten = checker,1,Answer()
+ same = n,ChanIsAvail(PJSIP/checked,as)
+ same = n,Hangup()
diff --git a/tests/channels/pjsip/dialplan_functions/chan_is_avail/configs/ast1/pjsip.conf b/tests/channels/pjsip/dialplan_functions/chan_is_avail/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..1f6336b
--- /dev/null
+++ b/tests/channels/pjsip/dialplan_functions/chan_is_avail/configs/ast1/pjsip.conf
@@ -0,0 +1,19 @@
+[local]
+type=transport
+protocol=udp
+bind=0.0.0.0
+
+[checked]
+type=aor
+qualify_frequency = 1
+max_contacts=1
+
+[checked]
+type=endpoint
+transport=local
+context=default
+aors=checked
+direct_media=no
+disallow=all
+allow=ulaw
+
diff --git a/tests/channels/pjsip/dialplan_functions/chan_is_avail/sipp/register.xml b/tests/channels/pjsip/dialplan_functions/chan_is_avail/sipp/register.xml
new file mode 100644
index 0000000..f24b69b
--- /dev/null
+++ b/tests/channels/pjsip/dialplan_functions/chan_is_avail/sipp/register.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Options">
+    <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: "checked" <sip:checked@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
+        To: "checked" <sip:checked@[remote_ip]:[remote_port]>
+        Call-ID: [call_id]
+        CSeq: 1 REGISTER
+        Max-Forwards: 70
+        Contact: <sip:checked@[local_ip]:[local_port]>;transport=[transport]
+        Subject: Performance Test
+        Content-Length: 0
+
+        ]]>
+    </send>
+
+    <recv response="200" rtd="true" />
+    <pause milliseconds="1000"/>
+
+</scenario>
diff --git a/tests/channels/pjsip/dialplan_functions/chan_is_avail/test-config.yaml b/tests/channels/pjsip/dialplan_functions/chan_is_avail/test-config.yaml
new file mode 100644
index 0000000..136fca4
--- /dev/null
+++ b/tests/channels/pjsip/dialplan_functions/chan_is_avail/test-config.yaml
@@ -0,0 +1,83 @@
+testinfo:
+    summary: 'Test ChanIsAvail dialplan app'
+    description: |
+        Confirms that when ChanIsAvail creates a pjsip channel then
+        hangs it up without dialing that the session is properly cleaned up.
+
+properties:
+    minversion: '13.16.0'
+    dependencies:
+        - buildoption: 'TEST_FRAMEWORK'
+        - sipp :
+            version : 'v3.0'
+        - asterisk : 'res_pjsip'
+        - asterisk : 'chan_pjsip'
+        - asterisk : 'res_pjsip_session'
+        - asterisk : 'app_chanisavail'
+
+    tags:
+        - pjsip
+
+test-modules:
+    test-object:
+        config-section: sipp-config
+        typename: 'sipp.SIPpTestCase'
+    modules:
+        -
+            config-section: 'ami-config'
+            typename: 'pluggable_modules.EventActionModule'
+
+sipp-config:
+    connect-ami: True
+    reactor-timeout: 15
+    fail-on-any: True
+    test-iterations:
+        -
+            scenarios:
+            # we need to pass -aa to sipp so it will respond to the OPTIONS request
+            # asterisk sends after the register
+                - { 'key-args': {'scenario': 'register.xml', '-p': '5061' },
+                    'ordered-args': ['-aa'] }
+
+ami-config:
+    -
+        ami-events:
+            conditions:
+                match:
+                    Event: 'ContactStatus'
+                    ContactStatus: 'Reachable'
+                    AOR: 'checked'
+            requirements:
+                match:
+                    EndpointName: 'checked'
+            count: '1'
+        ami-actions:
+            action:
+                Action: 'Originate'
+                ActionID: '12345'
+                Channel: 'Local/check at default'
+                Exten: 'checker'
+                Context: 'default'
+                Priority: '1'
+
+    -
+        ami-events:
+            conditions:
+                match:
+                    Event: 'VarSet'
+                    Exten: checker
+                    Variable: 'AVAILORIGCHAN'
+            requirements:
+                match:
+                    Value: 'PJSIP/checked'
+            count: 1
+    -
+        ami-events:
+            conditions:
+                match:
+                    Event: 'TestEvent'
+                    State: 'SESSION_DESTROYING'
+            requirements:
+                match:
+                    Endpoint: 'checked'
+            count: 1
diff --git a/tests/channels/pjsip/dialplan_functions/tests.yaml b/tests/channels/pjsip/dialplan_functions/tests.yaml
index 038634c..1767366 100644
--- a/tests/channels/pjsip/dialplan_functions/tests.yaml
+++ b/tests/channels/pjsip/dialplan_functions/tests.yaml
@@ -5,3 +5,4 @@
     - test: 'pjsip_aor'
     - test: 'pjsip_contact'
     - test: 'pjsip_session_refresh'
+    - test: 'chan_is_avail'

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I9a64f1f51b17fc47b6d3fb21b501fb08d0636bfc
Gerrit-PatchSet: 1
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>



More information about the asterisk-commits mailing list