Hello,
We have several SIP domains coming into our SBC. I need to build a Kamailio box that will 302 the call to the appropriate server based on the domain. If the call does not come in with a recognized domain I would like for it to 404 the call. Not sure how to do this. Can someone point me in the right direction?
Hi,
I think this comes part and parcel with learning how to use Kamailio in general.
If you are looking for someone to build it for you end-to-end or provide one-on-one tutoring, perhaps private consulting is a better option.
— Sent from my iPad
On Mar 3, 2020, at 10:45 PM, Joli Martinez mrjoli021@gmail.com wrote:
Hello,
We have several SIP domains coming into our SBC. I need to build a Kamailio box that will 302 the call to the appropriate server based on the domain. If the call does not come in with a recognized domain I would like for it to 404 the call. Not sure how to do this. Can someone point me in the right direction? _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
+1
On Wed, 4 Mar 2020 at 04:17, Alex Balashov abalashov@evaristesys.com wrote:
Hi,
I think this comes part and parcel with learning how to use Kamailio in general.
If you are looking for someone to build it for you end-to-end or provide one-on-one tutoring, perhaps private consulting is a better option.
— Sent from my iPad
On Mar 3, 2020, at 10:45 PM, Joli Martinez mrjoli021@gmail.com wrote:
Hello,
We have several SIP domains coming into our SBC. I need to build a
Kamailio box that will 302 the call to the appropriate server based on the domain. If the call does not come in with a recognized domain I would like for it to 404 the call. Not sure how to do this. Can someone point me in the right direction?
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Hello,
On 04.03.20 04:44, Joli Martinez wrote:
Hello,
We have several SIP domains coming into our SBC. I need to build a Kamailio box that will 302 the call to the appropriate server based on the domain. If the call does not come in with a recognized domain I would like for it to 404 the call. Not sure how to do this. Can someone point me in the right direction?
the complete solution and complexity can be a matter of scalability and security needs, but for redirect itself is about sending a sl_send_reply(...) after using append_to_reply(). If relevant data is stored in database, sqlops is the module that can help to fetch the matching records.
Cheers, Daniel
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.
In terms of multiple domains, there’s probably a better way, but this is how I do it:
So I would add to the dialplan table the domains I’m serving to, I.e.:
Match *dom1* and attrs 1 Match *dom2* and attrs 2 ...
Then on the dispatcher:
GID:1 ip: sip:1.2.3.4:5060 GID:1 ip: sip:2.3.4.4:5060 GID:2 ip: sip:9.8.7.6:5060 GID:2 ip: sip:8.7.6.5:5060
So anything with “dom1” in the $ru would be sent out to GID 1, “dom2” to GID 2, and so on.
And use the dialplan and dispatcher like so:
modparam("dialplan", "db_url", "mysql://DB_USER:DB_PASS@DB_HOST/kamailio")
modparam("dialplan", "attrs_pvar", "$var(dispatcher_id)")
modparam("dialplan", "fetch_rows", 100)
...
route[DISPATCH] {
dp_match("1", "$ru");
xlog("[DISPATCH] '$ru' was translated to '$var(dispatcher_id)'\n");
xlog("[DISPATCH] avp(dsdstid): $avp(dsdstid)\n");
if(!ds_select_dst("$var(dispatcher_id)", "9"))
{
send_reply("404", "No destination");
exit;
}
xlog("L_DBG", "--- SCRIPT: going to <$ru> via <$du>\n");
t_on_failure("RTF_DISPATCH”);
append_to_reply("Contact: sip:$du\r\n");
sl_send_reply("300","Multiple Choices");
exit;
}
Or something like that. (I took this off my https://github.com/davidcsi/kamailio-private-public/blob/master/README.md )
Please excuse and errors, typing on my phone :)
Hope that helps!
David
On Wed, 4 Mar 2020 at 07:49, Daniel-Constantin Mierla miconda@gmail.com wrote:
Hello,
On 04.03.20 04:44, Joli Martinez wrote:
Hello,
We have several SIP domains coming into our SBC. I need to build a Kamailio box that will 302 the call to the appropriate server based on the domain. If the call does not come in with a recognized domain I would like for it to 404 the call. Not sure how to do this. Can someone point me in the right direction?
the complete solution and complexity can be a matter of scalability and security needs, but for redirect itself is about sending a sl_send_reply(...) after using append_to_reply(). If relevant data is stored in database, sqlops is the module that can help to fetch the matching records.
Cheers, Daniel
-- Daniel-Constantin Mierla -- www.asipto.com www.twitter.com/miconda -- www.linkedin.com/in/miconda Kamailio Advanced Training - March 9-11, 2020, Berlin - www.asipto.com Kamailio World Conference - April 27-29, 2020, in Berlin -- www.kamailioworld.com
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
On Tue, Mar 03, 2020 at 10:44:32PM -0500, Joli Martinez wrote:
We have several SIP domains coming into our SBC. I need to build a Kamailio box that will 302 the call to the appropriate server based on the domain. If the call does not come in with a recognized domain I would like for it to 404 the call. Not sure how to do this. Can someone point me in the right direction?
You can create a redirect by changing the domain in the R-URI ($rd) and sending a 302 with. send_reply("302", "Redirect");
The logic how to choose which is the correct $rd is up to you.