]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-7776 #resolve add mod_kazoo to build system
authorLuis Azedo <luis@2600hz.com>
Sat, 4 Jul 2015 00:20:02 +0000 (01:20 +0100)
committerLuis Azedo <luis@2600hz.com>
Mon, 6 Jul 2015 22:13:00 +0000 (23:13 +0100)
build/config/erlang.m4
conf/vanilla/autoload_configs/kazoo.conf.xml [moved from src/mod/event_handlers/mod_kazoo/conf/autoload_configs/kazoo.conf.xml with 100% similarity]
debian/bootstrap.sh
debian/control-modules
freeswitch.spec
src/mod/event_handlers/mod_kazoo/Makefile.am
src/mod/event_handlers/mod_kazoo/kazoo_utils.c
src/mod/event_handlers/mod_kazoo/mod_kazoo.c
src/mod/event_handlers/mod_kazoo/mod_kazoo.h

index 32969e15b59ff08bb4cfbd8ac3f804b7eb185567..7e4dc35b9be5b273077d0105a41e4a44c3acc265 100644 (file)
@@ -9,6 +9,7 @@ AC_ARG_WITH(
        [with_erlang="try"]
 )
 
+AM_CONDITIONAL([HAVE_ERLANG],[false])
 if test "$with_erlang" != "no"
 then
        save_CFLAGS="$CFLAGS"
@@ -78,6 +79,7 @@ then
                        AC_MSG_NOTICE([Your erlang seems OK, do not forget to enable mod_erlang_event in modules.conf])
                        AC_SUBST([ERLANG_CFLAGS],  [$ERLANG_CFLAGS])
                        AC_SUBST([ERLANG_LDFLAGS], [$ERLANG_LDFLAGS])
+                       AM_CONDITIONAL([HAVE_ERLANG],[true])
                fi
 
                LIBS="$save_LIBS"
index 07e5f07316d58191e36656a0ef254c61b8ff55ed..47cbb30953b358ee3606245bb6fe5d5a93abdc6c 100755 (executable)
@@ -642,6 +642,7 @@ Recommends:
  freeswitch-mod-event-test (= \${binary:Version}),
  freeswitch-mod-event-zmq (= \${binary:Version}),
  freeswitch-mod-json-cdr (= \${binary:Version}),
+ freeswitch-mod-kazoo (= \${binary:Version}),
  freeswitch-mod-radius-cdr (= \${binary:Version}),
  freeswitch-mod-snmp (= \${binary:Version}),
  freeswitch-mod-local-stream (= \${binary:Version}),
index 00835c515cc0bbbdaf90e0d8772442b22f7906b7..caf64760ce2cd854a316eae23a672b098bf95e0f 100644 (file)
@@ -523,6 +523,12 @@ Module: event_handlers/mod_format_cdr
 Description: mod_format_cdr
  Adds mod_format_cdr.
 
+Module: event_handlers/mod_kazoo
+Description: mod_kazoo
+ Adds mod_kazoo.
+Build-Depends: erlang-dev
+Depends: erlang
+
 Module: event_handlers/mod_json_cdr
 Description: mod_json_cdr
  Adds mod_json_cdr.
index b3d33d8ea7c54ed36472a193b5b283fb82948130..3ee7b72dda57c40733a7a52414de37c53d464ce3 100644 (file)
@@ -1016,6 +1016,16 @@ Requires:        %{name} = %{version}-%{release}
 %description event-format-cdr
 JSON and XML Logger for the FreeSWITCH open source telephony platform
 
+%package kazoo
+Summary:       Kazoo Module for the FreeSWITCH open source telephony platform
+Group:         System/Libraries
+Requires:       %{name} = %{version}-%{release}
+Requires:      erlang
+BuildRequires: erlang
+
+%description kazoo
+Kazoo Module for FreeSWITCH.
+
 %package event-multicast
 Summary:       Multicast Event System for the FreeSWITCH open source telephony platform
 Group:         System/Libraries
@@ -1485,7 +1495,7 @@ ENDPOINTS_MODULES="endpoints/mod_dingaling ../../libs/freetdm/mod_freetdm \
 ######################################################################################################################
 EVENT_HANDLERS_MODULES="event_handlers/mod_cdr_csv event_handlers/mod_cdr_pg_csv event_handlers/mod_cdr_sqlite \
                        event_handlers/mod_cdr_mongodb event_handlers/mod_format_cdr event_handlers/mod_erlang_event event_handlers/mod_event_multicast \
-                       event_handlers/mod_event_socket event_handlers/mod_json_cdr event_handlers/mod_radius_cdr \
+                       event_handlers/mod_event_socket event_handlers/mod_json_cdr event_handlers/mod_kazoo event_handlers/mod_radius_cdr \
                        event_handlers/mod_snmp"
 %if %{build_mod_rayo}
 EVENT_HANDLERS_MODULES+=" event_handlers/mod_rayo"
@@ -1873,6 +1883,7 @@ fi
 %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/http_cache.conf.xml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/ivr.conf.xml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/java.conf.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/kazoo.conf.xml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/lcr.conf.xml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/local_stream.conf.xml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/logfile.conf.xml
@@ -2257,6 +2268,9 @@ fi
 %files event-json-cdr
 %{MODINSTDIR}/mod_json_cdr.so*
 
+%files kazoo
+%{MODINSTDIR}/mod_kazoo.so*
+
 %files event-radius-cdr
 %{MODINSTDIR}/mod_radius_cdr.so*
 
index 86d556ba77a2e1f85f2a58513fe4ab05e15543c9..53fd7112e139a69925d92dc5bd5ef3ff797903aa 100644 (file)
@@ -1,7 +1,17 @@
 include $(top_srcdir)/build/modmake.rulesam
 MODNAME=mod_kazoo
+
+if HAVE_ERLANG
+
 mod_LTLIBRARIES = mod_kazoo.la
 mod_kazoo_la_SOURCES  = mod_kazoo.c kazoo_utils.c kazoo_node.c kazoo_event_stream.c kazoo_fetch_agent.c kazoo_commands.c kazoo_dptools.c
 mod_kazoo_la_CFLAGS   = $(AM_CFLAGS) @ERLANG_CFLAGS@ -D_REENTRANT
 mod_kazoo_la_LIBADD   = $(switch_builddir)/libfreeswitch.la
 mod_kazoo_la_LDFLAGS  = -avoid-version -module -no-undefined -shared @ERLANG_LDFLAGS@
+
+else
+install: error
+all: error
+error:
+       $(error You must install erlang to build this module)
+endif
index e1e356a752909de874dac187dfaaf0276678e8c9..83295234ec120b96c0aa3cdad8f86eddfc1ca5ba 100644 (file)
@@ -328,7 +328,7 @@ int ei_decode_string_or_binary_limited(char *buf, int *index, int maxsize, char
 
        if (type == ERL_NIL_EXT) {
                res = 0;
-               dst = '\0';
+               *dst = '\0';
        } else if (type == ERL_BINARY_EXT) {
         res = ei_decode_binary(buf, index, dst, &len);
         dst[len] = '\0'; /* binaries aren't null terminated */
index c0931e35c6bc09d11185ea4813cb803d9e6fa507..1e3403d1a112594199a813d63cfe2c7cb23e2fd8 100644 (file)
@@ -35,6 +35,8 @@
 #define KAZOO_DESC "kazoo information"
 #define KAZOO_SYNTAX "<command> [<args>]"
 
+globals_t globals;
+
 SWITCH_MODULE_LOAD_FUNCTION(mod_kazoo_load);
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_kazoo_shutdown);
 SWITCH_MODULE_RUNTIME_FUNCTION(mod_kazoo_runtime);
index d030feab525280b6474e5a8ca21dc9fd031a8653..855f239c334af0d7f8d2b94d2780a7f714a3335b 100644 (file)
@@ -111,8 +111,9 @@ struct globals_s {
        int event_stream_preallocate;
        int send_msg_batch;
        short event_stream_framing;
-} globals;
+};
 typedef struct globals_s globals_t;
+extern globals_t globals;
 
 /* kazoo_node.c */
 switch_status_t new_kazoo_node(int nodefd, ErlConnect *conn);