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





<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
 <p style="margin-top: 0;">On November 29th, 2010, 12:46 p.m., <b>Russell Bryant</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">How do you envision this being used?  Is it primarily for development and debugging?  If you think there is a need for this in a production environment, I&#39;d like to see corresponding manager actions, as well, since we don&#39;t want to encourage the usage of CLI commands from programs when possible.</pre>
 </blockquote>




 <p>On November 29th, 2010, 1:04 p.m., <b>schmidts</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">as i said above this is a possible problem in an asterisk cluster with a sip proxy in front if the cluster is used in an active:active setup with distributed device states.

i will take a look at corresponding manager actions.</pre>
 </blockquote>





 <p>On November 29th, 2010, 1:55 p.m., <b>Russell Bryant</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Shouldn&#39;t you just be ensuring that SUBSCRIBE always hits the same server that it started with?</pre>
 </blockquote>





 <p>On November 30th, 2010, 3:20 a.m., <b>Klaus Darilion</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Russel, consider the following scenario:

                                  /------ Asterisk 1
UAC------- Kamailio/Load-Balancer-------- Asterisk 2
                                  \------ Asterisk 3

Kamailio handles registrations, subscriptions and calls are forwarded to one of Asterisk servers. Out-of-dialog requests will be load-balanced by Kamailio, in-dialog requests (e.g. subscription refresh) will be loose-routed to the proper Asterisk server. Now, if you want to maintain one of the Asterisk servers (e.g. upgrade Asterisk) you will remove this Asterisk server from the cluster, usually by changing the load-balancer algorithm to exclude this single server. New calls will be automatically routed to the other servers, but the subscriptions are still active one the excluded Asterisk server. Therefore it is necessary to force all UACs to create a new subscription and this new subscription will be routed to one of the other servers.

The subscription will be terminated by sending a NOTIFY with Subscription-State terminated. Using &quot;reason=probation&quot; with &quot;Retry-After: 60&quot; should force UACs to resubscribe in 60 seconds. Using &quot;reason=deactivated&quot; could be used to force immediate resubscriptions.

A typical scenario to remove a server form the cluster would be:
- remove the server from the load-balancer destinations
- remove the subscriptions from this server by terminating them
- wait until all active calls are over
- now it is safe to shutdown the server
</pre>
 </blockquote>








</blockquote>

<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Thanks for the clear explanation, Klaus!</pre>
<br />








<p>- Russell</p>


<br />
<p>On November 30th, 2010, 7:09 a.m., schmidts wrote:</p>






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

<div>Review request for Asterisk Developers and Klaus Darilion.</div>
<div>By schmidts.</div>


<p style="color: grey;"><i>Updated 2010-11-30 07:09:20</i></p>




<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;">After testing a clustered Asterisk solution we have noticed that there is no other way to remove subscriptions from a server then to let them time out. If you use distributed device states its possible to get notifys from different asterisk servers, cause the subscription was sent to another asterisk in the cluster, before the old subscription timed out.

With this functions all subscribes or all subscribes from a peer could be removed using a CLI command

Both functions send a terminating notify out to the watcher.

I change the expiry value of this subscribe to -1 to mark these subscribes as removed cause they will exists up to T1 X 64 seconds if the watcher is not reachable.

</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;">generate several thousand subscribes with sipp and removed them.
</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>trunk/channels/chan_sip.c <span style="color: grey">(296751)</span></li>

</ul>

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




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








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