Hello, Kamailio community, we are implementing evapi communication to our Kamailio server. We have implemented and tested it on our testing server. Everything was working OK.
Now we are testing it on our production servers with a lot more calls and we have some problems here. Every n seconds we are requesting from Kamailio list of all dialogs. And this list of dialogs (from jsonrpc *dlg.list*) is sent to evapi connection. Here is a snippet of our *Kamailio code*:
route[CGR_DLG_LIST] { xlog("L_INFO", "XLOG: $ci [CGR_DLG_LIST] Requested dialog list"); # CGRateS connection is still alive, set check to true $sht(cgrconn=>check) = 1; if $sht(cgrconn=>cgr) == $null { sl_send_reply("503","Charging controller unreachable"); exit; } jsonrpc_exec('{"jsonrpc":"2.0","id":1, "method":"dlg.list","params":[]}'); xlog("L_INFO", "XLOG: $ci [CGR_DLG_LIST] Test1: $jsonrpl(body)");
evapi_relay("{"event":"CGR_DLG_LIST_REPLY", "jsonrpl_body":$jsonrpl(body)}"); }
During a higher number of calls Kamailio is generating ERROR messages from evapi module. Here is the syslog:
Oct 30 12:02:15 kam-prod /opt/ipgate/kamailio/sbin/kamailio[19512]: INFO: <script>: XLOG: 123 [CGR_DLG_LIST] Requested dialog list Oct 30 12:02:15 kam-prod /opt/ipgate/kamailio/sbin/kamailio[19512]: INFO: <script>: Oct 30 12:02:15 kam-prod /opt/ipgate/kamailio/sbin/kamailio[19512]: DEBUG: evapi [evapi_dispatch.c:740]: _evapi_relay(): relaying event data [ Oct 30 12:02:15 kam-prod /opt/ipgate/kamailio/sbin/kamailio[19512]: ERROR: evapi [evapi_dispatch.c:764]: _evapi_relay(): cannot serialize event Oct 30 12:02:15 kam-prod /opt/ipgate/kamailio/sbin/kamailio[19512]: ERROR: evapi [evapi_mod.c:265]: w_evapi_relay(): failed to relay event:
*We are expecting something like this when nobody is calling* Oct 30 14:12:22 kam-test /opt/ipgate/kamailio/sbin/kamailio[32090]: INFO: <script>: XLOG: 123 [CGR_DLG_LIST] Requested dialog list Oct 30 14:12:22 kam-test /opt/ipgate/kamailio/sbin/kamailio[32090]: INFO: <script>: XLOG: 123 [CGR_DLG_LIST] Test1: { #011"jsonrpc":#011"2.0", #011"result":#011[], #011"id":#0111 } Oct 30 14:12:22 kam-test /opt/ipgate/kamailio/sbin/kamailio[32090]: DEBUG: evapi [evapi_dispatch.c:740]: _evapi_relay(): relaying event data [{"event":"CGR_DLG_LIST_REPLY", #011#011#011"jsonrpl_body":{ #011"jsonrpc":#011"2.0", #011"result":#011[], #011"id":#0111 }}] (96) Oct 30 14:12:22 kam-test /opt/ipgate/kamailio/sbin/kamailio[32090]: DEBUG: evapi [evapi_dispatch.c:778]: _evapi_relay(): sending [0x169ff674] [96:{"event":"CGR_DLG_LIST_REPLY", #011#011#011"jsonrpl_body":{ #011"jsonrpc":#011"2.0", #011"result":#011[], #011"id":#0111 }},] (100) Oct 30 14:12:22 kam-test /opt/ipgate/kamailio/sbin/kamailio[32090]: DEBUG: evapi [evapi_dispatch.c:789]: _evapi_relay(): dispatching [0x169ff674] [96:{"event":"CGR_DLG_LIST_REPLY", #011#011#011"jsonrpl_body":{ #011"jsonrpc":#011"2.0", #011"result":#011[], #011"id":#0111 }},] (100)
We enabled debug messages for module evapi and are trying to understand where is the problem. To make this work to this state we needed to increase the *pv_buffer* to really big size (2097152). It looks like $jsonrpl(body) is not ready and everything concated with it is not working.
Any help or suggestion is welcomed.
Sincerely Michal
Hello,
how often are you requesting the list of all dialogs (what is the n in that every n seconds)? Is it done using a single evapi connection, or are there many of them?
And to clarify, is the error ("cannot serialize event") happening when there is no call or when there are too many? Is not clear for me given that you follow with what you expect to be when nobody is calling ...
Cheers, Daniel
On 30.10.19 14:26, Michal Škuta wrote:
Hello, Kamailio community, we are implementing evapi communication to our Kamailio server. We have implemented and tested it on our testing server. Everything was working OK.
Now we are testing it on our production servers with a lot more calls and we have some problems here. Every n seconds we are requesting from Kamailio list of all dialogs. And this list of dialogs (from jsonrpc *dlg.list*) is sent to evapi connection. Here is a snippet of our *Kamailio code*:
route[CGR_DLG_LIST] { xlog("L_INFO", "XLOG: $ci [CGR_DLG_LIST] Requested dialog list"); # CGRateS connection is still alive, set check to true $sht(cgrconn=>check) = 1; if $sht(cgrconn=>cgr) == $null { sl_send_reply("503","Charging controller unreachable"); exit; } jsonrpc_exec('{"jsonrpc":"2.0","id":1, "method":"dlg.list","params":[]}'); xlog("L_INFO", "XLOG: $ci [CGR_DLG_LIST] Test1: $jsonrpl(body)");
evapi_relay("{"event":"CGR_DLG_LIST_REPLY", "jsonrpl_body":$jsonrpl(body)}"); }
During a higher number of calls Kamailio is generating ERROR messages from evapi module. Here is the syslog:
Oct 30 12:02:15 kam-prod /opt/ipgate/kamailio/sbin/kamailio[19512]: INFO: <script>: XLOG: 123 [CGR_DLG_LIST] Requested dialog list Oct 30 12:02:15 kam-prod /opt/ipgate/kamailio/sbin/kamailio[19512]: INFO: <script>: Oct 30 12:02:15 kam-prod /opt/ipgate/kamailio/sbin/kamailio[19512]: DEBUG: evapi [evapi_dispatch.c:740]: _evapi_relay(): relaying event data [ Oct 30 12:02:15 kam-prod /opt/ipgate/kamailio/sbin/kamailio[19512]: ERROR: evapi [evapi_dispatch.c:764]: _evapi_relay(): cannot serialize event Oct 30 12:02:15 kam-prod /opt/ipgate/kamailio/sbin/kamailio[19512]: ERROR: evapi [evapi_mod.c:265]: w_evapi_relay(): failed to relay event:
*We are expecting something like this when nobody is calling* Oct 30 14:12:22 kam-test /opt/ipgate/kamailio/sbin/kamailio[32090]: INFO: <script>: XLOG: 123 [CGR_DLG_LIST] Requested dialog list Oct 30 14:12:22 kam-test /opt/ipgate/kamailio/sbin/kamailio[32090]: INFO: <script>: XLOG: 123 [CGR_DLG_LIST] Test1: { #011"jsonrpc":#011"2.0", #011"result":#011[], #011"id":#0111 } Oct 30 14:12:22 kam-test /opt/ipgate/kamailio/sbin/kamailio[32090]: DEBUG: evapi [evapi_dispatch.c:740]: _evapi_relay(): relaying event data [{"event":"CGR_DLG_LIST_REPLY", #011#011#011"jsonrpl_body":{ #011"jsonrpc":#011"2.0", #011"result":#011[], #011"id":#0111 }}] (96) Oct 30 14:12:22 kam-test /opt/ipgate/kamailio/sbin/kamailio[32090]: DEBUG: evapi [evapi_dispatch.c:778]: _evapi_relay(): sending [0x169ff674] [96:{"event":"CGR_DLG_LIST_REPLY", #011#011#011"jsonrpl_body":{ #011"jsonrpc":#011"2.0", #011"result":#011[], #011"id":#0111 }},] (100) Oct 30 14:12:22 kam-test /opt/ipgate/kamailio/sbin/kamailio[32090]: DEBUG: evapi [evapi_dispatch.c:789]: _evapi_relay(): dispatching [0x169ff674] [96:{"event":"CGR_DLG_LIST_REPLY", #011#011#011"jsonrpl_body":{ #011"jsonrpc":#011"2.0", #011"result":#011[], #011"id":#0111 }},] (100)
We enabled debug messages for module evapi and are trying to understand where is the problem. To make this work to this state we needed to increase the *pv_buffer* to really big size (2097152). It looks like $jsonrpl(body) is not ready and everything concated with it is not working.
||Any help or suggestion is welcomed. || ||Sincerely Michal||
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Hi Michal,
I've already encountered this same problem and got an answer from Daniel. Check below link.
https://lists.kamailio.org/pipermail/sr-users/2019-October/107092.html
Cheers.
On Wed, Oct 30, 2019 at 9:57 AM Daniel-Constantin Mierla miconda@gmail.com wrote:
Hello,
how often are you requesting the list of all dialogs (what is the n in that every n seconds)? Is it done using a single evapi connection, or are there many of them?
And to clarify, is the error ("cannot serialize event") happening when there is no call or when there are too many? Is not clear for me given that you follow with what you expect to be when nobody is calling ...
Cheers, Daniel On 30.10.19 14:26, Michal Škuta wrote:
Hello, Kamailio community, we are implementing evapi communication to our Kamailio server. We have implemented and tested it on our testing server. Everything was working OK.
Now we are testing it on our production servers with a lot more calls and we have some problems here. Every n seconds we are requesting from Kamailio list of all dialogs. And this list of dialogs (from jsonrpc *dlg.list*) is sent to evapi connection. Here is a snippet of our *Kamailio code*:
route[CGR_DLG_LIST] { xlog("L_INFO", "XLOG: $ci [CGR_DLG_LIST] Requested dialog list"); # CGRateS connection is still alive, set check to true $sht(cgrconn=>check) = 1; if $sht(cgrconn=>cgr) == $null { sl_send_reply("503","Charging controller unreachable"); exit; } jsonrpc_exec('{"jsonrpc":"2.0","id":1, "method":"dlg.list","params":[]}'); xlog("L_INFO", "XLOG: $ci [CGR_DLG_LIST] Test1: $jsonrpl(body)");
evapi_relay("{\"event\":\"CGR_DLG_LIST_REPLY\", \"jsonrpl_body\":$jsonrpl(body)}");
}
During a higher number of calls Kamailio is generating ERROR messages from evapi module. Here is the syslog:
Oct 30 12:02:15 kam-prod /opt/ipgate/kamailio/sbin/kamailio[19512]: INFO:
<script>: XLOG: 123 [CGR_DLG_LIST] Requested dialog list Oct 30 12:02:15 kam-prod /opt/ipgate/kamailio/sbin/kamailio[19512]: INFO: <script>: Oct 30 12:02:15 kam-prod /opt/ipgate/kamailio/sbin/kamailio[19512]: DEBUG: evapi [evapi_dispatch.c:740]: _evapi_relay(): relaying event data [ Oct 30 12:02:15 kam-prod /opt/ipgate/kamailio/sbin/kamailio[19512]: ERROR: evapi [evapi_dispatch.c:764]: _evapi_relay(): cannot serialize event Oct 30 12:02:15 kam-prod /opt/ipgate/kamailio/sbin/kamailio[19512]: ERROR: evapi [evapi_mod.c:265]: w_evapi_relay(): failed to relay event: *We are expecting something like this when nobody is calling* Oct 30 14:12:22 kam-test /opt/ipgate/kamailio/sbin/kamailio[32090]: INFO: <script>: XLOG: 123 [CGR_DLG_LIST] Requested dialog list Oct 30 14:12:22 kam-test /opt/ipgate/kamailio/sbin/kamailio[32090]: INFO: <script>: XLOG: 123 [CGR_DLG_LIST] Test1: { #011"jsonrpc":#011"2.0", #011"result":#011[], #011"id":#0111 } Oct 30 14:12:22 kam-test /opt/ipgate/kamailio/sbin/kamailio[32090]: DEBUG: evapi [evapi_dispatch.c:740]: _evapi_relay(): relaying event data [{"event":"CGR_DLG_LIST_REPLY", #011#011#011"jsonrpl_body":{ #011"jsonrpc":#011"2.0", #011"result":#011[], #011"id":#0111 }}] (96) Oct 30 14:12:22 kam-test /opt/ipgate/kamailio/sbin/kamailio[32090]: DEBUG: evapi [evapi_dispatch.c:778]: _evapi_relay(): sending [0x169ff674] [96:{"event":"CGR_DLG_LIST_REPLY", #011#011#011"jsonrpl_body":{ #011"jsonrpc":#011"2.0", #011"result":#011[], #011"id":#0111 }},] (100) Oct 30 14:12:22 kam-test /opt/ipgate/kamailio/sbin/kamailio[32090]: DEBUG: evapi [evapi_dispatch.c:789]: _evapi_relay(): dispatching [0x169ff674] [96:{"event":"CGR_DLG_LIST_REPLY", #011#011#011"jsonrpl_body":{ #011"jsonrpc":#011"2.0", #011"result":#011[], #011"id":#0111 }},] (100) We enabled debug messages for module evapi and are trying to understand where is the problem. To make this work to this state we needed to increase the *pv_buffer* to really big size (2097152). It looks like $jsonrpl(body) is not ready and everything concated with it is not working. Any help or suggestion is welcomed. Sincerely Michal _______________________________________________ Kamailio (SER) - Users Mailing Listsr-users@lists.kamailio.orghttps://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users -- Daniel-Constantin Mierla -- www.asipto.comwww.twitter.com/miconda -- www.linkedin.com/in/miconda 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
And BTW, not Kamailio related, but just FYI - you could disable that harsh dialog syncing every *n* minutes in cgrates.
"sessions": { "channel_sync_interval":"0", // sync channels to detect stale sessions (0 to disable) }
On Wed, Oct 30, 2019 at 10:56 AM Sergiu Pojoga pojogas@gmail.com wrote:
Hi Michal,
I've already encountered this same problem and got an answer from Daniel. Check below link.
https://lists.kamailio.org/pipermail/sr-users/2019-October/107092.html
Cheers.
On Wed, Oct 30, 2019 at 9:57 AM Daniel-Constantin Mierla < miconda@gmail.com> wrote:
Hello,
how often are you requesting the list of all dialogs (what is the n in that every n seconds)? Is it done using a single evapi connection, or are there many of them?
And to clarify, is the error ("cannot serialize event") happening when there is no call or when there are too many? Is not clear for me given that you follow with what you expect to be when nobody is calling ...
Cheers, Daniel On 30.10.19 14:26, Michal Škuta wrote:
Hello, Kamailio community, we are implementing evapi communication to our Kamailio server. We have implemented and tested it on our testing server. Everything was working OK.
Now we are testing it on our production servers with a lot more calls and we have some problems here. Every n seconds we are requesting from Kamailio list of all dialogs. And this list of dialogs (from jsonrpc *dlg.list*) is sent to evapi connection. Here is a snippet of our *Kamailio code*:
route[CGR_DLG_LIST] { xlog("L_INFO", "XLOG: $ci [CGR_DLG_LIST] Requested dialog list"); # CGRateS connection is still alive, set check to true $sht(cgrconn=>check) = 1; if $sht(cgrconn=>cgr) == $null { sl_send_reply("503","Charging controller unreachable"); exit; } jsonrpc_exec('{"jsonrpc":"2.0","id":1, "method":"dlg.list","params":[]}'); xlog("L_INFO", "XLOG: $ci [CGR_DLG_LIST] Test1: $jsonrpl(body)");
evapi_relay("{\"event\":\"CGR_DLG_LIST_REPLY\", \"jsonrpl_body\":$jsonrpl(body)}");
}
During a higher number of calls Kamailio is generating ERROR messages from evapi module. Here is the syslog:
Oct 30 12:02:15 kam-prod /opt/ipgate/kamailio/sbin/kamailio[19512]: INFO:
<script>: XLOG: 123 [CGR_DLG_LIST] Requested dialog list Oct 30 12:02:15 kam-prod /opt/ipgate/kamailio/sbin/kamailio[19512]: INFO: <script>: Oct 30 12:02:15 kam-prod /opt/ipgate/kamailio/sbin/kamailio[19512]: DEBUG: evapi [evapi_dispatch.c:740]: _evapi_relay(): relaying event data [ Oct 30 12:02:15 kam-prod /opt/ipgate/kamailio/sbin/kamailio[19512]: ERROR: evapi [evapi_dispatch.c:764]: _evapi_relay(): cannot serialize event Oct 30 12:02:15 kam-prod /opt/ipgate/kamailio/sbin/kamailio[19512]: ERROR: evapi [evapi_mod.c:265]: w_evapi_relay(): failed to relay event: *We are expecting something like this when nobody is calling* Oct 30 14:12:22 kam-test /opt/ipgate/kamailio/sbin/kamailio[32090]: INFO: <script>: XLOG: 123 [CGR_DLG_LIST] Requested dialog list Oct 30 14:12:22 kam-test /opt/ipgate/kamailio/sbin/kamailio[32090]: INFO: <script>: XLOG: 123 [CGR_DLG_LIST] Test1: { #011"jsonrpc":#011"2.0", #011"result":#011[], #011"id":#0111 } Oct 30 14:12:22 kam-test /opt/ipgate/kamailio/sbin/kamailio[32090]: DEBUG: evapi [evapi_dispatch.c:740]: _evapi_relay(): relaying event data [{"event":"CGR_DLG_LIST_REPLY", #011#011#011"jsonrpl_body":{ #011"jsonrpc":#011"2.0", #011"result":#011[], #011"id":#0111 }}] (96) Oct 30 14:12:22 kam-test /opt/ipgate/kamailio/sbin/kamailio[32090]: DEBUG: evapi [evapi_dispatch.c:778]: _evapi_relay(): sending [0x169ff674] [96:{"event":"CGR_DLG_LIST_REPLY", #011#011#011"jsonrpl_body":{ #011"jsonrpc":#011"2.0", #011"result":#011[], #011"id":#0111 }},] (100) Oct 30 14:12:22 kam-test /opt/ipgate/kamailio/sbin/kamailio[32090]: DEBUG: evapi [evapi_dispatch.c:789]: _evapi_relay(): dispatching [0x169ff674] [96:{"event":"CGR_DLG_LIST_REPLY", #011#011#011"jsonrpl_body":{ #011"jsonrpc":#011"2.0", #011"result":#011[], #011"id":#0111 }},] (100) We enabled debug messages for module evapi and are trying to understand where is the problem. To make this work to this state we needed to increase the *pv_buffer* to really big size (2097152). It looks like $jsonrpl(body) is not ready and everything concated with it is not working. Any help or suggestion is welcomed. Sincerely Michal _______________________________________________ Kamailio (SER) - Users Mailing Listsr-users@lists.kamailio.orghttps://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users -- Daniel-Constantin Mierla -- www.asipto.comwww.twitter.com/miconda -- www.linkedin.com/in/miconda 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
Hello,
I just finished pushing on master branch a series of commits targeting to have evapi using an internal buffer for the data parameter instead of relying on pv-related buffers.
Can people facing the reported issue try with latest master and report if all goes ok, even without setting pv buffer size to higher value?
On the other hand, because the reports so far where related to the use of jsonrpc response, I am thinking of adding a dedicated function like: evapi_relay_jsonrpcs_response(), so it is no need to copy from the internal buffer of jsonrpcs module to the internal buffer of evapi.
Thinking of a few other enhancements, therefore I am asking for feedback to see what and how to do:
1) does cgrates require all the attributes from the active dialog rpc list command? I was considering for quite some time to add a new rpc command in dialog module to list active dialogs with fewer attributes (e.g., dialog hash id, label, call id, from tag, to tag, from address, to address and state). Maybe we can add one tailored for cgrates needs
2) maybe worth considering to add a cgrates tailored module (or just a function in evapi module like evapi_relay_dialog_list()), so the list of active dialogs is retrieved directly from dialog module, avoiding to go through jsonrpcs module, like it seems to be the current mechanism. So a question here would be if cgrates interaction with kamailio requires more than just fetching active calls via evapi (e.g., trigger BYE for active calls in case of prepaid) -- is out there a complete config about using cgrates with all the features/commands interacting with kamailio?
Cheers, Daniel
On 30.10.19 15:56, Sergiu Pojoga wrote:
Hi Michal,
I've already encountered this same problem and got an answer from Daniel. Check below link.
https://lists.kamailio.org/pipermail/sr-users/2019-October/107092.html
Cheers.
On Wed, Oct 30, 2019 at 9:57 AM Daniel-Constantin Mierla <miconda@gmail.com mailto:miconda@gmail.com> wrote:
Hello, how often are you requesting the list of all dialogs (what is the n in that every n seconds)? Is it done using a single evapi connection, or are there many of them? And to clarify, is the error ("cannot serialize event") happening when there is no call or when there are too many? Is not clear for me given that you follow with what you expect to be when nobody is calling ... Cheers, Daniel On 30.10.19 14:26, Michal Škuta wrote:
Hello, Kamailio community, we are implementing evapi communication to our Kamailio server. We have implemented and tested it on our testing server. Everything was working OK. Now we are testing it on our production servers with a lot more calls and we have some problems here. Every n seconds we are requesting from Kamailio list of all dialogs. And this list of dialogs (from jsonrpc *dlg.list*) is sent to evapi connection. Here is a snippet of our *Kamailio code*: route[CGR_DLG_LIST] { xlog("L_INFO", "XLOG: $ci [CGR_DLG_LIST] Requested dialog list"); # CGRateS connection is still alive, set check to true $sht(cgrconn=>check) = 1; if $sht(cgrconn=>cgr) == $null { sl_send_reply("503","Charging controller unreachable"); exit; } jsonrpc_exec('{"jsonrpc":"2.0","id":1, "method":"dlg.list","params":[]}'); xlog("L_INFO", "XLOG: $ci [CGR_DLG_LIST] Test1: $jsonrpl(body)"); evapi_relay("{\"event\":\"CGR_DLG_LIST_REPLY\", \"jsonrpl_body\":$jsonrpl(body)}"); } During a higher number of calls Kamailio is generating ERROR messages from evapi module. Here is the syslog: Oct 30 12:02:15 kam-prod /opt/ipgate/kamailio/sbin/kamailio[19512]: INFO: <script>: XLOG: 123 [CGR_DLG_LIST] Requested dialog list Oct 30 12:02:15 kam-prod /opt/ipgate/kamailio/sbin/kamailio[19512]: INFO: <script>: Oct 30 12:02:15 kam-prod /opt/ipgate/kamailio/sbin/kamailio[19512]: DEBUG: evapi [evapi_dispatch.c:740]: _evapi_relay(): relaying event data [ Oct 30 12:02:15 kam-prod /opt/ipgate/kamailio/sbin/kamailio[19512]: ERROR: evapi [evapi_dispatch.c:764]: _evapi_relay(): cannot serialize event Oct 30 12:02:15 kam-prod /opt/ipgate/kamailio/sbin/kamailio[19512]: ERROR: evapi [evapi_mod.c:265]: w_evapi_relay(): failed to relay event: *We are expecting something like this when nobody is calling* Oct 30 14:12:22 kam-test /opt/ipgate/kamailio/sbin/kamailio[32090]: INFO: <script>: XLOG: 123 [CGR_DLG_LIST] Requested dialog list Oct 30 14:12:22 kam-test /opt/ipgate/kamailio/sbin/kamailio[32090]: INFO: <script>: XLOG: 123 [CGR_DLG_LIST] Test1: { #011"jsonrpc":#011"2.0", #011"result":#011[], #011"id":#0111 } Oct 30 14:12:22 kam-test /opt/ipgate/kamailio/sbin/kamailio[32090]: DEBUG: evapi [evapi_dispatch.c:740]: _evapi_relay(): relaying event data [{"event":"CGR_DLG_LIST_REPLY", #011#011#011"jsonrpl_body":{ #011"jsonrpc":#011"2.0", #011"result":#011[], #011"id":#0111 }}] (96) Oct 30 14:12:22 kam-test /opt/ipgate/kamailio/sbin/kamailio[32090]: DEBUG: evapi [evapi_dispatch.c:778]: _evapi_relay(): sending [0x169ff674] [96:{"event":"CGR_DLG_LIST_REPLY", #011#011#011"jsonrpl_body":{ #011"jsonrpc":#011"2.0", #011"result":#011[], #011"id":#0111 }},] (100) Oct 30 14:12:22 kam-test /opt/ipgate/kamailio/sbin/kamailio[32090]: DEBUG: evapi [evapi_dispatch.c:789]: _evapi_relay(): dispatching [0x169ff674] [96:{"event":"CGR_DLG_LIST_REPLY", #011#011#011"jsonrpl_body":{ #011"jsonrpc":#011"2.0", #011"result":#011[], #011"id":#0111 }},] (100) We enabled debug messages for module evapi and are trying to understand where is the problem. To make this work to this state we needed to increase the *pv_buffer* to really big size (2097152). It looks like $jsonrpl(body) is not ready and everything concated with it is not working. ||Any help or suggestion is welcomed. || ||Sincerely Michal|| _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org <mailto:sr-users@lists.kamailio.org> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
-- Daniel-Constantin Mierla -- www.asipto.com <http://www.asipto.com> www.twitter.com/miconda <http://www.twitter.com/miconda> -- www.linkedin.com/in/miconda <http://www.linkedin.com/in/miconda> Kamailio World Conference - April 27-29, 2020, in Berlin -- www.kamailioworld.com <http://www.kamailioworld.com> _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org <mailto: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,
as I wrote in another email, the master branch should have a solution for it (hoping people that are interested in this matter will provide feedback to my email in order to decide how to proceed further and improve based on the real needs) -- for reference, the link to that email:
- https://lists.kamailio.org/pipermail/sr-users/2019-October/107210.html
However, here is a new idea that can be used with existing deployments (likely needing 5.1.x at least): use an embedded scripting language to pass the data from $jsonrpl(body) to evapi_relay(). For example, app_jsdt doesn't have external dependency and you can make a small JS script to be executed inline from kamailio.cfg routing blocks with jsdt_run() or jsdt_runstring():
- https://www.kamailio.org/docs/modules/devel/modules/app_jsdt.html#app_jsdt.f...
The KEMI function for evapi_relay():
- http://kamailio.org/docs/tutorials/devel/kamailio-kemi-framework/modules/#ks...
So, the js script can even be like one line:
KSR.evapi.relay(KSR.pv.gete("$jsonrpl(body) ");
In this way, the internal pv buffer should not be used for transferring the content of $jsonrpl(body) to the parameter of evapi_relay().
If someone tries this solution, I would be curious about the results.
Cheers, Daniel
On 30.10.19 15:56, Sergiu Pojoga wrote:
Hi Michal,
I've already encountered this same problem and got an answer from Daniel. Check below link.
https://lists.kamailio.org/pipermail/sr-users/2019-October/107092.html
Cheers.
On Wed, Oct 30, 2019 at 9:57 AM Daniel-Constantin Mierla <miconda@gmail.com mailto:miconda@gmail.com> wrote:
Hello, how often are you requesting the list of all dialogs (what is the n in that every n seconds)? Is it done using a single evapi connection, or are there many of them? And to clarify, is the error ("cannot serialize event") happening when there is no call or when there are too many? Is not clear for me given that you follow with what you expect to be when nobody is calling ... Cheers, Daniel On 30.10.19 14:26, Michal Škuta wrote:
Hello, Kamailio community, we are implementing evapi communication to our Kamailio server. We have implemented and tested it on our testing server. Everything was working OK. Now we are testing it on our production servers with a lot more calls and we have some problems here. Every n seconds we are requesting from Kamailio list of all dialogs. And this list of dialogs (from jsonrpc *dlg.list*) is sent to evapi connection. Here is a snippet of our *Kamailio code*: route[CGR_DLG_LIST] { xlog("L_INFO", "XLOG: $ci [CGR_DLG_LIST] Requested dialog list"); # CGRateS connection is still alive, set check to true $sht(cgrconn=>check) = 1; if $sht(cgrconn=>cgr) == $null { sl_send_reply("503","Charging controller unreachable"); exit; } jsonrpc_exec('{"jsonrpc":"2.0","id":1, "method":"dlg.list","params":[]}'); xlog("L_INFO", "XLOG: $ci [CGR_DLG_LIST] Test1: $jsonrpl(body)"); evapi_relay("{\"event\":\"CGR_DLG_LIST_REPLY\", \"jsonrpl_body\":$jsonrpl(body)}"); } During a higher number of calls Kamailio is generating ERROR messages from evapi module. Here is the syslog: Oct 30 12:02:15 kam-prod /opt/ipgate/kamailio/sbin/kamailio[19512]: INFO: <script>: XLOG: 123 [CGR_DLG_LIST] Requested dialog list Oct 30 12:02:15 kam-prod /opt/ipgate/kamailio/sbin/kamailio[19512]: INFO: <script>: Oct 30 12:02:15 kam-prod /opt/ipgate/kamailio/sbin/kamailio[19512]: DEBUG: evapi [evapi_dispatch.c:740]: _evapi_relay(): relaying event data [ Oct 30 12:02:15 kam-prod /opt/ipgate/kamailio/sbin/kamailio[19512]: ERROR: evapi [evapi_dispatch.c:764]: _evapi_relay(): cannot serialize event Oct 30 12:02:15 kam-prod /opt/ipgate/kamailio/sbin/kamailio[19512]: ERROR: evapi [evapi_mod.c:265]: w_evapi_relay(): failed to relay event: *We are expecting something like this when nobody is calling* Oct 30 14:12:22 kam-test /opt/ipgate/kamailio/sbin/kamailio[32090]: INFO: <script>: XLOG: 123 [CGR_DLG_LIST] Requested dialog list Oct 30 14:12:22 kam-test /opt/ipgate/kamailio/sbin/kamailio[32090]: INFO: <script>: XLOG: 123 [CGR_DLG_LIST] Test1: { #011"jsonrpc":#011"2.0", #011"result":#011[], #011"id":#0111 } Oct 30 14:12:22 kam-test /opt/ipgate/kamailio/sbin/kamailio[32090]: DEBUG: evapi [evapi_dispatch.c:740]: _evapi_relay(): relaying event data [{"event":"CGR_DLG_LIST_REPLY", #011#011#011"jsonrpl_body":{ #011"jsonrpc":#011"2.0", #011"result":#011[], #011"id":#0111 }}] (96) Oct 30 14:12:22 kam-test /opt/ipgate/kamailio/sbin/kamailio[32090]: DEBUG: evapi [evapi_dispatch.c:778]: _evapi_relay(): sending [0x169ff674] [96:{"event":"CGR_DLG_LIST_REPLY", #011#011#011"jsonrpl_body":{ #011"jsonrpc":#011"2.0", #011"result":#011[], #011"id":#0111 }},] (100) Oct 30 14:12:22 kam-test /opt/ipgate/kamailio/sbin/kamailio[32090]: DEBUG: evapi [evapi_dispatch.c:789]: _evapi_relay(): dispatching [0x169ff674] [96:{"event":"CGR_DLG_LIST_REPLY", #011#011#011"jsonrpl_body":{ #011"jsonrpc":#011"2.0", #011"result":#011[], #011"id":#0111 }},] (100) We enabled debug messages for module evapi and are trying to understand where is the problem. To make this work to this state we needed to increase the *pv_buffer* to really big size (2097152). It looks like $jsonrpl(body) is not ready and everything concated with it is not working. ||Any help or suggestion is welcomed. || ||Sincerely Michal|| _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org <mailto:sr-users@lists.kamailio.org> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
-- Daniel-Constantin Mierla -- www.asipto.com <http://www.asipto.com> www.twitter.com/miconda <http://www.twitter.com/miconda> -- www.linkedin.com/in/miconda <http://www.linkedin.com/in/miconda> Kamailio World Conference - April 27-29, 2020, in Berlin -- www.kamailioworld.com <http://www.kamailioworld.com> _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org <mailto: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
Hi Daniel,
Thanks for the patch and clarifications. Planning to test it over the upcoming weekend in a dev environment (don't use master branches in production) and get back to you with the findings.
To answer your previous question, below find the master example of how Cgrates interacts with Kamailio. In terms of jsonrpc, it uses *dlg.list *(no params?) and *dlg.end_dlg*. https://github.com/cgrates/cgrates/blob/master/data/tutorials/kamevapi/kamai...
Cheers.
On Tue, Nov 5, 2019 at 4:33 AM Daniel-Constantin Mierla miconda@gmail.com wrote:
Hello,
as I wrote in another email, the master branch should have a solution for it (hoping people that are interested in this matter will provide feedback to my email in order to decide how to proceed further and improve based on the real needs) -- for reference, the link to that email:
However, here is a new idea that can be used with existing deployments (likely needing 5.1.x at least): use an embedded scripting language to pass the data from $jsonrpl(body) to evapi_relay(). For example, app_jsdt doesn't have external dependency and you can make a small JS script to be executed inline from kamailio.cfg routing blocks with jsdt_run() or jsdt_runstring():
https://www.kamailio.org/docs/modules/devel/modules/app_jsdt.html#app_jsdt.f...
The KEMI function for evapi_relay():
http://kamailio.org/docs/tutorials/devel/kamailio-kemi-framework/modules/#ks...
So, the js script can even be like one line:
KSR.evapi.relay(KSR.pv.gete("$jsonrpl(body) ");
In this way, the internal pv buffer should not be used for transferring the content of $jsonrpl(body) to the parameter of evapi_relay().
If someone tries this solution, I would be curious about the results.
Cheers, Daniel On 30.10.19 15:56, Sergiu Pojoga wrote:
Hi Michal,
I've already encountered this same problem and got an answer from Daniel. Check below link.
https://lists.kamailio.org/pipermail/sr-users/2019-October/107092.html
Cheers.
On Wed, Oct 30, 2019 at 9:57 AM Daniel-Constantin Mierla < miconda@gmail.com> wrote:
Hello,
how often are you requesting the list of all dialogs (what is the n in that every n seconds)? Is it done using a single evapi connection, or are there many of them?
And to clarify, is the error ("cannot serialize event") happening when there is no call or when there are too many? Is not clear for me given that you follow with what you expect to be when nobody is calling ...
Cheers, Daniel On 30.10.19 14:26, Michal Škuta wrote:
Hello, Kamailio community, we are implementing evapi communication to our Kamailio server. We have implemented and tested it on our testing server. Everything was working OK.
Now we are testing it on our production servers with a lot more calls and we have some problems here. Every n seconds we are requesting from Kamailio list of all dialogs. And this list of dialogs (from jsonrpc *dlg.list*) is sent to evapi connection. Here is a snippet of our *Kamailio code*:
route[CGR_DLG_LIST] { xlog("L_INFO", "XLOG: $ci [CGR_DLG_LIST] Requested dialog list"); # CGRateS connection is still alive, set check to true $sht(cgrconn=>check) = 1; if $sht(cgrconn=>cgr) == $null { sl_send_reply("503","Charging controller unreachable"); exit; } jsonrpc_exec('{"jsonrpc":"2.0","id":1, "method":"dlg.list","params":[]}'); xlog("L_INFO", "XLOG: $ci [CGR_DLG_LIST] Test1: $jsonrpl(body)");
evapi_relay("{\"event\":\"CGR_DLG_LIST_REPLY\", \"jsonrpl_body\":$jsonrpl(body)}");
}
During a higher number of calls Kamailio is generating ERROR messages from evapi module. Here is the syslog:
Oct 30 12:02:15 kam-prod /opt/ipgate/kamailio/sbin/kamailio[19512]: INFO:
<script>: XLOG: 123 [CGR_DLG_LIST] Requested dialog list Oct 30 12:02:15 kam-prod /opt/ipgate/kamailio/sbin/kamailio[19512]: INFO: <script>: Oct 30 12:02:15 kam-prod /opt/ipgate/kamailio/sbin/kamailio[19512]: DEBUG: evapi [evapi_dispatch.c:740]: _evapi_relay(): relaying event data [ Oct 30 12:02:15 kam-prod /opt/ipgate/kamailio/sbin/kamailio[19512]: ERROR: evapi [evapi_dispatch.c:764]: _evapi_relay(): cannot serialize event Oct 30 12:02:15 kam-prod /opt/ipgate/kamailio/sbin/kamailio[19512]: ERROR: evapi [evapi_mod.c:265]: w_evapi_relay(): failed to relay event: *We are expecting something like this when nobody is calling* Oct 30 14:12:22 kam-test /opt/ipgate/kamailio/sbin/kamailio[32090]: INFO: <script>: XLOG: 123 [CGR_DLG_LIST] Requested dialog list Oct 30 14:12:22 kam-test /opt/ipgate/kamailio/sbin/kamailio[32090]: INFO: <script>: XLOG: 123 [CGR_DLG_LIST] Test1: { #011"jsonrpc":#011"2.0", #011"result":#011[], #011"id":#0111 } Oct 30 14:12:22 kam-test /opt/ipgate/kamailio/sbin/kamailio[32090]: DEBUG: evapi [evapi_dispatch.c:740]: _evapi_relay(): relaying event data [{"event":"CGR_DLG_LIST_REPLY", #011#011#011"jsonrpl_body":{ #011"jsonrpc":#011"2.0", #011"result":#011[], #011"id":#0111 }}] (96) Oct 30 14:12:22 kam-test /opt/ipgate/kamailio/sbin/kamailio[32090]: DEBUG: evapi [evapi_dispatch.c:778]: _evapi_relay(): sending [0x169ff674] [96:{"event":"CGR_DLG_LIST_REPLY", #011#011#011"jsonrpl_body":{ #011"jsonrpc":#011"2.0", #011"result":#011[], #011"id":#0111 }},] (100) Oct 30 14:12:22 kam-test /opt/ipgate/kamailio/sbin/kamailio[32090]: DEBUG: evapi [evapi_dispatch.c:789]: _evapi_relay(): dispatching [0x169ff674] [96:{"event":"CGR_DLG_LIST_REPLY", #011#011#011"jsonrpl_body":{ #011"jsonrpc":#011"2.0", #011"result":#011[], #011"id":#0111 }},] (100) We enabled debug messages for module evapi and are trying to understand where is the problem. To make this work to this state we needed to increase the *pv_buffer* to really big size (2097152). It looks like $jsonrpl(body) is not ready and everything concated with it is not working. Any help or suggestion is welcomed. Sincerely Michal _______________________________________________ Kamailio (SER) - Users Mailing Listsr-users@lists.kamailio.orghttps://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users -- Daniel-Constantin Mierla -- www.asipto.comwww.twitter.com/miconda -- www.linkedin.com/in/miconda 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
Kamailio (SER) - Users Mailing Listsr-users@lists.kamailio.orghttps://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
-- Daniel-Constantin Mierla -- www.asipto.comwww.twitter.com/miconda -- www.linkedin.com/in/miconda Kamailio World Conference - April 27-29, 2020, in Berlin -- www.kamailioworld.com