<div><div><div><div dir="auto">One could also use dialplan and dispatcher, add the domains to the dialplan table with the GID of the dispatcher, add all IPs to redirect to, and use dispatcher instead. That would also give you failover and distribution.</div><div dir="auto"><br></div><div dir="auto">In terms of multiple domains, there’s probably a better way, but this is how I do it:</div><div dir="auto"><br></div><div dir="auto">So I would add to the dialplan table the domains I’m serving to, I.e.:</div><div dir="auto"><br></div><div dir="auto">Match *dom1* and attrs 1</div><div dir="auto">Match *dom2* and attrs 2</div><div dir="auto">...</div><div dir="auto"><br></div><div dir="auto">Then on the dispatcher:</div><div dir="auto"><br></div><div dir="auto">GID:1 ip: sip:<a href="http://1.2.3.4:5060">1.2.3.4:5060</a></div><div dir="auto">GID:1 ip: sip:<a href="http://2.3.4.4:5060">2.3.4.4:5060</a></div><div dir="auto">GID:2 ip: sip:<a href="http://9.8.7.6:5060">9.8.7.6:5060</a></div><div dir="auto">GID:2 ip: sip:<a href="http://8.7.6.5:5060">8.7.6.5:5060</a></div><div dir="auto"><br></div><div dir="auto">So anything with “dom1” in the $ru would be sent out to GID 1, “dom2” to GID 2, and so on.</div><div dir="auto"><br></div><div dir="auto">And use the dialplan and dispatcher like so:</div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto"><p style="margin:0px;font-stretch:normal;font-size:21px;line-height:normal;color:rgb(0,0,0)"><span>modparam("dialplan", "db_url", "mysql://DB_USER:DB_PASS@DB_HOST/kamailio")</span></p><p style="margin:0px;font-stretch:normal;font-size:21px;line-height:normal;color:rgb(0,0,0)"><span>modparam("dialplan", "attrs_pvar", "$var(dispatcher_id)")</span></p><p style="margin:0px;font-stretch:normal;font-size:21px;line-height:normal;color:rgb(0,0,0)"><span>modparam("dialplan", "fetch_rows", 100)</span></p><p style="margin:0px;font-stretch:normal;font-size:21px;line-height:normal;color:rgb(0,0,0)"><span>...</span></p><p style="margin:0px;font-stretch:normal;font-size:21px;line-height:normal;color:rgb(0,0,0)"><span>route[DISPATCH] {</span></p><p style="margin:0px;font-stretch:normal;font-size:21px;line-height:normal;color:rgb(0,0,0)"><span><span style="white-space:pre-wrap">       </span>   <span> </span>dp_match("1", "$ru");</span></p><p style="margin:0px;font-stretch:normal;font-size:21px;line-height:normal;color:rgb(0,0,0)"><span>   <span> </span>xlog("[DISPATCH] '$ru' was translated to '$var(dispatcher_id)'\n");</span></p><p style="margin:0px;font-stretch:normal;font-size:21px;line-height:normal;color:rgb(0,0,0)"><span>   <span> </span>xlog("[DISPATCH] avp(dsdstid): $avp(dsdstid)\n");</span></p><p style="margin:0px;font-stretch:normal;font-size:21px;line-height:normal;min-height:25.1px;color:rgb(0,0,0)"><span></span><br></p><p style="margin:0px;font-stretch:normal;font-size:21px;line-height:normal;color:rgb(0,0,0)"><span>       <span> </span>if(!ds_select_dst("$var(dispatcher_id)", "9"))</span></p><p style="margin:0px;font-stretch:normal;font-size:21px;line-height:normal;color:rgb(0,0,0)"><span><span style="white-space:pre-wrap">   </span>{</span></p><p style="margin:0px;font-stretch:normal;font-size:21px;line-height:normal;color:rgb(0,0,0)"><span><span style="white-space:pre-wrap">       </span><span style="white-space:pre-wrap">        </span>send_reply("404", "No destination");</span></p><p style="margin:0px;font-stretch:normal;font-size:21px;line-height:normal;color:rgb(0,0,0)"><span><span style="white-space:pre-wrap">        </span><span style="white-space:pre-wrap">        </span>exit;</span></p><p style="margin:0px;font-stretch:normal;font-size:21px;line-height:normal;color:rgb(0,0,0)"><span><span style="white-space:pre-wrap">   </span>}</span></p><p style="margin:0px;font-stretch:normal;font-size:21px;line-height:normal;color:rgb(0,0,0)"><span><span style="white-space:pre-wrap">       </span>xlog("L_DBG", "--- SCRIPT: going to <$ru> via <$du>\n");</span></p><p style="margin:0px;font-stretch:normal;font-size:21px;line-height:normal;color:rgb(0,0,0)"><span><span style="white-space:pre-wrap">        </span>t_on_failure("RTF_DISPATCH”);</span></p><p style="margin:0px;font-stretch:normal;font-size:21px;line-height:normal;color:rgb(0,0,0)"><span>     <span> </span>append_to_reply("Contact: <sip:$du>\r\n");</span></p><p style="margin:0px;font-stretch:normal;font-size:21px;line-height:normal;color:rgb(0,0,0)"><span>     <span> </span>sl_send_reply("300","Multiple Choices");</span></p><p style="margin:0px;font-stretch:normal;font-size:21px;line-height:normal;color:rgb(0,0,0)"><span><span style="white-space:pre-wrap">        </span>exit;</span></p><p style="margin:0px;font-stretch:normal;font-size:21px;line-height:normal;color:rgb(0,0,0)"><span>}</span></p></div></div></div></div><div><div><div dir="auto"><br></div><div dir="auto"><br></div><div>Or something like that. (I took this off my <div><a href="https://github.com/davidcsi/kamailio-private-public/blob/master/README.md">https://github.com/davidcsi/kamailio-private-public/blob/master/README.md</a> )</div></div><div dir="auto"><br></div><div dir="auto">Please excuse and errors, typing on my phone :)</div><div dir="auto"><br></div><div dir="auto">Hope that helps!</div><div dir="auto"><br></div><div dir="auto">David </div><div dir="auto"><br><div class="gmail_quote" dir="auto"><div dir="ltr" class="gmail_attr">On Wed, 4 Mar 2020 at 07:49, Daniel-Constantin Mierla <<a href="mailto:miconda@gmail.com" target="_blank">miconda@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)">Hello,<br>
<br>
On 04.03.20 04:44, Joli Martinez wrote:<br>
> Hello,<br>
><br>
> We have several SIP domains coming into our SBC.  I need to build a<br>
> Kamailio box that will 302 the call to the appropriate server based on<br>
> the domain.  If the call does not come in with a recognized domain I<br>
> would like for it to 404 the call.  Not sure how to do this.  Can<br>
> someone point me in the right direction?<br>
<br>
the complete solution and complexity can be a matter of scalability and<br>
security needs, but for redirect itself is about sending a<br>
sl_send_reply(...) after using append_to_reply(). If relevant data is<br>
stored in database, sqlops is the module that can help to fetch the<br>
matching records.<br>
<br>
Cheers,<br>
Daniel<br>
<br>
-- <br>
Daniel-Constantin Mierla -- <a href="http://www.asipto.com" rel="noreferrer" target="_blank">www.asipto.com</a><br>
<a href="http://www.twitter.com/miconda" rel="noreferrer" target="_blank">www.twitter.com/miconda</a> -- <a href="http://www.linkedin.com/in/miconda" rel="noreferrer" target="_blank">www.linkedin.com/in/miconda</a><br>
Kamailio Advanced Training - March 9-11, 2020, Berlin - <a href="http://www.asipto.com" rel="noreferrer" target="_blank">www.asipto.com</a><br>
Kamailio World Conference - April 27-29, 2020, in Berlin -- <a href="http://www.kamailioworld.com" rel="noreferrer" target="_blank">www.kamailioworld.com</a><br>
<br>
<br>
_______________________________________________<br>
Kamailio (SER) - Users Mailing List<br>
<a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a><br>
<a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br>
</blockquote></div></div>
</div>
</div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Regards,</div><div><br></div>David Villasmil<div>email: <a href="mailto:david.villasmil.work@gmail.com" target="_blank">david.villasmil.work@gmail.com</a></div><div>phone: +34669448337</div></div></div>