Do you have an example of your python script (or at least a simplified example that reproduces the problem).
Honestly, I tried going down this path as a follow up to the discussions on using http-async the other week, and while I have no doubt there is a performance gain using evapi, I had no success coding an async client (in other words, my client requests to
an http service, etc. were blocking). That's not an indictment of evapi, rather it's the state of my coding ability in other language. I was able to get a simple synchronous example working, but if I couldn't get it to perform better than http_async, there
was no gain.
Kaufman
Senior Voice Engineer
E: bkaufman@bcmone.com
|
SIP.US Client Support: 800.566.9810
| SIPTRUNK Client Support: 800.250.6510 | Flowroute Client Support: 855.356.9768
|
|
|
|
|
Regards,
Kaufman
From: Sergio Charrua via sr-users <sr-users@lists.kamailio.org>
Sent: Wednesday, January 8, 2025 11:25 AM
To: Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.org>
Cc: Sergio Charrua <sergio.charrua@voip.pt>
Subject: [SR-Users] evapi not processing received messages
|
CAUTION: This email originated from outside the organization.
Do not click links or open attachments unless you recognize the sender and know the content is safe.
|
Hi all!
I have implemented evapi module on Kamailio 5.8.4, calling a python script.
Python script is listening to a socket. It receives messages (JSON) from Kamailio, makes an HTTP request somewhere, and sends the response back to Kamailio.
The Python script is working fine: it connects to Kamailio, sends HTTP requests, and forwards a response back to Kamailio: I have confirmed using TCPDump that, in fact, the data is received and forwarded back.
However, despite showing messages that the Python client script is correctly connected to Kamailio, the event_route[evapi:message-received] is never executed.
Probably there is some detail that I am missing, but the docs and online info for evapi are very rare, and they all show very similar configuration.
And as I wrote, I have confirmed using TCPDump that the data is received from Python client script to Kamailio node.
What am I missing?
This is my Kamailio cfg:
[loads modules]
[sets modparams]
debug=2
children=16
log_facility=LOG_LOCAL0
log_prefix="{$mt $hdr(CSeq) $ci} "
disable_sctp = yes
force_rport = yes
rundir="/tmp"
request_route {
if ( is_method("ACK") ) {
if ( t_check_trans() ) {
t_relay();
}
exit;
}
if(is_method("OPTIONS")){
sl_reply("200", "OK");
exit;
}
if(is_method("CANCEL")){
sl_reply("200","OK");
sl_reply("487","Request Terminated");
exit;
}
route(TOEVAPI);
exit;
}
event_route[evapi:connection-new] {
xlog("LINFO","new connection from [$evapi(srcaddr):$evapi(srcport)]\n");
if($evapi(srcaddr)!="10.20.0.1") {
evapi_close();
exit;
}
}
event_route[evapi:connection-closed] {
xlog("LINFO","connection closed by $evapi(srcaddr):$evapi(srcport)\n");
}
event_route[evapi:message-received] {
xlog("LINFO","received [$evapi(msg)] from $evapi(srcaddr):$evapi(srcport)\n");
jansson_get("t-index", "$evapi(msg)", "$var(t-index)");
jansson_get("t-label", "$evapi(msg)", "$var(t-label)");
$var(evmsg) = $evapi(msg);
xlog("L_INFO", "preparing to resume transaction for processing: $var(tindex) / $var(tlabel)\n");
t_continue("$var(tindex)", "$var(tlabel)", "EVAPIRESPONSE");
}
route[EVAPIRESPONSE] {
xlog("L_INFO", "resumed transaction for processing: $T(id_index) / $T(id_label)\n");
[do stuff]
}
route[TOEVAPI]{
xlog("L_INFO", "suspended transaction: $T(id_index) / $T(id_label)\n");
evapi_async_relay( [some JSON string] );
exit;
}
Thanks in advance!
Atenciosamente / Kind Regards / Cordialement / Un saludo,
Sérgio Charrua