<div dir="ltr">If your list is large, you can add them to a database, give each row an Id number, then use it with sql_cacher and random number generator to randomly look up a number in table.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Jul 16, 2022 at 4:06 PM John Burke via Users <<a href="mailto:users@lists.opensips.org">users@lists.opensips.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div 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] <a href="https://opensips.org/html/docs/modules/3.1.x/cfgutils.html#func_set_select_weight" target="_blank">https://opensips.org/html/docs/modules/3.1.x/cfgutils.html#func_set_select_weight</a></div><div dir="auto"><br></div><div dir="auto">[2] <a href="https://github.com/OpenSIPS/opensips/pull/2852" target="_blank">https://github.com/OpenSIPS/opensips/pull/2852</a></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:rgb(0,0,0)"></div><div style="font-size:100%;color:rgb(0,0,0)" dir="auto"></div><div dir="auto" style="font-size:100%;color:rgb(0,0,0)"></div><div style="font-size:100%;color:rgb(0,0,0)" dir="auto"></div><div dir="auto" style="font-size:100%;color:rgb(0,0,0)"></div><div style="font-size:100%;color:rgb(0,0,0)" dir="auto"></div>
<div align="left" dir="auto" style="font-size:100%;color:rgb(0,0,0)"><div>-------- Original message --------</div><div>From: Alexey Kazantsev via Users <<a href="mailto:users@lists.opensips.org" target="_blank">users@lists.opensips.org</a>> </div><div>Date: 7/16/22  7:52 AM  (GMT-06:00) </div><div>To: <a href="mailto:users@lists.opensips.org" target="_blank">users@lists.opensips.org</a> </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><div><div>-----------------------------------------------<br><span style="font-size:15px">BR, Alexey</span><br style="font-size:15px"><span style="font-size:15px"><a href="https://alexeyka.zantsev.com/" target="_blank">https://alexeyka.zantsev.com/</a></span></div></div></div>

<br>--<br><table border="1" style="border-collapse:collapse;width:100%;height:64px;background-color:rgb(253,61,20)">
<tbody>
<tr style="height:64px">
<td style="width:100%;height:64px;text-align:center">
<pre><span style="background-color:rgb(253,61,20);color:rgb(255,255,255)"><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>
</div>_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
</blockquote></div>