<html>
 <body>
  <div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
   <table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 solid;">
    <tr>
     <td>
      This is an automatically generated e-mail. To reply, visit:
      <a href="https://reviewboard.asterisk.org/r/3383/">https://reviewboard.asterisk.org/r/3383/</a>
     </td>
    </tr>
   </table>
   <br />



<table bgcolor="#e0e0e0" width="100%" cellpadding="8" style="border: 1px gray solid;">
 <tr>
  <td>
   <h1 style="margin-right: 0.2em; padding: 0; font-size: 10pt;">This change has been marked as submitted.</h1>
  </td>
 </tr>
</table>
<br />


<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('https://reviewboard.asterisk.org/static/rb/images/review_request_box_top_bg.ab6f3b1072c9.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
 <tr>
  <td>

<div>Review request for Asterisk Developers.</div>
<div>By opticron.</div>


<p style="color: grey;"><i>Updated April 3, 2014, 6:57 a.m.</i></p>



<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Changes</h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
 <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Committed in revision 411670</pre>
  </td>
 </tr>
</table>







<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt;">Repository: </b>
testsuite
</div>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
 <table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
 <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">This fixes a race condition in the tests/channels/pjsip/ami/show_subscriptions test where the PJSIPShowSubscriptionsInbound AMI command would be issued before states had finished transitioning resulting in the response containing "NULL" instead of "ACTIVE". This also requires the following patch that adds a test event when Asterisk is compiled in development mode:

Index: res/res_pjsip_pubsub.c
===================================================================
--- res/res_pjsip_pubsub.c      (revision 410980)
+++ res/res_pjsip_pubsub.c      (working copy)
@@ -42,6 +42,7 @@
 #include "asterisk/res_pjsip.h"
 #include "asterisk/callerid.h"
 #include "asterisk/manager.h"
+#include "asterisk/test.h"
 #include "res_pjsip/include/res_pjsip_private.h"

 /*** DOCUMENTATION
@@ -464,8 +465,18 @@

 int ast_sip_subscription_send_request(struct ast_sip_subscription *sub, pjsip_tx_data *tdata)
 {
-       return pjsip_evsub_send_request(ast_sip_subscription_get_evsub(sub),
+       struct ast_sip_endpoint *endpoint = ast_sip_subscription_get_endpoint(sub);
+       int res = pjsip_evsub_send_request(ast_sip_subscription_get_evsub(sub),
                        tdata) == PJ_SUCCESS ? 0 : -1;
+
+       ast_test_suite_event_notify("SUBSCRIPTION_STATE_SET",
+               "StateText: %s\r\n"
+               "Endpoint: %s\r\n",
+               pjsip_evsub_get_state_name(ast_sip_subscription_get_evsub(sub)),
+               ast_sorcery_object_get_id(endpoint));
+
+       ao2_cleanup(endpoint);
+       return res;
 }

 static void subscription_datastore_destroy(void *obj)</pre>
  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
 <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Verified that the race was resolved by using state transition test events instead of the successful callback of the SIPp scenario.</pre>
  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">

 <li>asterisk/trunk/tests/channels/pjsip/ami/show_subscriptions/AMISendTest.py <span style="color: grey">(4885)</span></li>

</ul>

<p><a href="https://reviewboard.asterisk.org/r/3383/diff/" style="margin-left: 3em;">View Diff</a></p>







  </td>
 </tr>
</table>




  </div>
 </body>
</html>