Module: kamailio
Branch: master
Commit: 75ba3ef01c08027e5694419e9c923fef02262daa
URL:
https://github.com/kamailio/kamailio/commit/75ba3ef01c08027e5694419e9c923fe…
Author: Seudin Kasumovic <seudin(a)bicomsystems.com>
Committer: Seudin Kasumovic <seudin.kasumovic(a)gmail.com>
Date: 2015-05-22T22:03:40+02:00
erlang: Fix detecting event route
Ensure proper detect event route and lost connection in erl_reply.
---
Modified: modules/erlang/cnode.c
Modified: modules/erlang/erl_api.c
---
Diff:
https://github.com/kamailio/kamailio/commit/75ba3ef01c08027e5694419e9c923fe…
Patch:
https://github.com/kamailio/kamailio/commit/75ba3ef01c08027e5694419e9c923fe…
---
diff --git a/modules/erlang/cnode.c b/modules/erlang/cnode.c
index 6cc2786..d18f043 100644
--- a/modules/erlang/cnode.c
+++ b/modules/erlang/cnode.c
@@ -514,6 +514,7 @@ int csockfd_init(csockfd_handler_t *phandler, const ei_cnode *ec)
csocket_handler = phandler;
+ csockfd = 0;
return 0;
}
diff --git a/modules/erlang/erl_api.c b/modules/erlang/erl_api.c
index 36cd1ed..0c5d15b 100644
--- a/modules/erlang/erl_api.c
+++ b/modules/erlang/erl_api.c
@@ -236,9 +236,12 @@ int _impl_reply(const ei_x_buff *msg)
/* must be in call back / event route */
- if (!enode) {
+ if (csockfd) {
LM_ERR("not in callback\n");
return -1;
+ } else if (!enode) {
+ LM_ERR("not connected\n");
+ return -1;
}
/* copy into reply */
if (enode->response.buffsz < msg->buffsz) {