On 26 Apr 2024, at 11:16 AM, Ihor Olkhovskyi via
sr-users <sr-users(a)lists.kamailio.org> wrote:
Alexis,
I'd switch to http_async, but this is a general advice.
As for switching to KEMI, I'd not expect increasing in performance as native script
is the fastest so far. KEMI will give you "comfort of writing on a high-level
language" and config reload, but performance should not be the reason for switching
AFAIK
Le 26/04/2024 à 15:19, Alexis Fidalgo via sr-users a écrit :
Hello all, little and fast context, we have 8
docker swarm clusters (4 nodes each) where there are deployed as global service 4 kamailio
per cluster. Each cluster runs 8 replicas of a call processing service/app (for the sake
of this question we’ll assume the performance of this app is ok, no problems on what it
does and how much it consumes in cpu/memory).
kamailio is configured to use http_client module to query the processing app (those
queries are load balanced by the docker swarm cluster) in a very simple way, added below
in this email.
Everything goes well, there’s an average of ~450 caps on each kamailio on peak hours.
Question and reason of this email is: Is this the best approach i can take? (the
http_client) or maybe there’s a more efficient one for this scenario? maybe kemi, or
other?
The processing app is written in golang.
We’re planning to add more traffic (significantly more) to this instances and i would
like to know if there’s a better scenario, to explore it before this migration.
Thanks, regards
—
request_route {
route(AF_SL);
}
route[AF_SL] {
if(is_method("ACK")){
exit;
}
if(is_method("REGISTER")){
sl_reply("200", "OK");
exit;
}
if(is_method("OPTIONS")){
sl_reply("200", "OK");
exit;
}
if(is_method("CANCEL")){
sl_reply("200","OK");
sl_reply("487","Request Terminated");
exit;
}
if(is_method("INVITE")){
if ($hdr(X-Carrier-In)!="" && $hdr(Organization)!=""
&& $hdr(X-SBC-Type)!="") {
sl_reply("100","Trying");
$var(retCode) =
http_client_query("http://cbrcre:3001/cbrcre/v1/callHandler",'xsbct=$(hdr(X-SBC-Type){s.escape.param})&org=$(hdr(Organization){s.escape.param})&xci=$(hdr(X-Carrier-In){s.escape.param})&fu=$(fu{s.escape.param})&ru=$(ru{s.escape.param})&rU=$(rU{s.escape.param})&fU=$(fU{s.escape.param})&ci=$(ci{s.escape.param})&cin=$(hdr(Call-Info){s.escape.param})&ih=$hdr(Identity)&tag=$(ft{s.escape.param})&ct=$(ct{s.escape.param})&via=$(hdr(Via)[0]{s.escape.param})',
"$var(result)");
xlog("L_INFO", "*************** RESULT: $var(result)\n\n");
jansson_get("response_code", "$var(result)",
"$var(rc)");
switch($var(rc)){
case "200":
if jansson_get("contact", "$var(result)", "$var(ct)")
== true {
append_branch("$var(ct)");
}
if jansson_get("callinfo", "$var(result)",
"$var(cinfo)") == true {
append_to_reply("Call-Info: $var(cinfo)\r\n");
}
if jansson_get("pai", "$var(result)", "$var(pai)")
==true {
append_to_reply("P-Asserted-Identity: $var(pai)\r\n");
}
if jansson_get("xfrom", "$var(result)", "$var(xfrom)")
==true {
append_to_reply("X-From: $var(xfrom)\r\n");
}
if jansson_get("identity", "$var(result)",
"$var(identity)") ==true {
append_to_reply("Identity: $var(identity)\r\n");
}
append_to_reply("X-Handled: ServiceBroker\r\n");
sl_send_reply("302", "Redirect");
break;
default:
jansson_get("reason","$var(result)","$var(reason)");
jansson_get("sbReason","$var(result)","$var(sbreason)");
append_to_reply("X-SBReason: $var(sbreason)\r\n");
sl_send_reply("$var(rc)", "$var(reason)");
}
exit;
}
xlog("L_ERR","missing xci or org or sbct");
sl_send_reply("608", "SBK Rejected");
}
}
__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-leave(a)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(a)lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the sender!
Edit mailing list options or unsubscribe: