<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/2944/">https://reviewboard.asterisk.org/r/2944/</a>
     </td>
    </tr>
   </table>
   <br />





 <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">The changes in res_pjsip.c have the potential to cause crashes.

First, if the call to pjsip_endpt_send_request() in send_out_of_dialog_request() fails, you're going to crash because the log message is going to try to print the sorcery ID of a NULL pointer.
Second, if our outgoing request receives a 401/407 response, then our attempts to get authentication credentials is going to crash, again because of trying to get data from a NULL pointer.

I've been giving this some thought, and I think that the way this will have to be done is to have some sort of default endpoint used when sending a MESSAGE (or other type of request) directly to a URI instead of specifying an endpoint. I can think of a couple of ways to do this:

1) Use a specially-named endpoint (maybe called "default_outbound"). This endpoint can be automatically created when res_pjsip is loaded and contain nothing but the default values for the endpoint. If people want to tweak default behavior, then they can create an endpoint called "default_outbound" in their pjsip.conf file and set appropriate values on it. This approach has the advantage of "just working" out of the box and allowing for overriding of the default behavior if desired.
2) Create a new option for PJSIP global configuration (maybe called "default_outbound_endpoint") that indicates an endpoint to be used when sending an outbound request to a URI. This approach has the advantage of not creating any "secret" endpoints that the user did not explicitly place in the configuration file.</pre>
 <br />









<p>- Mark Michelson</p>


<br />
<p>On November 1st, 2013, 8:53 p.m. UTC, Kevin Harwell wrote:</p>








<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 Kevin Harwell.</div>


<p style="color: grey;"><i>Updated Nov. 1, 2013, 8:53 p.m.</i></p>









<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt;">Repository: </b>
Asterisk
</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;">Added the ability to send messages to a URI (an associated endpoint is no longer needed). </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;">Had the PJSIP message module send a SIP message to a specified IP address.</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>branches/12/res/res_pjsip_messaging.c <span style="color: grey">(402380)</span></li>

 <li>branches/12/res/res_pjsip.c <span style="color: grey">(402380)</span></li>

</ul>

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







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








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