<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></head><body dir="auto"><div dir="auto">Hey Alexey,</div><div dir="auto"><br></div><div dir="auto">One solution might be to use a parallel set of AVPs (1 for CIDs, 1 for weight) and use "set_select_weight" [1] to select a random index. There is also a PR in to shuffle an AVP list in place [2].</div><div dir="auto"><br></div><div dir="auto">If your list of CIDs is large, then it may not be performant to load the list on every request and you may need to look into leveraging another module that has similar functionality (like dispatcher).</div><div dir="auto"><br></div><div dir="auto">[1] https://opensips.org/html/docs/modules/3.1.x/cfgutils.html#func_set_select_weight</div><div dir="auto"><br></div><div dir="auto">[2] https://github.com/OpenSIPS/opensips/pull/2852</div><div dir="auto"><br></div><div dir="auto">Thanks,</div><div dir="auto">John</div><div dir="auto"><br></div><div><br></div><div dir="auto" style="font-size:100%;color:#000000"></div><div style="font-size:100%;color:#000000" dir="auto"></div><div dir="auto" style="font-size:100%;color:#000000"></div><div style="font-size:100%;color:#000000" dir="auto"></div><div dir="auto" style="font-size:100%;color:#000000"></div><div style="font-size:100%;color:#000000" dir="auto"></div>
<div align="left" dir="auto" style="font-size:100%;color:#000000"><div>-------- Original message --------</div><div>From: Alexey Kazantsev via Users <users@lists.opensips.org> </div><div>Date: 7/16/22 7:52 AM (GMT-06:00) </div><div>To: users@lists.opensips.org </div><div>Subject: [OpenSIPS-Users] Random decision </div><div><br></div></div><div>Hi list.</div><div> </div><div> </div><div>I’m looking for a solution how to set caller id from a pre-defined list of phone numbers _randlomly_ .</div><div>So, there is some number of caller ids allowed by our VoIP provider for outgoing calls.</div><div>And I need to set it randomly, from the list.</div><div> </div><div>I know the solution how it can be achieved in Asterisk, but I also would like to know</div><div> </div><div>how to configure it in OpenSIPS.</div><div> </div><div>Not sure if the dialplan module is what I need.</div><div data-signature-widget="container"><div data-signature-widget="content"><div>-----------------------------------------------<br><span style="font-size: 15px;">BR, Alexey</span><br style="font-size: 15px;"><span style="font-size: 15px;">https://alexeyka.zantsev.com/</span></div></div></div>
<br>--<br><table border="1" style="border-collapse: collapse; width: 100%; height: 64px; background-color: #fd3d14;">
<tbody>
<tr style="height: 64px;">
<td style="width: 100%; height: 64px; text-align: center;">
<pre><span style="background-color: #fd3d14; color: #ffffff;"><strong><span style="font-size: 300%;"> Please be cautious!</span></strong>
<span style="font-size: x-large;"> This email was sent from outside of Voxtelesys.</span></span></pre>
</td>
</tr>
</tbody>
</table>
</body></html>