[asterisk-commits] kharwell: testsuite/asterisk/trunk r4536 - in /asterisk/trunk/tests/channels/...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jan 2 13:11:19 CST 2014


Author: kharwell
Date: Thu Jan  2 13:11:16 2014
New Revision: 4536

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=4536
Log:
res_pjsip: add 'set_var' support on endpoints

Test for adding the 'set_var' option for ast_sip_endpoint(s).  Configures a
couple of channel variables on an endpoint and then has one endpoint call
another.  The called endpoint then checks to make sure the channel variables
are properly set.

(issue ASTERISK-22868)
Reported by: Joshua Colp
Review: https://reviewboard.asterisk.org/r/3097/

Added:
    asterisk/trunk/tests/channels/pjsip/set_var/
    asterisk/trunk/tests/channels/pjsip/set_var/configs/
    asterisk/trunk/tests/channels/pjsip/set_var/configs/ast1/
    asterisk/trunk/tests/channels/pjsip/set_var/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/channels/pjsip/set_var/configs/ast1/pjsip.conf   (with props)
    asterisk/trunk/tests/channels/pjsip/set_var/sipp/
    asterisk/trunk/tests/channels/pjsip/set_var/sipp/invite.xml   (with props)
    asterisk/trunk/tests/channels/pjsip/set_var/sipp/invite_recv.xml   (with props)
    asterisk/trunk/tests/channels/pjsip/set_var/test-config.yaml   (with props)
Modified:
    asterisk/trunk/tests/channels/pjsip/tests.yaml

Added: asterisk/trunk/tests/channels/pjsip/set_var/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/set_var/configs/ast1/extensions.conf?view=auto&rev=4536
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/set_var/configs/ast1/extensions.conf (added)
+++ asterisk/trunk/tests/channels/pjsip/set_var/configs/ast1/extensions.conf Thu Jan  2 13:11:16 2014
@@ -1,0 +1,6 @@
+[general]
+
+[default]
+exten => bob,1,Dial(PJSIP/${EXTEN})
+      same => n,Hangup
+

Propchange: asterisk/trunk/tests/channels/pjsip/set_var/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/pjsip/set_var/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Rev URL

Propchange: asterisk/trunk/tests/channels/pjsip/set_var/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/pjsip/set_var/configs/ast1/pjsip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/set_var/configs/ast1/pjsip.conf?view=auto&rev=4536
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/set_var/configs/ast1/pjsip.conf (added)
+++ asterisk/trunk/tests/channels/pjsip/set_var/configs/ast1/pjsip.conf Thu Jan  2 13:11:16 2014
@@ -1,0 +1,42 @@
+[local]
+type=transport
+protocol=udp
+bind=0.0.0.0
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+[endpoint_t](!)
+type=endpoint
+context=default
+transport=local
+direct_media=no
+disallow=all
+allow=ulaw
+
+[aor_t](!)
+type=aor
+max_contacts=1
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; alice
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+[alice](aor_t)
+contact=sip:alice at localhost:5061
+
+[alice](endpoint_t)
+aors=alice
+set_var=CALLERID(name)=foo
+set_var=CALLERID(num)=foo
+set_var=bar=foo
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; bob
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+[bob](aor_t)
+contact=sip:bob at localhost:5062
+
+[bob](endpoint_t)
+aors=bob
+

Propchange: asterisk/trunk/tests/channels/pjsip/set_var/configs/ast1/pjsip.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/pjsip/set_var/configs/ast1/pjsip.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Rev URL

Propchange: asterisk/trunk/tests/channels/pjsip/set_var/configs/ast1/pjsip.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/pjsip/set_var/sipp/invite.xml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/set_var/sipp/invite.xml?view=auto&rev=4536
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/set_var/sipp/invite.xml (added)
+++ asterisk/trunk/tests/channels/pjsip/set_var/sipp/invite.xml Thu Jan  2 13:11:16 2014
@@ -1,0 +1,71 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Invite with variables">
+	<send retrans="500">
+		<![CDATA[
+                        INVITE sip:bob@[remote_ip]:[remote_port] SIP/2.0
+                        Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+                        From: "alice" <sip:alice@[local_ip]:[local_port]>;tag=[call_number]
+                        To: "bob" <sip:bob@[remote_ip]:[remote_port]>
+                        Call-ID: [call_id]
+                        CSeq: [cseq] INVITE
+                        Contact: sip:alice@[local_ip]:[local_port]
+                        Max-Forwards: 70
+                        Content-Type: application/sdp
+                        Content-Length: [len]
+
+			v=0
+			o=- 1324901698 1324901698 IN IP4 [local_ip]
+			s=-
+			c=IN IP4 [local_ip]
+			t=0 0
+			m=audio 2226 RTP/AVP 0 101
+			a=sendrecv
+			a=rtpmap:0 PCMU/8000
+			a=rtpmap:101 telephone-event/8000
+
+		]]>
+	</send>
+
+	<recv response="100" optional="true" />
+
+	<recv response="180" optional="true" />
+
+	<recv response="200" />
+
+	<send>
+		<![CDATA[
+			ACK sip:bob@[remote_ip]:[remote_port] SIP/2.0
+			Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+			From: <sip:alice@[local_ip]>;tag=[call_number]
+			To: <sip:bob@[remote_ip]:[remote_port]>[peer_tag_param]
+			CSeq: [cseq] ACK
+			Call-ID: [call_id]
+			Contact: <sip:alice@[local_ip]>
+                        Allow: INVITE, ACK, MESSAGE, BYE
+			Max-Forwards: 70
+			Content-Length: 0
+
+		]]>
+	</send>
+
+	<recv request="BYE" crlf="true" />
+
+	<send retrans="500">
+		<![CDATA[
+			SIP/2.0 200 OK
+			[last_Via:]
+			[last_From:]
+			[last_To:];tag=[call_number]
+			[last_Call-ID:]
+			[last_CSeq:]
+			Contact: <sip:alice@[local_ip]:[local_port];transport=[transport]>
+                        Allow: INVITE, ACK, MESSAGE, BYE
+			Content-Type: application/sdp
+			Content-Length: 0
+
+		]]>
+	</send>
+
+</scenario>

Propchange: asterisk/trunk/tests/channels/pjsip/set_var/sipp/invite.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/pjsip/set_var/sipp/invite.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Rev URL

Propchange: asterisk/trunk/tests/channels/pjsip/set_var/sipp/invite.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/pjsip/set_var/sipp/invite_recv.xml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/set_var/sipp/invite_recv.xml?view=auto&rev=4536
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/set_var/sipp/invite_recv.xml (added)
+++ asterisk/trunk/tests/channels/pjsip/set_var/sipp/invite_recv.xml Thu Jan  2 13:11:16 2014
@@ -1,0 +1,79 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Invite with variables">
+  <Global variables="remote_tag" />
+  <recv request="INVITE" crlf="true">
+      <!-- Save the from tag. We'll need it when we send our BYE -->
+      <action>
+          <ereg regexp="\"foo\"\\s+<sip:foo.*(;tag=.*)"
+              search_in="hdr"
+              header="From:"
+              check_it="true"
+              assign_to="1,remote_tag"/>
+      </action>
+  </recv>
+
+  <Reference variables="1" />
+
+  <send>
+    <![CDATA[
+
+      SIP/2.0 180 Ringing
+      [last_Via:]
+      [last_From:]
+      [last_To:];tag=[pid]SIPpTag01[call_number]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <send retrans="500">
+    <![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]>
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=- 1324901698 1324901698 IN IP4 [local_ip]
+      s=-
+      c=IN IP4 [local_ip]
+      t=0 0
+      m=audio 2226 RTP/AVP 0 101
+      a=sendrecv
+      a=rtpmap:0 PCMU/8000
+      a=rtpmap:101 telephone-event/8000
+    ]]>
+  </send>
+
+  <recv request="ACK" rtd="true" crlf="true" />
+
+  <send retrans="500">
+    <![CDATA[
+
+      BYE sip:alice@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: <sip:bob@[local_ip]:[local_port]>;tag=[pid]SIPpTag01[call_number]
+      To: <sip:alice@[remote_ip]:[remote_port]>[$remote_tag]
+      [last_Call-ID:]
+      CSeq: [cseq] BYE
+      Contact: sip:bob@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv response="200" />
+</scenario>

Propchange: asterisk/trunk/tests/channels/pjsip/set_var/sipp/invite_recv.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/pjsip/set_var/sipp/invite_recv.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Rev URL

Propchange: asterisk/trunk/tests/channels/pjsip/set_var/sipp/invite_recv.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/pjsip/set_var/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/set_var/test-config.yaml?view=auto&rev=4536
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/set_var/test-config.yaml (added)
+++ asterisk/trunk/tests/channels/pjsip/set_var/test-config.yaml Thu Jan  2 13:11:16 2014
@@ -1,0 +1,42 @@
+testinfo:
+    summary: 'Test configured channel variables are set.'
+    description: |
+        'Checks to make sure variables configured with set_var on an endpoint
+         are properly set.'
+
+properties:
+    minversion: '12'
+    dependencies:
+        - app : 'sipp'
+        - asterisk : 'res_pjsip'
+    tags:
+        - pjsip
+
+test-modules:
+    test-object:
+        config-section: test-object-config
+        typename: 'sipp.SIPpTestCase'
+    modules:
+        -
+            minversion: '12.0.0'
+            config-section: 'ami-config'
+            typename: 'ami.AMIEventModule'
+
+test-object-config:
+    test-iterations:
+        -
+             scenarios:
+                - { 'key-args': { 'scenario':'invite_recv.xml', '-p':'5062' } }
+                - { 'key-args': { 'scenario':'invite.xml', '-p':'5061' } }
+
+ami-config:
+        -
+            type: 'headermatch'
+            conditions:
+                match:
+                    Event: 'VarSet'
+                    Variable: 'bar'
+            requirements:
+                match:
+                    Value: 'foo'
+            count: 1

Propchange: asterisk/trunk/tests/channels/pjsip/set_var/test-config.yaml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/pjsip/set_var/test-config.yaml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Rev URL

Propchange: asterisk/trunk/tests/channels/pjsip/set_var/test-config.yaml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: asterisk/trunk/tests/channels/pjsip/tests.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/tests.yaml?view=diff&rev=4536&r1=4535&r2=4536
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/tests.yaml (original)
+++ asterisk/trunk/tests/channels/pjsip/tests.yaml Thu Jan  2 13:11:16 2014
@@ -11,3 +11,4 @@
     - dir: 'message'
     - dir: 'dialplan_functions'
     - dir: 'ami'
+    - test: 'set_var'




More information about the asterisk-commits mailing list