[SR-Users] issues using evapi module

Daniel-Constantin Mierla miconda at gmail.com
Mon Sep 21 09:45:43 CEST 2020


Hello,

you must have a different socket in modparam("evapi", "bind_addr",
"...") than the core listen parameter for sip tcp traffic. The connect
with your evapi app to the socket specified in modparam.

Cheers,
Daniel

On 15.09.20 09:29, David Escartin wrote:
> hello Daniel
>
> i have tried the directive
> listen=127.0.0.1:8448 <http://127.0.0.1:8448>
> and listen=tcp:127.0.0.1:8448 <http://127.0.0.1:8448>
> and i tried now  for example to connect with a tcp client from port
> 48583 (randomly selected when i made the tcp connect i guess)
>
> tcp        0      0 127.0.0.1:8448 <http://127.0.0.1:8448>        
>  127.0.0.1:48583 <http://127.0.0.1:48583>         ESTABLISHED
> 4508/kamailio        keepalive (2.24/0/0)
>
> i configured the kernel to send keep alives 30secs after the tcp
> connection
>
> should this be ok?
>
> best regards
> david
>
> El lun., 14 sept. 2020 a las 18:50, Daniel-Constantin Mierla
> (<miconda at gmail.com <mailto:miconda at gmail.com>>) escribió:
>
>     Hello,
>
>     to what port do you connect for evapi?
>
>     The logs indicate connection to sip tcp port.
>
>     Cheers,
>     Daniel
>
>     On 14.09.20 18:06, David Escartin wrote:
>>     Dear all
>>
>>     We are trying to use the evapi module to send some data to an
>>     external application but I'm having problems getting the clients
>>     connected.
>>
>>     I have the kamailio (version 5.3) running with a  tcp socket
>>     127.0.0.1:8228 <http://127.0.0.1:8228>, and the evapi params are just
>>     modparam("evapi", "workers", 4)
>>     modparam("evapi", "netstring_format", 0)
>>     modparam("evapi", "bind_addr", "127.0.0.1:8448
>>     <http://127.0.0.1:8448>")
>>     modparam("evapi", "max_clients", 32)
>>
>>     I tried a different number of workers and netstring_format 1 too.
>>     When I start the kamailio i added some debug to the code, and
>>     seems when doing the mod init of the evapi dispatcher
>>     38(4779) DEBUG: <core> [core/sr_module.c:779]: init_mod_child():
>>     idx 38 rank -2: evapi [EvAPI Dispatcher]
>>     it reaches to 
>>             while(1) {
>>                     ev_loop (loop, 0);
>>             }
>>     at evapi_run_dispatcher function.
>>     I guess if I connected to the tcp socket and sent some event, I
>>     would see the client accepted and the event route
>>     evapi:connection-new would be triggered. But i'm not able to do that.
>>     I tried to use the prime option, a tcp input client connection
>>     from logstash, so i could relay the data to the logstash using
>>     the evapi relay, but i only see the tcp socket being created but
>>     no client accepted.
>>     I also tried to connect with an erlang gen_tcp client, but it's
>>     the same
>>     i only see
>>
>>     47(4798) DEBUG: <core> [core/ip_addr.c:229]: print_ip():
>>     tcpconn_new: new tcp connection: 127.0.0.1
>>     47(4798) DEBUG: <core> [core/tcp_main.c:1174]: tcpconn_new(): on
>>     port 54537, type 2, socket 105
>>     47(4798) DEBUG: <core> [core/tcp_main.c:1497]: tcpconn_add():
>>     hashes: 1117:1187:1505, 1
>>     47(4798) DEBUG: <core> [core/io_wait.h:375]: io_watch_add(): DBG:
>>     io_watch_add(0xad0880, 105, 2, 0x7fc211712d58), fd_no=53
>>     and if i try to send any data
>>
>>     47(4798) DEBUG: <core> [core/io_wait.h:600]: io_watch_del(): DBG:
>>     io_watch_del (0xad0880, 105, -1, 0x0) fd_no=54 called
>>     47(4798) DEBUG: <core> [core/tcp_main.c:4456]:
>>     handle_tcpconn_ev(): sending to child, events 1
>>     47(4798) DEBUG: <core> [core/tcp_main.c:4129]: send2child():
>>     selected tcp worker idx:0 proc:43 pid:4791 for activity on
>>     [tcp:127.0.0.1:8448 <http://127.0.0.1:8448>], 0x7fc211712d58
>>     43(4791) DEBUG: <core> [core/tcp_read.c:1749]: handle_io():
>>     received n=8 con=0x7fc211712d58, fd=39
>>     43(4791) DEBUG: <core> [core/io_wait.h:375]: io_watch_add(): DBG:
>>     io_watch_add(0xb3c720, 39, 2, 0x7fc211712d58), fd_no=1
>>     43(4791) DEBUG: <core> [core/io_wait.h:600]: io_watch_del(): DBG:
>>     io_watch_del (0xb3c720, 39, -1, 0x10) fd_no=2 called
>>     43(4791) DEBUG: <core> [core/tcp_read.c:1671]: release_tcpconn():
>>     releasing con 0x7fc211712d58, state 1, fd=39, id=1
>>     ([127.0.0.1]:54537 -> [127.0.0.1]:8448)
>>     43(4791) DEBUG: <core> [core/tcp_read.c:1672]: release_tcpconn():
>>     extra_data (nil)
>>     47(4798) DEBUG: <core> [core/tcp_main.c:3559]:
>>     handle_tcp_child(): reader response= 7fc211712d58, 1 from 0
>>     47(4798) DEBUG: <core> [core/io_wait.h:375]: io_watch_add(): DBG:
>>     io_watch_add(0xad0880, 105, 2, 0x7fc211712d58), fd_no=53
>>     47(4798) DEBUG: <core> [core/tcp_main.c:3686]:
>>     handle_tcp_child(): CONN_RELEASE  0x7fc211712d58 refcnt= 1
>>
>>     and when i try to send any data
>>     38(10867) DEBUG: evapi [evapi_dispatch.c:610]:
>>     evapi_recv_notify(): received [0x7f17d23fc628] [{"test" :
>>     "1.1.1.1", "uuid" : "1-31629 at 3.3.3.3 <mailto:1-31629 at 3.3.3.3>" ,
>>     "pdd" : "4"}] (75)
>>     38(10867) DEBUG: evapi [evapi_dispatch.c:316]:
>>     evapi_dispatch_notify(): the message was sent to 0 clients
>>
>>     I don't know what i'm missing, or if i'm understanding the use of
>>     the module correctly
>>
>>     could you please take a look?
>>     thanks a lot
>>     David
>>
>>
>>     -- 
>>     Logo 	
>>
>>     David Escartín Almudévar
>>     VoIP/Switch Engineer
>>     descartin at sonoc.io <mailto:descartin at sonoc.io>
>>
>>     *SONOC*
>>     C/ Josefa Amar y Borbón, 10, 4ª · 50001 Zaragoza, España
>>     Tlf: +34 917019888 · www.sonoc.io <http://www.sonoc.io>
>>
>>
>>     _______________________________________________
>>     Kamailio (SER) - Users Mailing List
>>     sr-users at lists.kamailio.org <mailto:sr-users at lists.kamailio.org>
>>     https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users <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>
>     Funding: https://www.paypal.me/dcmierla <https://www.paypal.me/dcmierla>
>
>
>
> -- 
> Logo 	
>
> David Escartín Almudévar
> VoIP/Switch Engineer
> descartin at sonoc.io <mailto:descartin at sonoc.io>
>
> *SONOC*
> C/ Josefa Amar y Borbón, 10, 4ª · 50001 Zaragoza, España
> Tlf: +34 917019888 · www.sonoc.io <http://www.sonoc.io>
>
-- 
Daniel-Constantin Mierla -- www.asipto.com
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Funding: https://www.paypal.me/dcmierla

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20200921/c2878200/attachment.htm>


More information about the sr-users mailing list