[Asterisk-code-review] testsuite: Outgoing call with peer authenticating in dialog ... (testsuite[master])

Richard Mudgett asteriskteam at digium.com
Tue May 26 16:59:26 CDT 2015


Richard Mudgett has uploaded a new change for review.

  https://gerrit.asterisk.org/537

Change subject: testsuite: Outgoing call with peer authenticating in dialog requests.
......................................................................

testsuite: Outgoing call with peer authenticating in dialog requests.

Run a SIPp scenario that accepts a call from res_pjsip and requires
authentication of in-dialog requests sent to it.  Specifically in-dialog
MESSAGE and re-INVITE.

ASTERISK-25131
Reported by: Richard Mudgett

Change-Id: If9889ccbe19177645951651515a43a272e8ba69b
---
A tests/channels/pjsip/basic_calls/outgoing/nominal/peer_in_dialog_auths/configs/ast1/extensions.conf
A tests/channels/pjsip/basic_calls/outgoing/nominal/peer_in_dialog_auths/configs/ast1/pjsip.conf
A tests/channels/pjsip/basic_calls/outgoing/nominal/peer_in_dialog_auths/sipp/outgoing_in_dialog_auths.xml
A tests/channels/pjsip/basic_calls/outgoing/nominal/peer_in_dialog_auths/test-config.yaml
M tests/channels/pjsip/basic_calls/outgoing/nominal/tests.yaml
5 files changed, 351 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/37/537/1

diff --git a/tests/channels/pjsip/basic_calls/outgoing/nominal/peer_in_dialog_auths/configs/ast1/extensions.conf b/tests/channels/pjsip/basic_calls/outgoing/nominal/peer_in_dialog_auths/configs/ast1/extensions.conf
new file mode 100644
index 0000000..0c8ccc6
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/outgoing/nominal/peer_in_dialog_auths/configs/ast1/extensions.conf
@@ -0,0 +1,11 @@
+[default]
+exten => in_dialog_auths,1,NoOp()
+same => n,Answer()
+same => n,SendText(My message to send)
+same => n,NoOp(SENDTEXTSTATUS is '${SENDTEXTSTATUS}')
+same => n,GotoIf($["${SENDTEXTSTATUS}"="SUCCESS"]?:done)
+same => n,Wait(0.5)
+same => n,Set(CONNECTEDLINE(all)="Fred" <boring>)
+same => n,Echo()
+same => n(done),Hangup()
+
diff --git a/tests/channels/pjsip/basic_calls/outgoing/nominal/peer_in_dialog_auths/configs/ast1/pjsip.conf b/tests/channels/pjsip/basic_calls/outgoing/nominal/peer_in_dialog_auths/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..848d1c7
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/outgoing/nominal/peer_in_dialog_auths/configs/ast1/pjsip.conf
@@ -0,0 +1,50 @@
+[local-transport-template](!)
+type=transport
+bind=127.0.0.1
+
+[local-transport6-template](!)
+type=transport
+bind=[::1]
+
+[local-transport-udp](local-transport-template)
+protocol=udp
+
+[local-transport-udp6](local-transport6-template)
+protocol=udp
+
+[local-transport-tcp](local-transport-template)
+protocol=tcp
+
+[local-transport-tcp6](local-transport6-template)
+protocol=tcp
+
+[endpoint-template](!)
+type=endpoint
+context=default
+allow=!all,ulaw,alaw
+outbound_auth=trunk-auth
+send_pai=yes
+trust_id_outbound=yes
+
+[endpoint-template-ipv4](!)
+media_address=127.0.0.1
+
+[endpoint-template-ipv6](!)
+media_address=[::1]
+rtp_ipv6=yes
+
+[alice-ipv4-udp](endpoint-template,endpoint-template-ipv4)
+
+[alice-ipv4-tcp](endpoint-template,endpoint-template-ipv4)
+
+[alice-ipv6-udp](endpoint-template,endpoint-template-ipv6)
+
+[alice-ipv6-tcp](endpoint-template,endpoint-template-ipv6)
+
+[auth-template](!)
+type=auth
+
+[trunk-auth](auth-template)
+username=alice
+password=swordfish
+
diff --git a/tests/channels/pjsip/basic_calls/outgoing/nominal/peer_in_dialog_auths/sipp/outgoing_in_dialog_auths.xml b/tests/channels/pjsip/basic_calls/outgoing/nominal/peer_in_dialog_auths/sipp/outgoing_in_dialog_auths.xml
new file mode 100644
index 0000000..e1e576d8
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/outgoing/nominal/peer_in_dialog_auths/sipp/outgoing_in_dialog_auths.xml
@@ -0,0 +1,232 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Outgoing call auths in-dialog requests.">
+    <Global variables="remote_from_data" />
+
+    <!-- Wait for incoming call to challenge -->
+    <recv request="INVITE">
+    </recv>
+
+    <send retrans="500">
+        <![CDATA[
+
+            SIP/2.0 401 Unauthorized
+            [last_Via:]
+            [last_From:]
+            [last_To:];tag=[call_number]
+            [last_Call-ID:]
+            [last_CSeq:]
+            WWW-Authenticate: Digest  realm="asterisk",nonce="1431715752/35e47f0a610ed24b774610798d5a9c85",opaque="6a40d12245927b97",algorithm=md5,qop="auth"
+            Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+            Server: SIPp test
+            Content-Length: 0
+
+            ]]>
+    </send>
+
+    <recv request="ACK" rtd="true">
+    </recv>
+
+    <recv request="INVITE">
+        <action>
+            <!-- Save the From data with tag. We'll need it when we send our BYE -->
+            <ereg regexp=".*(;tag=.*)" header="From:" search_in="hdr" check_it="true" assign_to="remote_from_data"/>
+            <!-- Need an Authorization header present to match. -->
+            <ereg regexp=".*" search_in="hdr" header="Authorization:" check_it="true" assign_to="dummy" />
+        </action>
+    </recv>
+
+    <send>
+        <![CDATA[
+
+            SIP/2.0 100 Trying
+            [last_Via:]
+            [last_From:]
+            [last_To:];tag=[call_number]
+            [last_Call-ID:]
+            [last_CSeq:]
+            Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+            Server: SIPp test
+            Content-Length: 0
+
+            ]]>
+    </send>
+
+    <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:test@[local_ip]:[local_port];transport=[transport]>
+            Server: SIPp 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 request="ACK" rtd="true">
+    </recv>
+
+    <!-- Wait for a MESSAGE to challenge -->
+    <recv request="MESSAGE">
+    </recv>
+
+    <send>
+        <![CDATA[
+
+            SIP/2.0 401 Unauthorized
+            [last_Via:]
+            [last_From:]
+            [last_To:]
+            [last_Call-ID:]
+            [last_CSeq:]
+            WWW-Authenticate: Digest  realm="asterisk",nonce="1431715752/35e47f0a610ed24b774610798d5a9c86",opaque="6a40d12245927b98",algorithm=md5,qop="auth"
+            Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+            Server: SIPp test
+            Content-Length: 0
+
+            ]]>
+    </send>
+
+    <recv request="MESSAGE">
+        <action>
+            <!-- Need an Authorization header present to match. -->
+            <ereg regexp=".*" search_in="hdr" header="Authorization:" check_it="true" assign_to="dummy" />
+        </action>
+    </recv>
+
+    <send>
+        <![CDATA[
+
+            SIP/2.0 202 Accepted
+            [last_Via:]
+            [last_From:]
+            [last_To:]
+            [last_Call-ID:]
+            [last_CSeq:]
+            Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+            Server: SIPp test
+            Content-Length: 0
+
+            ]]>
+    </send>
+
+    <!-- Wait for a re-INVITE to challenge -->
+    <recv request="INVITE">
+    </recv>
+
+    <send>
+        <![CDATA[
+
+            SIP/2.0 401 Unauthorized
+            [last_Via:]
+            [last_From:]
+            [last_To:]
+            [last_Call-ID:]
+            [last_CSeq:]
+            WWW-Authenticate: Digest  realm="asterisk",nonce="1431715752/35e47f0a610ed24b774610798d5a9c87",opaque="6a40d12245927b99",algorithm=md5,qop="auth"
+            Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+            Server: SIPp test
+            Content-Length: 0
+
+            ]]>
+    </send>
+
+    <recv request="ACK">
+    </recv>
+
+    <recv request="INVITE">
+        <action>
+            <!-- Need an Authorization header present to match. -->
+            <ereg regexp=".*" search_in="hdr" header="Authorization:" check_it="true" assign_to="dummy" />
+        </action>
+    </recv>
+
+    <send>
+        <![CDATA[
+
+            SIP/2.0 100 Trying
+            [last_Via:]
+            [last_From:]
+            [last_To:]
+            [last_Call-ID:]
+            [last_CSeq:]
+            Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+            Server: SIPp test
+            Content-Length: 0
+
+            ]]>
+    </send>
+
+    <send retrans="500">
+        <![CDATA[
+
+            SIP/2.0 200 OK
+            [last_Via:]
+            [last_From:]
+            [last_To:]
+            [last_Call-ID:]
+            [last_CSeq:]
+            Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+            Server: SIPp 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 request="ACK" rtd="true">
+    </recv>
+
+    <send retrans="500">
+        <![CDATA[
+
+            BYE sip:in_dialog_auths@[remote_ip]:[remote_port];transport=[transport] SIP/2.0
+            [last_Via:]
+            From: <sip:test@[local_ip]>;tag=[call_number]
+            To:[$remote_from_data]
+            [last_Call-ID:]
+            CSeq: 1 BYE
+            Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+            Max-Forwards: 70
+            User-Agent: SIPp test
+            Content-Length: 0
+
+            ]]>
+    </send>
+
+    <recv response="200" crlf="true">
+    </recv>
+
+    <Reference variables="dummy" />
+
+    <!-- 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/basic_calls/outgoing/nominal/peer_in_dialog_auths/test-config.yaml b/tests/channels/pjsip/basic_calls/outgoing/nominal/peer_in_dialog_auths/test-config.yaml
new file mode 100644
index 0000000..2e7e59e
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/outgoing/nominal/peer_in_dialog_auths/test-config.yaml
@@ -0,0 +1,57 @@
+testinfo:
+    summary:     'Tests outgoing calls with outbound in-dialog authentication'
+    description: |
+        'Run a SIPp scenario that sends various calls from res_pjsip,
+        that need authentication when requests are made to the peer.
+        Specifically in-dialog MESSAGE and re-INVITE.'
+
+test-modules:
+    test-object:
+        config-section: test-object-config
+        typename: 'sipp.SIPpTestCase'
+    modules:
+        -
+            config-section: 'originator-alice-ipv4-udp'
+            typename: 'pluggable_modules.Originator'
+        -
+            config-section: 'originator-alice-ipv6-udp'
+            typename: 'pluggable_modules.Originator'
+
+originator-alice-ipv4-udp:
+    trigger: 'ami_connect'
+    ignore-originate-failure: 'no'
+    id: '0'
+    channel: 'PJSIP/alice-ipv4-udp/sip:test at 127.0.0.1:5061;transport=udp'
+    context: 'default'
+    exten: 'in_dialog_auths'
+    priority: '1'
+    async: 'True'
+
+originator-alice-ipv6-udp:
+    trigger: 'ami_connect'
+    ignore-originate-failure: 'no'
+    id: '0'
+    channel: 'PJSIP/alice-ipv6-udp/sip:test@[::1]:5071;transport=udp'
+    context: 'default'
+    exten: 'in_dialog_auths'
+    priority: '1'
+    async: 'True'
+
+test-object-config:
+    test-iterations:
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'outgoing_in_dialog_auths.xml', '-i': '127.0.0.1', '-p': '5061', '-s': 'alice-ipv4-udp'} }
+                - { 'target': '[::1]', 'key-args': {'scenario': 'outgoing_in_dialog_auths.xml', '-i': '[::1]', '-p': '5071', '-s': 'alice-ipv6-udp'} }
+
+properties:
+    minversion: '13.5.0'
+    dependencies:
+        - sipp :
+            version : 'v3.0'
+        - asterisk : 'app_echo'
+        - asterisk : 'app_sendtext'
+        - asterisk : 'func_callerid'
+        - asterisk : 'res_pjsip'
+    tags:
+        - pjsip
diff --git a/tests/channels/pjsip/basic_calls/outgoing/nominal/tests.yaml b/tests/channels/pjsip/basic_calls/outgoing/nominal/tests.yaml
index edeb32b..7e9339f 100644
--- a/tests/channels/pjsip/basic_calls/outgoing/nominal/tests.yaml
+++ b/tests/channels/pjsip/basic_calls/outgoing/nominal/tests.yaml
@@ -3,3 +3,4 @@
     - test: 'echo'
     - test: 'auth'
     - test: 'nat'
+    - test: 'peer_in_dialog_auths'

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If9889ccbe19177645951651515a43a272e8ba69b
Gerrit-PatchSet: 1
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>



More information about the asterisk-code-review mailing list