<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class="">Hi,</div><div class=""><br class=""></div><div class="">Have you tried using sqlops?</div><div class=""><br class=""></div><div class="">Something like...</div><div class=""><br class=""></div><div class=""><div class="example" style="border: thin dotted rgb(112, 170, 229); padding-left: 10px; padding-right: 10px; background-color: rgb(239, 248, 248); overflow: auto; border-top-left-radius: 2.5px; border-top-right-radius: 2.5px; border-bottom-right-radius: 2.5px; border-bottom-left-radius: 2.5px; font-family: Helvetica, Arial, sans-serif; font-size: 15px;"><div class="example-contents"><pre class="programlisting" style="background-color: rgb(252, 255, 252); border: 1px solid rgb(153, 204, 204); padding-left: 15pt; overflow: auto; border-top-left-radius: 2.5px; border-top-right-radius: 2.5px; border-bottom-right-radius: 2.5px; border-bottom-left-radius: 2.5px;"><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(251, 255, 251);" class=""><span style="font-kerning: none" class="">...</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(251, 255, 251);" class=""><span style="font-kerning: none" class="">modparam("sqlops","sqlcon","ca=><a href="dbdriver://username:password@dbhost/dbname" class="">dbdriver://username:password@dbhost/dbname</a>")</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(251, 255, 251);" class=""><span style="font-kerning: none" class="">...</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(251, 255, 251);" class=""><span style="font-kerning: none" class="">sql_query("ca", "select dst_grp from lookup_table where from_domain=$(fd{s.escape.common})”, "ra");</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Courier; background-color: rgb(251, 255, 251);" class=""><span style="font-kerning: none" class="">if($dbr(ra=>rows)>0) {</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Courier; background-color: rgb(251, 255, 251);" class=""><span style="font-kerning: none" class=""> ds_select_dst(<span style="font-family: Menlo;" class="">"</span>$dbr(ra=>[0,0])<span style="font-family: Menlo;" class="">"</span>, <span style="font-family: Menlo;" class="">"</span>4<span style="font-family: Menlo;" class="">"</span>);</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Courier; background-color: rgb(251, 255, 251);" class=""><span style="font-kerning: none" class="">}</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(251, 255, 251);" class=""><span style="font-kerning: none" class="">sql_result_free("ra");</span></div><span style="font-family: Menlo; background-color: rgb(251, 255, 251);" class="">...</span>...</pre><div class=""><br class=""></div></div></div></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Alternatively, you could set up some naptr/srv records for all the from domains and simply relay to those, using dns instead of dispatcher, if you’re not already using them.</div><div class=""><br class=""></div><div class=""><br class=""></div>Blessings,<div class="">—</div><div class="">Daniel Donoghue</div><div class=""><br class=""></div><div class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On 27 Dec 2020, at 13:18, Mihai Cezar <<a href="mailto:mihai@mokalife.ro" class="">mihai@mokalife.ro</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="">Hello, <br class=""></div><div class=""><br class=""></div><div class="">I am redirecting the agents/reps to their asterisk server based on the hostname which they connect, and, i wonder if it's possible to read from db instead of the file cause it's getting big ;)</div><div class=""><br class=""></div><div class=""># Dispatch requests<br class="">route[DISPATCH] {<br class=""> switch ($fd){<br class=""> case "<a href="http://oro.streamlinepbx.nl/" class="">oro.streamlinepbx.nl</a>":<br class=""> if (!ds_select_dst("1", "4")) {<br class=""> send_reply(503, "Service Unavailable $fd");<br class=""> exit;<br class=""> }<br class=""> break;<br class=""> case "<a href="http://oro3.streamlinepbx.nl/" class="">oro3.streamlinepbx.nl</a>":<br class=""> if (!ds_select_dst("2", "4")) {<br class=""> send_reply(503, "Service Unavailable $fd");<br class=""> exit;<br class=""> }<br class=""> break;</div><div class=""> ............<br class=""> default:<br class=""> log("unknow destination?");<br class=""> send_reply(503, "No service defined");<br class=""> xlog("--- SCRIPT: going to <$ru> via <$du> ...Exiting");<br class=""> exit;<br class=""> }<br class=""><br class=""> xlog("--- SCRIPT: going to <$ru> via <$du> (attrs: $xavp(_dsdst_=>attrs))\n");<br class=""> t_on_failure("RTF_DISPATCH");<br class=""> route(RELAY);<br class=""> exit;<br class="">}</div><div class=""><br class=""></div><div class="">Thanks,</div><div class=""><br class=""></div></div>
_______________________________________________<br class="">Kamailio (SER) - Users Mailing List<br class=""><a href="mailto:sr-users@lists.kamailio.org" class="">sr-users@lists.kamailio.org</a><br class="">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users<br class=""></div></blockquote></div><br class=""></div></body></html>