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

Matt Jordan asteriskteam at digium.com
Tue Jun 2 09:30:00 CDT 2015


Matt Jordan has submitted this change and it was merged.

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


testsuite: Incoming call with peer authenticating in dialog requests.

Run a SIPp scenario that sends a call to 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: I4c344990c9b9bf6a57673c5ef5f12847dd588829
---
A tests/channels/pjsip/basic_calls/incoming/nominal/peer_in_dialog_auths/configs/ast1/extensions.conf
A tests/channels/pjsip/basic_calls/incoming/nominal/peer_in_dialog_auths/configs/ast1/pjsip.conf
A tests/channels/pjsip/basic_calls/incoming/nominal/peer_in_dialog_auths/sipp/incoming_in_dialog_auths.xml
A tests/channels/pjsip/basic_calls/incoming/nominal/peer_in_dialog_auths/test-config.yaml
M tests/channels/pjsip/basic_calls/incoming/nominal/tests.yaml
5 files changed, 312 insertions(+), 0 deletions(-)

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



diff --git a/tests/channels/pjsip/basic_calls/incoming/nominal/peer_in_dialog_auths/configs/ast1/extensions.conf b/tests/channels/pjsip/basic_calls/incoming/nominal/peer_in_dialog_auths/configs/ast1/extensions.conf
new file mode 100644
index 0000000..0c8ccc6
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/incoming/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/incoming/nominal/peer_in_dialog_auths/configs/ast1/pjsip.conf b/tests/channels/pjsip/basic_calls/incoming/nominal/peer_in_dialog_auths/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..848d1c7
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/incoming/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/incoming/nominal/peer_in_dialog_auths/sipp/incoming_in_dialog_auths.xml b/tests/channels/pjsip/basic_calls/incoming/nominal/peer_in_dialog_auths/sipp/incoming_in_dialog_auths.xml
new file mode 100644
index 0000000..45e256a
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/incoming/nominal/peer_in_dialog_auths/sipp/incoming_in_dialog_auths.xml
@@ -0,0 +1,205 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Incoming call auths in-dialog requests.">
+    <send retrans="500">
+        <![CDATA[
+
+            INVITE sip:in_dialog_auths@[remote_ip]:[remote_port];transport=[transport] 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: test <sip:test@[remote_ip]:[remote_port]>
+            Call-ID: [call_id]
+            CSeq: 1 INVITE
+            Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+            Max-Forwards: 70
+            User-Agent: 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 response="100" optional="true">
+    </recv>
+
+    <recv response="180" optional="true">
+    </recv>
+
+    <recv response="200" rtd="true">
+    </recv>
+
+    <send>
+        <![CDATA[
+
+            ACK sip:in_dialog_auths@[remote_ip]:[remote_port];transport=[transport] 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: test <sip:test@[remote_ip]:[remote_port]>[peer_tag_param]
+            Call-ID: [call_id]
+            CSeq: 1 ACK
+            Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+            Max-Forwards: 70
+            User-Agent: SIPp test
+            Content-Length: 0
+
+            ]]>
+    </send>
+
+    <!-- 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
+            Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+            From: test1 <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
+            To: test <sip:test@[remote_ip]:[remote_port]>[peer_tag_param]
+            Call-ID: [call_id]
+            CSeq: 2 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/incoming/nominal/peer_in_dialog_auths/test-config.yaml b/tests/channels/pjsip/basic_calls/incoming/nominal/peer_in_dialog_auths/test-config.yaml
new file mode 100644
index 0000000..0261be6
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/incoming/nominal/peer_in_dialog_auths/test-config.yaml
@@ -0,0 +1,45 @@
+testinfo:
+    summary:     'Tests incoming calls with outbound in-dialog authentication'
+    description: |
+        'Run a SIPp scenario that sends various calls to res_pjsip,
+        that need authentication when requests are made to the caller.
+        Specifically in-dialog MESSAGE and re-INVITE.'
+
+test-modules:
+    test-object:
+        config-section: test-object-config
+        typename: 'sipp.SIPpTestCase'
+
+test-object-config:
+    test-iterations:
+        # IPv4 & UDP
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'incoming_in_dialog_auths.xml', '-i': '127.0.0.1', '-p': '5061', '-s': 'alice-ipv4-udp'} }
+
+        # IPv4 & TCP
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'incoming_in_dialog_auths.xml', '-i': '127.0.0.1', '-p': '5062', '-t': 't1', '-s': 'alice-ipv4-tcp'} }
+
+        # IPv6 & UDP
+        -
+            scenarios:
+                - { 'target': '[::1]', 'key-args': {'scenario': 'incoming_in_dialog_auths.xml', '-i': '[::1]', '-p': '5071', '-s': 'alice-ipv6-udp'} }
+
+        # IPv6 & TCP
+        -
+            scenarios:
+                - { 'target': '[::1]', 'key-args': {'scenario': 'incoming_in_dialog_auths.xml', '-i': '[::1]', '-p': '5072', '-t': 't1', '-s': 'alice-ipv6-tcp'} }
+
+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/incoming/nominal/tests.yaml b/tests/channels/pjsip/basic_calls/incoming/nominal/tests.yaml
index c83a236..1306afd 100644
--- a/tests/channels/pjsip/basic_calls/incoming/nominal/tests.yaml
+++ b/tests/channels/pjsip/basic_calls/incoming/nominal/tests.yaml
@@ -1,3 +1,4 @@
 tests:
     - dir: 'unauthed'
     - dir: 'authed'
+    - test: 'peer_in_dialog_auths'

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I4c344990c9b9bf6a57673c5ef5f12847dd588829
Gerrit-PatchSet: 1
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: 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-code-review mailing list