<h4>Type Of Change</h4>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> New feature (non-breaking change which adds new functionality)</li>
</ul>
<h4>Checklist:</h4>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> Tested changes locally</li>
</ul>
<h4>Description</h4>
<p>Previously discussed in the mailing list  :</p>
<p><strong>“13” - latency optimized routing mode, the lowest latency gets higher priority (serial forking ordered by priority, ds_ping_latency_stats is required).</strong></p>
<ul>
<li>The algorithm will load balance using round-robin prioritizing the gateways with the highest priority.</li>
<li>The priority will be lowered by 1 point every time the latency ms is as high as the priority.</li>
</ul>
<p>Using this simple formula : ADJUSTED_PRIORITY = PRIORITY - (ESTIMATED_LATENCY/PRIORITY)</p>
<table role="table">
<thead>
<tr>
<th>GATEWAY</th>
<th>PRIORITY</th>
<th>ESTIMATED_LATENCY</th>
<th>ADJUSTED_PRIORITY</th>
<th>LOAD DISTRIBUTION</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>30</td>
<td>21</td>
<td>30</td>
<td>33%</td>
</tr>
<tr>
<td>2</td>
<td>30</td>
<td>91</td>
<td>27</td>
<td>0%</td>
</tr>
<tr>
<td>3</td>
<td>30</td>
<td>61</td>
<td>28</td>
<td>0%</td>
</tr>
<tr>
<td>4</td>
<td>30</td>
<td>19</td>
<td>30</td>
<td>33%</td>
</tr>
<tr>
<td>5</td>
<td>30</td>
<td>32</td>
<td>29</td>
<td>0%</td>
</tr>
<tr>
<td>6</td>
<td>30</td>
<td>0</td>
<td>30</td>
<td>33%</td>
</tr>
<tr>
<td>7</td>
<td>30</td>
<td>201</td>
<td>24</td>
<td>0%</td>
</tr>
</tbody>
</table>

<hr>

<h4>You can view, comment on, or merge this pull request online at:</h4>
<p>  <a href='https://github.com/kamailio/kamailio/pull/2493'>https://github.com/kamailio/kamailio/pull/2493</a></p>

<h4>Commit Summary</h4>
<ul>
  <li>dispatcher: algorithm 13</li>
</ul>

<h4>File Changes</h4>
<ul>
  <li>
    <strong>M</strong>
    <a href="https://github.com/kamailio/kamailio/pull/2493/files#diff-b9d00a2976c1b1c5d3535a5ae0e24047">src/modules/dispatcher/dispatch.c</a>
    (43)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/kamailio/kamailio/pull/2493/files#diff-24da3e32b70c3596dd958f08136370b6">src/modules/dispatcher/dispatch.h</a>
    (1)
  </li>
</ul>

<h4>Patch Links:</h4>
<ul>
  <li><a href='https://github.com/kamailio/kamailio/pull/2493.patch'>https://github.com/kamailio/kamailio/pull/2493.patch</a></li>
  <li><a href='https://github.com/kamailio/kamailio/pull/2493.diff'>https://github.com/kamailio/kamailio/pull/2493.diff</a></li>
</ul>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/pull/2493">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABO7UZNZ6QSTKAQF4T5LQ6DSITVDFANCNFSM4SA5ZYNQ">unsubscribe</a>.<img src="https://github.com/notifications/beacon/ABO7UZLOJMMJGQGJCFJNL2DSITVDFA5CNFSM4SA5ZYN2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4KUCJT5Q.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/kamailio/kamailio/pull/2493",
"url": "https://github.com/kamailio/kamailio/pull/2493",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>