[Asterisk-code-review] pjsip/basic_calls: Add a few more nominal and off nominal basic calls... (...testsuite[16])

Friendly Automation asteriskteam at digium.com
Mon Jul 22 07:57:11 CDT 2019


Friendly Automation has submitted this change and it was merged. ( https://gerrit.asterisk.org/c/testsuite/+/11567 )

Change subject: pjsip/basic_calls: Add a few more nominal and off nominal basic calls tests
......................................................................

pjsip/basic_calls: Add a few more nominal and off nominal basic calls tests

Added the following new basic calls tests:

pjsip/basic_calls/incoming/nominal/unauthed/ident_by_anonymous
pjsip/basic_calls/incoming/off-nominal/invalid_number/
pjsip/basic_calls/outgoing/nominal/dialstring
pjsip/basic_calls/outgoing/nominal/from_user
pjsip/basic_calls/outgoing/off-nominal/bob_is_busy_at
pjsip/basic_calls/two_parties/nominal/two_servers/
pjsip/basic_calls/two_parties/off-nominal/authed/bob_rejects/

Change-Id: Iae9854ea496d7241c1a4f9cd551be2ca1fb01078
---
A tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_anonymous/configs/ast1/extensions.conf
A tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_anonymous/configs/ast1/pjsip.conf
A tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_anonymous/sipp/anonymous_invite.xml
A tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_anonymous/test-config.yaml
M tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/tests.yaml
A tests/channels/pjsip/basic_calls/incoming/off-nominal/invalid_number/configs/ast1/extensions.conf
A tests/channels/pjsip/basic_calls/incoming/off-nominal/invalid_number/configs/ast1/modules.conf.inc
A tests/channels/pjsip/basic_calls/incoming/off-nominal/invalid_number/configs/ast1/pjsip.conf
A tests/channels/pjsip/basic_calls/incoming/off-nominal/invalid_number/sipp/inbound_to_asterisk.xml
A tests/channels/pjsip/basic_calls/incoming/off-nominal/invalid_number/test-config.yaml
M tests/channels/pjsip/basic_calls/incoming/off-nominal/tests.yaml
A tests/channels/pjsip/basic_calls/outgoing/nominal/dialstring/configs/ast1/pjsip.conf
A tests/channels/pjsip/basic_calls/outgoing/nominal/dialstring/sipp/uas-checkuser.xml
A tests/channels/pjsip/basic_calls/outgoing/nominal/dialstring/sipp/uas.xml
A tests/channels/pjsip/basic_calls/outgoing/nominal/dialstring/test-config.yaml
A tests/channels/pjsip/basic_calls/outgoing/nominal/from_user/configs/ast1/pjsip.conf
A tests/channels/pjsip/basic_calls/outgoing/nominal/from_user/sipp/check_from_user.xml
A tests/channels/pjsip/basic_calls/outgoing/nominal/from_user/test-config.yaml
M tests/channels/pjsip/basic_calls/outgoing/nominal/tests.yaml
A tests/channels/pjsip/basic_calls/outgoing/off-nominal/bob_is_busy_at/configs/ast1/extensions.conf
A tests/channels/pjsip/basic_calls/outgoing/off-nominal/bob_is_busy_at/configs/ast1/pjsip.conf
A tests/channels/pjsip/basic_calls/outgoing/off-nominal/bob_is_busy_at/sipp/bob.xml
A tests/channels/pjsip/basic_calls/outgoing/off-nominal/bob_is_busy_at/test-config.yaml
M tests/channels/pjsip/basic_calls/outgoing/off-nominal/tests.yaml
M tests/channels/pjsip/basic_calls/two_parties/nominal/tests.yaml
A tests/channels/pjsip/basic_calls/two_parties/nominal/two_servers/configs/ast1/extensions.conf
A tests/channels/pjsip/basic_calls/two_parties/nominal/two_servers/configs/ast1/pjsip.conf
A tests/channels/pjsip/basic_calls/two_parties/nominal/two_servers/configs/ast2/extensions.conf
A tests/channels/pjsip/basic_calls/two_parties/nominal/two_servers/configs/ast2/pjsip.conf
A tests/channels/pjsip/basic_calls/two_parties/nominal/two_servers/configs/ast3/extensions.conf
A tests/channels/pjsip/basic_calls/two_parties/nominal/two_servers/configs/ast3/pjsip.conf
A tests/channels/pjsip/basic_calls/two_parties/nominal/two_servers/configs/ast4/extensions.conf
A tests/channels/pjsip/basic_calls/two_parties/nominal/two_servers/configs/ast4/pjsip.conf
A tests/channels/pjsip/basic_calls/two_parties/nominal/two_servers/test-config.yaml
A tests/channels/pjsip/basic_calls/two_parties/off-nominal/authed/bob_rejects/configs/ast1/extensions.conf
A tests/channels/pjsip/basic_calls/two_parties/off-nominal/authed/bob_rejects/configs/ast1/pjsip.conf
A tests/channels/pjsip/basic_calls/two_parties/off-nominal/authed/bob_rejects/sipp/alice.xml
A tests/channels/pjsip/basic_calls/two_parties/off-nominal/authed/bob_rejects/sipp/bob.xml
A tests/channels/pjsip/basic_calls/two_parties/off-nominal/authed/bob_rejects/test-config.yaml
A tests/channels/pjsip/basic_calls/two_parties/off-nominal/authed/tests.yaml
A tests/channels/pjsip/basic_calls/two_parties/off-nominal/tests.yaml
M tests/channels/pjsip/basic_calls/two_parties/tests.yaml
42 files changed, 1,216 insertions(+), 0 deletions(-)

Approvals:
  George Joseph: Looks good to me, approved
  Friendly Automation: Approved for Submit



diff --git a/tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_anonymous/configs/ast1/extensions.conf b/tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_anonymous/configs/ast1/extensions.conf
new file mode 100644
index 0000000..a5bc80f
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_anonymous/configs/ast1/extensions.conf
@@ -0,0 +1,4 @@
+[default]
+exten => echo,1,Answer()
+same  => n,Echo()
+same  => n,Hangup()
diff --git a/tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_anonymous/configs/ast1/pjsip.conf b/tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_anonymous/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..f35f723
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_anonymous/configs/ast1/pjsip.conf
@@ -0,0 +1,16 @@
+[global]
+debug=yes
+
+[transport-template](!)
+type=transport
+bind=127.0.0.1
+
+[transport-udp](transport-template)
+protocol=udp
+
+[endpoint-template](!)
+type=endpoint
+context=default
+allow=!all,ulaw
+
+[anonymous](endpoint-template)
diff --git a/tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_anonymous/sipp/anonymous_invite.xml b/tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_anonymous/sipp/anonymous_invite.xml
new file mode 100644
index 0000000..10b7a2b
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_anonymous/sipp/anonymous_invite.xml
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="INVITE Anon">
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE sip:echo@[remote_ip]:[remote_port] 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
+      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 response="200" rtd="true" />
+
+  <send>
+    <![CDATA[
+
+      ACK sip:echo@[remote_ip]:[remote_port] 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
+      Subject: Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <send retrans="500">
+    <![CDATA[
+
+      BYE sip:echo@[remote_ip]:[remote_port] 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
+      Subject: Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv response="200" crlf="true" />
+
+</scenario>
diff --git a/tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_anonymous/test-config.yaml b/tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_anonymous/test-config.yaml
new file mode 100644
index 0000000..accf9d7
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_anonymous/test-config.yaml
@@ -0,0 +1,29 @@
+testinfo:
+    summary: 'Ensure that the anonymous endpoint works.'
+    description: |
+        Test to make sure anonymous calls are allowed when an anonymous
+        endpoint has been defined.
+
+test-modules:
+    test-object:
+        config-section: test-object-config
+        typename: 'sipp.SIPpTestCase'
+
+test-object-config:
+    memcheck-delay-stop: 7
+    fail-on-any: False
+    test-iterations:
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'anonymous_invite.xml', '-i': '127.0.0.1', '-p': '5061', '-s': 'anon'} }
+
+properties:
+    dependencies:
+        - python : 'twisted'
+        - python : 'starpy'
+        - sipp :
+            version : 'v3.0'
+        - asterisk: 'chan_pjsip'
+        - asterisk: 'res_pjsip'
+    tags:
+        - pjsip
diff --git a/tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/tests.yaml b/tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/tests.yaml
index 68e17f6..812c134 100644
--- a/tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/tests.yaml
+++ b/tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/tests.yaml
@@ -1,4 +1,5 @@
 tests:
+    - test: 'ident_by_anonymous'
     - test: 'ident_by_host'
     - test: 'ident_by_host_only'
     - test: 'ident_by_user'
diff --git a/tests/channels/pjsip/basic_calls/incoming/off-nominal/invalid_number/configs/ast1/extensions.conf b/tests/channels/pjsip/basic_calls/incoming/off-nominal/invalid_number/configs/ast1/extensions.conf
new file mode 100644
index 0000000..cf73312
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/incoming/off-nominal/invalid_number/configs/ast1/extensions.conf
@@ -0,0 +1,3 @@
+[default]
+; SIPp will dial 1234 which doesn't exist here.
+exten => 1001,1,NoOp(=== Just so we have an extension defined ===)
diff --git a/tests/channels/pjsip/basic_calls/incoming/off-nominal/invalid_number/configs/ast1/modules.conf.inc b/tests/channels/pjsip/basic_calls/incoming/off-nominal/invalid_number/configs/ast1/modules.conf.inc
new file mode 100644
index 0000000..ad9aeb1
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/incoming/off-nominal/invalid_number/configs/ast1/modules.conf.inc
@@ -0,0 +1,6 @@
+; Don't load pbx_lua.so as the extensions.lua sample file conflicts with this test
+noload => pbx_lua.so
+
+; Might as well not load AEL modules either to prevent the possiblity of future conflicts
+noload => pbx_ael.so
+noload => res_ael_share.so
diff --git a/tests/channels/pjsip/basic_calls/incoming/off-nominal/invalid_number/configs/ast1/pjsip.conf b/tests/channels/pjsip/basic_calls/incoming/off-nominal/invalid_number/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..fb37d36
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/incoming/off-nominal/invalid_number/configs/ast1/pjsip.conf
@@ -0,0 +1,23 @@
+[global]
+debug=yes
+
+[transport-template](!)
+type=transport
+bind=127.0.0.1
+
+[transport-udp](transport-template)
+protocol=udp
+
+[aor-template](!)
+type=aor
+
+[endpoint-template](!)
+type=endpoint
+context=default
+allow=!all,ulaw
+
+[alice](aor-template)
+contact=sip:alice at 127.0.0.1:5061
+
+[alice](endpoint-template)
+aors=alice
diff --git a/tests/channels/pjsip/basic_calls/incoming/off-nominal/invalid_number/sipp/inbound_to_asterisk.xml b/tests/channels/pjsip/basic_calls/incoming/off-nominal/invalid_number/sipp/inbound_to_asterisk.xml
new file mode 100644
index 0000000..0b7d317
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/incoming/off-nominal/invalid_number/sipp/inbound_to_asterisk.xml
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Inbound call to invalid extension">
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE sip:1234@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: "alice" <sip:alice@[local_ip]:[local_port]>;tag=[call_number]
+      To: <sip:1234@[remote_ip]:[remote_port]>
+      Contact: <sip:alice@[local_ip]:[local_port]>
+      Call-ID: [call_id]
+      CSeq: [cseq] INVITE
+      Max-Forwards: 70
+      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 [media_port] RTP/AVP 8 0
+      a=rtpmap:0 PCMU/8000
+      a=rtpmap:101 telephone-event/8000
+
+    ]]>
+  </send>
+
+  <recv response="100" optional="true" />
+  <recv response="180" optional="true" />
+  <recv response="183" optional="true" />
+
+  <recv response="404" />
+
+  <send>
+    <![CDATA[
+
+      ACK sip:1234@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: sipp <sip:alice@[local_ip]:[local_port]>;tag=[call_number]
+      To: sut <sip:alice@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 1 ACK
+      Contact: <sip:sipp@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: Performance Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+</scenario>
diff --git a/tests/channels/pjsip/basic_calls/incoming/off-nominal/invalid_number/test-config.yaml b/tests/channels/pjsip/basic_calls/incoming/off-nominal/invalid_number/test-config.yaml
new file mode 100644
index 0000000..87c58b5
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/incoming/off-nominal/invalid_number/test-config.yaml
@@ -0,0 +1,27 @@
+testinfo:
+    summary: 'Ensure that Asterisk responds to a request for an invalid number with a 404.'
+    description: |
+        Make sure that Asterisk responds with a SIP 404 to an incoming request
+        for a dialed number that doesn't exist in the dial plan.
+
+test-modules:
+    test-object:
+        config-section: test-config
+        typename: 'sipp.SIPpTestCase'
+
+test-config:
+    test-iterations:
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'inbound_to_asterisk.xml', '-p': '5061'} }
+
+properties:
+    dependencies:
+        - python : 'twisted'
+        - python : 'starpy'
+        - sipp :
+            version : 'v3.0'
+        - asterisk: 'chan_pjsip'
+        - asterisk: 'res_pjsip'
+    tags:
+        - pjsip
diff --git a/tests/channels/pjsip/basic_calls/incoming/off-nominal/tests.yaml b/tests/channels/pjsip/basic_calls/incoming/off-nominal/tests.yaml
index 33856eb..9672628 100644
--- a/tests/channels/pjsip/basic_calls/incoming/off-nominal/tests.yaml
+++ b/tests/channels/pjsip/basic_calls/incoming/off-nominal/tests.yaml
@@ -1,6 +1,7 @@
 tests:
     - dir: 'userpass'
     - test: 'incompatible_codecs'
+    - test: 'invalid_number'
     - test: 'invalid_sdp'
     - test: 'md5'
     - test: 'unknown_user'
diff --git a/tests/channels/pjsip/basic_calls/outgoing/nominal/dialstring/configs/ast1/pjsip.conf b/tests/channels/pjsip/basic_calls/outgoing/nominal/dialstring/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..1df967c
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/outgoing/nominal/dialstring/configs/ast1/pjsip.conf
@@ -0,0 +1,23 @@
+[global]
+debug=yes
+
+[transport-template](!)
+type=transport
+bind=127.0.0.1
+
+[transport-udp](transport-template)
+protocol=udp
+
+[aor-template](!)
+type=aor
+
+[endpoint-template](!)
+type=endpoint
+context=default
+allow=!all,ulaw
+
+[uas](aor-template)
+contact=sip:uas at 127.0.0.1:5061
+
+[uas](endpoint-template)
+aors=uas
diff --git a/tests/channels/pjsip/basic_calls/outgoing/nominal/dialstring/sipp/uas-checkuser.xml b/tests/channels/pjsip/basic_calls/outgoing/nominal/dialstring/sipp/uas-checkuser.xml
new file mode 100644
index 0000000..6cb7a89
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/outgoing/nominal/dialstring/sipp/uas-checkuser.xml
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Check request user">
+  <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=.*)"
+              header="From:"
+              search_in="hdr"
+              check_it="true"
+              assign_to="remote_tag"/>
+          <ereg regexp="INVITE sip:foo at .*"
+              search_in="msg"
+              check_it="true"
+              assign_to="1"/>
+          <strcmp assign_to="1" variable="1" value="" />
+      </action>
+  </recv>
+
+  <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=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+      s=-
+      c=IN IP[media_ip_type] [media_ip]
+      t=0 0
+      m=audio [media_port] RTP/AVP 0
+      a=rtpmap:0 PCMU/8000
+
+    ]]>
+  </send>
+
+  <recv request="ACK" />
+
+  <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:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag01[call_number]
+      To: [$remote_tag]
+      [last_Call-ID:]
+      CSeq: [cseq] BYE
+      Contact: sip:sipp@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv response="200" />
+
+</scenario>
+
diff --git a/tests/channels/pjsip/basic_calls/outgoing/nominal/dialstring/sipp/uas.xml b/tests/channels/pjsip/basic_calls/outgoing/nominal/dialstring/sipp/uas.xml
new file mode 100644
index 0000000..942607e
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/outgoing/nominal/dialstring/sipp/uas.xml
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Check request">
+  <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=.*)"
+              header="From:"
+              search_in="hdr"
+              check_it="true"
+              assign_to="remote_tag"/>
+      </action>
+  </recv>
+
+  <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=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+      s=-
+      c=IN IP[media_ip_type] [media_ip]
+      t=0 0
+      m=audio [media_port] RTP/AVP 0
+      a=rtpmap:0 PCMU/8000
+
+    ]]>
+  </send>
+
+  <recv request="ACK" />
+
+  <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:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag01[call_number]
+      To: [$remote_tag]
+      [last_Call-ID:]
+      CSeq: [cseq] BYE
+      Contact: sip:sipp@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv response="200" />
+
+</scenario>
+
diff --git a/tests/channels/pjsip/basic_calls/outgoing/nominal/dialstring/test-config.yaml b/tests/channels/pjsip/basic_calls/outgoing/nominal/dialstring/test-config.yaml
new file mode 100644
index 0000000..630713a
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/outgoing/nominal/dialstring/test-config.yaml
@@ -0,0 +1,53 @@
+testinfo:
+    summary: 'Test that the PJSIP dial strings result in the call being rightly routed'
+    description: |
+        'See summary'
+
+test-modules:
+    test-object:
+        config-section: test-config
+        typename: 'sipp.SIPpTestCase'
+    modules:
+        -
+            config-section: orig-config1
+            typename: 'pluggable_modules.Originator'
+        -
+            config-section: orig-config2
+            typename: 'pluggable_modules.Originator'
+        -
+            config-section: orig-config3
+            typename: 'pluggable_modules.Originator'
+
+orig-config1:
+    scenario-trigger-after: 1
+    channel: 'PJSIP/uas'
+
+orig-config2:
+    scenario-trigger-after: 1
+    channel: 'PJSIP/foo at uas'
+
+orig-config3:
+    scenario-trigger-after: 1
+    channel: 'PJSIP/uas/sip:foo at 127.0.0.1:5062'
+
+test-config:
+    test-iterations:
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'uas.xml', '-p': '5061', '-s': 'uas'} }
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'uas-checkuser.xml', '-p': '5061', '-s': 'foo'} }
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'uas-checkuser.xml', '-p': '5062', '-s': 'foo'} }
+
+properties:
+    dependencies:
+        - python: 'starpy'
+        - sipp:
+            version: 'v3.1'
+        - asterisk: 'chan_pjsip'
+        - asterisk: 'res_pjsip'
+    tags:
+        - pjsip
diff --git a/tests/channels/pjsip/basic_calls/outgoing/nominal/from_user/configs/ast1/pjsip.conf b/tests/channels/pjsip/basic_calls/outgoing/nominal/from_user/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..cced85d
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/outgoing/nominal/from_user/configs/ast1/pjsip.conf
@@ -0,0 +1,24 @@
+[global]
+debug=yes
+
+[transport-template](!)
+type=transport
+bind=127.0.0.1
+
+[transport-udp](transport-template)
+protocol=udp
+
+[aor-template](!)
+type=aor
+
+[endpoint-template](!)
+type=endpoint
+context=default
+allow=!all,ulaw
+
+[alice](aor-template)
+contact=sip:alice at 127.0.0.1:5061
+
+[alice](endpoint-template)
+aors=alice
+from_user=banana
diff --git a/tests/channels/pjsip/basic_calls/outgoing/nominal/from_user/sipp/check_from_user.xml b/tests/channels/pjsip/basic_calls/outgoing/nominal/from_user/sipp/check_from_user.xml
new file mode 100644
index 0000000..a592ae7
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/outgoing/nominal/from_user/sipp/check_from_user.xml
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Check from user">
+  <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=.*)"
+              header="From:"
+              search_in="hdr"
+              check_it="true"
+              assign_to="remote_tag"/>
+          <ereg regexp=".*<sip:banana at .*"
+              header="From:"
+              seach_in="hdr"
+              check_it="true"
+              assign_to="1"/>
+          <strcmp assign_to="1" variable="1" value=""/>
+      </action>
+  </recv>
+
+  <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=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+      s=-
+      c=IN IP[media_ip_type] [media_ip]
+      t=0 0
+      m=audio [media_port] RTP/AVP 0
+      a=rtpmap:0 PCMU/8000
+
+    ]]>
+  </send>
+
+  <recv request="ACK" />
+
+  <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:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag01[call_number]
+      To: [$remote_tag]
+      [last_Call-ID:]
+      CSeq: [cseq] BYE
+      Contact: sip:sipp@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv response="200" />
+
+</scenario>
+
diff --git a/tests/channels/pjsip/basic_calls/outgoing/nominal/from_user/test-config.yaml b/tests/channels/pjsip/basic_calls/outgoing/nominal/from_user/test-config.yaml
new file mode 100644
index 0000000..eb1c366
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/outgoing/nominal/from_user/test-config.yaml
@@ -0,0 +1,33 @@
+testinfo:
+    summary: 'Test that the from_user setting works properly'
+    description: |
+        'Send an outgoing call with from_user set on the definition, and then
+        validate it in the sipp scenario.'
+
+test-modules:
+    test-object:
+        config-section: test-config
+        typename: 'sipp.SIPpTestCase'
+    modules:
+        -
+            config-section: orig-config
+            typename: 'pluggable_modules.Originator'
+
+test-config:
+    test-iterations:
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'check_from_user.xml', '-s': 'alice', '-p': '5061'} }
+
+orig-config:
+    channel: 'PJSIP/alice'
+
+properties:
+    dependencies:
+        - python: 'starpy'
+        - sipp:
+            version: 'v3.1'
+        - asterisk: 'chan_pjsip'
+        - 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 543a17a..08a822c 100644
--- a/tests/channels/pjsip/basic_calls/outgoing/nominal/tests.yaml
+++ b/tests/channels/pjsip/basic_calls/outgoing/nominal/tests.yaml
@@ -1,6 +1,8 @@
 tests:
     - test: 'playback'
+    - test: 'dialstring'
     - test: 'echo'
+    - test: 'from_user'
     - test: 'auth'
     - test: 'nat'
     - test: 'peer_in_dialog_auths'
diff --git a/tests/channels/pjsip/basic_calls/outgoing/off-nominal/bob_is_busy_at/configs/ast1/extensions.conf b/tests/channels/pjsip/basic_calls/outgoing/off-nominal/bob_is_busy_at/configs/ast1/extensions.conf
new file mode 100644
index 0000000..e87bbe7
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/outgoing/off-nominal/bob_is_busy_at/configs/ast1/extensions.conf
@@ -0,0 +1,8 @@
+[default]
+exten => s,1,Set(state=${DEVICE_STATE(PJSIP/bob)})
+	  same => n,Verbose(0,The dev is equal to ${state})
+	  same => n,UserEvent(devicestate,device: PJSIP/bob,state: ${DEVICE_STATE(PJSIP/bob)})
+	  same => n,GotoIf($["${state}" = "NOT_INUSE"]?:busy)
+	  same => n,Dial(PJSIP/bob)
+	  same => n(busy),Hangup()
+
diff --git a/tests/channels/pjsip/basic_calls/outgoing/off-nominal/bob_is_busy_at/configs/ast1/pjsip.conf b/tests/channels/pjsip/basic_calls/outgoing/off-nominal/bob_is_busy_at/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..fae3f5a
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/outgoing/off-nominal/bob_is_busy_at/configs/ast1/pjsip.conf
@@ -0,0 +1,25 @@
+[global]
+debug=yes
+
+[transport-template](!)
+type=transport
+bind=127.0.0.1
+
+[transport-udp](transport-template)
+protocol=udp
+
+[aor-template](!)
+type=aor
+
+[endpoint-template](!)
+type=endpoint
+context=default
+direct_media=false
+allow=!all,ulaw
+
+[bob](aor-template)
+contact=sip:bob at 127.0.0.1:5061
+
+[bob](endpoint-template)
+aors=bob
+device_state_busy_at=1
diff --git a/tests/channels/pjsip/basic_calls/outgoing/off-nominal/bob_is_busy_at/sipp/bob.xml b/tests/channels/pjsip/basic_calls/outgoing/off-nominal/bob_is_busy_at/sipp/bob.xml
new file mode 100644
index 0000000..bd978a6
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/outgoing/off-nominal/bob_is_busy_at/sipp/bob.xml
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Bob answers">
+
+  <recv request="INVITE" />
+
+  <send>
+    <![CDATA[
+
+        SIP/2.0 100 Trying
+        [last_Via:]
+        [last_From:]
+        [last_To:];tag=[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=[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=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" />
+
+  <recv request="BYE" />
+
+  <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]>
+        ]]>
+  </send>
+
+</scenario>
diff --git a/tests/channels/pjsip/basic_calls/outgoing/off-nominal/bob_is_busy_at/test-config.yaml b/tests/channels/pjsip/basic_calls/outgoing/off-nominal/bob_is_busy_at/test-config.yaml
new file mode 100644
index 0000000..5e4ac70
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/outgoing/off-nominal/bob_is_busy_at/test-config.yaml
@@ -0,0 +1,67 @@
+testinfo:
+    summary: 'Ensure the device_state_busy_at option works'
+    description: |
+        'An endpoint is configured with a device_state_busy_at set to one. Two
+        calls are made to the endpoint's extension. The first one succeeds,
+        while the second one gets a "busy". Device state is checked through
+        raised user events.'
+
+test-modules:
+    test-object:
+        config-section: test-config
+        typename: 'sipp.SIPpTestCase'
+    modules:
+        -
+            typename: 'pluggable_modules.Originator'
+        -
+            config-section: ami-config
+            typename: 'pluggable_modules.EventActionModule'
+
+test-config:
+    reactor_timeout: 10
+    test-iterations:
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'bob.xml', '-p': '5061' } }
+
+ami-config:
+    -
+        ami-events:
+            type: 'headermatch'
+            conditions:
+                match:
+                    Event: 'UserEvent'
+                    state: 'NOT_INUSE'
+            requirements:
+                match:
+                    device: 'PJSIP/bob'
+            count: 1
+        ami-actions:
+            action:
+               action: 'Originate'
+               channel: 'Local/s'
+               application: 'Echo'
+    -
+        ami-events:
+            type: 'headermatch'
+            conditions:
+                match:
+                    Event: 'UserEvent'
+                    state: 'BUSY'
+            requirements:
+                match:
+                    device: 'PJSIP/bob'
+            count: 1
+        ami-actions:
+            action:
+                action: 'Hangup'
+                channel: '/^PJSIP/bob-.*$/'
+
+properties:
+    dependencies:
+        - python: 'twisted'
+        - python: 'starpy'
+        - asterisk: 'chan_pjsip'
+        - asterisk: 'res_pjsip'
+    tags:
+        - pjsip
diff --git a/tests/channels/pjsip/basic_calls/outgoing/off-nominal/tests.yaml b/tests/channels/pjsip/basic_calls/outgoing/off-nominal/tests.yaml
index 45fcb12..be7ad6f 100644
--- a/tests/channels/pjsip/basic_calls/outgoing/off-nominal/tests.yaml
+++ b/tests/channels/pjsip/basic_calls/outgoing/off-nominal/tests.yaml
@@ -2,5 +2,6 @@
     - test: 'bob_does_not_exist'
     - test: 'bob_does_not_answer'
     - test: 'bob_is_busy'
+    - test: 'bob_is_busy_at'
     - test: 'bob_incompatible_codecs'
     - test: 'call_canceled'
diff --git a/tests/channels/pjsip/basic_calls/two_parties/nominal/tests.yaml b/tests/channels/pjsip/basic_calls/two_parties/nominal/tests.yaml
index 0386723..29b5255 100644
--- a/tests/channels/pjsip/basic_calls/two_parties/nominal/tests.yaml
+++ b/tests/channels/pjsip/basic_calls/two_parties/nominal/tests.yaml
@@ -1,2 +1,3 @@
 tests:
     - dir: 'alice_initiated'
+    - test: 'two_servers'
diff --git a/tests/channels/pjsip/basic_calls/two_parties/nominal/two_servers/configs/ast1/extensions.conf b/tests/channels/pjsip/basic_calls/two_parties/nominal/two_servers/configs/ast1/extensions.conf
new file mode 100644
index 0000000..1d1315d
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/two_parties/nominal/two_servers/configs/ast1/extensions.conf
@@ -0,0 +1,2 @@
+[default]
+exten => bob,1,Dial(PJSIP/bob at uut2)
diff --git a/tests/channels/pjsip/basic_calls/two_parties/nominal/two_servers/configs/ast1/pjsip.conf b/tests/channels/pjsip/basic_calls/two_parties/nominal/two_servers/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..06a19dd
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/two_parties/nominal/two_servers/configs/ast1/pjsip.conf
@@ -0,0 +1,26 @@
+[global]
+debug=yes
+
+[transport-template](!)
+type=transport
+bind=127.0.0.1:5060
+
+[transport-udp](transport-template)
+protocol=udp
+
+[aor-template](!)
+type=aor
+
+[endpoint-template](!)
+type=endpoint
+context=default
+allow=!all,ulaw
+media_address=127.0.0.1
+
+[uut2](aor-template)
+contact=sip:uut2 at 127.0.0.1:5061
+
+[uut2](endpoint-template)
+aors=uut2
+
+[alice](endpoint-template)
diff --git a/tests/channels/pjsip/basic_calls/two_parties/nominal/two_servers/configs/ast2/extensions.conf b/tests/channels/pjsip/basic_calls/two_parties/nominal/two_servers/configs/ast2/extensions.conf
new file mode 100644
index 0000000..e92876c
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/two_parties/nominal/two_servers/configs/ast2/extensions.conf
@@ -0,0 +1,2 @@
+[default]
+exten => bob,1,Dial(PJSIP/bob)
diff --git a/tests/channels/pjsip/basic_calls/two_parties/nominal/two_servers/configs/ast2/pjsip.conf b/tests/channels/pjsip/basic_calls/two_parties/nominal/two_servers/configs/ast2/pjsip.conf
new file mode 100644
index 0000000..47439ef
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/two_parties/nominal/two_servers/configs/ast2/pjsip.conf
@@ -0,0 +1,27 @@
+[global]
+debug=yes
+
+[transport-template](!)
+type=transport
+bind=127.0.0.1:5061
+
+[transport-udp](transport-template)
+protocol=udp
+
+[aor-template](!)
+type=aor
+
+[endpoint-template](!)
+type=endpoint
+context=default
+allow=!all,ulaw
+media_address=127.0.0.1
+
+[alice](endpoint-template)
+
+[bob](aor-template)
+contact=sip:bob at 127.0.0.1:5062
+
+[bob](endpoint-template)
+aors=bob
+
diff --git a/tests/channels/pjsip/basic_calls/two_parties/nominal/two_servers/configs/ast3/extensions.conf b/tests/channels/pjsip/basic_calls/two_parties/nominal/two_servers/configs/ast3/extensions.conf
new file mode 100644
index 0000000..e567f42
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/two_parties/nominal/two_servers/configs/ast3/extensions.conf
@@ -0,0 +1,15 @@
+[default]
+exten => bob,1,Answer()
+same => n,BackgroundDetect(tt-weasels,1,20,,5000)
+same => n,NoOp(Talking was NOT detected! Trying again)
+same => n,BackgroundDetect(tt-weasels,1,20,,5000)
+same => n,NoOp(Talking was NOT detected!)
+same => n,UserEvent(TalkDetect, result: fail)
+same => n,Hangup()
+
+; If talking is detected then it jumps here
+exten => talk,1,NoOp(Talking was detected!)
+same => n,UserEvent(TalkDetect, result: pass)
+same => n,Playback(tt-weasels)
+same => n,Wait(2)
+same => n,Hangup()
diff --git a/tests/channels/pjsip/basic_calls/two_parties/nominal/two_servers/configs/ast3/pjsip.conf b/tests/channels/pjsip/basic_calls/two_parties/nominal/two_servers/configs/ast3/pjsip.conf
new file mode 100644
index 0000000..53ac0cc
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/two_parties/nominal/two_servers/configs/ast3/pjsip.conf
@@ -0,0 +1,21 @@
+[global]
+debug=yes
+
+[transport-template](!)
+type=transport
+bind=127.0.0.1:5062
+
+[transport-udp](transport-template)
+protocol=udp
+
+[aor-template](!)
+type=aor
+
+[endpoint-template](!)
+type=endpoint
+context=default
+allow=!all,ulaw
+media_address=127.0.0.1
+
+[alice](endpoint-template)
+aors=alice
diff --git a/tests/channels/pjsip/basic_calls/two_parties/nominal/two_servers/configs/ast4/extensions.conf b/tests/channels/pjsip/basic_calls/two_parties/nominal/two_servers/configs/ast4/extensions.conf
new file mode 100644
index 0000000..c170511
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/two_parties/nominal/two_servers/configs/ast4/extensions.conf
@@ -0,0 +1,15 @@
+[default]
+exten => start,1,Answer()
+same => n,BackgroundDetect(tt-weasels,1,20,,5000)
+same => n,NoOp(Talking was NOT detected! Trying again)
+same => n,BackgroundDetect(tt-weasels,1,20,,5000)
+same => n,NoOp(Talking was NOT detected!)
+same => n,UserEvent(TalkDetect, result: fail)
+same => n,Hangup()
+
+; If talking is detected then it jumps here
+exten => talk,1,NoOp(Talking was detected!)
+same => n,UserEvent(TalkDetect, result: pass)
+same => n,Playback(tt-weasels)
+same => n,Wait(2)
+same => n,Hangup()
diff --git a/tests/channels/pjsip/basic_calls/two_parties/nominal/two_servers/configs/ast4/pjsip.conf b/tests/channels/pjsip/basic_calls/two_parties/nominal/two_servers/configs/ast4/pjsip.conf
new file mode 100644
index 0000000..e09bb6b
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/two_parties/nominal/two_servers/configs/ast4/pjsip.conf
@@ -0,0 +1,26 @@
+[global]
+debug=yes
+
+[transport-template](!)
+type=transport
+bind=127.0.0.1:5063
+
+[transport-udp](transport-template)
+protocol=udp
+
+[aor-template](!)
+type=aor
+
+[endpoint-template](!)
+type=endpoint
+context=default
+allow=!all,ulaw
+media_address=127.0.0.1
+
+[uut1](aor-template)
+contact=sip:uut1 at 127.0.0.1:5060
+
+[uut1](endpoint-template)
+aors=uut1
+from_user=alice
+from_domain=127.0.0.1
diff --git a/tests/channels/pjsip/basic_calls/two_parties/nominal/two_servers/test-config.yaml b/tests/channels/pjsip/basic_calls/two_parties/nominal/two_servers/test-config.yaml
new file mode 100644
index 0000000..c8221ed
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/two_parties/nominal/two_servers/test-config.yaml
@@ -0,0 +1,74 @@
+testinfo:
+    summary: 'Tests basic two party calls across two Asterisk servers'
+    description: |
+        'Run four instances of Asterisk, uut1 (ast1), uut2 (ast2), bob (ast3),
+        and alice (ast4) that test two party calls across two Asterisk servers.
+        Alice initiates the call through uut1 and uut2 to bob. Both alice and
+        bob send, and listen for audio in order to ensure audio is received.'
+
+test-modules:
+    test-object:
+        config-section: test-object-config
+        typename: 'test_case.TestCaseModule'
+    modules:
+        -
+            config-section: originator-config
+            typename: 'pluggable_modules.Originator'
+        -
+            config-section: 'ami-config'
+            typename: 'ami.AMIEventModule'
+        -
+            config-section: hangup-monitor
+            typename: 'pluggable_modules.HangupMonitor'
+
+test-object-config:
+    reactor-timeout: 20
+    asterisk-instances: 4
+    connect-ami: True
+
+originator-config:
+    # Originate call from Alice
+    id: '3'
+    trigger: 'ami_connect'
+    channel: 'PJSIP/bob at uut1'
+    context: 'default'
+    exten: 'start'
+    priority: '1'
+
+ami-config:
+    # Alice events
+    -
+        type: 'headermatch'
+        id: '2'
+        conditions:
+            match:
+                Event: 'UserEvent'
+                UserEvent: 'TalkDetect'
+        requirements:
+            match:
+                result: 'pass'
+        count: '1'
+    # Bob events
+    -
+        type: 'headermatch'
+        id: '3'
+        conditions:
+            match:
+                Event: 'UserEvent'
+                UserEvent: 'TalkDetect'
+        requirements:
+            match:
+                result: 'pass'
+        count: '1'
+
+hangup-monitor:
+    ids: '0'
+
+properties:
+    dependencies:
+        - python: 'twisted'
+        - python: 'starpy'
+        - asterisk: 'chan_pjsip'
+        - asterisk: 'res_pjsip'
+    tags:
+        - pjsip
diff --git a/tests/channels/pjsip/basic_calls/two_parties/off-nominal/authed/bob_rejects/configs/ast1/extensions.conf b/tests/channels/pjsip/basic_calls/two_parties/off-nominal/authed/bob_rejects/configs/ast1/extensions.conf
new file mode 100644
index 0000000..80b2608
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/two_parties/off-nominal/authed/bob_rejects/configs/ast1/extensions.conf
@@ -0,0 +1,3 @@
+[default]
+exten => bob,1,Dial(PJSIP/bob)
+
diff --git a/tests/channels/pjsip/basic_calls/two_parties/off-nominal/authed/bob_rejects/configs/ast1/pjsip.conf b/tests/channels/pjsip/basic_calls/two_parties/off-nominal/authed/bob_rejects/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..4a68025
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/two_parties/off-nominal/authed/bob_rejects/configs/ast1/pjsip.conf
@@ -0,0 +1,45 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[local-transport-template](!)
+type=transport
+bind=127.0.0.1
+
+[local-transport-udp](local-transport-template)
+protocol=udp
+
+[aor-template](!)
+type=aor
+
+[auth-template](!)
+type=auth
+password=swordfish
+realm=asterisk
+
+[endpoint-template-ipv4](!)
+type=endpoint
+context=default
+allow=!all,ulaw,alaw
+media_address=127.0.0.1
+
+[alice](aor-template)
+contact=sip:alice at 127.0.0.1:5062
+
+[alice](auth-template)
+username=alice
+
+[alice](endpoint-template-ipv4)
+aors=alice
+auth=alice
+
+[bob](aor-template)
+contact=sip:bob at 127.0.0.1:5061
+
+[bob](auth-template)
+username=bob
+
+[bob](endpoint-template-ipv4)
+aors=bob
+outbound_auth=bob
diff --git a/tests/channels/pjsip/basic_calls/two_parties/off-nominal/authed/bob_rejects/sipp/alice.xml b/tests/channels/pjsip/basic_calls/two_parties/off-nominal/authed/bob_rejects/sipp/alice.xml
new file mode 100644
index 0000000..8b71207
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/two_parties/off-nominal/authed/bob_rejects/sipp/alice.xml
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Send call and expect a 503">
+
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE sip:bob@[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=[call_number]
+      To: <sip:bob@[remote_ip]:[remote_port]>
+      Call-ID: [call_id]
+      CSeq: 1 INVITE
+      Contact: <sip:alice@[local_ip]:[local_port];transport=[transport]>
+      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="401" auth="true" />
+
+  <send>
+    <![CDATA[
+
+      ACK sip:bob@[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=[call_number]
+      To: <sip:bob@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 1 ACK
+      Contact: <sip:alice@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE sip:bob@[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=[call_number]
+      To: <sip:bob@[remote_ip]:[remote_port]>
+      Call-ID: [call_id]
+      CSeq: 2 INVITE
+      Contact: <sip:alice@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      [authentication]
+      Subject: Test
+      User-Agent: Test
+      Content-Length: 0
+    ]]>
+  </send>
+
+  <recv response="100" />
+
+  <recv response="503" />
+
+  <!-- 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/two_parties/off-nominal/authed/bob_rejects/sipp/bob.xml b/tests/channels/pjsip/basic_calls/two_parties/off-nominal/authed/bob_rejects/sipp/bob.xml
new file mode 100644
index 0000000..993e2e1
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/two_parties/off-nominal/authed/bob_rejects/sipp/bob.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Reject authentication with a 403">
+
+  <recv request="INVITE" crlf="true" />
+
+  <send>
+    <![CDATA[
+
+      SIP/2.0 401 Unauthorized
+      [last_Via:]
+      [last_From:]
+      [last_To:];tag=[pid]SIPpTag01[call_number]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      WWW-Authenticate: Digest algorithm=MD5, realm="asterisk", nonce="47ebe028cda119c35d4877b383027d28da013815"
+      Content-Length: [len]
+
+    ]]>
+  </send>
+
+  <recv request="ACK" />
+
+  <!-- We don't verify the authentication because we just want to send a 403 back to Asterisk for this test -->
+  <recv request="INVITE" crlf="true" />
+
+  <send>
+    <![CDATA[
+
+      SIP/2.0 403 Forbidden
+      [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: [len]
+
+    ]]>
+  </send>
+
+  <!-- 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/two_parties/off-nominal/authed/bob_rejects/test-config.yaml b/tests/channels/pjsip/basic_calls/two_parties/off-nominal/authed/bob_rejects/test-config.yaml
new file mode 100644
index 0000000..9582570
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/two_parties/off-nominal/authed/bob_rejects/test-config.yaml
@@ -0,0 +1,41 @@
+testinfo:
+    summary: 'Ensure Asterisk sends a 503 to caller upon outbound auth failure'
+    description: |
+         'Two instances of SIPp are executed with "alice" being the caller and
+          "bob" being the callee. The inbound call from Alice is authenticated,
+          bob is called, and bob rejects the authentication with a 403. The
+          SIPp scenario for alice expects to receive a 503 from Asterisk.'
+
+test-modules:
+    test-object:
+        config-section: test-object-config
+        typename: 'sipp.SIPpTestCase'
+
+test-object-config:
+    fail-on-any: False
+    test-iterations:
+        -
+            scenarios:
+                # Bob receives call and rejects auth by sending a 403
+                - { 'key-args': { 'scenario': 'bob.xml',
+                                  '-i': '127.0.0.1',
+                                  '-p': '5061',
+                                  '-timeout': '10s'},
+                    'ordered-args': ['-timeout_error'] }
+                # Alice sends call and ensures a 503 is received
+                - { 'key-args': { 'scenario': 'alice.xml',
+                                  '-i': '127.0.0.1',
+                                  '-p': '5062',
+                                  '-au': 'alice',
+                                  '-ap': 'swordfish',
+                                  '-timeout': '10s'},
+                    'ordered-args': ['-timeout_error'] }
+
+properties:
+    dependencies:
+        - sipp :
+            version : 'v3.3'
+        - asterisk: 'chan_pjsip'
+        - asterisk: 'res_pjsip'
+    tags:
+        - pjsip
diff --git a/tests/channels/pjsip/basic_calls/two_parties/off-nominal/authed/tests.yaml b/tests/channels/pjsip/basic_calls/two_parties/off-nominal/authed/tests.yaml
new file mode 100644
index 0000000..86b4835
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/two_parties/off-nominal/authed/tests.yaml
@@ -0,0 +1,2 @@
+tests:
+    - test: 'bob_rejects'
diff --git a/tests/channels/pjsip/basic_calls/two_parties/off-nominal/tests.yaml b/tests/channels/pjsip/basic_calls/two_parties/off-nominal/tests.yaml
new file mode 100644
index 0000000..6660529
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/two_parties/off-nominal/tests.yaml
@@ -0,0 +1,2 @@
+tests:
+    - dir: 'authed'
diff --git a/tests/channels/pjsip/basic_calls/two_parties/tests.yaml b/tests/channels/pjsip/basic_calls/two_parties/tests.yaml
index 0b8c229..cec47df 100644
--- a/tests/channels/pjsip/basic_calls/two_parties/tests.yaml
+++ b/tests/channels/pjsip/basic_calls/two_parties/tests.yaml
@@ -1,2 +1,3 @@
 tests:
     - dir: 'nominal'
+    - dir: 'off-nominal'

-- 
To view, visit https://gerrit.asterisk.org/c/testsuite/+/11567
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: testsuite
Gerrit-Branch: 16
Gerrit-Change-Id: Iae9854ea496d7241c1a4f9cd551be2ca1fb01078
Gerrit-Change-Number: 11567
Gerrit-PatchSet: 4
Gerrit-Owner: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Benjamin Keith Ford <bford at digium.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20190722/a1836803/attachment-0001.html>


More information about the asterisk-code-review mailing list