Hi Daniel,
My 1&1 colleague Patric Marschall is going to help us maintain the
p_usrloc, carrierroute, userblacklist modules in Kamailio and I wonder
if you
could add him to Kamailio Git Hub giving him rights to change the code.
His account is: https://github.com/pmarschall.
Thank you,
Lucian Balaceanu
Call_control depends on pv, but it's not documented in the README
0(70806) ERROR: <core> [pvapi.c:790]: pv_parse_spec2(): error searching pvar "avp"
0(70806) ERROR: <core> [pvapi.c:994]: pv_parse_spec2(): wrong char [s/115] in [$avp(s:can_uri)] at [5 (5)]
0(70806) : call_control [call_control.c:1076]: mod_init(): invalid AVP specification for canonical_uri_avp: `$avp(s:can_uri)'
0(70806) ERROR: <core> [sr_module.c:945]: init_mod(): Error while initializing module call_control
---
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/36
Hi,
I think the EVAPI listening socket should be bound with setsockopt
SO_REUSEADDR.
Often, when I restart Kamailio, I cannot immediately get it to stop
because the listening descriptor was seemingly not
shutdown()'d/close()'d cleanly:
Jan 18 13:14:09 sip-xmpp kamailio[24771]: ERROR: evapi
[evapi_dispatch.c:474]: evapi_run_dispatcher(): cannot bind to local
address and port [0.0.0.0:8010]
Jan 18 13:14:09 sip-xmpp kamailio[24771]: ERROR: evapi
[evapi_mod.c:181]: child_init(): failed to initialize disptacher process
Jan 18 13:14:09 sip-xmpp kamailio[24771]: ERROR: <core>
[sr_module.c:923]: init_mod_child(): Error while initializing module
evapi (/usr/local/lib64/kamailio/modules/evapi.so)
Jan 18 13:14:09 sip-xmpp kamailio[24771]: ERROR: <core> [main.c:1707]:
main_loop(): error in init_child
Jan 18 13:14:09 sip-xmpp kamailio[24752]: ALERT: <core> [main.c:781]:
handle_sigs(): child process 24771 exited normally, status=255
Jan 18 13:14:09 sip-xmpp kamailio[24752]: INFO: <core> [main.c:799]:
handle_sigs(): terminating due to SIGCHLD
... but there is nothing listening:
[root@peacock kamailio]# telnet localhost 8010
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused
The SO_REUSEADDR option would solve that problem I think.
-- Alex
--
Alex Balashov - Principal
Evariste Systems LLC
235 E Ponce de Leon Ave
Suite 106
Decatur, GA 30030
United States
Tel: +1-678-954-0670
Web: http://www.evaristesys.com/, http://www.alexbalashov.com/
Module: kamailio
Branch: master
Commit: cd1a59f223e2806ca4c16ab4a8dc1e0ff2b219d1
URL: https://github.com/kamailio/kamailio/commit/cd1a59f223e2806ca4c16ab4a8dc1e0…
Author: Alex Balashov <abalashov(a)evaristesys.com>
Committer: Alex Balashov <abalashov(a)evaristesys.com>
Date: 2015-01-18T17:08:18-05:00
evapi: Listening socket will be bound with SO_REUSEADDR option so that rebinding does not have to wait for TIME_WAIT connections to clear.
---
Modified: modules/evapi/evapi_dispatch.c
---
Diff: https://github.com/kamailio/kamailio/commit/cd1a59f223e2806ca4c16ab4a8dc1e0…
Patch: https://github.com/kamailio/kamailio/commit/cd1a59f223e2806ca4c16ab4a8dc1e0…
---
diff --git a/modules/evapi/evapi_dispatch.c b/modules/evapi/evapi_dispatch.c
index 6ee7e3d..1ba1c0b 100644
--- a/modules/evapi/evapi_dispatch.c
+++ b/modules/evapi/evapi_dispatch.c
@@ -434,6 +434,7 @@ int evapi_run_dispatcher(char *laddr, int lport)
struct hostent *h = NULL;
struct ev_io io_server;
struct ev_io io_notify;
+ int yes_true = 1;
LM_DBG("starting dispatcher processing\n");
@@ -469,6 +470,18 @@ int evapi_run_dispatcher(char *laddr, int lport)
evapi_srv_addr.sin_port = htons((short)lport);
evapi_srv_addr.sin_addr = *(struct in_addr*)h->h_addr;
+ /* Set SO_REUSEADDR option on listening socket so that we don't
+ * have to wait for connections in TIME_WAIT to go away before
+ * re-binding.
+ */
+
+ if(setsockopt(evapi_srv_sock, SOL_SOCKET, SO_REUSEADDR,
+ &yes_true, sizeof(int)) < 0) {
+ LM_ERR("cannot set SO_REUSEADDR option on descriptor\n");
+ close(evapi_srv_sock);
+ return -1;
+ }
+
if (bind(evapi_srv_sock, (struct sockaddr*)&evapi_srv_addr,
sizeof(evapi_srv_addr)) < 0) {
LM_ERR("cannot bind to local address and port [%s:%d]\n", laddr, lport);