[asterisk-commits] file: testsuite/asterisk/trunk r4920 - in /asterisk/trunk/tests/channels/pjsi...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Apr 1 10:17:54 CDT 2014


Author: file
Date: Tue Apr  1 10:17:45 2014
New Revision: 4920

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=4920
Log:
This test covers two different scenarios: reading the headers on an inbound call, and reading/modifying the headers on an outbound call.

- On the inbound call, a standard header is read, as well as a custom header.

- On the outbound call, a standard header is read, as well as a custom header. Custom headers are added to the SIP packet, modified, and removed.

(closes issue ASTERISK-23453)
Reported by: Matt Jordan

Review: https://reviewboard.asterisk.org/r/3392/

Added:
    asterisk/trunk/tests/channels/pjsip/headers/
    asterisk/trunk/tests/channels/pjsip/headers/configs/
    asterisk/trunk/tests/channels/pjsip/headers/configs/ast1/
    asterisk/trunk/tests/channels/pjsip/headers/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/channels/pjsip/headers/configs/ast1/pjsip.conf   (with props)
    asterisk/trunk/tests/channels/pjsip/headers/sipp/
    asterisk/trunk/tests/channels/pjsip/headers/sipp/inbound-headers.xml   (with props)
    asterisk/trunk/tests/channels/pjsip/headers/sipp/outbound-headers.xml   (with props)
    asterisk/trunk/tests/channels/pjsip/headers/sipp/outbound-recv-headers.xml   (with props)
    asterisk/trunk/tests/channels/pjsip/headers/test-config.yaml   (with props)
Modified:
    asterisk/trunk/tests/channels/pjsip/tests.yaml

Added: asterisk/trunk/tests/channels/pjsip/headers/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/headers/configs/ast1/extensions.conf?view=auto&rev=4920
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/headers/configs/ast1/extensions.conf (added)
+++ asterisk/trunk/tests/channels/pjsip/headers/configs/ast1/extensions.conf Tue Apr  1 10:17:45 2014
@@ -1,0 +1,46 @@
+; Tests an inbound call and an outbound, checking headers for each to
+; make sure PJSIP_HEADER does what it is supposed to.
+
+[default]
+
+; The inbound call.
+
+exten => inbound,1,NoOp()
+    same => n,Answer()
+    same => n,Set(to_var=${URIENCODE(${PJSIP_HEADER(read,To)})})
+    same => n,Set(custom1_var=${PJSIP_HEADER(read,Custom-Header)})
+    same => n,Set(custom2_var=${PJSIP_HEADER(read,Custom-Header,2)})
+    same => n,UserEvent(InboundResult,result:${IF($["${to_var}"="%22sut%22%20%3Csip%3Ainbound%40127.0.0.1%3E"]?pass:fail)})
+    same => n,UserEvent(InboundResult,result:${IF($[${custom1_var}=hopethisworks]?pass:fail)})
+    same => n,UserEvent(InboundResult,result:${IF($[${custom2_var}=justtotest:inbound]?pass:fail)})
+    same => n,Echo()
+
+; The outbound call.
+
+exten => outbound-recv,1,NoOp()
+    same => n,Dial(PJSIP/outbound-recv,,B(default^outbound-handler^1))
+
+; The outbound call handler.
+
+exten => outbound-handler,1,NoOp()
+    same => n,Set(PJSIP_HEADER(add,Custom-Header)=adding-custom-outbound-header)
+    same => n,Set(PJSIP_HEADER(add,Custom-Header)=lets-add-another-one)
+    same => n,Set(custom1_var=${PJSIP_HEADER(read,Custom-Header)})
+    same => n,Set(custom2_var=${PJSIP_HEADER(read,Custom-Header,2)})
+    same => n,Set(to_var=${URIENCODE(${PJSIP_HEADER(read,To)})})
+    same => n,UserEvent(OutboundResult,result:${IF($["${to_var}"="%22outbound-recv%22%20%3Csip%3Aoutbound-recv%40127.0.0.1%3E"]?pass:fail)})
+    same => n,UserEvent(OutboundResult,result:${IF($[${custom1_var}=adding-custom-outbound-header]?pass:fail)})
+    same => n,UserEvent(OutboundResult,result:${IF($[${custom2_var}=lets-add-another-one]?pass:fail)})
+    same => n,Set(PJSIP_HEADER(update,Custom-Header)=change-is-good)
+    same => n,Set(PJSIP_HEADER(update,Custom-Header,2)=yet-another-change)
+    same => n,Set(custom1_var=${PJSIP_HEADER(read,Custom-Header)})
+    same => n,Set(custom2_var=${PJSIP_HEADER(read,Custom-Header,2)})
+    same => n,UserEvent(OutboundResult,result:${IF($[${custom1_var}=change-is-good]?pass:fail)})
+    same => n,UserEvent(OutboundResult,result:${IF($[${custom2_var}=yet-another-change]?pass:fail)})
+    same => n,Set(PJSIP_HEADER(remove,Custom-Header,2)=)
+    same => n,Set(custom2_var=${PJSIP_HEADER(read,Custom-Header,2)})
+    same => n,UserEvent(OutboundResult,result:${IF($[${LEN(${custom2_var})}=0]?pass:fail)})
+    same => n,Set(PJSIP_HEADER(remove,Custom-Header)=)
+    same => n,Set(custom1_var=${PJSIP_HEADER(read,Custom-Header)})
+    same => n,UserEvent(OutboundResult,result:${IF($[${LEN(${custom1_var})}=0]?pass:fail)})
+    same => n,Return()

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

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

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

Added: asterisk/trunk/tests/channels/pjsip/headers/configs/ast1/pjsip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/headers/configs/ast1/pjsip.conf?view=auto&rev=4920
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/headers/configs/ast1/pjsip.conf (added)
+++ asterisk/trunk/tests/channels/pjsip/headers/configs/ast1/pjsip.conf Tue Apr  1 10:17:45 2014
@@ -1,0 +1,40 @@
+[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
+
+;; inbound
+
+[inbound](endpoint_t)
+aors=inbound
+
+[inbound](aor_t)
+contact=sip:inbound at localhost:5061
+
+;; outbound
+
+[outbound](endpoint_t)
+aors=outbound
+
+[outbound](aor_t)
+contact=sip:outbound at localhost:5062
+
+;; outbound-two
+
+[outbound-recv](endpoint_t)
+aors=outbound-recv
+
+[outbound-recv](aor_t)
+contact=sip:outbound-recv at localhost:5063

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

Propchange: asterisk/trunk/tests/channels/pjsip/headers/configs/ast1/pjsip.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

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

Added: asterisk/trunk/tests/channels/pjsip/headers/sipp/inbound-headers.xml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/headers/sipp/inbound-headers.xml?view=auto&rev=4920
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/headers/sipp/inbound-headers.xml (added)
+++ asterisk/trunk/tests/channels/pjsip/headers/sipp/inbound-headers.xml Tue Apr  1 10:17:45 2014
@@ -1,0 +1,84 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Send INVITE from an inbound channel">
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: sipp <sip:inbound@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
+      To: sut <sip:[service]@[remote_ip]:[remote_port]>
+      Call-ID: [call_id]
+      Custom-Header: hopethisworks
+      Custom-Header: justtotest:[service]
+      CSeq: 1 INVITE
+      Contact: sip:sipp@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Test
+      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="200" rtd="true">
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      ACK sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: sipp <sip:inbound@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
+      To: sut <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 1 ACK
+      Contact: sip:sipp@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Test
+      Content-Type: application/sdp
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <pause/>
+
+  <send retrans="500">
+    <![CDATA[
+
+      BYE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: sipp <sip:inbound@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
+      To: sut <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 2 BYE
+      Contact: sip:sipp@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv response="200" crlf="true">
+  </recv>
+
+  <!-- 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>

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

Propchange: asterisk/trunk/tests/channels/pjsip/headers/sipp/inbound-headers.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

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

Added: asterisk/trunk/tests/channels/pjsip/headers/sipp/outbound-headers.xml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/headers/sipp/outbound-headers.xml?view=auto&rev=4920
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/headers/sipp/outbound-headers.xml (added)
+++ asterisk/trunk/tests/channels/pjsip/headers/sipp/outbound-headers.xml Tue Apr  1 10:17:45 2014
@@ -1,0 +1,68 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Send INVITE to another endpoint">
+  <send retrans="500">
+    <![CDATA[
+      INVITE sip:outbound-recv@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: outbound <sip:outbound@[local_ip]:[local_port]>;tag=[call_number]
+      To: outbound-recv <sip:outbound-recv@[remote_ip]:[remote_port]>
+      Call-ID: [call_id]
+      CSeq: [cseq] INVITE
+      Contact: sip:outbound@[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:outbound-recv@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: <sip:outbound@[local_ip]>;tag=[call_number]
+      To: <sip:outbound-recv@[remote_ip]:[remote_port]>[peer_tag_param]
+      CSeq: [cseq] ACK
+      Call-ID: [call_id]
+      Contact: <sip:outbound@[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:outbound@[local_ip]:[local_port];transport=[transport]>
+      Allow: INVITE, ACK, MESSAGE, BYE
+      Content-Type: application/sdp
+      Content-Lnegth: 0
+    ]]>
+  </send>
+
+</scenario>

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

Propchange: asterisk/trunk/tests/channels/pjsip/headers/sipp/outbound-headers.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

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

Added: asterisk/trunk/tests/channels/pjsip/headers/sipp/outbound-recv-headers.xml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/headers/sipp/outbound-recv-headers.xml?view=auto&rev=4920
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/headers/sipp/outbound-recv-headers.xml (added)
+++ asterisk/trunk/tests/channels/pjsip/headers/sipp/outbound-recv-headers.xml Tue Apr  1 10:17:45 2014
@@ -1,0 +1,79 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Receive INVITE">
+  <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=".*(;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:outbound@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: <sip:outbound-recv@[local_ip]:[local_port]>;tag=[pid]SIPpTag01[call_number]
+      To: <sip:outbound@[remote_ip]:[remote_port]>[$remote_tag]
+      [last_Call-ID:]
+      CSeq: [cseq] BYE
+      Contact: sip:outbound-recv@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv response="200" />
+</scenario>

Propchange: asterisk/trunk/tests/channels/pjsip/headers/sipp/outbound-recv-headers.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/pjsip/headers/sipp/outbound-recv-headers.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/pjsip/headers/sipp/outbound-recv-headers.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/pjsip/headers/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/headers/test-config.yaml?view=auto&rev=4920
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/headers/test-config.yaml (added)
+++ asterisk/trunk/tests/channels/pjsip/headers/test-config.yaml Tue Apr  1 10:17:45 2014
@@ -1,0 +1,55 @@
+testinfo:
+    summary: 'Tests the different capabilities of PJSIP_HEADER.'
+    description:
+        Checks to see if PJSIP_HEADER can add, remove, get, and update different SIP headers
+        in a PJSIP session.
+
+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:
+                # Inbound checks to see if a header can be read, as well as two custom headers with the same name
+                - { 'key-args': {'scenario': 'inbound-headers.xml', '-i': '127.0.0.1', '-p': '5061', '-d': '3000', '-s': 'inbound'} }
+                # Outbound checks to see if a header can be read, added, updated, and removed
+                - { 'key-args': {'scenario': 'outbound-headers.xml', '-i': '127.0.0.1', '-p': '5062'} }
+                # Outbound-recv-headers receives the call
+                - { 'key-args': {'scenario': 'outbound-recv-headers.xml', '-i': '127.0.0.1', '-p': '5063'} }
+
+ami-config:
+    -
+        type: 'headermatch'
+        conditions:
+            match:
+                Event: 'UserEvent'
+                UserEvent: 'InboundResult'
+        requirements:
+            match:
+                Result: 'pass'
+        count: 3
+    -
+        type: 'headermatch'
+        conditions:
+            match:
+                Event: 'UserEvent'
+                UserEvent: 'OutboundResult'
+        requirements:
+            match:
+                Result: 'pass'
+        count: 7
+
+properties:
+    minversion: '12.0.0'
+    dependencies:
+        - app : 'sipp'
+        - asterisk : 'res_pjsip'
+    tags:
+        - pjsip

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

Propchange: asterisk/trunk/tests/channels/pjsip/headers/test-config.yaml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/pjsip/headers/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=4920&r1=4919&r2=4920
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/tests.yaml (original)
+++ asterisk/trunk/tests/channels/pjsip/tests.yaml Tue Apr  1 10:17:45 2014
@@ -18,4 +18,5 @@
     - test: 'hold_ice'
     - test: 'refer_send_to_vm'
     - test: 'qualify'
+    - test: 'headers'
 




More information about the asterisk-commits mailing list