[Asterisk-code-review] bridge_builtin_features: add test to detect beep (testsuite[certified/18.9])

George Joseph asteriskteam at digium.com
Mon Mar 20 07:40:37 CDT 2023


George Joseph has uploaded this change for review. ( https://gerrit.asterisk.org/c/testsuite/+/20010 )


Change subject: bridge_builtin_features: add test to detect beep
......................................................................

bridge_builtin_features: add test to detect beep

Adds new test:
tests/channels/pjsip/one_touch_recording/endpoint_beep

This tests that specifying the periodic beep option
TOUCH_MIXMONITOR_BEEP results in the newly
PERIODIC_HOOK_ENABLED test event being generated,
indicating the periodic beep has been enabled.

Requires corresponding Asterisk change to pass.

ASTERISK-30446

Change-Id: I342fc55b171f82901026eb10353b3c0322151c44
---
A tests/channels/pjsip/one_touch_recording/endpoint_beep/configs/ast1/extensions.conf
A tests/channels/pjsip/one_touch_recording/endpoint_beep/configs/ast1/features.conf
A tests/channels/pjsip/one_touch_recording/endpoint_beep/configs/ast1/pjsip.conf
A tests/channels/pjsip/one_touch_recording/endpoint_beep/sipp/beep.xml
A tests/channels/pjsip/one_touch_recording/endpoint_beep/sipp/nobeep.xml
A tests/channels/pjsip/one_touch_recording/endpoint_beep/test-config.yaml
M tests/channels/pjsip/one_touch_recording/tests.yaml
7 files changed, 329 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/10/20010/1

diff --git a/tests/channels/pjsip/one_touch_recording/endpoint_beep/configs/ast1/extensions.conf b/tests/channels/pjsip/one_touch_recording/endpoint_beep/configs/ast1/extensions.conf
new file mode 100644
index 0000000..8e514c0
--- /dev/null
+++ b/tests/channels/pjsip/one_touch_recording/endpoint_beep/configs/ast1/extensions.conf
@@ -0,0 +1,14 @@
+[default]
+exten => beep,1,Answer()
+same  =>      n,Set(TOUCH_MIXMONITOR_BEEP=5)
+same  =>      n,Dial(local/waiter at waitstaff,,Xh)
+same  =>      n,Hangup()
+
+exten => nobeep,1,Answer()
+same  =>      n,Dial(local/waiter at waitstaff,,Xh)
+same  =>      n,Hangup()
+
+[waitstaff]
+exten  => waiter,1,Answer()
+same  =>      n,Wait(10)
+same  =>      n,Hangup()
diff --git a/tests/channels/pjsip/one_touch_recording/endpoint_beep/configs/ast1/features.conf b/tests/channels/pjsip/one_touch_recording/endpoint_beep/configs/ast1/features.conf
new file mode 100644
index 0000000..b291fa2
--- /dev/null
+++ b/tests/channels/pjsip/one_touch_recording/endpoint_beep/configs/ast1/features.conf
@@ -0,0 +1,3 @@
+[featuremap]
+automixmon => *3
+
diff --git a/tests/channels/pjsip/one_touch_recording/endpoint_beep/configs/ast1/pjsip.conf b/tests/channels/pjsip/one_touch_recording/endpoint_beep/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..90b2a90
--- /dev/null
+++ b/tests/channels/pjsip/one_touch_recording/endpoint_beep/configs/ast1/pjsip.conf
@@ -0,0 +1,19 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[local-transport-template](!)
+type=transport
+bind=127.0.0.1
+
+[local-transport-udp](local-transport-template)
+protocol=udp
+
+[endpoint-template](!)
+type=endpoint
+context=default
+allow=!all,ulaw,alaw
+
+[bob](endpoint-template)
+one_touch_recording=yes
diff --git a/tests/channels/pjsip/one_touch_recording/endpoint_beep/sipp/beep.xml b/tests/channels/pjsip/one_touch_recording/endpoint_beep/sipp/beep.xml
new file mode 100644
index 0000000..580bf6e
--- /dev/null
+++ b/tests/channels/pjsip/one_touch_recording/endpoint_beep/sipp/beep.xml
@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="SIP INFO Record Header Test">
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE sip:beep@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:bob@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>
+      Call-ID: [call_id]
+      CSeq: 1 INVITE
+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: SIP INFO Record Header Test
+      User-Agent: Test
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=phoneA 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+      s=-
+      c=IN IP[media_ip_type] [media_ip]
+      t=0 0
+      m=audio 6000 RTP/AVP 0 3
+      a=rtpmap:0 PCMU/8000
+
+    ]]>
+  </send>
+
+  <recv response="100"
+        optional="true">
+  </recv>
+
+  <recv response="180" optional="true">
+  </recv>
+
+  <recv response="200" rtd="true">
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      ACK sip:beep@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:bob@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 1 ACK
+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: SIP INFO Record Header Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <pause milliseconds="1500"/>
+
+  <!--
+    Example INFO packet with Record header from:
+    http://wiki.snom.com/Category:HowTo:Call_Recording
+  -->
+
+  <send retrans="500">
+    <![CDATA[
+
+      INFO sip:beep@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:bob@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 2 INFO
+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Record: on
+      Content-Length: 0
+
+    ]]>
+
+  </send>
+
+  <recv response="200">
+  </recv>
+
+  <pause milliseconds="1000"/>
+
+  <send retrans="500">
+    <![CDATA[
+
+      BYE sip:beep@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:bob@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 3 BYE
+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: SIP INFO Record Header Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv response="200" crlf="true">
+  </recv>
+
+  <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
+
+  <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
+
+</scenario>
diff --git a/tests/channels/pjsip/one_touch_recording/endpoint_beep/sipp/nobeep.xml b/tests/channels/pjsip/one_touch_recording/endpoint_beep/sipp/nobeep.xml
new file mode 100644
index 0000000..14d8bad
--- /dev/null
+++ b/tests/channels/pjsip/one_touch_recording/endpoint_beep/sipp/nobeep.xml
@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="SIP INFO Record Header Test">
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE sip:nobeep@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:bob@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>
+      Call-ID: [call_id]
+      CSeq: 1 INVITE
+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: SIP INFO Record Header Test
+      User-Agent: Test
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=phoneA 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+      s=-
+      c=IN IP[media_ip_type] [media_ip]
+      t=0 0
+      m=audio 6000 RTP/AVP 0 3
+      a=rtpmap:0 PCMU/8000
+
+    ]]>
+  </send>
+
+  <recv response="100"
+        optional="true">
+  </recv>
+
+  <recv response="180" optional="true">
+  </recv>
+
+  <recv response="200" rtd="true">
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      ACK sip:nobeep@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:bob@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 1 ACK
+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: SIP INFO Record Header Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <pause milliseconds="1500"/>
+
+  <!--
+    Example INFO packet with Record header from:
+    http://wiki.snom.com/Category:HowTo:Call_Recording
+  -->
+
+  <send retrans="500">
+    <![CDATA[
+
+      INFO sip:nobeep@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:bob@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 2 INFO
+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Record: on
+      Content-Length: 0
+
+    ]]>
+
+  </send>
+
+  <recv response="200">
+  </recv>
+
+  <pause milliseconds="1000"/>
+
+  <send retrans="500">
+    <![CDATA[
+
+      BYE sip:nobeep@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:bob@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 3 BYE
+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: SIP INFO Record Header Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv response="200" crlf="true">
+  </recv>
+
+  <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
+
+  <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
+
+</scenario>
diff --git a/tests/channels/pjsip/one_touch_recording/endpoint_beep/test-config.yaml b/tests/channels/pjsip/one_touch_recording/endpoint_beep/test-config.yaml
new file mode 100644
index 0000000..b550fd4
--- /dev/null
+++ b/tests/channels/pjsip/one_touch_recording/endpoint_beep/test-config.yaml
@@ -0,0 +1,45 @@
+testinfo:
+    summary:     'Tests One Touch Recording beep touch variable.'
+    description: |
+        'Run two SIPp scenarios, one that dials the beep extension which sets
+        TOUCH_MIXMONITOR_BEEP to 5s before Dial and one that does not. Each
+        SIPp scenario enables one touch recording, we expect the beep extension
+        to trigger a periodic hook and the nobeep extension to not.'
+
+test-modules:
+    test-object:
+        config-section: test-object-config
+        typename: 'sipp.SIPpTestCase'
+    modules:
+        -
+            config-section: 'ami-config'
+            typename: 'pluggable_modules.EventActionModule'
+
+test-object-config:
+    memcheck-delay-stop: 7
+    test-iterations:
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'beep.xml', '-i': '127.0.0.1', '-p': '5061'} }
+                - { 'key-args': {'scenario': 'nobeep.xml', '-i': '127.0.0.1', '-p': '5062'} }
+
+ami-config:
+    -
+        ami-events:
+            conditions:
+                match:
+                    Event: 'TestEvent'
+                    Channel: 'Local/waiter at waitstaff-*'
+                    state: 'PERIODIC_HOOK_ENABLED'
+            count: 1
+
+properties:
+    dependencies:
+        - python : 'twisted'
+        - python : 'starpy'
+        - asterisk : 'chan_pjsip'
+        - sipp :
+            version : 'v3.0'
+        - asterisk : 'res_pjsip'
+    tags:
+        - pjsip
diff --git a/tests/channels/pjsip/one_touch_recording/tests.yaml b/tests/channels/pjsip/one_touch_recording/tests.yaml
index 917fefe..883290d 100644
--- a/tests/channels/pjsip/one_touch_recording/tests.yaml
+++ b/tests/channels/pjsip/one_touch_recording/tests.yaml
@@ -1,3 +1,4 @@
 tests:
     - dir: 'features_config'
     - test: 'endpoint_config'
+    - test: 'endpoint_beep'

-- 
To view, visit https://gerrit.asterisk.org/c/testsuite/+/20010
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: testsuite
Gerrit-Branch: certified/18.9
Gerrit-Change-Id: I342fc55b171f82901026eb10353b3c0322151c44
Gerrit-Change-Number: 20010
Gerrit-PatchSet: 1
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-CC: Michael Bradeen <mbradeen at sangoma.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20230320/519f14a5/attachment-0001.html>


More information about the asterisk-code-review mailing list