[Asterisk-code-review] channels/pjsip/dialplan functions/pjsip channel2: Add reques... (testsuite[master])

Richard Mudgett asteriskteam at digium.com
Mon Dec 11 15:21:23 CST 2017


Richard Mudgett has uploaded this change for review. ( https://gerrit.asterisk.org/7514


Change subject: channels/pjsip/dialplan_functions/pjsip_channel2: Add request-uri/dnid test.
......................................................................

channels/pjsip/dialplan_functions/pjsip_channel2: Add request-uri/dnid test.

Test PJSIP channel for CALLERID(dnid) and CHANNEL(pjsip,request_uri)

ASTERISK-27478

Change-Id: Ic3b98ceb212f5310a616d6bf373eac32adb1a395
---
A tests/channels/pjsip/dialplan_functions/pjsip_channel2/configs/ast1/extensions.conf
A tests/channels/pjsip/dialplan_functions/pjsip_channel2/configs/ast1/pjsip.conf
A tests/channels/pjsip/dialplan_functions/pjsip_channel2/sipp/incoming.xml
A tests/channels/pjsip/dialplan_functions/pjsip_channel2/test-config.yaml
M tests/channels/pjsip/dialplan_functions/tests.yaml
5 files changed, 186 insertions(+), 6 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/14/7514/1

diff --git a/tests/channels/pjsip/dialplan_functions/pjsip_channel2/configs/ast1/extensions.conf b/tests/channels/pjsip/dialplan_functions/pjsip_channel2/configs/ast1/extensions.conf
new file mode 100644
index 0000000..9a96461
--- /dev/null
+++ b/tests/channels/pjsip/dialplan_functions/pjsip_channel2/configs/ast1/extensions.conf
@@ -0,0 +1,28 @@
+[globals]
+ruri_user = 1234
+ruri_full = sip:${ruri_user}@127.0.0.1:5060\;transport=UDP\;lr
+
+[default]
+exten = _XXXX,1,NoOp()
+same = n,NoOp(EXTEN is "${EXTEN}")
+same = n,NoOp(CALLERID(dnid) is "${CALLERID(dnid)}")
+same = n,NoOp(CHANNEL(pjsip,request_uri) is "${CHANNEL(pjsip,request_uri)}")
+
+same = n,Answer()
+
+same = n(exten),NoOp()
+same = n,GotoIf($["${ruri_user}"="${EXTEN}"]?dnid)
+same = n,UserEvent(Failure,Result:EXTEN is "${EXTEN}" expected "${ruri_user}")
+
+same = n(dnid),NoOp()
+same = n,GotoIf($["${ruri_user}"="${CALLERID(dnid)}"]?ruri)
+same = n,UserEvent(Failure,Result:CALLERID(dnid) is "${CALLERID(dnid)}" expected "${ruri_user}")
+
+same = n(ruri),NoOp()
+same = n,GotoIf($["${ruri_full}"="${CHANNEL(pjsip,request_uri)}"]?done)
+same = n,UserEvent(Failure,Result:CHANNEL(pjsip,request_uri) is "${CHANNEL(pjsip,request_uri)}" expected "${ruri_full}")
+
+same = n(done),NoOp()
+same = n,UserEvent(Done)
+same = n,Hangup()
+
diff --git a/tests/channels/pjsip/dialplan_functions/pjsip_channel2/configs/ast1/pjsip.conf b/tests/channels/pjsip/dialplan_functions/pjsip_channel2/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..30b28ed
--- /dev/null
+++ b/tests/channels/pjsip/dialplan_functions/pjsip_channel2/configs/ast1/pjsip.conf
@@ -0,0 +1,9 @@
+[transport-udp]
+type = transport
+protocol = udp
+bind = 0.0.0.0
+
+[alice]
+type = endpoint
+context = default
+allow = !all,ulaw
diff --git a/tests/channels/pjsip/dialplan_functions/pjsip_channel2/sipp/incoming.xml b/tests/channels/pjsip/dialplan_functions/pjsip_channel2/sipp/incoming.xml
new file mode 100644
index 0000000..671741f
--- /dev/null
+++ b/tests/channels/pjsip/dialplan_functions/pjsip_channel2/sipp/incoming.xml
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="INVITE with different Request-URI and To URI's">
+	<send retrans="500">
+		<![CDATA[
+			INVITE sip:1234@[remote_ip]:[remote_port];transport=[transport];lr SIP/2.0
+			Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+			From: [service] <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
+			To: test <sip:4321@[remote_ip]:[remote_port]>
+			Call-ID: [call_id]
+			CSeq: 1 INVITE
+			Contact: <sip:[service]@[local_ip]:[local_port];transport=[transport]>
+			Max-Forwards: 70
+			Subject: 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
+			a=rtpmap:0 PCMU/8000
+		]]>
+	</send>
+
+	<recv response="100" optional="true">
+	</recv>
+
+	<recv response="180" optional="true">
+	</recv>
+
+	<recv response="183" optional="true">
+	</recv>
+
+	<recv response="200" rtd="true">
+	</recv>
+
+	<send>
+		<![CDATA[
+			ACK sip:1234@[remote_ip]:[remote_port];transport=[transport];lr SIP/2.0
+			Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+			From: [service] <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
+			To: test <sip:4321@[remote_ip]:[remote_port]>[peer_tag_param]
+			Call-ID: [call_id]
+			CSeq: 1 ACK
+			Contact: <sip:[service]@[local_ip]:[local_port];transport=[transport]>
+			Max-Forwards: 70
+			Subject: Test
+			Content-Length: 0
+		]]>
+	</send>
+
+	<recv request="BYE">
+	</recv>
+
+	<send>
+		<![CDATA[
+			SIP/2.0 200 OK
+			[last_Via:]
+			[last_From:]
+			[last_To:]
+			[last_Call-ID:]
+			[last_CSeq:]
+			Contact: <sip:[service]@[local_ip]:[local_port];transport=[transport]>
+			Content-Length: 0
+		]]>
+	</send>
+
+	<!-- definition of the response time repartition table (unit is ms)   -->
+	<ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
+
+	<!-- definition of the call length repartition table (unit is ms)     -->
+	<CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
+
+</scenario>
+
diff --git a/tests/channels/pjsip/dialplan_functions/pjsip_channel2/test-config.yaml b/tests/channels/pjsip/dialplan_functions/pjsip_channel2/test-config.yaml
new file mode 100644
index 0000000..bc1a537
--- /dev/null
+++ b/tests/channels/pjsip/dialplan_functions/pjsip_channel2/test-config.yaml
@@ -0,0 +1,62 @@
+testinfo:
+    summary:    'Test PJSIP channel for CALLERID(dnid) and CHANNEL(pjsip,request_uri)'
+    description: |
+        'Run a SIPp scenario that places a call from endpoint alice to check
+        that the CALLERID(dnid) and CHANNEL(pjsip,request_uri) are set to
+        expected values.'
+
+test-modules:
+    test-object:
+        config-section: test-object-config
+        typename: 'sipp.SIPpTestCase'
+    modules:
+        -
+            config-section: ami-config
+            typename: 'ami.AMIEventModule'
+
+test-object-config:
+    test-iterations:
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'incoming.xml', '-i': '127.0.0.1', '-p': '5061', '-s': 'alice'} }
+
+ami-config:
+    -
+        type: 'headermatch'
+        id: '0'
+        conditions:
+            match:
+                Event: 'Newchannel'
+                Channel: 'PJSIP/alice-.*'
+        count: '1'
+    -
+        type: 'headermatch'
+        id: '0'
+        conditions:
+            match:
+                Event: 'UserEvent'
+                Channel: 'PJSIP/alice-.*'
+                UserEvent: 'Failure'
+        count: '0'
+    -
+        type: 'headermatch'
+        id: '0'
+        conditions:
+            match:
+                Event: 'UserEvent'
+                Channel: 'PJSIP/alice-.*'
+                UserEvent: 'Done'
+        count: '1'
+
+properties:
+    minversion: ['13.19.0', '15.2.0']
+    dependencies:
+        - sipp :
+            version : 'v3.0'
+        - asterisk : 'app_dial'
+        - asterisk : 'app_userevent'
+        - asterisk : 'func_callerid'
+        - asterisk : 'func_channel'
+        - asterisk : 'res_pjsip'
+    tags:
+        - pjsip
diff --git a/tests/channels/pjsip/dialplan_functions/tests.yaml b/tests/channels/pjsip/dialplan_functions/tests.yaml
index f653aa8..a2e26a0 100644
--- a/tests/channels/pjsip/dialplan_functions/tests.yaml
+++ b/tests/channels/pjsip/dialplan_functions/tests.yaml
@@ -1,10 +1,11 @@
 # Enter tests here in the order they should be considered for execution:
 tests:
-    - test: 'pjsip_channel'
-    - test: 'pjsip_endpoint'
-    - test: 'pjsip_aor'
-    - test: 'pjsip_contact'
-    - test: 'pjsip_session_refresh'
     - test: 'chan_is_avail'
-    - test: 'pjsip_header'
+    - test: 'pjsip_aor'
+    - test: 'pjsip_channel'
+    - test: 'pjsip_channel2'
+    - test: 'pjsip_contact'
     - test: 'pjsip_dtmfmode'
+    - test: 'pjsip_endpoint'
+    - test: 'pjsip_header'
+    - test: 'pjsip_session_refresh'

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

Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic3b98ceb212f5310a616d6bf373eac32adb1a395
Gerrit-Change-Number: 7514
Gerrit-PatchSet: 1
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20171211/1499fd9c/attachment-0001.html>


More information about the asterisk-code-review mailing list