Hello masters, I am a newbie who recently got to know Kamailio. I have a scenario and I would like to know if this tool would suit: a central asterisk server with all user accounts and three remote units with Kamailio acting as a proxy. Is there any module or configuration that if the central asterisk server fails to respond, would the remote proxies act in survival mode, allowing local communication by users until the central asterisk server returns a response?
Att,
Joao Paulo
Hello,
Such a configuration is indeed possible. However, Asterisk and Kamailio are not interchangeable; Kamailio is a SIP proxy, and cannot offer the same in-channel and call supervision features that Asterisk can. So, the "survival mode" might be very simplified and basic compared to the caller experiences that Asterisk can provide.
But it is possible.
I don't know that it's the best architecture. You might instead investigate ways to make Asterisk more distributed and/or highly available.
-- Alex
On Jan 12, 2023, at 7:06 AM, Joao Paulo Vaz jpvazdasilva@gmail.com wrote:
Hello masters, I am a newbie who recently got to know Kamailio. I have a scenario and I would like to know if this tool would suit: a central asterisk server with all user accounts and three remote units with Kamailio acting as a proxy. Is there any module or configuration that if the central asterisk server fails to respond, would the remote proxies act in survival mode, allowing local communication by users until the central asterisk server returns a response?
Att,
Joao Paulo
Kamailio - Users Mailing List - Non Commercial Discussions To unsubscribe send an email to sr-users-leave@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender! Edit mailing list options or unsubscribe:
Thank you very much for this clarification Alex. I also believe that this is not the best scenario but it is the demand presented, and in the case of "survivor mode" it would really only be the basics, a user being able to make a call to another on the same site, the other applications can wait for the communication to return with the center point. Could you point me a way to this configuration?
Att,
Joao Paulo
Em qui., 12 de jan. de 2023 às 10:52, Alex Balashov < abalashov@evaristesys.com> escreveu:
Hello,
Such a configuration is indeed possible. However, Asterisk and Kamailio are not interchangeable; Kamailio is a SIP proxy, and cannot offer the same in-channel and call supervision features that Asterisk can. So, the "survival mode" might be very simplified and basic compared to the caller experiences that Asterisk can provide.
But it is possible.
I don't know that it's the best architecture. You might instead investigate ways to make Asterisk more distributed and/or highly available.
-- Alex
On Jan 12, 2023, at 7:06 AM, Joao Paulo Vaz jpvazdasilva@gmail.com
wrote:
Hello masters, I am a newbie who recently got to know Kamailio. I have a scenario and I would like to know if this tool would suit: a
central asterisk server with all user accounts and three remote units with Kamailio acting as a proxy.
Is there any module or configuration that if the central asterisk server
fails to respond, would the remote proxies act in survival mode, allowing local communication by users
until the central asterisk server returns a response?
Att,
Joao Paulo
Kamailio - Users Mailing List - Non Commercial Discussions To unsubscribe send an email to sr-users-leave@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to
the sender!
Edit mailing list options or unsubscribe:
-- Alex Balashov Principal Consultant Evariste Systems LLC Web: https://evaristesys.com Tel: +1-706-510-6800
Kamailio - Users Mailing List - Non Commercial Discussions To unsubscribe send an email to sr-users-leave@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender! Edit mailing list options or unsubscribe:
Hi João,
I don't know that I can point you to a specific configuration. But I can elucidate some general principles:
1. Learn about and set these timers in the TM module configuration:
https://kamailio.org/docs/modules/5.6.x/modules/tm.html#tm.p.fr_timer
https://kamailio.org/docs/modules/5.6.x/modules/tm.html#tmp.p.fr_inv_timer
If your logic for what constitutes a 'failure to respond' on the part of Asterisk is more complex or situational, there are also dynamic equivalents:
https://kamailio.org/docs/modules/5.6.x/modules/tm.html#tm.p.fr_timer_avp
https://kamailio.org/docs/modules/5.6.x/modules/tm.html#tm.p.fr_inv_timer_av...
https://kamailio.org/docs/modules/5.6.x/modules/tm.html#tm.f.t_set_fr
https://kamailio.org/docs/modules/5.6.x/modules/tm.html#tm.f.t_reset_fr
It's safe to say that 'fr_timer' is the one you really care about.
2. When contacting Asterisk, use t_relay(). Prior to t_relay(), arm a failure_route:
request_route { ...
if(method == "INVITE") { ... t_on_failure("ASTERISK_FAILOVER");
if(!t_relay()) sl_reply_error();
exit; }
... }
3. The failure_route is called when any negative reply is received, or when a timeout occurs. Depending on how you choose to define 'fails to respond', you will need to have some logic in the failure_route to account for this:
failure_route[ASTERISK_FAILOVER] { if(t_is_canceled()) exit;
# The actual timeout case.
if(t_branch_timeout()) { # Do a local registrar lookup instead.
if(!lookup("location")) { send_reply("404", "Not Found"); exit; } }
... }
4. To allow Kamailio to know how to reach other extensions, you need a kind of "middlebox" or "shadow registrar" on the Kamailio side, even if the primary source of truth for the location database is the upstream Asterisk.
There are several ways to accomplish this. One is to do a silent local save() and relay the registration upstream:
if(method == "REGISTER") { save("0x06"); # probably should check for errors
$du = "sip:asterisk_ip:5060";
if(!t_relay()) sl_reply_error();
exit; }
Or perhaps you might prefer to use t_replicate() to share the registration with Asterisk more crudely. That depends on a number of other factors. And, of course, if you're in the path of registrations relayed upstream to Asterisk, you'll need to use Path (if the version of Asterisk you are using upstream supports it[1]), or set an `outbound_proxy` value on the chan_pjsip peer for the proxy.
I think you can understand why building an entire configuration for you is not a simple task, but hopefully these pointers should get you moving in the right direction. Feel free to ask further specific questions if you run into stumbling blocks!
Boa sorte!
-- Alex
[1] https://www.mail-archive.com/sr-users@lists.kamailio.org/msg18644.html
Joao Paulo,
add a second Asterisk server, and add a Virtual IP (VIP) using Keepalived. Then UAC connects to Asterisk using the VIP. Keepalived will switch to the 2nd node once the 1st is down (or even if the 1st one stops Asterisk service). In this case, you may not need a SIP Proxy as frontend.
If you require a SIP Proxy, use Kamailio and Dispatcher module to distribute SIP requests to one Asterisk node, or the other. In case 1 node gets offline, the 2nd node will still handle the calls. And if you add GlusterFS you can even share a folder between the 2 Asterisk nodes (folder A in Node 1 and folder A in Node 2 will be synced) and anything you modify on 1 node, will be modified on the 2nd node too (and vice-versa).
Just a few tips ;)
*Sérgio Charrua*
*www.voip.pt http://www.voip.pt/*
On Thu, Jan 12, 2023 at 3:23 PM Joao Paulo Vaz jpvazdasilva@gmail.com wrote:
Thank you very much for this clarification Alex. I also believe that this is not the best scenario but it is the demand presented, and in the case of "survivor mode" it would really only be the basics, a user being able to make a call to another on the same site, the other applications can wait for the communication to return with the center point. Could you point me a way to this configuration?
Att,
Joao Paulo
Em qui., 12 de jan. de 2023 às 10:52, Alex Balashov < abalashov@evaristesys.com> escreveu:
Hello,
Such a configuration is indeed possible. However, Asterisk and Kamailio are not interchangeable; Kamailio is a SIP proxy, and cannot offer the same in-channel and call supervision features that Asterisk can. So, the "survival mode" might be very simplified and basic compared to the caller experiences that Asterisk can provide.
But it is possible.
I don't know that it's the best architecture. You might instead investigate ways to make Asterisk more distributed and/or highly available.
-- Alex
On Jan 12, 2023, at 7:06 AM, Joao Paulo Vaz jpvazdasilva@gmail.com
wrote:
Hello masters, I am a newbie who recently got to know Kamailio. I have a scenario and I would like to know if this tool would suit: a
central asterisk server with all user accounts and three remote units with Kamailio acting as a proxy.
Is there any module or configuration that if the central asterisk
server fails to respond, would the remote proxies act in survival mode, allowing local communication by users
until the central asterisk server returns a response?
Att,
Joao Paulo
Kamailio - Users Mailing List - Non Commercial Discussions To unsubscribe send an email to sr-users-leave@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only
to the sender!
Edit mailing list options or unsubscribe:
-- Alex Balashov Principal Consultant Evariste Systems LLC Web: https://evaristesys.com Tel: +1-706-510-6800
Kamailio - Users Mailing List - Non Commercial Discussions To unsubscribe send an email to sr-users-leave@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender! Edit mailing list options or unsubscribe:
Kamailio - Users Mailing List - Non Commercial Discussions To unsubscribe send an email to sr-users-leave@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender! Edit mailing list options or unsubscribe: