<p>Friendly Automation <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/testsuite/+/12823">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  Joshua Colp: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, approved
  Friendly Automation: Approved for Submit

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">pjsip mwi: Add a few more tests for solicited mwi subscriptinons<br><br>Added some tests to ensure that the "mwi_subscribe_replaces_unsolicited" option<br>works as it should. The tests make sure aggregation is also handled correctly<br>when enabled.<br><br>A couple tests make sure that a solicited subscription is able to replace<br>an unsolicited subscription when appropriate. A couple of other tests make<br>sure that if the unsolicited is created after the solicited one then the<br>solicited subscription is shutdown, and the unsolicited one is allowed.<br><br>Lastly, one test makes sure that when a solicited subscription replaces an<br>unsolicited one then when the contact is updated no extra MWI messages are<br>sent out.<br><br>ASTERISK-28488<br><br>Change-Id: I50ebd212789249f14056b8b3948304237a5f1042<br>---<br>A tests/channels/pjsip/subscriptions/mwi/solicited/replaced_by_unsolicited/aggregate/configs/ast1/pjsip.conf<br>A tests/channels/pjsip/subscriptions/mwi/solicited/replaced_by_unsolicited/aggregate/sipp/solicited.xml<br>A tests/channels/pjsip/subscriptions/mwi/solicited/replaced_by_unsolicited/aggregate/sipp/unsolicited.xml<br>A tests/channels/pjsip/subscriptions/mwi/solicited/replaced_by_unsolicited/aggregate/test-config.yaml<br>A tests/channels/pjsip/subscriptions/mwi/solicited/replaced_by_unsolicited/non_aggregate/configs/ast1/pjsip.conf<br>A tests/channels/pjsip/subscriptions/mwi/solicited/replaced_by_unsolicited/non_aggregate/sipp/solicited.xml<br>A tests/channels/pjsip/subscriptions/mwi/solicited/replaced_by_unsolicited/non_aggregate/sipp/unsolicited.xml<br>A tests/channels/pjsip/subscriptions/mwi/solicited/replaced_by_unsolicited/non_aggregate/test-config.yaml<br>A tests/channels/pjsip/subscriptions/mwi/solicited/replaced_by_unsolicited/tests.yaml<br>A tests/channels/pjsip/subscriptions/mwi/solicited/replaces_unsolicited/aggregate/configs/ast1/pjsip.conf<br>A tests/channels/pjsip/subscriptions/mwi/solicited/replaces_unsolicited/aggregate/sipp/solicited.xml<br>A tests/channels/pjsip/subscriptions/mwi/solicited/replaces_unsolicited/aggregate/sipp/unsolicited.xml<br>A tests/channels/pjsip/subscriptions/mwi/solicited/replaces_unsolicited/aggregate/test-config.yaml<br>A tests/channels/pjsip/subscriptions/mwi/solicited/replaces_unsolicited/multiple_registers/configs/ast1/pjsip.conf<br>A tests/channels/pjsip/subscriptions/mwi/solicited/replaces_unsolicited/multiple_registers/sipp/solicited.xml<br>A tests/channels/pjsip/subscriptions/mwi/solicited/replaces_unsolicited/multiple_registers/sipp/unsolicited.xml<br>A tests/channels/pjsip/subscriptions/mwi/solicited/replaces_unsolicited/multiple_registers/test-config.yaml<br>A tests/channels/pjsip/subscriptions/mwi/solicited/replaces_unsolicited/non_aggregate/configs/ast1/pjsip.conf<br>A tests/channels/pjsip/subscriptions/mwi/solicited/replaces_unsolicited/non_aggregate/sipp/solicited.xml<br>A tests/channels/pjsip/subscriptions/mwi/solicited/replaces_unsolicited/non_aggregate/sipp/unsolicited.xml<br>A tests/channels/pjsip/subscriptions/mwi/solicited/replaces_unsolicited/non_aggregate/test-config.yaml<br>A tests/channels/pjsip/subscriptions/mwi/solicited/replaces_unsolicited/tests.yaml<br>A tests/channels/pjsip/subscriptions/mwi/solicited/tests.yaml<br>M tests/channels/pjsip/subscriptions/mwi/tests.yaml<br>24 files changed, 1,454 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/tests/channels/pjsip/subscriptions/mwi/solicited/replaced_by_unsolicited/aggregate/configs/ast1/pjsip.conf b/tests/channels/pjsip/subscriptions/mwi/solicited/replaced_by_unsolicited/aggregate/configs/ast1/pjsip.conf</span><br><span>new file mode 100644</span><br><span>index 0000000..5aeab58</span><br><span>--- /dev/null</span><br><span>+++ b/tests/channels/pjsip/subscriptions/mwi/solicited/replaced_by_unsolicited/aggregate/configs/ast1/pjsip.conf</span><br><span>@@ -0,0 +1,29 @@</span><br><span style="color: hsl(120, 100%, 40%);">+[global]</span><br><span style="color: hsl(120, 100%, 40%);">+debug=yes</span><br><span style="color: hsl(120, 100%, 40%);">+mwi_disable_initial_unsolicited=yes</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+[transport-template](!)</span><br><span style="color: hsl(120, 100%, 40%);">+type=transport</span><br><span style="color: hsl(120, 100%, 40%);">+bind=127.0.0.1:5060</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+[transport-udp](transport-template)</span><br><span style="color: hsl(120, 100%, 40%);">+protocol=udp</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+[aor-template](!)</span><br><span style="color: hsl(120, 100%, 40%);">+type=aor</span><br><span style="color: hsl(120, 100%, 40%);">+max_contacts=1</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+[endpoint-template](!)</span><br><span style="color: hsl(120, 100%, 40%);">+type=endpoint</span><br><span style="color: hsl(120, 100%, 40%);">+context=default</span><br><span style="color: hsl(120, 100%, 40%);">+allow=!all,ulaw</span><br><span style="color: hsl(120, 100%, 40%);">+direct_media=false</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+[alice](aor-template)</span><br><span style="color: hsl(120, 100%, 40%);">+mailboxes=mb1</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+[alice](endpoint-template)</span><br><span style="color: hsl(120, 100%, 40%);">+aors=alice</span><br><span style="color: hsl(120, 100%, 40%);">+mailboxes=mb1,mb2</span><br><span style="color: hsl(120, 100%, 40%);">+mwi_subscribe_replaces_unsolicited=no</span><br><span style="color: hsl(120, 100%, 40%);">+aggregate_mwi=yes</span><br><span>diff --git a/tests/channels/pjsip/subscriptions/mwi/solicited/replaced_by_unsolicited/aggregate/sipp/solicited.xml b/tests/channels/pjsip/subscriptions/mwi/solicited/replaced_by_unsolicited/aggregate/sipp/solicited.xml</span><br><span>new file mode 100644</span><br><span>index 0000000..088ff90</span><br><span>--- /dev/null</span><br><span>+++ b/tests/channels/pjsip/subscriptions/mwi/solicited/replaced_by_unsolicited/aggregate/sipp/solicited.xml</span><br><span>@@ -0,0 +1,106 @@</span><br><span style="color: hsl(120, 100%, 40%);">+<?xml version="1.0" encoding="ISO-8859-1" ?></span><br><span style="color: hsl(120, 100%, 40%);">+<!DOCTYPE scenario SYSTEM "sipp.dtd"></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+<scenario name="Solicited"></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <!-- Wait a few seconds before initiating the scenario to make sure</span><br><span style="color: hsl(120, 100%, 40%);">+        the mailbox(es) have been updated --></span><br><span style="color: hsl(120, 100%, 40%);">+  <pause milliseconds="3000" /></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <!-- Setup the solicited subscription first --></span><br><span style="color: hsl(120, 100%, 40%);">+  <send retrans="500"></span><br><span style="color: hsl(120, 100%, 40%);">+    <![CDATA[</span><br><span style="color: hsl(120, 100%, 40%);">+      SUBSCRIBE sip:[service]@[remote_ip]:[remote_port] SIP/2.0</span><br><span style="color: hsl(120, 100%, 40%);">+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]</span><br><span style="color: hsl(120, 100%, 40%);">+      From: "alice" <sip:alice@[local_ip]:[local_port]>;tag=[call_number]</span><br><span style="color: hsl(120, 100%, 40%);">+      To: "alice" <sip:[service]@[remote_ip]:[remote_port]></span><br><span style="color: hsl(120, 100%, 40%);">+      Call-ID: [call_id]</span><br><span style="color: hsl(120, 100%, 40%);">+      CSeq: 1 SUBSCRIBE</span><br><span style="color: hsl(120, 100%, 40%);">+      Contact: "alice" <sip:alice@[local_ip]:[local_port]></span><br><span style="color: hsl(120, 100%, 40%);">+      Max-Forwards: 70</span><br><span style="color: hsl(120, 100%, 40%);">+      Event: message-summary</span><br><span style="color: hsl(120, 100%, 40%);">+      Expires: 60</span><br><span style="color: hsl(120, 100%, 40%);">+      Accept: application/simple-message-summary</span><br><span style="color: hsl(120, 100%, 40%);">+      Allow-Events: message-summary</span><br><span style="color: hsl(120, 100%, 40%);">+      Content-Length: 0</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    ]]></span><br><span style="color: hsl(120, 100%, 40%);">+  </send></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <recv response="200" /></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <!-- Receive NOTIFY due to SUBSCRIBE --></span><br><span style="color: hsl(120, 100%, 40%);">+  <recv request="NOTIFY"></span><br><span style="color: hsl(120, 100%, 40%);">+    <action></span><br><span style="color: hsl(120, 100%, 40%);">+      <ereg regexp="message-summary" check_it="true" search_in="hdr" header="Event" assign_to="event" /></span><br><span style="color: hsl(120, 100%, 40%);">+      <ereg regexp="active;expires=[5,6][0-9]" check_it="true" search_in="hdr" header="Subscription-State" assign_to="state" /></span><br><span style="color: hsl(120, 100%, 40%);">+      <ereg regexp="Voice-Message: 1\/1" check_it="true" search_in="body" assign_to="vm" /></span><br><span style="color: hsl(120, 100%, 40%);">+    </action></span><br><span style="color: hsl(120, 100%, 40%);">+  </recv></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <send></span><br><span style="color: hsl(120, 100%, 40%);">+    <![CDATA[</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+      SIP/2.0 200 OK</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_Via:]</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_From:]</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_To:]</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_Call-ID:]</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_CSeq:]</span><br><span style="color: hsl(120, 100%, 40%);">+      Contact: <sip:[local_ip]:[local_port];transport=[transport]></span><br><span style="color: hsl(120, 100%, 40%);">+      Content-Length: 0</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    ]]></span><br><span style="color: hsl(120, 100%, 40%);">+  </send></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <pause milliseconds="1000" /></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <!-- Now by updating the contact an unsolicited subscription will be setup. Since</span><br><span style="color: hsl(120, 100%, 40%);">+     the mwi_subscribe_replaces_unsolicited option is disabled the solicited</span><br><span style="color: hsl(120, 100%, 40%);">+       subscription is shutdown. --></span><br><span style="color: hsl(120, 100%, 40%);">+  <send retrans="500"></span><br><span style="color: hsl(120, 100%, 40%);">+    <![CDATA[</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+      REGISTER sip:[remote_ip]:[remote_port] SIP/2.0</span><br><span style="color: hsl(120, 100%, 40%);">+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]</span><br><span style="color: hsl(120, 100%, 40%);">+      From: "[service]" <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]</span><br><span style="color: hsl(120, 100%, 40%);">+      To: "[service]" <sip:[service]@[remote_ip]:[remote_port]></span><br><span style="color: hsl(120, 100%, 40%);">+      Call-ID: [call_id]</span><br><span style="color: hsl(120, 100%, 40%);">+      CSeq: [cseq] REGISTER</span><br><span style="color: hsl(120, 100%, 40%);">+      Max-Forwards: 70</span><br><span style="color: hsl(120, 100%, 40%);">+      Contact: <sip:[service]@[local_ip]:5062;transport=[transport]></span><br><span style="color: hsl(120, 100%, 40%);">+      Expires: 60</span><br><span style="color: hsl(120, 100%, 40%);">+      Content-Length: 0</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    ]]></span><br><span style="color: hsl(120, 100%, 40%);">+  </send></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <recv response="200" /></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <!-- Receive NOTIFY due to solicited subscription shutdown --></span><br><span style="color: hsl(120, 100%, 40%);">+  <recv request="NOTIFY"></span><br><span style="color: hsl(120, 100%, 40%);">+    <action></span><br><span style="color: hsl(120, 100%, 40%);">+      <ereg regexp="message-summary" check_it="true" search_in="hdr" header="Event" assign_to="event" /></span><br><span style="color: hsl(120, 100%, 40%);">+      <ereg regexp="terminated" check_it="true" search_in="hdr" header="Subscription-State" assign_to="state" /></span><br><span style="color: hsl(120, 100%, 40%);">+      <ereg regexp="Voice-Message: 1\/1" check_it="true" search_in="body" assign_to="vm" /></span><br><span style="color: hsl(120, 100%, 40%);">+    </action></span><br><span style="color: hsl(120, 100%, 40%);">+  </recv></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <send></span><br><span style="color: hsl(120, 100%, 40%);">+    <![CDATA[</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+      SIP/2.0 200 OK</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_Via:]</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_From:]</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_To:]</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_Call-ID:]</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_CSeq:]</span><br><span style="color: hsl(120, 100%, 40%);">+      Contact: <sip:[local_ip]:[local_port];transport=[transport]></span><br><span style="color: hsl(120, 100%, 40%);">+      Content-Length: 0</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    ]]></span><br><span style="color: hsl(120, 100%, 40%);">+  </send></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <Reference variables="event,state,vm" /></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+</scenario></span><br><span>diff --git a/tests/channels/pjsip/subscriptions/mwi/solicited/replaced_by_unsolicited/aggregate/sipp/unsolicited.xml b/tests/channels/pjsip/subscriptions/mwi/solicited/replaced_by_unsolicited/aggregate/sipp/unsolicited.xml</span><br><span>new file mode 100644</span><br><span>index 0000000..f541bb4</span><br><span>--- /dev/null</span><br><span>+++ b/tests/channels/pjsip/subscriptions/mwi/solicited/replaced_by_unsolicited/aggregate/sipp/unsolicited.xml</span><br><span>@@ -0,0 +1,60 @@</span><br><span style="color: hsl(120, 100%, 40%);">+<?xml version="1.0" encoding="ISO-8859-1" ?></span><br><span style="color: hsl(120, 100%, 40%);">+<!DOCTYPE scenario SYSTEM "sipp.dtd"></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+<scenario name="Unsolicited"></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <recv request="NOTIFY"></span><br><span style="color: hsl(120, 100%, 40%);">+    <action></span><br><span style="color: hsl(120, 100%, 40%);">+    <ereg regexp="message-summary" check_it="true" search_in="hdr" header="Event" assign_to="event" /></span><br><span style="color: hsl(120, 100%, 40%);">+      <ereg regexp="terminated" check_it="true" search_in="hdr" header="Subscription-State" assign_to="state" /></span><br><span style="color: hsl(120, 100%, 40%);">+          <!-- Expect the combined mailbox information for mb1 and mb2 --></span><br><span style="color: hsl(120, 100%, 40%);">+      <ereg regexp="Voice-Message: 3\/3" check_it="true" search_in="body" assign_to="vm" /></span><br><span style="color: hsl(120, 100%, 40%);">+     <!-- Get the call number and see if we've either met or acceded the expected number. --></span><br><span style="color: hsl(120, 100%, 40%);">+      <assignstr assign_to="call_num" value="[call_number]" /></span><br><span style="color: hsl(120, 100%, 40%);">+      <todouble assign_to="count" variable="call_num" /></span><br><span style="color: hsl(120, 100%, 40%);">+      <test assign_to="expected" variable="count" compare="equal" value="1" /></span><br><span style="color: hsl(120, 100%, 40%);">+      <test assign_to="greater" variable="count" compare="greater_than" value="1" /></span><br><span style="color: hsl(120, 100%, 40%);">+    </action></span><br><span style="color: hsl(120, 100%, 40%);">+  </recv></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <send></span><br><span style="color: hsl(120, 100%, 40%);">+    <![CDATA[</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+      SIP/2.0 200 OK</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_Via:]</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_From:]</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_To:]</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_Call-ID:]</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_CSeq:]</span><br><span style="color: hsl(120, 100%, 40%);">+      Contact: <sip:[local_ip]:[local_port];transport=[transport]></span><br><span style="color: hsl(120, 100%, 40%);">+      Content-Length: 0</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    ]]></span><br><span style="color: hsl(120, 100%, 40%);">+  </send></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <!-- Fail the scenario if we've received more than the expected number of calls --></span><br><span style="color: hsl(120, 100%, 40%);">+  <nop condexec="greater"></span><br><span style="color: hsl(120, 100%, 40%);">+    <action></span><br><span style="color: hsl(120, 100%, 40%);">+      <error message="Received too many out of call NOTIFYs ([call_id])" /></span><br><span style="color: hsl(120, 100%, 40%);">+    </action></span><br><span style="color: hsl(120, 100%, 40%);">+  </nop></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <!-- Pause for a time less than the global timeout, but long enough where we feel</span><br><span style="color: hsl(120, 100%, 40%);">+       that we won't potentially receive any erroneous calls after the expected call</span><br><span style="color: hsl(120, 100%, 40%);">+       count has been met. If we stop too soon then the scenario could have successfully</span><br><span style="color: hsl(120, 100%, 40%);">+       ended, but another unexpected message may have potentially arrived, which in</span><br><span style="color: hsl(120, 100%, 40%);">+       that case we should have failed the test. --></span><br><span style="color: hsl(120, 100%, 40%);">+  <pause milliseconds="10000" /></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <!-- Stop the scenario gracefully if we've received the expected number of calls</span><br><span style="color: hsl(120, 100%, 40%);">+     Note, do this stops the test in a non-failure mode. --></span><br><span style="color: hsl(120, 100%, 40%);">+  <nop condexec="expected"></span><br><span style="color: hsl(120, 100%, 40%);">+    <action></span><br><span style="color: hsl(120, 100%, 40%);">+      <log message="call count met stopping test" /></span><br><span style="color: hsl(120, 100%, 40%);">+      <exec int_cmd="stop_gracefully" /></span><br><span style="color: hsl(120, 100%, 40%);">+    </action></span><br><span style="color: hsl(120, 100%, 40%);">+  </nop></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <Reference variables="event,state,vm" /></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+</scenario></span><br><span>diff --git a/tests/channels/pjsip/subscriptions/mwi/solicited/replaced_by_unsolicited/aggregate/test-config.yaml b/tests/channels/pjsip/subscriptions/mwi/solicited/replaced_by_unsolicited/aggregate/test-config.yaml</span><br><span>new file mode 100644</span><br><span>index 0000000..13a48a9</span><br><span>--- /dev/null</span><br><span>+++ b/tests/channels/pjsip/subscriptions/mwi/solicited/replaced_by_unsolicited/aggregate/test-config.yaml</span><br><span>@@ -0,0 +1,72 @@</span><br><span style="color: hsl(120, 100%, 40%);">+testinfo:</span><br><span style="color: hsl(120, 100%, 40%);">+    summary: 'Test a solicited subscription getting replaced by an unsolicited one.'</span><br><span style="color: hsl(120, 100%, 40%);">+    description: |</span><br><span style="color: hsl(120, 100%, 40%);">+        'This tests that when the mwi_subscribe_replaces_unsolicited option is</span><br><span style="color: hsl(120, 100%, 40%);">+        disabled (set to "no"), and a contact is updated, thus setting up the</span><br><span style="color: hsl(120, 100%, 40%);">+        unsolicited subscription, the solicited subscription is properly</span><br><span style="color: hsl(120, 100%, 40%);">+        terminated. As well this verifies that the unsolicited subscription</span><br><span style="color: hsl(120, 100%, 40%);">+        gets setup.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+        Note, this tests disables initial unsolicited at startup in order to</span><br><span style="color: hsl(120, 100%, 40%);">+        make the test a bit more deterministic.'</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+properties:</span><br><span style="color: hsl(120, 100%, 40%);">+    dependencies:</span><br><span style="color: hsl(120, 100%, 40%);">+        - python: 'twisted'</span><br><span style="color: hsl(120, 100%, 40%);">+        - python: 'starpy'</span><br><span style="color: hsl(120, 100%, 40%);">+        - asterisk: 'res_pjsip'</span><br><span style="color: hsl(120, 100%, 40%);">+        - asterisk: 'res_pjsip_mwi'</span><br><span style="color: hsl(120, 100%, 40%);">+        - asterisk: 'res_mwi_external'</span><br><span style="color: hsl(120, 100%, 40%);">+        - asterisk: 'res_mwi_external_ami'</span><br><span style="color: hsl(120, 100%, 40%);">+        - sipp:</span><br><span style="color: hsl(120, 100%, 40%);">+            version: 'v3.0'</span><br><span style="color: hsl(120, 100%, 40%);">+    tags:</span><br><span style="color: hsl(120, 100%, 40%);">+        - pjsip</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+test-modules:</span><br><span style="color: hsl(120, 100%, 40%);">+    test-object:</span><br><span style="color: hsl(120, 100%, 40%);">+        config-section: 'sipp-config'</span><br><span style="color: hsl(120, 100%, 40%);">+        typename: 'sipp.SIPpTestCase'</span><br><span style="color: hsl(120, 100%, 40%);">+    modules:</span><br><span style="color: hsl(120, 100%, 40%);">+        -</span><br><span style="color: hsl(120, 100%, 40%);">+            config-section: 'event-action-config'</span><br><span style="color: hsl(120, 100%, 40%);">+            typename: 'pluggable_modules.EventActionModule'</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+sipp-config:</span><br><span style="color: hsl(120, 100%, 40%);">+    test-iterations:</span><br><span style="color: hsl(120, 100%, 40%);">+        -</span><br><span style="color: hsl(120, 100%, 40%);">+            # Due to the nature of SIPp, and it's handling of out of call messages</span><br><span style="color: hsl(120, 100%, 40%);">+            # we'll execute two scenarios. One to receive unsolicited MWI, and</span><br><span style="color: hsl(120, 100%, 40%);">+            # another to handle solicited MWI.</span><br><span style="color: hsl(120, 100%, 40%);">+            scenarios:</span><br><span style="color: hsl(120, 100%, 40%);">+                # For this test we expect to receive 1 unsolicited MWI message.</span><br><span style="color: hsl(120, 100%, 40%);">+                # One single message is sent with combined mailbox information for</span><br><span style="color: hsl(120, 100%, 40%);">+                # "mb1" and one for "mb2". This occurs when unsolicited is setup.</span><br><span style="color: hsl(120, 100%, 40%);">+                #</span><br><span style="color: hsl(120, 100%, 40%);">+                # Even though we expect only 1 unsolicited message set the call count</span><br><span style="color: hsl(120, 100%, 40%);">+                # to 2 for the scenario. Once the expected call count is met the scenario</span><br><span style="color: hsl(120, 100%, 40%);">+                # is responsible for gracefully shutting itself down. See the scenario</span><br><span style="color: hsl(120, 100%, 40%);">+                # itself for more information.</span><br><span style="color: hsl(120, 100%, 40%);">+                #</span><br><span style="color: hsl(120, 100%, 40%);">+                # Note, we must tell SIPp to cause an error on scenario timeout (20 seconds).</span><br><span style="color: hsl(120, 100%, 40%);">+                # This way the test will fail if the expected number of calls is not met.</span><br><span style="color: hsl(120, 100%, 40%);">+                - { 'key-args': {'scenario': 'unsolicited.xml', '-i': '127.0.0.1', '-p': '5062', '-m': '2', '-timeout_error': ''} }</span><br><span style="color: hsl(120, 100%, 40%);">+                - { 'key-args': {'scenario': 'solicited.xml', '-i': '127.0.0.1', '-p': '5061', '-s': 'alice'} }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+event-action-config:</span><br><span style="color: hsl(120, 100%, 40%);">+    -</span><br><span style="color: hsl(120, 100%, 40%);">+        ami-start:</span><br><span style="color: hsl(120, 100%, 40%);">+        ami-actions:</span><br><span style="color: hsl(120, 100%, 40%);">+            action:</span><br><span style="color: hsl(120, 100%, 40%);">+                Action: 'MWIUpdate'</span><br><span style="color: hsl(120, 100%, 40%);">+                Mailbox: 'mb1'</span><br><span style="color: hsl(120, 100%, 40%);">+                NewMessages: 1</span><br><span style="color: hsl(120, 100%, 40%);">+                OldMessages: 1</span><br><span style="color: hsl(120, 100%, 40%);">+    -</span><br><span style="color: hsl(120, 100%, 40%);">+        ami-start:</span><br><span style="color: hsl(120, 100%, 40%);">+        ami-actions:</span><br><span style="color: hsl(120, 100%, 40%);">+            action:</span><br><span style="color: hsl(120, 100%, 40%);">+                Action: 'MWIUpdate'</span><br><span style="color: hsl(120, 100%, 40%);">+                Mailbox: 'mb2'</span><br><span style="color: hsl(120, 100%, 40%);">+                NewMessages: 2</span><br><span style="color: hsl(120, 100%, 40%);">+                OldMessages: 2</span><br><span>diff --git a/tests/channels/pjsip/subscriptions/mwi/solicited/replaced_by_unsolicited/non_aggregate/configs/ast1/pjsip.conf b/tests/channels/pjsip/subscriptions/mwi/solicited/replaced_by_unsolicited/non_aggregate/configs/ast1/pjsip.conf</span><br><span>new file mode 100644</span><br><span>index 0000000..87cdfea</span><br><span>--- /dev/null</span><br><span>+++ b/tests/channels/pjsip/subscriptions/mwi/solicited/replaced_by_unsolicited/non_aggregate/configs/ast1/pjsip.conf</span><br><span>@@ -0,0 +1,29 @@</span><br><span style="color: hsl(120, 100%, 40%);">+[global]</span><br><span style="color: hsl(120, 100%, 40%);">+debug=yes</span><br><span style="color: hsl(120, 100%, 40%);">+mwi_disable_initial_unsolicited=yes</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+[transport-template](!)</span><br><span style="color: hsl(120, 100%, 40%);">+type=transport</span><br><span style="color: hsl(120, 100%, 40%);">+bind=127.0.0.1:5060</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+[transport-udp](transport-template)</span><br><span style="color: hsl(120, 100%, 40%);">+protocol=udp</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+[aor-template](!)</span><br><span style="color: hsl(120, 100%, 40%);">+type=aor</span><br><span style="color: hsl(120, 100%, 40%);">+max_contacts=1</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+[endpoint-template](!)</span><br><span style="color: hsl(120, 100%, 40%);">+type=endpoint</span><br><span style="color: hsl(120, 100%, 40%);">+context=default</span><br><span style="color: hsl(120, 100%, 40%);">+allow=!all,ulaw</span><br><span style="color: hsl(120, 100%, 40%);">+direct_media=false</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+[alice](aor-template)</span><br><span style="color: hsl(120, 100%, 40%);">+mailboxes=mb1</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+[alice](endpoint-template)</span><br><span style="color: hsl(120, 100%, 40%);">+aors=alice</span><br><span style="color: hsl(120, 100%, 40%);">+mailboxes=mb1,mb2</span><br><span style="color: hsl(120, 100%, 40%);">+mwi_subscribe_replaces_unsolicited=no</span><br><span style="color: hsl(120, 100%, 40%);">+aggregate_mwi=no</span><br><span>diff --git a/tests/channels/pjsip/subscriptions/mwi/solicited/replaced_by_unsolicited/non_aggregate/sipp/solicited.xml b/tests/channels/pjsip/subscriptions/mwi/solicited/replaced_by_unsolicited/non_aggregate/sipp/solicited.xml</span><br><span>new file mode 100644</span><br><span>index 0000000..088ff90</span><br><span>--- /dev/null</span><br><span>+++ b/tests/channels/pjsip/subscriptions/mwi/solicited/replaced_by_unsolicited/non_aggregate/sipp/solicited.xml</span><br><span>@@ -0,0 +1,106 @@</span><br><span style="color: hsl(120, 100%, 40%);">+<?xml version="1.0" encoding="ISO-8859-1" ?></span><br><span style="color: hsl(120, 100%, 40%);">+<!DOCTYPE scenario SYSTEM "sipp.dtd"></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+<scenario name="Solicited"></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <!-- Wait a few seconds before initiating the scenario to make sure</span><br><span style="color: hsl(120, 100%, 40%);">+      the mailbox(es) have been updated --></span><br><span style="color: hsl(120, 100%, 40%);">+  <pause milliseconds="3000" /></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <!-- Setup the solicited subscription first --></span><br><span style="color: hsl(120, 100%, 40%);">+  <send retrans="500"></span><br><span style="color: hsl(120, 100%, 40%);">+    <![CDATA[</span><br><span style="color: hsl(120, 100%, 40%);">+      SUBSCRIBE sip:[service]@[remote_ip]:[remote_port] SIP/2.0</span><br><span style="color: hsl(120, 100%, 40%);">+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]</span><br><span style="color: hsl(120, 100%, 40%);">+      From: "alice" <sip:alice@[local_ip]:[local_port]>;tag=[call_number]</span><br><span style="color: hsl(120, 100%, 40%);">+      To: "alice" <sip:[service]@[remote_ip]:[remote_port]></span><br><span style="color: hsl(120, 100%, 40%);">+      Call-ID: [call_id]</span><br><span style="color: hsl(120, 100%, 40%);">+      CSeq: 1 SUBSCRIBE</span><br><span style="color: hsl(120, 100%, 40%);">+      Contact: "alice" <sip:alice@[local_ip]:[local_port]></span><br><span style="color: hsl(120, 100%, 40%);">+      Max-Forwards: 70</span><br><span style="color: hsl(120, 100%, 40%);">+      Event: message-summary</span><br><span style="color: hsl(120, 100%, 40%);">+      Expires: 60</span><br><span style="color: hsl(120, 100%, 40%);">+      Accept: application/simple-message-summary</span><br><span style="color: hsl(120, 100%, 40%);">+      Allow-Events: message-summary</span><br><span style="color: hsl(120, 100%, 40%);">+      Content-Length: 0</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    ]]></span><br><span style="color: hsl(120, 100%, 40%);">+  </send></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <recv response="200" /></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <!-- Receive NOTIFY due to SUBSCRIBE --></span><br><span style="color: hsl(120, 100%, 40%);">+  <recv request="NOTIFY"></span><br><span style="color: hsl(120, 100%, 40%);">+    <action></span><br><span style="color: hsl(120, 100%, 40%);">+      <ereg regexp="message-summary" check_it="true" search_in="hdr" header="Event" assign_to="event" /></span><br><span style="color: hsl(120, 100%, 40%);">+      <ereg regexp="active;expires=[5,6][0-9]" check_it="true" search_in="hdr" header="Subscription-State" assign_to="state" /></span><br><span style="color: hsl(120, 100%, 40%);">+      <ereg regexp="Voice-Message: 1\/1" check_it="true" search_in="body" assign_to="vm" /></span><br><span style="color: hsl(120, 100%, 40%);">+    </action></span><br><span style="color: hsl(120, 100%, 40%);">+  </recv></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <send></span><br><span style="color: hsl(120, 100%, 40%);">+    <![CDATA[</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+      SIP/2.0 200 OK</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_Via:]</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_From:]</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_To:]</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_Call-ID:]</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_CSeq:]</span><br><span style="color: hsl(120, 100%, 40%);">+      Contact: <sip:[local_ip]:[local_port];transport=[transport]></span><br><span style="color: hsl(120, 100%, 40%);">+      Content-Length: 0</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    ]]></span><br><span style="color: hsl(120, 100%, 40%);">+  </send></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <pause milliseconds="1000" /></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <!-- Now by updating the contact an unsolicited subscription will be setup. Since</span><br><span style="color: hsl(120, 100%, 40%);">+     the mwi_subscribe_replaces_unsolicited option is disabled the solicited</span><br><span style="color: hsl(120, 100%, 40%);">+       subscription is shutdown. --></span><br><span style="color: hsl(120, 100%, 40%);">+  <send retrans="500"></span><br><span style="color: hsl(120, 100%, 40%);">+    <![CDATA[</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+      REGISTER sip:[remote_ip]:[remote_port] SIP/2.0</span><br><span style="color: hsl(120, 100%, 40%);">+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]</span><br><span style="color: hsl(120, 100%, 40%);">+      From: "[service]" <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]</span><br><span style="color: hsl(120, 100%, 40%);">+      To: "[service]" <sip:[service]@[remote_ip]:[remote_port]></span><br><span style="color: hsl(120, 100%, 40%);">+      Call-ID: [call_id]</span><br><span style="color: hsl(120, 100%, 40%);">+      CSeq: [cseq] REGISTER</span><br><span style="color: hsl(120, 100%, 40%);">+      Max-Forwards: 70</span><br><span style="color: hsl(120, 100%, 40%);">+      Contact: <sip:[service]@[local_ip]:5062;transport=[transport]></span><br><span style="color: hsl(120, 100%, 40%);">+      Expires: 60</span><br><span style="color: hsl(120, 100%, 40%);">+      Content-Length: 0</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    ]]></span><br><span style="color: hsl(120, 100%, 40%);">+  </send></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <recv response="200" /></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <!-- Receive NOTIFY due to solicited subscription shutdown --></span><br><span style="color: hsl(120, 100%, 40%);">+  <recv request="NOTIFY"></span><br><span style="color: hsl(120, 100%, 40%);">+    <action></span><br><span style="color: hsl(120, 100%, 40%);">+      <ereg regexp="message-summary" check_it="true" search_in="hdr" header="Event" assign_to="event" /></span><br><span style="color: hsl(120, 100%, 40%);">+      <ereg regexp="terminated" check_it="true" search_in="hdr" header="Subscription-State" assign_to="state" /></span><br><span style="color: hsl(120, 100%, 40%);">+      <ereg regexp="Voice-Message: 1\/1" check_it="true" search_in="body" assign_to="vm" /></span><br><span style="color: hsl(120, 100%, 40%);">+    </action></span><br><span style="color: hsl(120, 100%, 40%);">+  </recv></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <send></span><br><span style="color: hsl(120, 100%, 40%);">+    <![CDATA[</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+      SIP/2.0 200 OK</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_Via:]</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_From:]</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_To:]</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_Call-ID:]</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_CSeq:]</span><br><span style="color: hsl(120, 100%, 40%);">+      Contact: <sip:[local_ip]:[local_port];transport=[transport]></span><br><span style="color: hsl(120, 100%, 40%);">+      Content-Length: 0</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    ]]></span><br><span style="color: hsl(120, 100%, 40%);">+  </send></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <Reference variables="event,state,vm" /></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+</scenario></span><br><span>diff --git a/tests/channels/pjsip/subscriptions/mwi/solicited/replaced_by_unsolicited/non_aggregate/sipp/unsolicited.xml b/tests/channels/pjsip/subscriptions/mwi/solicited/replaced_by_unsolicited/non_aggregate/sipp/unsolicited.xml</span><br><span>new file mode 100644</span><br><span>index 0000000..2e5aaad</span><br><span>--- /dev/null</span><br><span>+++ b/tests/channels/pjsip/subscriptions/mwi/solicited/replaced_by_unsolicited/non_aggregate/sipp/unsolicited.xml</span><br><span>@@ -0,0 +1,59 @@</span><br><span style="color: hsl(120, 100%, 40%);">+<?xml version="1.0" encoding="ISO-8859-1" ?></span><br><span style="color: hsl(120, 100%, 40%);">+<!DOCTYPE scenario SYSTEM "sipp.dtd"></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+<scenario name="Unsolicited"></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <recv request="NOTIFY"></span><br><span style="color: hsl(120, 100%, 40%);">+    <action></span><br><span style="color: hsl(120, 100%, 40%);">+        <ereg regexp="message-summary" check_it="true" search_in="hdr" header="Event" assign_to="event" /></span><br><span style="color: hsl(120, 100%, 40%);">+      <ereg regexp="terminated" check_it="true" search_in="hdr" header="Subscription-State" assign_to="state" /></span><br><span style="color: hsl(120, 100%, 40%);">+      <ereg regexp="Voice-Message: [1|2]\/[1|2]" check_it="true" search_in="body" assign_to="vm" /></span><br><span style="color: hsl(120, 100%, 40%);">+       <!-- Get the call number and see if we've either met or acceded the expected number. --></span><br><span style="color: hsl(120, 100%, 40%);">+      <assignstr assign_to="call_num" value="[call_number]" /></span><br><span style="color: hsl(120, 100%, 40%);">+      <todouble assign_to="count" variable="call_num" /></span><br><span style="color: hsl(120, 100%, 40%);">+      <test assign_to="expected" variable="count" compare="equal" value="2" /></span><br><span style="color: hsl(120, 100%, 40%);">+      <test assign_to="greater" variable="count" compare="greater_than" value="2" /></span><br><span style="color: hsl(120, 100%, 40%);">+    </action></span><br><span style="color: hsl(120, 100%, 40%);">+  </recv></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <send></span><br><span style="color: hsl(120, 100%, 40%);">+    <![CDATA[</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+      SIP/2.0 200 OK</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_Via:]</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_From:]</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_To:]</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_Call-ID:]</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_CSeq:]</span><br><span style="color: hsl(120, 100%, 40%);">+      Contact: <sip:[local_ip]:[local_port];transport=[transport]></span><br><span style="color: hsl(120, 100%, 40%);">+      Content-Length: 0</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    ]]></span><br><span style="color: hsl(120, 100%, 40%);">+  </send></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <!-- Fail the scenario if we've received more than the expected number of calls --></span><br><span style="color: hsl(120, 100%, 40%);">+  <nop condexec="greater"></span><br><span style="color: hsl(120, 100%, 40%);">+    <action></span><br><span style="color: hsl(120, 100%, 40%);">+      <error message="Received too many out of call NOTIFYs ([call_id])" /></span><br><span style="color: hsl(120, 100%, 40%);">+    </action></span><br><span style="color: hsl(120, 100%, 40%);">+  </nop></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <!-- Pause for a time less than the global timeout, but long enough where we feel</span><br><span style="color: hsl(120, 100%, 40%);">+       that we won't potentially receive any erroneous calls after the expected call</span><br><span style="color: hsl(120, 100%, 40%);">+       count has been met. If we stop too soon then the scenario could have successfully</span><br><span style="color: hsl(120, 100%, 40%);">+       ended, but another unexpected message may have potentially arrived, which in</span><br><span style="color: hsl(120, 100%, 40%);">+       that case we should have failed the test. --></span><br><span style="color: hsl(120, 100%, 40%);">+  <pause milliseconds="10000" /></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <!-- Stop the scenario gracefully if we've received the expected number of calls</span><br><span style="color: hsl(120, 100%, 40%);">+     Note, do this stops the test in a non-failure mode. --></span><br><span style="color: hsl(120, 100%, 40%);">+  <nop condexec="expected"></span><br><span style="color: hsl(120, 100%, 40%);">+    <action></span><br><span style="color: hsl(120, 100%, 40%);">+      <log message="call count met stopping test" /></span><br><span style="color: hsl(120, 100%, 40%);">+      <exec int_cmd="stop_gracefully" /></span><br><span style="color: hsl(120, 100%, 40%);">+    </action></span><br><span style="color: hsl(120, 100%, 40%);">+  </nop></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <Reference variables="event,state,vm" /></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+</scenario></span><br><span>diff --git a/tests/channels/pjsip/subscriptions/mwi/solicited/replaced_by_unsolicited/non_aggregate/test-config.yaml b/tests/channels/pjsip/subscriptions/mwi/solicited/replaced_by_unsolicited/non_aggregate/test-config.yaml</span><br><span>new file mode 100644</span><br><span>index 0000000..d875013</span><br><span>--- /dev/null</span><br><span>+++ b/tests/channels/pjsip/subscriptions/mwi/solicited/replaced_by_unsolicited/non_aggregate/test-config.yaml</span><br><span>@@ -0,0 +1,72 @@</span><br><span style="color: hsl(120, 100%, 40%);">+testinfo:</span><br><span style="color: hsl(120, 100%, 40%);">+    summary: 'Test a solicited subscription getting replaced by an unsolicited one.'</span><br><span style="color: hsl(120, 100%, 40%);">+    description: |</span><br><span style="color: hsl(120, 100%, 40%);">+        'This tests that when the mwi_subscribe_replaces_unsolicited option is</span><br><span style="color: hsl(120, 100%, 40%);">+        disabled (set to "no"), and a contact is updated, thus setting up the</span><br><span style="color: hsl(120, 100%, 40%);">+        unsolicited subscription, the solicited subscription is properly</span><br><span style="color: hsl(120, 100%, 40%);">+        terminated. As well this verifies that the unsolicited subscription</span><br><span style="color: hsl(120, 100%, 40%);">+        gets setup.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+        Note, this tests disables initial unsolicited at startup in order to</span><br><span style="color: hsl(120, 100%, 40%);">+        make the test a bit more deterministic.'</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+properties:</span><br><span style="color: hsl(120, 100%, 40%);">+    dependencies:</span><br><span style="color: hsl(120, 100%, 40%);">+        - python: 'twisted'</span><br><span style="color: hsl(120, 100%, 40%);">+        - python: 'starpy'</span><br><span style="color: hsl(120, 100%, 40%);">+        - asterisk: 'res_pjsip'</span><br><span style="color: hsl(120, 100%, 40%);">+        - asterisk: 'res_pjsip_mwi'</span><br><span style="color: hsl(120, 100%, 40%);">+        - asterisk: 'res_mwi_external'</span><br><span style="color: hsl(120, 100%, 40%);">+        - asterisk: 'res_mwi_external_ami'</span><br><span style="color: hsl(120, 100%, 40%);">+        - sipp:</span><br><span style="color: hsl(120, 100%, 40%);">+            version: 'v3.0'</span><br><span style="color: hsl(120, 100%, 40%);">+    tags:</span><br><span style="color: hsl(120, 100%, 40%);">+        - pjsip</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+test-modules:</span><br><span style="color: hsl(120, 100%, 40%);">+    test-object:</span><br><span style="color: hsl(120, 100%, 40%);">+        config-section: 'sipp-config'</span><br><span style="color: hsl(120, 100%, 40%);">+        typename: 'sipp.SIPpTestCase'</span><br><span style="color: hsl(120, 100%, 40%);">+    modules:</span><br><span style="color: hsl(120, 100%, 40%);">+        -</span><br><span style="color: hsl(120, 100%, 40%);">+            config-section: 'event-action-config'</span><br><span style="color: hsl(120, 100%, 40%);">+            typename: 'pluggable_modules.EventActionModule'</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+sipp-config:</span><br><span style="color: hsl(120, 100%, 40%);">+    test-iterations:</span><br><span style="color: hsl(120, 100%, 40%);">+        -</span><br><span style="color: hsl(120, 100%, 40%);">+            # Due to the nature of SIPp, and it's handling of out of call messages</span><br><span style="color: hsl(120, 100%, 40%);">+            # we'll execute two scenarios. One to receive unsolicited MWI, and</span><br><span style="color: hsl(120, 100%, 40%);">+            # another to handle solicited MWI.</span><br><span style="color: hsl(120, 100%, 40%);">+            scenarios:</span><br><span style="color: hsl(120, 100%, 40%);">+                # For this test we expect to receive 2 unsolicited MWI messages.</span><br><span style="color: hsl(120, 100%, 40%);">+                # One for "mb1" and one for "mb2". Both occur when unsolicited is</span><br><span style="color: hsl(120, 100%, 40%);">+                # being setup post REGISTER (contact update).</span><br><span style="color: hsl(120, 100%, 40%);">+                #</span><br><span style="color: hsl(120, 100%, 40%);">+                # Even though we expect only 2 unsolicited messages set the call count</span><br><span style="color: hsl(120, 100%, 40%);">+                # to 3 for the scenario. Once the expected call count is met the scenario</span><br><span style="color: hsl(120, 100%, 40%);">+                # is responsible for gracefully shutting itself down. See the scenario</span><br><span style="color: hsl(120, 100%, 40%);">+                # itself for more information.</span><br><span style="color: hsl(120, 100%, 40%);">+                #</span><br><span style="color: hsl(120, 100%, 40%);">+                # Note, we must tell SIPp to cause an error on scenario timeout (20 seconds).</span><br><span style="color: hsl(120, 100%, 40%);">+                # This way the test will fail if the expected number of calls is not met.</span><br><span style="color: hsl(120, 100%, 40%);">+                - { 'key-args': {'scenario': 'unsolicited.xml', '-i': '127.0.0.1', '-p': '5062', '-m': '3', '-timeout_error': ''} }</span><br><span style="color: hsl(120, 100%, 40%);">+                - { 'key-args': {'scenario': 'solicited.xml', '-i': '127.0.0.1', '-p': '5061', '-s': 'alice'} }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+event-action-config:</span><br><span style="color: hsl(120, 100%, 40%);">+    -</span><br><span style="color: hsl(120, 100%, 40%);">+        ami-start:</span><br><span style="color: hsl(120, 100%, 40%);">+        ami-actions:</span><br><span style="color: hsl(120, 100%, 40%);">+            action:</span><br><span style="color: hsl(120, 100%, 40%);">+                Action: 'MWIUpdate'</span><br><span style="color: hsl(120, 100%, 40%);">+                Mailbox: 'mb1'</span><br><span style="color: hsl(120, 100%, 40%);">+                NewMessages: 1</span><br><span style="color: hsl(120, 100%, 40%);">+                OldMessages: 1</span><br><span style="color: hsl(120, 100%, 40%);">+    -</span><br><span style="color: hsl(120, 100%, 40%);">+        ami-start:</span><br><span style="color: hsl(120, 100%, 40%);">+        ami-actions:</span><br><span style="color: hsl(120, 100%, 40%);">+            action:</span><br><span style="color: hsl(120, 100%, 40%);">+                Action: 'MWIUpdate'</span><br><span style="color: hsl(120, 100%, 40%);">+                Mailbox: 'mb2'</span><br><span style="color: hsl(120, 100%, 40%);">+                NewMessages: 2</span><br><span style="color: hsl(120, 100%, 40%);">+                OldMessages: 2</span><br><span>diff --git a/tests/channels/pjsip/subscriptions/mwi/solicited/replaced_by_unsolicited/tests.yaml b/tests/channels/pjsip/subscriptions/mwi/solicited/replaced_by_unsolicited/tests.yaml</span><br><span>new file mode 100644</span><br><span>index 0000000..79bdfe0</span><br><span>--- /dev/null</span><br><span>+++ b/tests/channels/pjsip/subscriptions/mwi/solicited/replaced_by_unsolicited/tests.yaml</span><br><span>@@ -0,0 +1,4 @@</span><br><span style="color: hsl(120, 100%, 40%);">+# Enter tests here in the order they should be considered for execution:</span><br><span style="color: hsl(120, 100%, 40%);">+tests:</span><br><span style="color: hsl(120, 100%, 40%);">+    - test: 'aggregate'</span><br><span style="color: hsl(120, 100%, 40%);">+    - test: 'non_aggregate'</span><br><span>diff --git a/tests/channels/pjsip/subscriptions/mwi/solicited/replaces_unsolicited/aggregate/configs/ast1/pjsip.conf b/tests/channels/pjsip/subscriptions/mwi/solicited/replaces_unsolicited/aggregate/configs/ast1/pjsip.conf</span><br><span>new file mode 100644</span><br><span>index 0000000..5b1f463</span><br><span>--- /dev/null</span><br><span>+++ b/tests/channels/pjsip/subscriptions/mwi/solicited/replaces_unsolicited/aggregate/configs/ast1/pjsip.conf</span><br><span>@@ -0,0 +1,29 @@</span><br><span style="color: hsl(120, 100%, 40%);">+[global]</span><br><span style="color: hsl(120, 100%, 40%);">+debug=yes</span><br><span style="color: hsl(120, 100%, 40%);">+mwi_disable_initial_unsolicited=yes</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+[transport-template](!)</span><br><span style="color: hsl(120, 100%, 40%);">+type=transport</span><br><span style="color: hsl(120, 100%, 40%);">+bind=127.0.0.1:5060</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+[transport-udp](transport-template)</span><br><span style="color: hsl(120, 100%, 40%);">+protocol=udp</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+[aor-template](!)</span><br><span style="color: hsl(120, 100%, 40%);">+type=aor</span><br><span style="color: hsl(120, 100%, 40%);">+max_contacts=1</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+[endpoint-template](!)</span><br><span style="color: hsl(120, 100%, 40%);">+type=endpoint</span><br><span style="color: hsl(120, 100%, 40%);">+context=default</span><br><span style="color: hsl(120, 100%, 40%);">+allow=!all,ulaw</span><br><span style="color: hsl(120, 100%, 40%);">+direct_media=false</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+[alice](aor-template)</span><br><span style="color: hsl(120, 100%, 40%);">+mailboxes=mb1</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+[alice](endpoint-template)</span><br><span style="color: hsl(120, 100%, 40%);">+aors=alice</span><br><span style="color: hsl(120, 100%, 40%);">+mailboxes=mb1,mb2</span><br><span style="color: hsl(120, 100%, 40%);">+mwi_subscribe_replaces_unsolicited=yes</span><br><span style="color: hsl(120, 100%, 40%);">+aggregate_mwi=yes</span><br><span>diff --git a/tests/channels/pjsip/subscriptions/mwi/solicited/replaces_unsolicited/aggregate/sipp/solicited.xml b/tests/channels/pjsip/subscriptions/mwi/solicited/replaces_unsolicited/aggregate/sipp/solicited.xml</span><br><span>new file mode 100644</span><br><span>index 0000000..cb0d96e</span><br><span>--- /dev/null</span><br><span>+++ b/tests/channels/pjsip/subscriptions/mwi/solicited/replaces_unsolicited/aggregate/sipp/solicited.xml</span><br><span>@@ -0,0 +1,138 @@</span><br><span style="color: hsl(120, 100%, 40%);">+<?xml version="1.0" encoding="ISO-8859-1" ?></span><br><span style="color: hsl(120, 100%, 40%);">+<!DOCTYPE scenario SYSTEM "sipp.dtd"></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+<scenario name="Solicited"></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <!-- Wait a few seconds before initiating the scenario to make sure</span><br><span style="color: hsl(120, 100%, 40%);">+      the mailbox(es) have been updated --></span><br><span style="color: hsl(120, 100%, 40%);">+  <pause milliseconds="3000" /></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <!-- Once the contact is registered a SIP NOTIFY (for unsolicited MWI) is sent to</span><br><span style="color: hsl(120, 100%, 40%);">+           the contact. Note, this registers the contact to port 5062 where SIP NOTIFY's</span><br><span style="color: hsl(120, 100%, 40%);">+     for unsolicited MWI are expected --></span><br><span style="color: hsl(120, 100%, 40%);">+  <send retrans="500"></span><br><span style="color: hsl(120, 100%, 40%);">+    <![CDATA[</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+      REGISTER sip:[remote_ip]:[remote_port] SIP/2.0</span><br><span style="color: hsl(120, 100%, 40%);">+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]</span><br><span style="color: hsl(120, 100%, 40%);">+      From: "[service]" <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]</span><br><span style="color: hsl(120, 100%, 40%);">+      To: "[service]" <sip:[service]@[remote_ip]:[remote_port]></span><br><span style="color: hsl(120, 100%, 40%);">+      Call-ID: [call_id]</span><br><span style="color: hsl(120, 100%, 40%);">+      CSeq: [cseq] REGISTER</span><br><span style="color: hsl(120, 100%, 40%);">+      Max-Forwards: 70</span><br><span style="color: hsl(120, 100%, 40%);">+      Contact: <sip:[service]@[local_ip]:5062;transport=[transport]></span><br><span style="color: hsl(120, 100%, 40%);">+      Expires: 60</span><br><span style="color: hsl(120, 100%, 40%);">+      Content-Length: 0</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    ]]></span><br><span style="color: hsl(120, 100%, 40%);">+  </send></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <recv response="200" /></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <!-- Wait a few more seconds to make sure the unsolicited NOTIFY is received</span><br><span style="color: hsl(120, 100%, 40%);">+         before subscribing --></span><br><span style="color: hsl(120, 100%, 40%);">+  <pause milliseconds="3000" /></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <!-- Now subscribe --></span><br><span style="color: hsl(120, 100%, 40%);">+  <send retrans="500"></span><br><span style="color: hsl(120, 100%, 40%);">+    <![CDATA[</span><br><span style="color: hsl(120, 100%, 40%);">+      SUBSCRIBE sip:[service]@[remote_ip]:[remote_port] SIP/2.0</span><br><span style="color: hsl(120, 100%, 40%);">+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]</span><br><span style="color: hsl(120, 100%, 40%);">+      From: "alice" <sip:alice@[local_ip]:[local_port]>;tag=[call_number]</span><br><span style="color: hsl(120, 100%, 40%);">+      To: "alice" <sip:[service]@[remote_ip]:[remote_port]></span><br><span style="color: hsl(120, 100%, 40%);">+      Call-ID: [call_id]</span><br><span style="color: hsl(120, 100%, 40%);">+      CSeq: 1 SUBSCRIBE</span><br><span style="color: hsl(120, 100%, 40%);">+      Contact: "alice" <sip:alice@[local_ip]:[local_port]></span><br><span style="color: hsl(120, 100%, 40%);">+      Max-Forwards: 70</span><br><span style="color: hsl(120, 100%, 40%);">+      Event: message-summary</span><br><span style="color: hsl(120, 100%, 40%);">+      Expires: 60</span><br><span style="color: hsl(120, 100%, 40%);">+      Accept: application/simple-message-summary</span><br><span style="color: hsl(120, 100%, 40%);">+      Allow-Events: message-summary</span><br><span style="color: hsl(120, 100%, 40%);">+      Content-Length: 0</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    ]]></span><br><span style="color: hsl(120, 100%, 40%);">+  </send></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <recv response="200"></span><br><span style="color: hsl(120, 100%, 40%);">+    <action></span><br><span style="color: hsl(120, 100%, 40%);">+          <!-- Get the tag to use when unsubscribing --></span><br><span style="color: hsl(120, 100%, 40%);">+          <ereg regexp="(;tag=.*)" header="To:" search_in="hdr" check_it="true" assign_to="to_tag"/></span><br><span style="color: hsl(120, 100%, 40%);">+    </action></span><br><span style="color: hsl(120, 100%, 40%);">+  </recv></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <!-- Receive NOTIFY due to SUBSCRIBE --></span><br><span style="color: hsl(120, 100%, 40%);">+  <recv request="NOTIFY"></span><br><span style="color: hsl(120, 100%, 40%);">+    <action></span><br><span style="color: hsl(120, 100%, 40%);">+      <ereg regexp="message-summary" check_it="true" search_in="hdr" header="Event" assign_to="event" /></span><br><span style="color: hsl(120, 100%, 40%);">+      <ereg regexp="active;expires=[5,6][0-9]" check_it="true" search_in="hdr" header="Subscription-State" assign_to="state" /></span><br><span style="color: hsl(120, 100%, 40%);">+      <ereg regexp="Voice-Message: 1\/1" check_it="true" search_in="body" assign_to="vm" /></span><br><span style="color: hsl(120, 100%, 40%);">+    </action></span><br><span style="color: hsl(120, 100%, 40%);">+  </recv></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <send></span><br><span style="color: hsl(120, 100%, 40%);">+    <![CDATA[</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+      SIP/2.0 200 OK</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_Via:]</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_From:]</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_To:]</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_Call-ID:]</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_CSeq:]</span><br><span style="color: hsl(120, 100%, 40%);">+      Contact: <sip:[local_ip]:[local_port];transport=[transport]></span><br><span style="color: hsl(120, 100%, 40%);">+      Content-Length: 0</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    ]]></span><br><span style="color: hsl(120, 100%, 40%);">+  </send></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <pause milliseconds="1000" /></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <!-- Unsubscribe --></span><br><span style="color: hsl(120, 100%, 40%);">+  <send retrans="500"></span><br><span style="color: hsl(120, 100%, 40%);">+    <![CDATA[</span><br><span style="color: hsl(120, 100%, 40%);">+      SUBSCRIBE sip:[service]@[remote_ip]:[remote_port] SIP/2.0</span><br><span style="color: hsl(120, 100%, 40%);">+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]</span><br><span style="color: hsl(120, 100%, 40%);">+      From: "alice" <sip:alice@[local_ip]:[local_port]>;tag=[call_number]</span><br><span style="color: hsl(120, 100%, 40%);">+      To: "alice" <sip:[service]@[remote_ip]:[remote_port]>[$to_tag]</span><br><span style="color: hsl(120, 100%, 40%);">+      Call-ID: [call_id]</span><br><span style="color: hsl(120, 100%, 40%);">+      CSeq: 3 SUBSCRIBE</span><br><span style="color: hsl(120, 100%, 40%);">+      Contact: "alice" <sip:alice@[local_ip]:[local_port]></span><br><span style="color: hsl(120, 100%, 40%);">+      Max-Forwards: 70</span><br><span style="color: hsl(120, 100%, 40%);">+      Event: message-summary</span><br><span style="color: hsl(120, 100%, 40%);">+      Expires: 0</span><br><span style="color: hsl(120, 100%, 40%);">+      Accept: application/simple-message-summary</span><br><span style="color: hsl(120, 100%, 40%);">+      Allow-Events: message-summary</span><br><span style="color: hsl(120, 100%, 40%);">+      User-Agent: SIPp</span><br><span style="color: hsl(120, 100%, 40%);">+      Content-Length: 0</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    ]]></span><br><span style="color: hsl(120, 100%, 40%);">+  </send></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <recv response="200" /></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <!-- Receive NOTIFY due to unsubscribe --></span><br><span style="color: hsl(120, 100%, 40%);">+  <recv request="NOTIFY"></span><br><span style="color: hsl(120, 100%, 40%);">+    <action></span><br><span style="color: hsl(120, 100%, 40%);">+      <ereg regexp="message-summary" check_it="true" search_in="hdr" header="Event" assign_to="event" /></span><br><span style="color: hsl(120, 100%, 40%);">+      <ereg regexp="terminated" check_it="true" search_in="hdr" header="Subscription-State" assign_to="state" /></span><br><span style="color: hsl(120, 100%, 40%);">+      <ereg regexp="Voice-Message: 1\/1" check_it="true" search_in="body" assign_to="vm" /></span><br><span style="color: hsl(120, 100%, 40%);">+    </action></span><br><span style="color: hsl(120, 100%, 40%);">+  </recv></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <send></span><br><span style="color: hsl(120, 100%, 40%);">+    <![CDATA[</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+      SIP/2.0 200 OK</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_Via:]</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_From:]</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_To:]</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_Call-ID:]</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_CSeq:]</span><br><span style="color: hsl(120, 100%, 40%);">+      Contact: <sip:[local_ip]:[local_port];transport=[transport]></span><br><span style="color: hsl(120, 100%, 40%);">+      Content-Length: 0</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    ]]></span><br><span style="color: hsl(120, 100%, 40%);">+  </send></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <Reference variables="event,state,vm" /></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+</scenario></span><br><span>diff --git a/tests/channels/pjsip/subscriptions/mwi/solicited/replaces_unsolicited/aggregate/sipp/unsolicited.xml b/tests/channels/pjsip/subscriptions/mwi/solicited/replaces_unsolicited/aggregate/sipp/unsolicited.xml</span><br><span>new file mode 100644</span><br><span>index 0000000..f3479d1</span><br><span>--- /dev/null</span><br><span>+++ b/tests/channels/pjsip/subscriptions/mwi/solicited/replaces_unsolicited/aggregate/sipp/unsolicited.xml</span><br><span>@@ -0,0 +1,59 @@</span><br><span style="color: hsl(120, 100%, 40%);">+<?xml version="1.0" encoding="ISO-8859-1" ?></span><br><span style="color: hsl(120, 100%, 40%);">+<!DOCTYPE scenario SYSTEM "sipp.dtd"></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+<scenario name="Unsolicited"></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <recv request="NOTIFY"></span><br><span style="color: hsl(120, 100%, 40%);">+    <action></span><br><span style="color: hsl(120, 100%, 40%);">+      <ereg regexp="message-summary" check_it="true" search_in="hdr" header="Event" assign_to="event" /></span><br><span style="color: hsl(120, 100%, 40%);">+      <ereg regexp="terminated" check_it="true" search_in="hdr" header="Subscription-State" assign_to="state" /></span><br><span style="color: hsl(120, 100%, 40%);">+      <ereg regexp="Voice-Message: [3]\/[3]" check_it="true" search_in="body" assign_to="vm" /></span><br><span style="color: hsl(120, 100%, 40%);">+   <!-- Get the call number and see if we've either met or acceded the expected number. --></span><br><span style="color: hsl(120, 100%, 40%);">+      <assignstr assign_to="call_num" value="[call_number]" /></span><br><span style="color: hsl(120, 100%, 40%);">+      <todouble assign_to="count" variable="call_num" /></span><br><span style="color: hsl(120, 100%, 40%);">+      <test assign_to="expected" variable="count" compare="equal" value="2" /></span><br><span style="color: hsl(120, 100%, 40%);">+      <test assign_to="greater" variable="count" compare="greater_than" value="2" /></span><br><span style="color: hsl(120, 100%, 40%);">+    </action></span><br><span style="color: hsl(120, 100%, 40%);">+  </recv></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <send></span><br><span style="color: hsl(120, 100%, 40%);">+    <![CDATA[</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+      SIP/2.0 200 OK</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_Via:]</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_From:]</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_To:]</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_Call-ID:]</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_CSeq:]</span><br><span style="color: hsl(120, 100%, 40%);">+      Contact: <sip:[local_ip]:[local_port];transport=[transport]></span><br><span style="color: hsl(120, 100%, 40%);">+      Content-Length: 0</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    ]]></span><br><span style="color: hsl(120, 100%, 40%);">+  </send></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <!-- Fail the scenario if we've received more than the expected number of calls --></span><br><span style="color: hsl(120, 100%, 40%);">+  <nop condexec="greater"></span><br><span style="color: hsl(120, 100%, 40%);">+    <action></span><br><span style="color: hsl(120, 100%, 40%);">+      <error message="Received too many out of call NOTIFYs ([call_id])" /></span><br><span style="color: hsl(120, 100%, 40%);">+    </action></span><br><span style="color: hsl(120, 100%, 40%);">+  </nop></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <!-- Pause for a time less than the global timeout, but long enough where we feel</span><br><span style="color: hsl(120, 100%, 40%);">+       that we won't potentially receive any erroneous calls after the expected call</span><br><span style="color: hsl(120, 100%, 40%);">+       count has been met. If we stop too soon then the scenario could have successfully</span><br><span style="color: hsl(120, 100%, 40%);">+       ended, but another unexpected message may have potentially arrived, which in</span><br><span style="color: hsl(120, 100%, 40%);">+       that case we should have failed the test. --></span><br><span style="color: hsl(120, 100%, 40%);">+  <pause milliseconds="11000" /></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <!-- Stop the scenario gracefully if we've received the expected number of calls</span><br><span style="color: hsl(120, 100%, 40%);">+     Note, do this stops the test in a non-failure mode. --></span><br><span style="color: hsl(120, 100%, 40%);">+  <nop condexec="expected"></span><br><span style="color: hsl(120, 100%, 40%);">+    <action></span><br><span style="color: hsl(120, 100%, 40%);">+      <log message="call count met stopping test" /></span><br><span style="color: hsl(120, 100%, 40%);">+      <exec int_cmd="stop_gracefully" /></span><br><span style="color: hsl(120, 100%, 40%);">+    </action></span><br><span style="color: hsl(120, 100%, 40%);">+  </nop></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <Reference variables="event,state,vm" /></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+</scenario></span><br><span>diff --git a/tests/channels/pjsip/subscriptions/mwi/solicited/replaces_unsolicited/aggregate/test-config.yaml b/tests/channels/pjsip/subscriptions/mwi/solicited/replaces_unsolicited/aggregate/test-config.yaml</span><br><span>new file mode 100644</span><br><span>index 0000000..29e2b82</span><br><span>--- /dev/null</span><br><span>+++ b/tests/channels/pjsip/subscriptions/mwi/solicited/replaces_unsolicited/aggregate/test-config.yaml</span><br><span>@@ -0,0 +1,74 @@</span><br><span style="color: hsl(120, 100%, 40%);">+testinfo:</span><br><span style="color: hsl(120, 100%, 40%);">+    summary: 'Test replacing an aggregated unsolicited subscription with a solicited one.'</span><br><span style="color: hsl(120, 100%, 40%);">+    description: |</span><br><span style="color: hsl(120, 100%, 40%);">+        'After enabling the mwi_subscribe_replaces_unsolicited option on an</span><br><span style="color: hsl(120, 100%, 40%);">+        endpoint, this tests to make sure an aggregated solicited subscription</span><br><span style="color: hsl(120, 100%, 40%);">+        for MWI is allowed to replace the unsolicited subscription, and</span><br><span style="color: hsl(120, 100%, 40%);">+        subsequently replaced by an unsolicited again when unsubscribed.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+        Note, this tests disables initial unsolicited at startup in order to</span><br><span style="color: hsl(120, 100%, 40%);">+        make the test a bit more deterministic.'</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+properties:</span><br><span style="color: hsl(120, 100%, 40%);">+    dependencies:</span><br><span style="color: hsl(120, 100%, 40%);">+        - python: 'twisted'</span><br><span style="color: hsl(120, 100%, 40%);">+        - python: 'starpy'</span><br><span style="color: hsl(120, 100%, 40%);">+        - asterisk: 'res_pjsip'</span><br><span style="color: hsl(120, 100%, 40%);">+        - asterisk: 'res_pjsip_mwi'</span><br><span style="color: hsl(120, 100%, 40%);">+        - asterisk: 'res_mwi_external'</span><br><span style="color: hsl(120, 100%, 40%);">+        - asterisk: 'res_mwi_external_ami'</span><br><span style="color: hsl(120, 100%, 40%);">+        - sipp:</span><br><span style="color: hsl(120, 100%, 40%);">+            version: 'v3.0'</span><br><span style="color: hsl(120, 100%, 40%);">+    tags:</span><br><span style="color: hsl(120, 100%, 40%);">+        - pjsip</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+test-modules:</span><br><span style="color: hsl(120, 100%, 40%);">+    test-object:</span><br><span style="color: hsl(120, 100%, 40%);">+        config-section: 'sipp-config'</span><br><span style="color: hsl(120, 100%, 40%);">+        typename: 'sipp.SIPpTestCase'</span><br><span style="color: hsl(120, 100%, 40%);">+    modules:</span><br><span style="color: hsl(120, 100%, 40%);">+        -</span><br><span style="color: hsl(120, 100%, 40%);">+            config-section: 'event-action-config'</span><br><span style="color: hsl(120, 100%, 40%);">+            typename: 'pluggable_modules.EventActionModule'</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+sipp-config:</span><br><span style="color: hsl(120, 100%, 40%);">+    test-iterations:</span><br><span style="color: hsl(120, 100%, 40%);">+        -</span><br><span style="color: hsl(120, 100%, 40%);">+            # Due to the nature of SIPp, and it's handling of out of call messages</span><br><span style="color: hsl(120, 100%, 40%);">+            # we'll execute two scenarios. One to receive unsolicited MWI, and</span><br><span style="color: hsl(120, 100%, 40%);">+            # another to handle solicited MWI.</span><br><span style="color: hsl(120, 100%, 40%);">+            scenarios:</span><br><span style="color: hsl(120, 100%, 40%);">+                # For this test we expect to receive 2 unsolicited MWI messages.</span><br><span style="color: hsl(120, 100%, 40%);">+                # The first happens after the initial REGISTER (on contact</span><br><span style="color: hsl(120, 100%, 40%);">+                # updated). One NOTIFY is sent containing the combined message</span><br><span style="color: hsl(120, 100%, 40%);">+                # counts for "mb1" and "mb2". Upon unsubscribing, the replaced</span><br><span style="color: hsl(120, 100%, 40%);">+                # NOTIFY unsolicited subscription get recreated and sends out another</span><br><span style="color: hsl(120, 100%, 40%);">+                # again with the combined message count.</span><br><span style="color: hsl(120, 100%, 40%);">+                #</span><br><span style="color: hsl(120, 100%, 40%);">+                # Even though we expect only 2 unsolicited messages set the call count</span><br><span style="color: hsl(120, 100%, 40%);">+                # to 3 for the scenario. Once the expected call count is met the scenario</span><br><span style="color: hsl(120, 100%, 40%);">+                # is responsible for gracefully shutting itself down. See the scenario</span><br><span style="color: hsl(120, 100%, 40%);">+                # itself for more information.</span><br><span style="color: hsl(120, 100%, 40%);">+                #</span><br><span style="color: hsl(120, 100%, 40%);">+                # Note, we must tell SIPp to cause an error on scenario timeout.</span><br><span style="color: hsl(120, 100%, 40%);">+                # This way the test will fail if the expected number of calls is not met.</span><br><span style="color: hsl(120, 100%, 40%);">+                - { 'key-args': {'scenario': 'unsolicited.xml', '-i': '127.0.0.1', '-p': '5062', '-m': '3', '-timeout': '25', '-timeout_error': ''} }</span><br><span style="color: hsl(120, 100%, 40%);">+                - { 'key-args': {'scenario': 'solicited.xml', '-i': '127.0.0.1', '-p': '5061', '-s': 'alice'} }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+event-action-config:</span><br><span style="color: hsl(120, 100%, 40%);">+    -</span><br><span style="color: hsl(120, 100%, 40%);">+        ami-start:</span><br><span style="color: hsl(120, 100%, 40%);">+        ami-actions:</span><br><span style="color: hsl(120, 100%, 40%);">+            action:</span><br><span style="color: hsl(120, 100%, 40%);">+                Action: 'MWIUpdate'</span><br><span style="color: hsl(120, 100%, 40%);">+                Mailbox: 'mb1'</span><br><span style="color: hsl(120, 100%, 40%);">+                NewMessages: 1</span><br><span style="color: hsl(120, 100%, 40%);">+                OldMessages: 1</span><br><span style="color: hsl(120, 100%, 40%);">+    -</span><br><span style="color: hsl(120, 100%, 40%);">+        ami-start:</span><br><span style="color: hsl(120, 100%, 40%);">+        ami-actions:</span><br><span style="color: hsl(120, 100%, 40%);">+            action:</span><br><span style="color: hsl(120, 100%, 40%);">+                Action: 'MWIUpdate'</span><br><span style="color: hsl(120, 100%, 40%);">+                Mailbox: 'mb2'</span><br><span style="color: hsl(120, 100%, 40%);">+                NewMessages: 2</span><br><span style="color: hsl(120, 100%, 40%);">+                OldMessages: 2</span><br><span>diff --git a/tests/channels/pjsip/subscriptions/mwi/solicited/replaces_unsolicited/multiple_registers/configs/ast1/pjsip.conf b/tests/channels/pjsip/subscriptions/mwi/solicited/replaces_unsolicited/multiple_registers/configs/ast1/pjsip.conf</span><br><span>new file mode 100644</span><br><span>index 0000000..65302f4</span><br><span>--- /dev/null</span><br><span>+++ b/tests/channels/pjsip/subscriptions/mwi/solicited/replaces_unsolicited/multiple_registers/configs/ast1/pjsip.conf</span><br><span>@@ -0,0 +1,29 @@</span><br><span style="color: hsl(120, 100%, 40%);">+[global]</span><br><span style="color: hsl(120, 100%, 40%);">+debug=yes</span><br><span style="color: hsl(120, 100%, 40%);">+mwi_disable_initial_unsolicited=yes</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+[transport-template](!)</span><br><span style="color: hsl(120, 100%, 40%);">+type=transport</span><br><span style="color: hsl(120, 100%, 40%);">+bind=127.0.0.1:5060</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+[transport-udp](transport-template)</span><br><span style="color: hsl(120, 100%, 40%);">+protocol=udp</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+[aor-template](!)</span><br><span style="color: hsl(120, 100%, 40%);">+type=aor</span><br><span style="color: hsl(120, 100%, 40%);">+max_contacts=1</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+[endpoint-template](!)</span><br><span style="color: hsl(120, 100%, 40%);">+type=endpoint</span><br><span style="color: hsl(120, 100%, 40%);">+context=default</span><br><span style="color: hsl(120, 100%, 40%);">+allow=!all,ulaw</span><br><span style="color: hsl(120, 100%, 40%);">+direct_media=false</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+[alice](aor-template)</span><br><span style="color: hsl(120, 100%, 40%);">+mailboxes=mb1</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+[alice](endpoint-template)</span><br><span style="color: hsl(120, 100%, 40%);">+aors=alice</span><br><span style="color: hsl(120, 100%, 40%);">+mailboxes=mb1</span><br><span style="color: hsl(120, 100%, 40%);">+mwi_subscribe_replaces_unsolicited=yes</span><br><span style="color: hsl(120, 100%, 40%);">+aggregate_mwi=no</span><br><span>diff --git a/tests/channels/pjsip/subscriptions/mwi/solicited/replaces_unsolicited/multiple_registers/sipp/solicited.xml b/tests/channels/pjsip/subscriptions/mwi/solicited/replaces_unsolicited/multiple_registers/sipp/solicited.xml</span><br><span>new file mode 100644</span><br><span>index 0000000..f9a6156</span><br><span>--- /dev/null</span><br><span>+++ b/tests/channels/pjsip/subscriptions/mwi/solicited/replaces_unsolicited/multiple_registers/sipp/solicited.xml</span><br><span>@@ -0,0 +1,148 @@</span><br><span style="color: hsl(120, 100%, 40%);">+<?xml version="1.0" encoding="ISO-8859-1" ?></span><br><span style="color: hsl(120, 100%, 40%);">+<!DOCTYPE scenario SYSTEM "sipp.dtd"></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+<scenario name="Solicited"></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <!-- Wait a few seconds before initiating the scenario to make sure</span><br><span style="color: hsl(120, 100%, 40%);">+        the mailbox(es) have been updated --></span><br><span style="color: hsl(120, 100%, 40%);">+  <pause milliseconds="3000" /></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <!-- Once the contact is registered a SIP NOTIFY (for unsolicited MWI) is sent to</span><br><span style="color: hsl(120, 100%, 40%);">+           the contact. Note, this registers the contact to port 5062 where SIP NOTIFY's</span><br><span style="color: hsl(120, 100%, 40%);">+     for unsolicited MWI are expected --></span><br><span style="color: hsl(120, 100%, 40%);">+  <send retrans="500"></span><br><span style="color: hsl(120, 100%, 40%);">+    <![CDATA[</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+      REGISTER sip:[remote_ip]:[remote_port] SIP/2.0</span><br><span style="color: hsl(120, 100%, 40%);">+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]</span><br><span style="color: hsl(120, 100%, 40%);">+      From: "[service]" <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]</span><br><span style="color: hsl(120, 100%, 40%);">+      To: "[service]" <sip:[service]@[remote_ip]:[remote_port]></span><br><span style="color: hsl(120, 100%, 40%);">+      Call-ID: [call_id]</span><br><span style="color: hsl(120, 100%, 40%);">+      CSeq: [cseq] REGISTER</span><br><span style="color: hsl(120, 100%, 40%);">+      Max-Forwards: 70</span><br><span style="color: hsl(120, 100%, 40%);">+      Contact: <sip:[service]@[local_ip]:5062;transport=[transport]></span><br><span style="color: hsl(120, 100%, 40%);">+      Expires: 60</span><br><span style="color: hsl(120, 100%, 40%);">+      Content-Length: 0</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    ]]></span><br><span style="color: hsl(120, 100%, 40%);">+  </send></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <recv response="200" /></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <!-- Wait a few more seconds to make sure the unsolicited NOTIFY is received</span><br><span style="color: hsl(120, 100%, 40%);">+         before subscribing --></span><br><span style="color: hsl(120, 100%, 40%);">+  <pause milliseconds="3000" /></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <!-- Now subscribe --></span><br><span style="color: hsl(120, 100%, 40%);">+  <send retrans="500"></span><br><span style="color: hsl(120, 100%, 40%);">+    <![CDATA[</span><br><span style="color: hsl(120, 100%, 40%);">+      SUBSCRIBE sip:[service]@[remote_ip]:[remote_port] SIP/2.0</span><br><span style="color: hsl(120, 100%, 40%);">+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]</span><br><span style="color: hsl(120, 100%, 40%);">+      From: "alice" <sip:alice@[local_ip]:[local_port]>;tag=[call_number]</span><br><span style="color: hsl(120, 100%, 40%);">+      To: "alice" <sip:[service]@[remote_ip]:[remote_port]></span><br><span style="color: hsl(120, 100%, 40%);">+      Call-ID: [call_id]</span><br><span style="color: hsl(120, 100%, 40%);">+      CSeq: 1 SUBSCRIBE</span><br><span style="color: hsl(120, 100%, 40%);">+      Contact: "alice" <sip:alice@[local_ip]:[local_port]></span><br><span style="color: hsl(120, 100%, 40%);">+      Max-Forwards: 70</span><br><span style="color: hsl(120, 100%, 40%);">+      Event: message-summary</span><br><span style="color: hsl(120, 100%, 40%);">+      Expires: 60</span><br><span style="color: hsl(120, 100%, 40%);">+      Accept: application/simple-message-summary</span><br><span style="color: hsl(120, 100%, 40%);">+      Allow-Events: message-summary</span><br><span style="color: hsl(120, 100%, 40%);">+      Content-Length: 0</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    ]]></span><br><span style="color: hsl(120, 100%, 40%);">+  </send></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <recv response="200" /></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <!-- Receive NOTIFY due to SUBSCRIBE --></span><br><span style="color: hsl(120, 100%, 40%);">+  <recv request="NOTIFY"></span><br><span style="color: hsl(120, 100%, 40%);">+    <action></span><br><span style="color: hsl(120, 100%, 40%);">+      <ereg regexp="message-summary" check_it="true" search_in="hdr" header="Event" assign_to="event" /></span><br><span style="color: hsl(120, 100%, 40%);">+      <ereg regexp="active;expires=[5,6][0-9]" check_it="true" search_in="hdr" header="Subscription-State" assign_to="state" /></span><br><span style="color: hsl(120, 100%, 40%);">+      <ereg regexp="Voice-Message: 1\/1" check_it="true" search_in="body" assign_to="vm" /></span><br><span style="color: hsl(120, 100%, 40%);">+    </action></span><br><span style="color: hsl(120, 100%, 40%);">+  </recv></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <send></span><br><span style="color: hsl(120, 100%, 40%);">+    <![CDATA[</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+      SIP/2.0 200 OK</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_Via:]</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_From:]</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_To:]</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_Call-ID:]</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_CSeq:]</span><br><span style="color: hsl(120, 100%, 40%);">+      Contact: <sip:[local_ip]:[local_port];transport=[transport]></span><br><span style="color: hsl(120, 100%, 40%);">+      Content-Length: 0</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    ]]></span><br><span style="color: hsl(120, 100%, 40%);">+  </send></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <pause milliseconds="1000" /></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <!-- Now send multiple REGISTERs "updating the contact" --></span><br><span style="color: hsl(120, 100%, 40%);">+  <send retrans="500"></span><br><span style="color: hsl(120, 100%, 40%);">+    <![CDATA[</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+      REGISTER sip:[remote_ip]:[remote_port] SIP/2.0</span><br><span style="color: hsl(120, 100%, 40%);">+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]</span><br><span style="color: hsl(120, 100%, 40%);">+      From: "[service]" <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]</span><br><span style="color: hsl(120, 100%, 40%);">+      To: "[service]" <sip:[service]@[remote_ip]:[remote_port]></span><br><span style="color: hsl(120, 100%, 40%);">+      Call-ID: [call_id]</span><br><span style="color: hsl(120, 100%, 40%);">+      CSeq: [cseq] REGISTER</span><br><span style="color: hsl(120, 100%, 40%);">+      Max-Forwards: 70</span><br><span style="color: hsl(120, 100%, 40%);">+      Contact: <sip:[service]@[local_ip]:5062;transport=[transport]></span><br><span style="color: hsl(120, 100%, 40%);">+      Expires: 180</span><br><span style="color: hsl(120, 100%, 40%);">+      Content-Length: 0</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    ]]></span><br><span style="color: hsl(120, 100%, 40%);">+  </send></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <recv response="200" /></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <pause milliseconds="1000" /></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <send retrans="500"></span><br><span style="color: hsl(120, 100%, 40%);">+    <![CDATA[</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+      REGISTER sip:[remote_ip]:[remote_port] SIP/2.0</span><br><span style="color: hsl(120, 100%, 40%);">+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]</span><br><span style="color: hsl(120, 100%, 40%);">+      From: "[service]" <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]</span><br><span style="color: hsl(120, 100%, 40%);">+      To: "[service]" <sip:[service]@[remote_ip]:[remote_port]></span><br><span style="color: hsl(120, 100%, 40%);">+      Call-ID: [call_id]</span><br><span style="color: hsl(120, 100%, 40%);">+      CSeq: [cseq] REGISTER</span><br><span style="color: hsl(120, 100%, 40%);">+      Max-Forwards: 70</span><br><span style="color: hsl(120, 100%, 40%);">+      Contact: <sip:[service]@[local_ip]:5062;transport=[transport]></span><br><span style="color: hsl(120, 100%, 40%);">+      Expires: 120</span><br><span style="color: hsl(120, 100%, 40%);">+      Content-Length: 0</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    ]]></span><br><span style="color: hsl(120, 100%, 40%);">+  </send></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <recv response="200" /></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <pause milliseconds="1000" /></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <send retrans="500"></span><br><span style="color: hsl(120, 100%, 40%);">+    <![CDATA[</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+      REGISTER sip:[remote_ip]:[remote_port] SIP/2.0</span><br><span style="color: hsl(120, 100%, 40%);">+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]</span><br><span style="color: hsl(120, 100%, 40%);">+      From: "[service]" <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]</span><br><span style="color: hsl(120, 100%, 40%);">+      To: "[service]" <sip:[service]@[remote_ip]:[remote_port]></span><br><span style="color: hsl(120, 100%, 40%);">+      Call-ID: [call_id]</span><br><span style="color: hsl(120, 100%, 40%);">+      CSeq: [cseq] REGISTER</span><br><span style="color: hsl(120, 100%, 40%);">+      Max-Forwards: 70</span><br><span style="color: hsl(120, 100%, 40%);">+      Contact: <sip:[service]@[local_ip]:5062;transport=[transport]></span><br><span style="color: hsl(120, 100%, 40%);">+      Expires: 60</span><br><span style="color: hsl(120, 100%, 40%);">+      Content-Length: 0</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    ]]></span><br><span style="color: hsl(120, 100%, 40%);">+  </send></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <recv response="200" /></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <Reference variables="event,state,vm" /></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+</scenario></span><br><span>diff --git a/tests/channels/pjsip/subscriptions/mwi/solicited/replaces_unsolicited/multiple_registers/sipp/unsolicited.xml b/tests/channels/pjsip/subscriptions/mwi/solicited/replaces_unsolicited/multiple_registers/sipp/unsolicited.xml</span><br><span>new file mode 100644</span><br><span>index 0000000..4b71490</span><br><span>--- /dev/null</span><br><span>+++ b/tests/channels/pjsip/subscriptions/mwi/solicited/replaces_unsolicited/multiple_registers/sipp/unsolicited.xml</span><br><span>@@ -0,0 +1,59 @@</span><br><span style="color: hsl(120, 100%, 40%);">+<?xml version="1.0" encoding="ISO-8859-1" ?></span><br><span style="color: hsl(120, 100%, 40%);">+<!DOCTYPE scenario SYSTEM "sipp.dtd"></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+<scenario name="Unsolicited"></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <recv request="NOTIFY"></span><br><span style="color: hsl(120, 100%, 40%);">+    <action></span><br><span style="color: hsl(120, 100%, 40%);">+    <ereg regexp="message-summary" check_it="true" search_in="hdr" header="Event" assign_to="event" /></span><br><span style="color: hsl(120, 100%, 40%);">+      <ereg regexp="terminated" check_it="true" search_in="hdr" header="Subscription-State" assign_to="state" /></span><br><span style="color: hsl(120, 100%, 40%);">+      <ereg regexp="Voice-Message: 1\/1" check_it="true" search_in="body" assign_to="vm" /></span><br><span style="color: hsl(120, 100%, 40%);">+       <!-- Get the call number and see if we've either met or acceded the expected number. --></span><br><span style="color: hsl(120, 100%, 40%);">+      <assignstr assign_to="call_num" value="[call_number]" /></span><br><span style="color: hsl(120, 100%, 40%);">+      <todouble assign_to="count" variable="call_num" /></span><br><span style="color: hsl(120, 100%, 40%);">+      <test assign_to="expected" variable="count" compare="equal" value="1" /></span><br><span style="color: hsl(120, 100%, 40%);">+      <test assign_to="greater" variable="count" compare="greater_than" value="1" /></span><br><span style="color: hsl(120, 100%, 40%);">+    </action></span><br><span style="color: hsl(120, 100%, 40%);">+  </recv></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <send></span><br><span style="color: hsl(120, 100%, 40%);">+    <![CDATA[</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+      SIP/2.0 200 OK</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_Via:]</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_From:]</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_To:]</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_Call-ID:]</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_CSeq:]</span><br><span style="color: hsl(120, 100%, 40%);">+      Contact: <sip:[local_ip]:[local_port];transport=[transport]></span><br><span style="color: hsl(120, 100%, 40%);">+      Content-Length: 0</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    ]]></span><br><span style="color: hsl(120, 100%, 40%);">+  </send></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <!-- Fail the scenario if we've received more than the expected number of calls --></span><br><span style="color: hsl(120, 100%, 40%);">+  <nop condexec="greater"></span><br><span style="color: hsl(120, 100%, 40%);">+    <action></span><br><span style="color: hsl(120, 100%, 40%);">+      <error message="Received too many out of call NOTIFYs ([call_id])" /></span><br><span style="color: hsl(120, 100%, 40%);">+    </action></span><br><span style="color: hsl(120, 100%, 40%);">+  </nop></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <!-- Pause for a time less than the global timeout, but long enough where we feel</span><br><span style="color: hsl(120, 100%, 40%);">+       that we won't potentially receive any erroneous calls after the expected call</span><br><span style="color: hsl(120, 100%, 40%);">+       count has been met. If we stop too soon then the scenario could have successfully</span><br><span style="color: hsl(120, 100%, 40%);">+       ended, but another unexpected message may have potentially arrived, which in</span><br><span style="color: hsl(120, 100%, 40%);">+       that case we should have failed the test. --></span><br><span style="color: hsl(120, 100%, 40%);">+  <pause milliseconds="12000" /></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <!-- Stop the scenario gracefully if we've received the expected number of calls</span><br><span style="color: hsl(120, 100%, 40%);">+     Note, do this stops the test in a non-failure mode. --></span><br><span style="color: hsl(120, 100%, 40%);">+  <nop condexec="expected"></span><br><span style="color: hsl(120, 100%, 40%);">+    <action></span><br><span style="color: hsl(120, 100%, 40%);">+      <log message="call count met stopping test" /></span><br><span style="color: hsl(120, 100%, 40%);">+      <exec int_cmd="stop_gracefully" /></span><br><span style="color: hsl(120, 100%, 40%);">+    </action></span><br><span style="color: hsl(120, 100%, 40%);">+  </nop></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <Reference variables="event,state,vm" /></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+</scenario></span><br><span>diff --git a/tests/channels/pjsip/subscriptions/mwi/solicited/replaces_unsolicited/multiple_registers/test-config.yaml b/tests/channels/pjsip/subscriptions/mwi/solicited/replaces_unsolicited/multiple_registers/test-config.yaml</span><br><span>new file mode 100644</span><br><span>index 0000000..2de0b07</span><br><span>--- /dev/null</span><br><span>+++ b/tests/channels/pjsip/subscriptions/mwi/solicited/replaces_unsolicited/multiple_registers/test-config.yaml</span><br><span>@@ -0,0 +1,70 @@</span><br><span style="color: hsl(120, 100%, 40%);">+testinfo:</span><br><span style="color: hsl(120, 100%, 40%);">+    summary: 'Test replacing an unsolicited subscription and multiple REGISTERs.'</span><br><span style="color: hsl(120, 100%, 40%);">+    description: |</span><br><span style="color: hsl(120, 100%, 40%);">+        'After enabling the mwi_subscribe_replaces_unsolicited option on an</span><br><span style="color: hsl(120, 100%, 40%);">+        endpoint, this tests to make sure a solicited subscription for MWI is</span><br><span style="color: hsl(120, 100%, 40%);">+        allowed to replace the unsolicited subscription. It also then verifies</span><br><span style="color: hsl(120, 100%, 40%);">+        that after subscribing, NOTIFYs for unsolicited subscriptions are not</span><br><span style="color: hsl(120, 100%, 40%);">+        received for a given mailbox upon the contact being updated.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+        Note, this tests disables initial unsolicited at startup in order to</span><br><span style="color: hsl(120, 100%, 40%);">+        make the test a bit more deterministic.'</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+properties:</span><br><span style="color: hsl(120, 100%, 40%);">+    dependencies:</span><br><span style="color: hsl(120, 100%, 40%);">+        - python: 'twisted'</span><br><span style="color: hsl(120, 100%, 40%);">+        - python: 'starpy'</span><br><span style="color: hsl(120, 100%, 40%);">+        - asterisk: 'res_pjsip'</span><br><span style="color: hsl(120, 100%, 40%);">+        - asterisk: 'res_pjsip_mwi'</span><br><span style="color: hsl(120, 100%, 40%);">+        - asterisk: 'res_mwi_external'</span><br><span style="color: hsl(120, 100%, 40%);">+        - asterisk: 'res_mwi_external_ami'</span><br><span style="color: hsl(120, 100%, 40%);">+        - sipp:</span><br><span style="color: hsl(120, 100%, 40%);">+            version: 'v3.0'</span><br><span style="color: hsl(120, 100%, 40%);">+    tags:</span><br><span style="color: hsl(120, 100%, 40%);">+        - pjsip</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+test-modules:</span><br><span style="color: hsl(120, 100%, 40%);">+    test-object:</span><br><span style="color: hsl(120, 100%, 40%);">+        config-section: 'sipp-config'</span><br><span style="color: hsl(120, 100%, 40%);">+        typename: 'sipp.SIPpTestCase'</span><br><span style="color: hsl(120, 100%, 40%);">+    modules:</span><br><span style="color: hsl(120, 100%, 40%);">+        -</span><br><span style="color: hsl(120, 100%, 40%);">+            config-section: 'event-action-config'</span><br><span style="color: hsl(120, 100%, 40%);">+            typename: 'pluggable_modules.EventActionModule'</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+sipp-config:</span><br><span style="color: hsl(120, 100%, 40%);">+    # The reactor-timeout needs to be lower than then unsolicited scenario timeout</span><br><span style="color: hsl(120, 100%, 40%);">+    # or there's a risk the test could "pass" even though the call count was not</span><br><span style="color: hsl(120, 100%, 40%);">+    # met for the scenario.</span><br><span style="color: hsl(120, 100%, 40%);">+    reactor-timeout: 20</span><br><span style="color: hsl(120, 100%, 40%);">+    test-iterations:</span><br><span style="color: hsl(120, 100%, 40%);">+        -</span><br><span style="color: hsl(120, 100%, 40%);">+            # Due to the nature of SIPp, and it's handling of out of call messages</span><br><span style="color: hsl(120, 100%, 40%);">+            # we'll execute two scenarios. One to receive unsolicited MWI, and</span><br><span style="color: hsl(120, 100%, 40%);">+            # another to handle solicited MWI.</span><br><span style="color: hsl(120, 100%, 40%);">+            scenarios:</span><br><span style="color: hsl(120, 100%, 40%);">+                # For this test we expect to receive 1 unsolicited MWI message.</span><br><span style="color: hsl(120, 100%, 40%);">+                # A NOTIFY is sent for unsolicited after the initial REGISTER</span><br><span style="color: hsl(120, 100%, 40%);">+                # (on contact updated). After that the solicited subscription</span><br><span style="color: hsl(120, 100%, 40%);">+                # replaces the unsolicited one so no more unsolicited MWI messages</span><br><span style="color: hsl(120, 100%, 40%);">+                # should be sent even if the contact is updated multiple times.</span><br><span style="color: hsl(120, 100%, 40%);">+                #</span><br><span style="color: hsl(120, 100%, 40%);">+                # Even though we expect only 1 unsolicited message set the call count</span><br><span style="color: hsl(120, 100%, 40%);">+                # to 2 for the scenario. Once the expected call count is met the scenario</span><br><span style="color: hsl(120, 100%, 40%);">+                # is responsible for gracefully shutting itself down. See the scenario</span><br><span style="color: hsl(120, 100%, 40%);">+                # itself for more information.</span><br><span style="color: hsl(120, 100%, 40%);">+                #</span><br><span style="color: hsl(120, 100%, 40%);">+                # Note, we must tell SIPp to cause an error on scenario timeout.</span><br><span style="color: hsl(120, 100%, 40%);">+                # This way the test will fail if the expected number of calls is not met.</span><br><span style="color: hsl(120, 100%, 40%);">+                - { 'key-args': {'scenario': 'unsolicited.xml', '-i': '127.0.0.1', '-p': '5062', '-m': '2', '-timeout': '25', '-timeout_error': ''} }</span><br><span style="color: hsl(120, 100%, 40%);">+                - { 'key-args': {'scenario': 'solicited.xml', '-i': '127.0.0.1', '-p': '5061', '-s': 'alice'} }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+event-action-config:</span><br><span style="color: hsl(120, 100%, 40%);">+    -</span><br><span style="color: hsl(120, 100%, 40%);">+        ami-start:</span><br><span style="color: hsl(120, 100%, 40%);">+        ami-actions:</span><br><span style="color: hsl(120, 100%, 40%);">+            action:</span><br><span style="color: hsl(120, 100%, 40%);">+                Action: 'MWIUpdate'</span><br><span style="color: hsl(120, 100%, 40%);">+                Mailbox: 'mb1'</span><br><span style="color: hsl(120, 100%, 40%);">+                NewMessages: 1</span><br><span style="color: hsl(120, 100%, 40%);">+                OldMessages: 1</span><br><span>diff --git a/tests/channels/pjsip/subscriptions/mwi/solicited/replaces_unsolicited/non_aggregate/configs/ast1/pjsip.conf b/tests/channels/pjsip/subscriptions/mwi/solicited/replaces_unsolicited/non_aggregate/configs/ast1/pjsip.conf</span><br><span>new file mode 100644</span><br><span>index 0000000..e047cf3</span><br><span>--- /dev/null</span><br><span>+++ b/tests/channels/pjsip/subscriptions/mwi/solicited/replaces_unsolicited/non_aggregate/configs/ast1/pjsip.conf</span><br><span>@@ -0,0 +1,29 @@</span><br><span style="color: hsl(120, 100%, 40%);">+[global]</span><br><span style="color: hsl(120, 100%, 40%);">+debug=yes</span><br><span style="color: hsl(120, 100%, 40%);">+mwi_disable_initial_unsolicited=yes</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+[transport-template](!)</span><br><span style="color: hsl(120, 100%, 40%);">+type=transport</span><br><span style="color: hsl(120, 100%, 40%);">+bind=127.0.0.1:5060</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+[transport-udp](transport-template)</span><br><span style="color: hsl(120, 100%, 40%);">+protocol=udp</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+[aor-template](!)</span><br><span style="color: hsl(120, 100%, 40%);">+type=aor</span><br><span style="color: hsl(120, 100%, 40%);">+max_contacts=1</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+[endpoint-template](!)</span><br><span style="color: hsl(120, 100%, 40%);">+type=endpoint</span><br><span style="color: hsl(120, 100%, 40%);">+context=default</span><br><span style="color: hsl(120, 100%, 40%);">+allow=!all,ulaw</span><br><span style="color: hsl(120, 100%, 40%);">+direct_media=false</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+[alice](aor-template)</span><br><span style="color: hsl(120, 100%, 40%);">+mailboxes=mb1</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+[alice](endpoint-template)</span><br><span style="color: hsl(120, 100%, 40%);">+aors=alice</span><br><span style="color: hsl(120, 100%, 40%);">+mailboxes=mb1,mb2</span><br><span style="color: hsl(120, 100%, 40%);">+mwi_subscribe_replaces_unsolicited=yes</span><br><span style="color: hsl(120, 100%, 40%);">+aggregate_mwi=no</span><br><span>diff --git a/tests/channels/pjsip/subscriptions/mwi/solicited/replaces_unsolicited/non_aggregate/sipp/solicited.xml b/tests/channels/pjsip/subscriptions/mwi/solicited/replaces_unsolicited/non_aggregate/sipp/solicited.xml</span><br><span>new file mode 100644</span><br><span>index 0000000..cb0d96e</span><br><span>--- /dev/null</span><br><span>+++ b/tests/channels/pjsip/subscriptions/mwi/solicited/replaces_unsolicited/non_aggregate/sipp/solicited.xml</span><br><span>@@ -0,0 +1,138 @@</span><br><span style="color: hsl(120, 100%, 40%);">+<?xml version="1.0" encoding="ISO-8859-1" ?></span><br><span style="color: hsl(120, 100%, 40%);">+<!DOCTYPE scenario SYSTEM "sipp.dtd"></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+<scenario name="Solicited"></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <!-- Wait a few seconds before initiating the scenario to make sure</span><br><span style="color: hsl(120, 100%, 40%);">+        the mailbox(es) have been updated --></span><br><span style="color: hsl(120, 100%, 40%);">+  <pause milliseconds="3000" /></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <!-- Once the contact is registered a SIP NOTIFY (for unsolicited MWI) is sent to</span><br><span style="color: hsl(120, 100%, 40%);">+           the contact. Note, this registers the contact to port 5062 where SIP NOTIFY's</span><br><span style="color: hsl(120, 100%, 40%);">+     for unsolicited MWI are expected --></span><br><span style="color: hsl(120, 100%, 40%);">+  <send retrans="500"></span><br><span style="color: hsl(120, 100%, 40%);">+    <![CDATA[</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+      REGISTER sip:[remote_ip]:[remote_port] SIP/2.0</span><br><span style="color: hsl(120, 100%, 40%);">+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]</span><br><span style="color: hsl(120, 100%, 40%);">+      From: "[service]" <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]</span><br><span style="color: hsl(120, 100%, 40%);">+      To: "[service]" <sip:[service]@[remote_ip]:[remote_port]></span><br><span style="color: hsl(120, 100%, 40%);">+      Call-ID: [call_id]</span><br><span style="color: hsl(120, 100%, 40%);">+      CSeq: [cseq] REGISTER</span><br><span style="color: hsl(120, 100%, 40%);">+      Max-Forwards: 70</span><br><span style="color: hsl(120, 100%, 40%);">+      Contact: <sip:[service]@[local_ip]:5062;transport=[transport]></span><br><span style="color: hsl(120, 100%, 40%);">+      Expires: 60</span><br><span style="color: hsl(120, 100%, 40%);">+      Content-Length: 0</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    ]]></span><br><span style="color: hsl(120, 100%, 40%);">+  </send></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <recv response="200" /></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <!-- Wait a few more seconds to make sure the unsolicited NOTIFY is received</span><br><span style="color: hsl(120, 100%, 40%);">+         before subscribing --></span><br><span style="color: hsl(120, 100%, 40%);">+  <pause milliseconds="3000" /></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <!-- Now subscribe --></span><br><span style="color: hsl(120, 100%, 40%);">+  <send retrans="500"></span><br><span style="color: hsl(120, 100%, 40%);">+    <![CDATA[</span><br><span style="color: hsl(120, 100%, 40%);">+      SUBSCRIBE sip:[service]@[remote_ip]:[remote_port] SIP/2.0</span><br><span style="color: hsl(120, 100%, 40%);">+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]</span><br><span style="color: hsl(120, 100%, 40%);">+      From: "alice" <sip:alice@[local_ip]:[local_port]>;tag=[call_number]</span><br><span style="color: hsl(120, 100%, 40%);">+      To: "alice" <sip:[service]@[remote_ip]:[remote_port]></span><br><span style="color: hsl(120, 100%, 40%);">+      Call-ID: [call_id]</span><br><span style="color: hsl(120, 100%, 40%);">+      CSeq: 1 SUBSCRIBE</span><br><span style="color: hsl(120, 100%, 40%);">+      Contact: "alice" <sip:alice@[local_ip]:[local_port]></span><br><span style="color: hsl(120, 100%, 40%);">+      Max-Forwards: 70</span><br><span style="color: hsl(120, 100%, 40%);">+      Event: message-summary</span><br><span style="color: hsl(120, 100%, 40%);">+      Expires: 60</span><br><span style="color: hsl(120, 100%, 40%);">+      Accept: application/simple-message-summary</span><br><span style="color: hsl(120, 100%, 40%);">+      Allow-Events: message-summary</span><br><span style="color: hsl(120, 100%, 40%);">+      Content-Length: 0</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    ]]></span><br><span style="color: hsl(120, 100%, 40%);">+  </send></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <recv response="200"></span><br><span style="color: hsl(120, 100%, 40%);">+    <action></span><br><span style="color: hsl(120, 100%, 40%);">+          <!-- Get the tag to use when unsubscribing --></span><br><span style="color: hsl(120, 100%, 40%);">+          <ereg regexp="(;tag=.*)" header="To:" search_in="hdr" check_it="true" assign_to="to_tag"/></span><br><span style="color: hsl(120, 100%, 40%);">+    </action></span><br><span style="color: hsl(120, 100%, 40%);">+  </recv></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <!-- Receive NOTIFY due to SUBSCRIBE --></span><br><span style="color: hsl(120, 100%, 40%);">+  <recv request="NOTIFY"></span><br><span style="color: hsl(120, 100%, 40%);">+    <action></span><br><span style="color: hsl(120, 100%, 40%);">+      <ereg regexp="message-summary" check_it="true" search_in="hdr" header="Event" assign_to="event" /></span><br><span style="color: hsl(120, 100%, 40%);">+      <ereg regexp="active;expires=[5,6][0-9]" check_it="true" search_in="hdr" header="Subscription-State" assign_to="state" /></span><br><span style="color: hsl(120, 100%, 40%);">+      <ereg regexp="Voice-Message: 1\/1" check_it="true" search_in="body" assign_to="vm" /></span><br><span style="color: hsl(120, 100%, 40%);">+    </action></span><br><span style="color: hsl(120, 100%, 40%);">+  </recv></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <send></span><br><span style="color: hsl(120, 100%, 40%);">+    <![CDATA[</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+      SIP/2.0 200 OK</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_Via:]</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_From:]</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_To:]</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_Call-ID:]</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_CSeq:]</span><br><span style="color: hsl(120, 100%, 40%);">+      Contact: <sip:[local_ip]:[local_port];transport=[transport]></span><br><span style="color: hsl(120, 100%, 40%);">+      Content-Length: 0</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    ]]></span><br><span style="color: hsl(120, 100%, 40%);">+  </send></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <pause milliseconds="1000" /></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <!-- Unsubscribe --></span><br><span style="color: hsl(120, 100%, 40%);">+  <send retrans="500"></span><br><span style="color: hsl(120, 100%, 40%);">+    <![CDATA[</span><br><span style="color: hsl(120, 100%, 40%);">+      SUBSCRIBE sip:[service]@[remote_ip]:[remote_port] SIP/2.0</span><br><span style="color: hsl(120, 100%, 40%);">+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]</span><br><span style="color: hsl(120, 100%, 40%);">+      From: "alice" <sip:alice@[local_ip]:[local_port]>;tag=[call_number]</span><br><span style="color: hsl(120, 100%, 40%);">+      To: "alice" <sip:[service]@[remote_ip]:[remote_port]>[$to_tag]</span><br><span style="color: hsl(120, 100%, 40%);">+      Call-ID: [call_id]</span><br><span style="color: hsl(120, 100%, 40%);">+      CSeq: 3 SUBSCRIBE</span><br><span style="color: hsl(120, 100%, 40%);">+      Contact: "alice" <sip:alice@[local_ip]:[local_port]></span><br><span style="color: hsl(120, 100%, 40%);">+      Max-Forwards: 70</span><br><span style="color: hsl(120, 100%, 40%);">+      Event: message-summary</span><br><span style="color: hsl(120, 100%, 40%);">+      Expires: 0</span><br><span style="color: hsl(120, 100%, 40%);">+      Accept: application/simple-message-summary</span><br><span style="color: hsl(120, 100%, 40%);">+      Allow-Events: message-summary</span><br><span style="color: hsl(120, 100%, 40%);">+      User-Agent: SIPp</span><br><span style="color: hsl(120, 100%, 40%);">+      Content-Length: 0</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    ]]></span><br><span style="color: hsl(120, 100%, 40%);">+  </send></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <recv response="200" /></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <!-- Receive NOTIFY due to unsubscribe --></span><br><span style="color: hsl(120, 100%, 40%);">+  <recv request="NOTIFY"></span><br><span style="color: hsl(120, 100%, 40%);">+    <action></span><br><span style="color: hsl(120, 100%, 40%);">+      <ereg regexp="message-summary" check_it="true" search_in="hdr" header="Event" assign_to="event" /></span><br><span style="color: hsl(120, 100%, 40%);">+      <ereg regexp="terminated" check_it="true" search_in="hdr" header="Subscription-State" assign_to="state" /></span><br><span style="color: hsl(120, 100%, 40%);">+      <ereg regexp="Voice-Message: 1\/1" check_it="true" search_in="body" assign_to="vm" /></span><br><span style="color: hsl(120, 100%, 40%);">+    </action></span><br><span style="color: hsl(120, 100%, 40%);">+  </recv></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <send></span><br><span style="color: hsl(120, 100%, 40%);">+    <![CDATA[</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+      SIP/2.0 200 OK</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_Via:]</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_From:]</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_To:]</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_Call-ID:]</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_CSeq:]</span><br><span style="color: hsl(120, 100%, 40%);">+      Contact: <sip:[local_ip]:[local_port];transport=[transport]></span><br><span style="color: hsl(120, 100%, 40%);">+      Content-Length: 0</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    ]]></span><br><span style="color: hsl(120, 100%, 40%);">+  </send></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <Reference variables="event,state,vm" /></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+</scenario></span><br><span>diff --git a/tests/channels/pjsip/subscriptions/mwi/solicited/replaces_unsolicited/non_aggregate/sipp/unsolicited.xml b/tests/channels/pjsip/subscriptions/mwi/solicited/replaces_unsolicited/non_aggregate/sipp/unsolicited.xml</span><br><span>new file mode 100644</span><br><span>index 0000000..f1d0b94</span><br><span>--- /dev/null</span><br><span>+++ b/tests/channels/pjsip/subscriptions/mwi/solicited/replaces_unsolicited/non_aggregate/sipp/unsolicited.xml</span><br><span>@@ -0,0 +1,59 @@</span><br><span style="color: hsl(120, 100%, 40%);">+<?xml version="1.0" encoding="ISO-8859-1" ?></span><br><span style="color: hsl(120, 100%, 40%);">+<!DOCTYPE scenario SYSTEM "sipp.dtd"></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+<scenario name="Unsolicited"></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <recv request="NOTIFY"></span><br><span style="color: hsl(120, 100%, 40%);">+    <action></span><br><span style="color: hsl(120, 100%, 40%);">+          <ereg regexp="message-summary" check_it="true" search_in="hdr" header="Event" assign_to="event" /></span><br><span style="color: hsl(120, 100%, 40%);">+      <ereg regexp="terminated" check_it="true" search_in="hdr" header="Subscription-State" assign_to="state" /></span><br><span style="color: hsl(120, 100%, 40%);">+      <ereg regexp="Voice-Message: [1|2]\/[1|2]" check_it="true" search_in="body" assign_to="vm" /></span><br><span style="color: hsl(120, 100%, 40%);">+       <!-- Get the call number and see if we've either met or acceded the expected number. --></span><br><span style="color: hsl(120, 100%, 40%);">+      <assignstr assign_to="call_num" value="[call_number]" /></span><br><span style="color: hsl(120, 100%, 40%);">+      <todouble assign_to="count" variable="call_num" /></span><br><span style="color: hsl(120, 100%, 40%);">+      <test assign_to="expected" variable="count" compare="equal" value="3" /></span><br><span style="color: hsl(120, 100%, 40%);">+      <test assign_to="greater" variable="count" compare="greater_than" value="3" /></span><br><span style="color: hsl(120, 100%, 40%);">+    </action></span><br><span style="color: hsl(120, 100%, 40%);">+  </recv></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <send></span><br><span style="color: hsl(120, 100%, 40%);">+    <![CDATA[</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+      SIP/2.0 200 OK</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_Via:]</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_From:]</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_To:]</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_Call-ID:]</span><br><span style="color: hsl(120, 100%, 40%);">+      [last_CSeq:]</span><br><span style="color: hsl(120, 100%, 40%);">+      Contact: <sip:[local_ip]:[local_port];transport=[transport]></span><br><span style="color: hsl(120, 100%, 40%);">+      Content-Length: 0</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    ]]></span><br><span style="color: hsl(120, 100%, 40%);">+  </send></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <!-- Fail the scenario if we've received more than the expected number of calls --></span><br><span style="color: hsl(120, 100%, 40%);">+  <nop condexec="greater"></span><br><span style="color: hsl(120, 100%, 40%);">+    <action></span><br><span style="color: hsl(120, 100%, 40%);">+      <error message="Received too many out of call NOTIFYs ([call_id])" /></span><br><span style="color: hsl(120, 100%, 40%);">+    </action></span><br><span style="color: hsl(120, 100%, 40%);">+  </nop></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <!-- Pause for a time less than the global timeout, but long enough where we feel</span><br><span style="color: hsl(120, 100%, 40%);">+       that we won't potentially receive any erroneous calls after the expected call</span><br><span style="color: hsl(120, 100%, 40%);">+       count has been met. If we stop too soon then the scenario could have successfully</span><br><span style="color: hsl(120, 100%, 40%);">+       ended, but another unexpected message may have potentially arrived, which in</span><br><span style="color: hsl(120, 100%, 40%);">+       that case we should have failed the test. --></span><br><span style="color: hsl(120, 100%, 40%);">+  <pause milliseconds="11000" /></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <!-- Stop the scenario gracefully if we've received the expected number of calls</span><br><span style="color: hsl(120, 100%, 40%);">+     Note, do this stops the test in a non-failure mode. --></span><br><span style="color: hsl(120, 100%, 40%);">+  <nop condexec="expected"></span><br><span style="color: hsl(120, 100%, 40%);">+    <action></span><br><span style="color: hsl(120, 100%, 40%);">+      <log message="call count met stopping test" /></span><br><span style="color: hsl(120, 100%, 40%);">+      <exec int_cmd="stop_gracefully" /></span><br><span style="color: hsl(120, 100%, 40%);">+    </action></span><br><span style="color: hsl(120, 100%, 40%);">+  </nop></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  <Reference variables="event,state,vm" /></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+</scenario></span><br><span>diff --git a/tests/channels/pjsip/subscriptions/mwi/solicited/replaces_unsolicited/non_aggregate/test-config.yaml b/tests/channels/pjsip/subscriptions/mwi/solicited/replaces_unsolicited/non_aggregate/test-config.yaml</span><br><span>new file mode 100644</span><br><span>index 0000000..54dc4ae</span><br><span>--- /dev/null</span><br><span>+++ b/tests/channels/pjsip/subscriptions/mwi/solicited/replaces_unsolicited/non_aggregate/test-config.yaml</span><br><span>@@ -0,0 +1,74 @@</span><br><span style="color: hsl(120, 100%, 40%);">+testinfo:</span><br><span style="color: hsl(120, 100%, 40%);">+    summary: 'Test replacing an unsolicited subscription with a solicited one.'</span><br><span style="color: hsl(120, 100%, 40%);">+    description: |</span><br><span style="color: hsl(120, 100%, 40%);">+        'After enabling the mwi_subscribe_replaces_unsolicited option on an</span><br><span style="color: hsl(120, 100%, 40%);">+        endpoint, this tests to make sure a solicited subscription for MWI is</span><br><span style="color: hsl(120, 100%, 40%);">+        allowed to replace the unsolicited subscription, and subsequently</span><br><span style="color: hsl(120, 100%, 40%);">+        replaced by an unsolicited again when unsubscribed.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+        Note, this tests disables initial unsolicited at startup in order to</span><br><span style="color: hsl(120, 100%, 40%);">+        make the test a bit more deterministic.'</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+properties:</span><br><span style="color: hsl(120, 100%, 40%);">+    dependencies:</span><br><span style="color: hsl(120, 100%, 40%);">+        - python: 'twisted'</span><br><span style="color: hsl(120, 100%, 40%);">+        - python: 'starpy'</span><br><span style="color: hsl(120, 100%, 40%);">+        - asterisk: 'res_pjsip'</span><br><span style="color: hsl(120, 100%, 40%);">+        - asterisk: 'res_pjsip_mwi'</span><br><span style="color: hsl(120, 100%, 40%);">+        - asterisk: 'res_mwi_external'</span><br><span style="color: hsl(120, 100%, 40%);">+        - asterisk: 'res_mwi_external_ami'</span><br><span style="color: hsl(120, 100%, 40%);">+        - sipp:</span><br><span style="color: hsl(120, 100%, 40%);">+            version: 'v3.0'</span><br><span style="color: hsl(120, 100%, 40%);">+    tags:</span><br><span style="color: hsl(120, 100%, 40%);">+        - pjsip</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+test-modules:</span><br><span style="color: hsl(120, 100%, 40%);">+    test-object:</span><br><span style="color: hsl(120, 100%, 40%);">+        config-section: 'sipp-config'</span><br><span style="color: hsl(120, 100%, 40%);">+        typename: 'sipp.SIPpTestCase'</span><br><span style="color: hsl(120, 100%, 40%);">+    modules:</span><br><span style="color: hsl(120, 100%, 40%);">+        -</span><br><span style="color: hsl(120, 100%, 40%);">+            config-section: 'event-action-config'</span><br><span style="color: hsl(120, 100%, 40%);">+            typename: 'pluggable_modules.EventActionModule'</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+sipp-config:</span><br><span style="color: hsl(120, 100%, 40%);">+    test-iterations:</span><br><span style="color: hsl(120, 100%, 40%);">+        -</span><br><span style="color: hsl(120, 100%, 40%);">+            # Due to the nature of SIPp, and it's handling of out of call messages</span><br><span style="color: hsl(120, 100%, 40%);">+            # we'll execute two scenarios. One to receive unsolicited MWI, and</span><br><span style="color: hsl(120, 100%, 40%);">+            # another to handle solicited MWI.</span><br><span style="color: hsl(120, 100%, 40%);">+            scenarios:</span><br><span style="color: hsl(120, 100%, 40%);">+                # For this test we expect to receive 3 unsolicited MWI messages.</span><br><span style="color: hsl(120, 100%, 40%);">+                # The first two happen after the initial REGISTER (on contact</span><br><span style="color: hsl(120, 100%, 40%);">+                # updated). One for "mb1" and one for "mb2". The third, and last</span><br><span style="color: hsl(120, 100%, 40%);">+                # one occurs after the solicited scenario unsubscribes. Upon</span><br><span style="color: hsl(120, 100%, 40%);">+                # unsubscribing, the replaced unsolicited subscription get recreated</span><br><span style="color: hsl(120, 100%, 40%);">+                # and sends out another NOTIFY</span><br><span style="color: hsl(120, 100%, 40%);">+                #</span><br><span style="color: hsl(120, 100%, 40%);">+                # Even though we expect only 3 unsolicited messages set the call count</span><br><span style="color: hsl(120, 100%, 40%);">+                # to 4 for the scenario. Once the expected call count is met the scenario</span><br><span style="color: hsl(120, 100%, 40%);">+                # is responsible for gracefully shutting itself down. See the scenario</span><br><span style="color: hsl(120, 100%, 40%);">+                # itself for more information.</span><br><span style="color: hsl(120, 100%, 40%);">+                #</span><br><span style="color: hsl(120, 100%, 40%);">+                # Note, we must tell SIPp to cause an error on scenario timeout.</span><br><span style="color: hsl(120, 100%, 40%);">+                # This way the test will fail if the expected number of calls is not met.</span><br><span style="color: hsl(120, 100%, 40%);">+                - { 'key-args': {'scenario': 'unsolicited.xml', '-i': '127.0.0.1', '-p': '5062', '-m': '4', '-timeout': '25', '-timeout_error': ''} }</span><br><span style="color: hsl(120, 100%, 40%);">+                - { 'key-args': {'scenario': 'solicited.xml', '-i': '127.0.0.1', '-p': '5061', '-s': 'alice'} }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+event-action-config:</span><br><span style="color: hsl(120, 100%, 40%);">+    -</span><br><span style="color: hsl(120, 100%, 40%);">+        ami-start:</span><br><span style="color: hsl(120, 100%, 40%);">+        ami-actions:</span><br><span style="color: hsl(120, 100%, 40%);">+            action:</span><br><span style="color: hsl(120, 100%, 40%);">+                Action: 'MWIUpdate'</span><br><span style="color: hsl(120, 100%, 40%);">+                Mailbox: 'mb1'</span><br><span style="color: hsl(120, 100%, 40%);">+                NewMessages: 1</span><br><span style="color: hsl(120, 100%, 40%);">+                OldMessages: 1</span><br><span style="color: hsl(120, 100%, 40%);">+    -</span><br><span style="color: hsl(120, 100%, 40%);">+        ami-start:</span><br><span style="color: hsl(120, 100%, 40%);">+        ami-actions:</span><br><span style="color: hsl(120, 100%, 40%);">+            action:</span><br><span style="color: hsl(120, 100%, 40%);">+                Action: 'MWIUpdate'</span><br><span style="color: hsl(120, 100%, 40%);">+                Mailbox: 'mb2'</span><br><span style="color: hsl(120, 100%, 40%);">+                NewMessages: 2</span><br><span style="color: hsl(120, 100%, 40%);">+                OldMessages: 2</span><br><span>diff --git a/tests/channels/pjsip/subscriptions/mwi/solicited/replaces_unsolicited/tests.yaml b/tests/channels/pjsip/subscriptions/mwi/solicited/replaces_unsolicited/tests.yaml</span><br><span>new file mode 100644</span><br><span>index 0000000..c89e193</span><br><span>--- /dev/null</span><br><span>+++ b/tests/channels/pjsip/subscriptions/mwi/solicited/replaces_unsolicited/tests.yaml</span><br><span>@@ -0,0 +1,5 @@</span><br><span style="color: hsl(120, 100%, 40%);">+# Enter tests here in the order they should be considered for execution:</span><br><span style="color: hsl(120, 100%, 40%);">+tests:</span><br><span style="color: hsl(120, 100%, 40%);">+    - test: 'aggregate'</span><br><span style="color: hsl(120, 100%, 40%);">+    - test: 'non_aggregate'</span><br><span style="color: hsl(120, 100%, 40%);">+    - test: 'multiple_registers'</span><br><span>diff --git a/tests/channels/pjsip/subscriptions/mwi/solicited/tests.yaml b/tests/channels/pjsip/subscriptions/mwi/solicited/tests.yaml</span><br><span>new file mode 100644</span><br><span>index 0000000..ecad5b6</span><br><span>--- /dev/null</span><br><span>+++ b/tests/channels/pjsip/subscriptions/mwi/solicited/tests.yaml</span><br><span>@@ -0,0 +1,4 @@</span><br><span style="color: hsl(120, 100%, 40%);">+# Enter tests here in the order they should be considered for execution:</span><br><span style="color: hsl(120, 100%, 40%);">+tests:</span><br><span style="color: hsl(120, 100%, 40%);">+    - dir: 'replaces_unsolicited'</span><br><span style="color: hsl(120, 100%, 40%);">+    - dir: 'replaced_by_unsolicited'</span><br><span>diff --git a/tests/channels/pjsip/subscriptions/mwi/tests.yaml b/tests/channels/pjsip/subscriptions/mwi/tests.yaml</span><br><span>index 70b24dd..3636508 100644</span><br><span>--- a/tests/channels/pjsip/subscriptions/mwi/tests.yaml</span><br><span>+++ b/tests/channels/pjsip/subscriptions/mwi/tests.yaml</span><br><span>@@ -1,6 +1,8 @@</span><br><span> # Enter tests here in the order they should be considered for execution:</span><br><span> tests:</span><br><span style="color: hsl(120, 100%, 40%);">+    - dir: 'solicited'</span><br><span>     - dir: 'unsolicited'</span><br><span style="color: hsl(120, 100%, 40%);">+    - test: 'conflict'</span><br><span>     - test: 'missing_aor'</span><br><span>     - test: 'mwi_aggregate'</span><br><span>     - test: 'mwi_devstate'</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/testsuite/+/12823">change 12823</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/testsuite/+/12823"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: testsuite </div>
<div style="display:none"> Gerrit-Branch: 13 </div>
<div style="display:none"> Gerrit-Change-Id: I50ebd212789249f14056b8b3948304237a5f1042 </div>
<div style="display:none"> Gerrit-Change-Number: 12823 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: Kevin Harwell <kharwell@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>