[asterisk-commits] pjsip: Add test for outbound registration with line support. (testsuite[master])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Apr 30 10:53:50 CDT 2015


Matt Jordan has submitted this change and it was merged.

Change subject: pjsip: Add test for outbound registration with line support.
......................................................................


pjsip: Add test for outbound registration with line support.

This test sends an outbound registration to a SIPP scenario which,
upon completion, sends a call back into Asterisk using the Contact
of the REGISTER. As this Contact contains a line parameter the
res_pjsip_outbound_registration module associates it with the outbound
registration and identifies it as the configured endpoint.

ASTERISK-24949
Reported by: Joshua Colp

Change-Id: I4c80a969e4f29d49e83a03b3b0fed395d6ce2421
---
A tests/channels/pjsip/registration/outbound/line_parameter/configs/ast1/extensions.conf
A tests/channels/pjsip/registration/outbound/line_parameter/configs/ast1/pjsip.conf
A tests/channels/pjsip/registration/outbound/line_parameter/sipp/register.xml
A tests/channels/pjsip/registration/outbound/line_parameter/test-config.yaml
M tests/channels/pjsip/registration/outbound/tests.yaml
5 files changed, 167 insertions(+), 0 deletions(-)

Approvals:
  Mark Michelson: Looks good to me, but someone else must approve
  Matt Jordan: Looks good to me, approved; Verified



diff --git a/tests/channels/pjsip/registration/outbound/line_parameter/configs/ast1/extensions.conf b/tests/channels/pjsip/registration/outbound/line_parameter/configs/ast1/extensions.conf
new file mode 100644
index 0000000..b953975
--- /dev/null
+++ b/tests/channels/pjsip/registration/outbound/line_parameter/configs/ast1/extensions.conf
@@ -0,0 +1,3 @@
+[test]
+exten => playback,1,Answer
+exten => playback,n,Playback(demo-congrats)
diff --git a/tests/channels/pjsip/registration/outbound/line_parameter/configs/ast1/pjsip.conf b/tests/channels/pjsip/registration/outbound/line_parameter/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..b69b1c5
--- /dev/null
+++ b/tests/channels/pjsip/registration/outbound/line_parameter/configs/ast1/pjsip.conf
@@ -0,0 +1,25 @@
+[local-transport-template](!)
+type=transport
+bind=127.0.0.1:5060
+
+[local-transport-udp](local-transport-template)
+protocol=udp
+
+[registrar-ipv4-udp]
+type=registration
+max_retries=1
+retry_interval=5
+forbidden_retry_interval=0
+client_uri=sip:ua-ipv4-udp at 127.0.0.1:5060\;transport=udp
+server_uri=sip:ua-ipv4-udp at 127.0.0.1:5061\;transport=udp
+expiration=300
+auth_rejection_permanent=yes
+line=yes
+endpoint=test
+contact_user=playback
+
+[test]
+type=endpoint
+context=test
+disallow=all
+allow=ulaw
diff --git a/tests/channels/pjsip/registration/outbound/line_parameter/sipp/register.xml b/tests/channels/pjsip/registration/outbound/line_parameter/sipp/register.xml
new file mode 100644
index 0000000..0cef003
--- /dev/null
+++ b/tests/channels/pjsip/registration/outbound/line_parameter/sipp/register.xml
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Accept a REGISTER and then place a call back using the Contact in the REGISTER">
+
+  <!-- UA registers -->
+  <recv request="REGISTER">
+    <action>
+      <ereg regexp="(\<.*\>)"
+          header="Contact:"
+          search_in="hdr"
+          check_it="true"
+          assign_to="contact"/>
+    </action>
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To:];tag=[pid]SIPpTag01[call_number]
+      [last_Call-ID:]
+      [last_CSeq:]
+      [last_Expires:]
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Content-Length: [len]
+
+    ]]>
+  </send>
+
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE [$contact] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
+      To: <[$contact]>
+      Call-ID: [call_id]
+      CSeq: 1 INVITE
+      Contact: sip:test@[local_ip]:[local_port]
+      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="200" rtd="true">
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      ACK [$contact] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
+      To: <[$contact]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 1 ACK
+      Contact: sip:test@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <send retrans="500">
+    <![CDATA[
+
+      BYE [$contact] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
+      To: <[$contact]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 2 BYE
+      Contact: sip:test@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv response="200" crlf="true">
+  </recv>
+
+</scenario>
diff --git a/tests/channels/pjsip/registration/outbound/line_parameter/test-config.yaml b/tests/channels/pjsip/registration/outbound/line_parameter/test-config.yaml
new file mode 100644
index 0000000..40d8abd
--- /dev/null
+++ b/tests/channels/pjsip/registration/outbound/line_parameter/test-config.yaml
@@ -0,0 +1,34 @@
+testinfo:
+    summary: 'Send an outbound registration with line parameter'
+    description: |
+        'This test performs an outbound registration with the line parameter
+         option set to a SIPP scenario. Once the registration is complete SIPP
+         places a call to Asterisk using the Contact header provided in the
+         registration. Asterisk matches the call using the line parameter and
+         directs it to the expected position in the dialplan.'
+
+properties:
+    minversion: '13.4.0'
+    dependencies:
+        - python: 'twisted'
+        - python: 'starpy'
+        - asterisk: 'res_pjsip'
+        - asterisk: 'res_pjsip_outbound_registration'
+        - sipp:
+            version: 'v3.0'
+    tags:
+        - pjsip
+
+test-modules:
+    add-test-to-search-path: 'True'
+    test-object:
+        config-section: test-object-config
+        typename: 'sipp.SIPpTestCase'
+
+test-object-config:
+    fail-on-any: False
+    test-iterations:
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'register.xml', '-i': '127.0.0.1',
+                                    '-p': '5061'} }
diff --git a/tests/channels/pjsip/registration/outbound/tests.yaml b/tests/channels/pjsip/registration/outbound/tests.yaml
index 3b9c58d..8ff4a2c 100644
--- a/tests/channels/pjsip/registration/outbound/tests.yaml
+++ b/tests/channels/pjsip/registration/outbound/tests.yaml
@@ -3,3 +3,4 @@
     - test: 'forbidden_retry'
     - dir: 'unregister'
     - test: 'auth_loop'
+    - test: 'line_parameter'

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I4c80a969e4f29d49e83a03b3b0fed395d6ce2421
Gerrit-PatchSet: 2
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>



More information about the asterisk-commits mailing list