[asterisk-commits] jbigelow: testsuite/asterisk/trunk r4964 - in /asterisk/trunk: lib/python/ast...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Apr 16 17:34:49 CDT 2014


Author: jbigelow
Date: Wed Apr 16 17:34:38 2014
New Revision: 4964

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=4964
Log:
Add nominal caller initiated blind transfer tests using PJSIP.

This adds tests that cover nominal caller initiated blind transfers using
PJSIP. It also allows configuring a specific PJSUA transport for a PJSUA
account to use.

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

(closes issue ASTERISK-23446)


Added:
    asterisk/trunk/tests/channels/pjsip/transfers/
    asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/
    asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_direct_media/
    asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_direct_media/configs/
    asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_direct_media/configs/ast1/
    asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_direct_media/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_direct_media/configs/ast1/pjsip.conf   (with props)
    asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_direct_media/sipp/
    asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_direct_media/sipp/alice.xml   (with props)
    asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_direct_media/sipp/bob.xml   (with props)
    asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_direct_media/sipp/charlie.xml   (with props)
    asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_direct_media/test-config.yaml   (with props)
    asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_refer_only/
    asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_refer_only/configs/
    asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_refer_only/configs/ast1/
    asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_refer_only/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_refer_only/configs/ast1/pjsip.conf   (with props)
    asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_refer_only/test-config.yaml   (with props)
    asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_refer_only/transfer.py   (with props)
    asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_with_hold/
    asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_with_hold/configs/
    asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_with_hold/configs/ast1/
    asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_with_hold/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_with_hold/configs/ast1/pjsip.conf   (with props)
    asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_with_hold/sipp/
    asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_with_hold/sipp/alice.xml   (with props)
    asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_with_hold/sipp/bob.xml   (with props)
    asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_with_hold/sipp/charlie.xml   (with props)
    asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_with_hold/test-config.yaml   (with props)
    asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/tests.yaml   (with props)
    asterisk/trunk/tests/channels/pjsip/transfers/tests.yaml   (with props)
Modified:
    asterisk/trunk/lib/python/asterisk/pjsua_mod.py
    asterisk/trunk/tests/channels/pjsip/tests.yaml

Modified: asterisk/trunk/lib/python/asterisk/pjsua_mod.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/lib/python/asterisk/pjsua_mod.py?view=diff&rev=4964&r1=4963&r2=4964
==============================================================================
--- asterisk/trunk/lib/python/asterisk/pjsua_mod.py (original)
+++ asterisk/trunk/lib/python/asterisk/pjsua_mod.py Wed Apr 16 17:34:38 2014
@@ -67,9 +67,10 @@
     This object contains a reference to a pj.Account and a dictionary of the
     account's buddies, keyed by buddy name
     """
-    def __init__(self, account):
+    def __init__(self, account, pj_lib):
         self.account = account
         self.buddies = {}
+        self.pj_lib = pj_lib
 
     def add_buddies(self, buddy_cfg):
         """
@@ -214,10 +215,16 @@
         pj_acct_cfg = pj.AccountConfig(domain, username, password, name)
         if acct_cfg.get('mwi-subscribe'):
             pj_acct_cfg.mwi_enabled = 1
+        if acct_cfg.get('transport'):
+            acct_transport = acct_cfg.get('transport')
+            if acct_transport in self.pj_transports:
+                transport_id = self.pj_transports[acct_transport]._id
+                pj_acct_cfg.transport_id = transport_id
 
         LOGGER.info("Creating PJSUA account %s@%s" % (username, domain))
         account = PJsuaAccount(self.lib.create_account(pj_acct_cfg, False,
-                                                       RegDetector(self)))
+                                                       RegDetector(self)),
+                                                       self.lib)
         account.add_buddies(acct_cfg.get('buddies', []))
         return account
 

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=4964&r1=4963&r2=4964
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/tests.yaml (original)
+++ asterisk/trunk/tests/channels/pjsip/tests.yaml Wed Apr 16 17:34:38 2014
@@ -19,4 +19,5 @@
     - test: 'refer_send_to_vm'
     - test: 'qualify'
     - test: 'headers'
+    - dir: 'transfers'
 

Added: asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_direct_media/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_direct_media/configs/ast1/extensions.conf?view=auto&rev=4964
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_direct_media/configs/ast1/extensions.conf (added)
+++ asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_direct_media/configs/ast1/extensions.conf Wed Apr 16 17:34:38 2014
@@ -1,0 +1,25 @@
+[general]
+
+[globals]
+
+[transfertest]
+exten => bob,1,NoOp()
+	same => n,Dial(PJSIP/bob)
+	same => n,Hangup()
+
+exten => bob_two,1,NoOp()
+	same => n,Set(TRANSFER_CONTEXT=other)
+	same => n,Dial(PJSIP/bob)
+	same => n,Hangup()
+
+exten => charlie,1,NoOp()
+	same => n,Dial(PJSIP/charlie)
+	same => n,Hangup()
+
+[other]
+; Second test iteration should execute
+exten => charlie,1,NoOp()
+        same => n,Dial(PJSIP/charlie)
+	same => n,Hangup()
+
+

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

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

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

Added: asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_direct_media/configs/ast1/pjsip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_direct_media/configs/ast1/pjsip.conf?view=auto&rev=4964
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_direct_media/configs/ast1/pjsip.conf (added)
+++ asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_direct_media/configs/ast1/pjsip.conf Wed Apr 16 17:34:38 2014
@@ -1,0 +1,61 @@
+[global]
+type=global
+debug=yes
+
+[local-transport]
+type=transport
+bind=127.0.0.1
+protocol=udp
+
+[alice]
+type=endpoint
+allow=ulaw
+context=transfertest
+direct_media=yes
+media_address=127.0.0.1
+aors=alice
+
+[alice]
+type=aor
+max_contacts=1
+contact=sip:alice at 127.0.0.2:5060\;transport=udp
+
+[bob]
+type=endpoint
+allow=ulaw
+context=transfertest
+direct_media=yes
+media_address=127.0.0.1
+aors=bob
+
+[bob]
+type=aor
+max_contacts=1
+contact=sip:bob at 127.0.0.3:5060\;transport=udp
+
+[bob_two]
+type=endpoint
+allow=ulaw
+context=transfertest
+direct_media=yes
+media_address=127.0.0.1
+aors=bob_two
+
+[bob_two]
+type=aor
+max_contacts=1
+contact=sip:bob_two at 127.0.0.3:5060\;transport=udp
+
+[charlie]
+type=endpoint
+allow=ulaw
+context=transfertest
+direct_media=yes
+media_address=127.0.0.1
+aors=charlie
+
+[charlie]
+type=aor
+max_contacts=1
+contact=sip:charlie at 127.0.0.4:5060\;transport=udp
+

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

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

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

Added: asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_direct_media/sipp/alice.xml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_direct_media/sipp/alice.xml?view=auto&rev=4964
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_direct_media/sipp/alice.xml (added)
+++ asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_direct_media/sipp/alice.xml Wed Apr 16 17:34:38 2014
@@ -1,0 +1,229 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+
+<scenario name="Send Call">
+
+  <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: <sip:alice@[local_ip]:[local_port]>;tag=[pid]SIPpTag[call_number]
+      To: <sip:[service]@[remote_ip]:[remote_port]>
+      Call-ID: [call_id]
+      CSeq: [cseq] INVITE
+      Contact: <sip:alice@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=- 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+      s=-
+      c=IN IP[media_ip_type] [media_ip]
+      t=0 0
+      m=audio [custom_media_port] RTP/AVP 0
+      a=rtpmap:0 PCMU/8000
+
+    ]]>
+  </send>
+
+  <recv response="100" optional="true" />
+  <recv response="180" optional="true" />
+  <recv response="183" optional="true" />
+
+  <recv response="200" rtd="true">
+    <!-- Save the To tag. We'll need it when we send REFER -->
+    <action>
+      <ereg regexp="(;tag=.*)"
+          header="To:"
+          search_in="hdr"
+          check_it="true"
+          assign_to="remote_tag"/>
+    </action>
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      ACK sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+      [last_Via:]
+      [last_From:]
+      [last_To:]
+      Call-ID: [call_id]
+      CSeq: [cseq] ACK
+      Contact: <sip:alice@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <!-- Send audio -->
+  <nop>
+    <action>
+      <exec rtp_stream="lib/python/asterisk/audio.ulaw,3,0"/>
+    </action>
+  </nop>
+
+  <!-- Wait for re-invite to setup RTP directly between alice and bob -->
+  <recv request="INVITE" crlf="true"/>
+
+  <send retrans="500">
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To:]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:alice@[local_ip]:[local_port];transport=[transport]>
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+      s=-
+      c=IN IP[media_ip_type] [media_ip]
+      t=0 0
+      m=audio [custom_media_port] RTP/AVP 0
+      a=rtpmap:0 PCMU/8000
+
+    ]]>
+  </send>
+
+  <recv request="ACK"
+    rtd="true"
+    crlf="true">
+  </recv>
+
+  <pause milliseconds="4000" />
+
+  <!-- Blind transfer bob to charlie -->
+  <send retrans="500">
+    <![CDATA[
+
+      REFER sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+      [last_Via:]
+      From: <sip:alice@[local_ip]:[local_port]>;tag=[pid]SIPpTag[call_number]
+      To: <sip:[service]@[remote_ip]:[remote_port]>[$remote_tag]
+      Call-ID: [call_id]
+      CSeq: 2 REFER
+      Contact: sip:alice@[local_ip]:[local_port];transport=[transport]
+      Max-Forwards: 70
+      Subject: Performance Test
+      Refer-To: sip:charlie@[remote_ip]:[remote_port];user=phone
+      Referred-By: sip:alice@[local_ip]:[local_port]
+      Content-Length: 0
+
+    ]]>
+
+  </send>
+
+  <recv response="202" rtd="true">
+  </recv>
+
+  <!-- We should receive a NOTIFY from Asterisk with a 100 trying sipfrag -->
+  <recv request="NOTIFY" crlf="true">
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To:]
+      [last_Call-ID:]
+      [last_CSeq:]
+      [last_Event:]
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Content-Length: 0
+    ]]>
+  </send>
+
+  <!--
+       Wait for re-invite for tearing down direct media between alice and bob
+       due to transfering bob to charlie.
+  -->
+  <recv request="INVITE" crlf="true"/>
+
+  <send retrans="500">
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To:]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:alice@[local_ip]:[local_port];transport=[transport]>
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+      s=-
+      c=IN IP[media_ip_type] [media_ip]
+      t=0 0
+      m=audio [custom_media_port] RTP/AVP 0
+      a=rtpmap:0 PCMU/8000
+
+    ]]>
+  </send>
+
+  <recv request="ACK"
+    rtd="true"
+    crlf="true">
+  </recv>
+
+  <!-- We should receive a NOTIFY from Asterisk with a '200 OK' sipfrag -->
+  <recv request="NOTIFY" crlf="true">
+    <!-- Check if 'SIP/2.0 200 OK' is in the body -->
+    <action>
+       <ereg regexp="(SIP/2.0 200 OK)"
+          search_in="msg"
+          check_it="true"
+          assign_to="sip_frag_ok"/>
+    </action>
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To:]
+      [last_Call-ID:]
+      [last_CSeq:]
+      [last_Event:]
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Content-Length: 0
+    ]]>
+  </send>
+
+  <!-- Transfer should have successfully occurred so now we need to hang up -->
+  <send retrans="500">
+    <![CDATA[
+
+      BYE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+      [last_Via:]
+      From: <sip:alice@[local_ip]:[local_port]>;tag=[pid]SIPpTag[call_number]
+      To: <sip:[service]@[remote_ip]:[remote_port]>[$remote_tag]
+      Call-ID: [call_id]
+      CSeq: [cseq] BYE
+      Contact: sip:alice@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv response="200" crlf="true">
+  </recv>
+
+  <Reference variables="sip_frag_ok" />
+
+</scenario>

Propchange: asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_direct_media/sipp/alice.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_direct_media/sipp/alice.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_direct_media/sipp/alice.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_direct_media/sipp/bob.xml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_direct_media/sipp/bob.xml?view=auto&rev=4964
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_direct_media/sipp/bob.xml (added)
+++ asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_direct_media/sipp/bob.xml Wed Apr 16 17:34:38 2014
@@ -1,0 +1,179 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Basic UAS responder">
+
+  <recv request="INVITE" crlf="true" />
+
+  <send>
+    <![CDATA[
+
+      SIP/2.0 180 Ringing
+      [last_Via:]
+      [last_From:]
+      [last_To:];tag=[pid]SIPpTag[call_number]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:bob@[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]SIPpTag[call_number]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:bob@[local_ip]:[local_port];transport=[transport]>
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+      s=-
+      c=IN IP[media_ip_type] [media_ip]
+      t=0 0
+      m=audio [custom_media_port] RTP/AVP 0
+      a=rtpmap:0 PCMU/8000
+
+    ]]>
+  </send>
+
+  <recv request="ACK"
+    rtd="true"
+    crlf="true">
+  </recv>
+
+  <!-- Send audio -->
+  <nop>
+    <action>
+      <exec rtp_stream="lib/python/asterisk/audio.ulaw,3,0"/>
+    </action>
+  </nop>
+
+  <!-- Wait for re-invite to setup RTP directly between alice and bob -->
+  <recv request="INVITE" crlf="true"/>
+
+  <send retrans="500">
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To:]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:bob@[local_ip]:[local_port];transport=[transport]>
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+      s=-
+      c=IN IP[media_ip_type] [media_ip]
+      t=0 0
+      m=audio [custom_media_port] RTP/AVP 0
+      a=rtpmap:0 PCMU/8000
+
+    ]]>
+  </send>
+
+  <recv request="ACK"
+        rtd="true"
+        crlf="true">
+  </recv>
+
+  <!--
+       Wait for re-invite for tearing down direct media between alice and bob
+       due to transfering bob to charlie.
+  -->
+  <recv request="INVITE" crlf="true"/>
+
+  <send retrans="500">
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To:]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:bob@[local_ip]:[local_port];transport=[transport]>
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+      s=-
+      c=IN IP[media_ip_type] [media_ip]
+      t=0 0
+      m=audio [custom_media_port] RTP/AVP 0
+      a=rtpmap:0 PCMU/8000
+
+    ]]>
+  </send>
+
+  <recv request="ACK"
+    rtd="true"
+    crlf="true">
+  </recv>
+
+  <!-- Wait for re-invite to setup RTP directly between bob and charlie -->
+  <recv request="INVITE" crlf="true"/>
+
+  <send retrans="500">
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To:]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:bob@[local_ip]:[local_port];transport=[transport]>
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+      s=-
+      c=IN IP[media_ip_type] [media_ip]
+      t=0 0
+      m=audio [custom_media_port] RTP/AVP 0
+      a=rtpmap:0 PCMU/8000
+
+    ]]>
+  </send>
+
+  <recv request="ACK"
+        rtd="true"
+        crlf="true">
+  </recv>
+
+  <recv request="BYE" />
+
+  <send>
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To:]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
+
+  <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
+
+</scenario>
+

Propchange: asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_direct_media/sipp/bob.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_direct_media/sipp/bob.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_direct_media/sipp/bob.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_direct_media/sipp/charlie.xml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_direct_media/sipp/charlie.xml?view=auto&rev=4964
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_direct_media/sipp/charlie.xml (added)
+++ asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_direct_media/sipp/charlie.xml Wed Apr 16 17:34:38 2014
@@ -1,0 +1,128 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Basic UAS responder">
+
+  <recv request="INVITE" crlf="true">
+      <action>
+          <!-- Save the From tag. We'll need it when we send our BYE -->
+          <ereg regexp="(;tag=.*)"
+              header="From:"
+              search_in="hdr"
+              check_it="true"
+              assign_to="remote_tag"/>
+          <!-- Save the From user portion of URI. We'll need it when we send our BYE -->
+          <ereg regexp="(sip:bob|sip:bob_two)"
+              header="From:"
+              search_in="hdr"
+              check_it="true"
+              assign_to="remote_user"/>
+          <!-- Check the Referred-By header. -->
+          <ereg regexp="sip:alice at 127.0.0.2:5060"
+              header="Referred-By"
+              search_in="hdr"
+              check_it="true"
+              assign_to="referred_by"/>
+      </action>
+  </recv>
+
+  <!-- Answer inbound call -->
+  <send retrans="500">
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To:];tag=[pid]SIPpTag[call_number]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:charlie@[local_ip]:[local_port];transport=[transport]>
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+      s=-
+      c=IN IP[media_ip_type] [media_ip]
+      t=0 0
+      m=audio [custom_media_port] RTP/AVP 0
+      a=rtpmap:0 PCMU/8000
+
+    ]]>
+  </send>
+
+  <recv request="ACK"
+        rtd="true"
+        crlf="true">
+  </recv>
+
+  <!-- Send audio -->
+  <nop>
+    <action>
+      <exec rtp_stream="lib/python/asterisk/audio.ulaw,3,0"/>
+    </action>
+  </nop>
+
+  <!-- Wait for re-invite to setup RTP directly between bob and charlie -->
+  <recv request="INVITE" crlf="true" />
+
+  <send retrans="500">
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To:]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:charlie@[local_ip]:[local_port];transport=[transport]>
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+      s=-
+      c=IN IP[media_ip_type] [media_ip]
+      t=0 0
+      m=audio [custom_media_port] RTP/AVP 0
+      a=rtpmap:0 PCMU/8000
+
+    ]]>
+  </send>
+
+  <recv request="ACK"
+    rtd="true"
+    crlf="true">
+  </recv>
+
+  <!-- Allow 5s of audio to be sent to bob -->
+  <pause milliseconds="5000" />
+
+  <send retrans="500">
+    <![CDATA[
+
+      BYE [$remote_user]@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: <sip:charlie@[local_ip]:[local_port]>;tag=[pid]SIPpTag[call_number]
+      To: <[$remote_user]@[remote_ip]:[remote_port]>[$remote_tag]
+      Call-ID: [call_id]
+      CSeq: [cseq] BYE
+      Contact: sip:charlie@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance 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"/>
+
+  <Reference variables="referred_by" />
+
+</scenario>
+

Propchange: asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_direct_media/sipp/charlie.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_direct_media/sipp/charlie.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_direct_media/sipp/charlie.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_direct_media/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_direct_media/test-config.yaml?view=auto&rev=4964
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_direct_media/test-config.yaml (added)
+++ asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_direct_media/test-config.yaml Wed Apr 16 17:34:38 2014
@@ -1,0 +1,119 @@
+testinfo:
+    summary:     'Test SIP Blind Transfer (caller transfers with direct media)'
+    description: |
+        'This test verifies a SIP Blind transfer with direct media occurring
+        between each endpoint. This uses a SIPp instance for each of "Alice",
+        "Bob", and "Charlie". Alice calls Bob through Asterisk and direct media
+        is set up between them. Alice then blind transfers Bob to Charlie which
+        causes the direct media between Alice and Bob to be torn down. After
+        Asterisk notifies Alice that Charlie answered, Alice hangs up. Direct
+        media is set up between Bob and Charlie. Charlie hangs up the call. A
+        second iteration is performed to ensure correct behavior when the
+        TRANSFER_CONTEXT channel variable is used. This test ensures that the
+        transfer was successful and that direct media occurs between the
+        endpoints. It also ensures various channel variables are set
+        appropriately.'
+
+properties:
+    minversion: '12.0.0'
+    dependencies:
+        - python : 'twisted'
+        - python : 'starpy'
+        - asterisk : 'res_pjsip'
+        - sipp :
+            version : 'v3.4.1'
+    tags:
+        - pjsip
+        - transfer
+
+test-modules:
+    add-test-to-search-path: 'True'
+    test-object:
+        config-section: test-case-config
+        typename: 'sipp.SIPpTestCase'
+    modules:
+        -
+            config-section: 'ami-config'
+            typename: 'ami.AMIEventModule'
+
+test-case-config:
+    connect-ami: 'True'
+    fail-on-any: False
+    test-iterations:
+        # First iteration
+        -
+            scenarios:
+                # Charlie receives transfered call and sends audio to Bob.
+                - { 'key-args': {'scenario': 'charlie.xml', '-p': '5060', '-i': '127.0.0.4', '-timeout': '20s', '-min_rtp_port': '6004', '-max_rtp_port': '6008', '-mi': '127.0.0.4'},
+                    'ordered-args': ['-timeout_error', '-key', 'custom_media_port', '6004'] }
+                # Bob receives call from Alice and sends audio.
+                - { 'key-args': {'scenario': 'bob.xml', '-p': '5060', '-i': '127.0.0.3', '-s': 'alice', '-timeout': '20s', '-min_rtp_port': '6004', '-max_rtp_port': '6008', '-mi': '127.0.0.3'},
+                    'ordered-args': ['-timeout_error', '-key', 'custom_media_port', '6004'] }
+                # Alice calls Bob and sends audio. Alice then attempts to blind transfer Bob to Charlie.
+                - { 'key-args': {'scenario': 'alice.xml', '-p': '5060', '-i': '127.0.0.2', '-s': 'bob', '-timeout': '20s', '-min_rtp_port': '6004', '-max_rtp_port': '6008', '-mi': '127.0.0.2'},
+                    'ordered-args': ['-timeout_error', '-key', 'custom_media_port', '6004'] }
+        # Second iteration
+        -
+            scenarios:
+                # Charlie receives transfered call and sends audio to Bob.
+                - { 'key-args': {'scenario': 'charlie.xml', '-p': '5060', '-i': '127.0.0.4', '-timeout': '20s', '-min_rtp_port': '6004', '-max_rtp_port': '6008', '-mi': '127.0.0.4'},
+                    'ordered-args': ['-timeout_error', '-key', 'custom_media_port', '6004'] }
+                # Bob receives call from Alice and sends audio.
+                - { 'key-args': {'scenario': 'bob.xml', '-p': '5060', '-i': '127.0.0.3', '-s': 'alice', '-timeout': '20s', '-min_rtp_port': '6004', '-max_rtp_port': '6008', '-mi': '127.0.0.3'},
+                    'ordered-args': ['-timeout_error', '-key', 'custom_media_port', '6004'] }
+                # Alice calls Bob and sends audio. Alice then attempts to blind transfer Bob to Charlie.
+                - { 'key-args': {'scenario': 'alice.xml', '-p': '5060', '-i': '127.0.0.2', '-s': 'bob_two', '-timeout': '20s', '-min_rtp_port': '6004', '-max_rtp_port': '6008', '-mi': '127.0.0.2'},
+                    'ordered-args': ['-timeout_error', '-key', 'custom_media_port', '6004'] }
+
+ami-config:
+        -
+            type: 'headermatch'
+            conditions:
+                match:
+                    Event: 'VarSet'
+                    Variable: 'SIPTRANSFER'
+                    Value: 'yes'
+            count: 2
+        -
+            type: 'headermatch'
+            conditions:
+                match:
+                    Event: 'VarSet'
+                    Channel: 'PJSIP/bob-.{8}'
+                    Variable: 'SIPREFERRINGCONTEXT'
+                    Value: 'transfertest'
+            count: 1
+        -
+            type: 'headermatch'
+            conditions:
+                match:
+                    Event: 'VarSet'
+                    Channel: 'PJSIP/bob-.{8}'
+                    Variable: 'SIPREFERRINGCONTEXT'
+                    Value: 'other'
+            count: 1
+        -
+            type: 'headermatch'
+            conditions:
+                match:
+                    Event: 'VarSet'
+                    Channel: 'PJSIP/bob-.{8}'
+                    Variable: 'SIPREFERREDBYHDR'
+                    Value: 'sip:alice at 127.0.0.2:5060'
+            count: 2
+        -
+            type: 'headermatch'
+            conditions:
+                match:
+                    Event: 'VarSet'
+                    Variable: 'SIPREFERTOHDR'
+                    Value: 'sip:charlie at 127.0.0.1'
+            count: 2
+        -
+            type: 'headermatch'
+            conditions:
+                match:
+                    Event: 'BlindTransfer'
+                    TransfererChannel: 'PJSIP/alice-.{8}'
+            count: 2
+

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

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

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

Added: asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_refer_only/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_refer_only/configs/ast1/extensions.conf?view=auto&rev=4964
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_refer_only/configs/ast1/extensions.conf (added)
+++ asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_refer_only/configs/ast1/extensions.conf Wed Apr 16 17:34:38 2014
@@ -1,0 +1,25 @@
+[general]
+
+[globals]
+
+[transfertest]
+exten => bob,1,NoOp()
+	same => n,Dial(PJSIP/bob)
+	same => n,Hangup()
+
+exten => bob_two,1,NoOp()
+	same => n,Set(TRANSFER_CONTEXT=other)
+	same => n,Dial(PJSIP/bob)
+	same => n,Hangup()
+
+exten => charlie,1,NoOp()
+	same => n,Dial(PJSIP/charlie)
+	same => n,Hangup()
+
+[other]
+; Second test iteration should execute
+exten => charlie,1,NoOp()
+        same => n,Dial(PJSIP/charlie)
+	same => n,Hangup()
+
+

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

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

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

Added: asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_refer_only/configs/ast1/pjsip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_refer_only/configs/ast1/pjsip.conf?view=auto&rev=4964
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_refer_only/configs/ast1/pjsip.conf (added)
+++ asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_refer_only/configs/ast1/pjsip.conf Wed Apr 16 17:34:38 2014
@@ -1,0 +1,45 @@
+[global]
+type=global
+debug=yes
+
+[local-transport]
+type=transport
+bind=127.0.0.1
+protocol=udp
+
+[alice]
+type=endpoint
+allow=g722,ulaw,alaw
+context=transfertest
+direct_media=no
+media_address=127.0.0.1
+aors=alice
+
+[alice]
+type=aor
+max_contacts=1
+
+[bob]
+type=endpoint
+allow=g722,ulaw,alaw
+context=transfertest
+direct_media=no
+media_address=127.0.0.1
+aors=bob
+
+[bob]
+type=aor
+max_contacts=1
+
+[charlie]
+type=endpoint
+allow=g722,ulaw,alaw
+context=transfertest
+direct_media=no
+media_address=127.0.0.1
+aors=charlie
+
+[charlie]
+type=aor
+max_contacts=1
+

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

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

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

Added: asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_refer_only/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_refer_only/test-config.yaml?view=auto&rev=4964
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_refer_only/test-config.yaml (added)
+++ asterisk/trunk/tests/channels/pjsip/transfers/blind_transfer/caller_refer_only/test-config.yaml Wed Apr 16 17:34:38 2014
@@ -1,0 +1,125 @@
+testinfo:
+    summary:     'Test SIP Blind Transfer (caller transfers with only REFER)'
+    description: |
+        'This test verifies a basic SIP Blind transfer where no re-INVITE is
+        sent to put an endpoint on hold. This uses a SIPp instance for each of
+        "Alice", "Bob", and "Charlie". Alice calls Bob through Asterisk. Alice
+        then blind transfers Bob to Charlie. After Asterisk notifies Alice that
+        Charlie answered, Alice hangs up. Charlie hangs up the call with Bob. A
+        second iteration is performed to ensure correct behavior when the
+        TRANSFER_CONTEXT channel variable is used. This test ensures that the
+        transfer was successful and that various channel variables are set
+        appropriately.'
+
+properties:
+    minversion: '12.0.0'
+    dependencies:
+        - python : 'twisted'
+        - python : 'starpy'
+        - python: 'pjsua'
+        - asterisk : 'res_pjsip'
+    tags:
+        - pjsip
+        - transfer
+
+test-modules:
+    add-test-to-search-path: 'True'
+    test-object:
+        config-section: test-case-config
+        typename: 'test_case.TestCaseModule'
+    modules:
+        -
+            config-section: 'pjsua-config'
+            typename: 'pjsua_mod.PJsua'
+        -
+            config-section: 'ami-config'
+            typename: 'ami.AMIEventModule'
+
+test-case-config:
+    connect-ami: 'True'
+
+pjsua-config:
+    callback_module: 'transfer'
+    callback_method: 'transfer'
+    transports:
+        -
+            name: 'local-ipv4-1'
+            bind: '127.0.0.1'
+            bindport: '5061'
+        -
+            name: 'local-ipv4-2'
+            bind: '127.0.0.1'
+            bindport: '5062'
+        -
+            name: 'local-ipv4-3'
+            bind: '127.0.0.1'
+            bindport: '5063'
+    accounts:
+        -
+            name: 'alice'
+            username: 'alice'
+            domain: '127.0.0.1'
+            transport: 'local-ipv4-1'
+        -
+            name: 'bob'
+            username: 'bob'
+            domain: '127.0.0.1'
+            transport: 'local-ipv4-2'

[... 1045 lines stripped ...]



More information about the asterisk-commits mailing list