src/switch_core.c \
src/switch_loadable_module.c \
src/switch_mutex.c \
-src/switch_utils.c
+src/switch_utils.c \
+src/switch_event.c
#bindir = $(PREFIX)/bin
#libdir = $(PREFIX)/lib
src/include/switch_types.h \
src/include/switch_utils.h \
src/include/switch_caller.h \
- src/include/switch_buffer.h
+ src/include/switch_buffer.h \
+ src/include/switch_event.h
lib_LTLIBRARIES = libfreeswitch.la
libfreeswitch_la_CFLAGS = $(AM_CFLAGS) -Wall -Werror -Wstrict-prototypes -Wmissing-prototypes -g
libfreeswitch_la-switch_core.lo \
libfreeswitch_la-switch_loadable_module.lo \
libfreeswitch_la-switch_mutex.lo \
- libfreeswitch_la-switch_utils.lo
+ libfreeswitch_la-switch_utils.lo \
+ libfreeswitch_la-switch_event.lo
libfreeswitch_la_OBJECTS = $(am_libfreeswitch_la_OBJECTS)
binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
PROGRAMS = $(bin_PROGRAMS)
src/switch_core.c \
src/switch_loadable_module.c \
src/switch_mutex.c \
-src/switch_utils.c
+src/switch_utils.c \
+src/switch_event.c
#bindir = $(PREFIX)/bin
src/include/switch_types.h \
src/include/switch_utils.h \
src/include/switch_caller.h \
- src/include/switch_buffer.h
+ src/include/switch_buffer.h \
+ src/include/switch_event.h
lib_LTLIBRARIES = libfreeswitch.la
libfreeswitch_la_CFLAGS = $(AM_CFLAGS) -Wall -Werror -Wstrict-prototypes -Wmissing-prototypes -g
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfreeswitch_la-switch_config.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfreeswitch_la-switch_console.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfreeswitch_la-switch_core.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfreeswitch_la-switch_event.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfreeswitch_la-switch_loadable_module.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfreeswitch_la-switch_mutex.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfreeswitch_la-switch_utils.Plo@am__quote@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -c -o libfreeswitch_la-switch_utils.lo `test -f 'src/switch_utils.c' || echo '$(srcdir)/'`src/switch_utils.c
+libfreeswitch_la-switch_event.lo: src/switch_event.c
+@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -MT libfreeswitch_la-switch_event.lo -MD -MP -MF "$(DEPDIR)/libfreeswitch_la-switch_event.Tpo" -c -o libfreeswitch_la-switch_event.lo `test -f 'src/switch_event.c' || echo '$(srcdir)/'`src/switch_event.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libfreeswitch_la-switch_event.Tpo" "$(DEPDIR)/libfreeswitch_la-switch_event.Plo"; else rm -f "$(DEPDIR)/libfreeswitch_la-switch_event.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='src/switch_event.c' object='libfreeswitch_la-switch_event.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -c -o libfreeswitch_la-switch_event.lo `test -f 'src/switch_event.c' || echo '$(srcdir)/'`src/switch_event.c
+
freeswitch-switch.o: src/switch.c
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(freeswitch_CFLAGS) $(CFLAGS) -MT freeswitch-switch.o -MD -MP -MF "$(DEPDIR)/freeswitch-switch.Tpo" -c -o freeswitch-switch.o `test -f 'src/switch.c' || echo '$(srcdir)/'`src/switch.c; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/freeswitch-switch.Tpo" "$(DEPDIR)/freeswitch-switch.Po"; else rm -f "$(DEPDIR)/freeswitch-switch.Tpo"; exit 1; fi
mod_iaxchan
#mod_opalchan
mod_codec_g729
+mod_event_test
-/* config.h.in. Generated from configure.in by autoheader. */
-
-/* Define to 1 if you have the <arpa/inet.h> header file. */
-#undef HAVE_ARPA_INET_H
+/* src/include/config.h.in. Generated from configure.in by autoheader. */
/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
*/
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
-/* Define to 1 if you have the <fcntl.h> header file. */
-#undef HAVE_FCNTL_H
-
/* Define to 1 if you have the `gethostname' function. */
#undef HAVE_GETHOSTNAME
-/* Define to 1 if you have the `gettimeofday' function. */
-#undef HAVE_GETTIMEOFDAY
-
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
-/* Define to 1 if you have the `localtime_r' function. */
-#undef HAVE_LOCALTIME_R
-
/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
to 0 otherwise. */
#undef HAVE_MALLOC
-/* Define to 1 if you have the `memmove' function. */
-#undef HAVE_MEMMOVE
-
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
-/* Define to 1 if you have the `memset' function. */
-#undef HAVE_MEMSET
-
/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
#undef HAVE_NDIR_H
-/* Define to 1 if you have the <netdb.h> header file. */
-#undef HAVE_NETDB_H
-
-/* Define to 1 if you have the <netinet/in.h> header file. */
-#undef HAVE_NETINET_IN_H
-
-/* Define to 1 if you have the `socket' function. */
-#undef HAVE_SOCKET
-
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
-/* Define to 1 if you have the `strcasecmp' function. */
-#undef HAVE_STRCASECMP
-
-/* Define to 1 if you have the `strchr' function. */
-#undef HAVE_STRCHR
-
-/* Define to 1 if you have the `strdup' function. */
-#undef HAVE_STRDUP
-
/* Define to 1 if you have the `strftime' function. */
#undef HAVE_STRFTIME
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
-/* Define to 1 if you have the `strncasecmp' function. */
-#undef HAVE_STRNCASECMP
-
-/* Define to 1 if you have the `strstr' function. */
-#undef HAVE_STRSTR
-
/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
*/
#undef HAVE_SYS_DIR_H
-/* Define to 1 if you have the <sys/ioctl.h> header file. */
-#undef HAVE_SYS_IOCTL_H
-
/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
*/
#undef HAVE_SYS_NDIR_H
-/* Define to 1 if you have the <sys/socket.h> header file. */
-#undef HAVE_SYS_SOCKET_H
-
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
-/* Define to 1 if you have the <sys/time.h> header file. */
-#undef HAVE_SYS_TIME_H
-
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
#include <switch_module_interfaces.h>
#include <switch_channel.h>
#include <switch_buffer.h>
-
+#include <switch_event.h>
#ifdef __cplusplus
}
SWITCH_DECLARE(switch_status) switch_core_session_set_write_codec(switch_core_session *session, switch_codec *codec);
SWITCH_DECLARE(switch_memory_pool *) switch_core_session_get_pool(switch_core_session *session);
SWITCH_DECLARE(void) pbx_core_session_signal_state_change(switch_core_session *session);
+SWITCH_DECLARE(char *) switch_core_strdup(switch_memory_pool *pool, char *todup);
#ifdef __cplusplus
}
SWITCH_IO_FLAG_NOOP = 0,
} switch_io_flag;
+/* make sure this is synced with the EVENT_NAMES array in switch_event.c
+ also never put any new ones before EVENT_ALL
+*/
+typedef enum {
+ SWITCH_EVENT_CUSTOM,
+ SWITCH_EVENT_INBOUND_CHAN,
+ SWITCH_EVENT_OUTBOUND_CHAN,
+ SWITCH_EVENT_ANSWER_CHAN,
+ SWITCH_EVENT_HANGUP_CHAN,
+ SWITCH_EVENT_STARTUP,
+ SWITCH_EVENT_ALL
+} switch_event_t;
+
+typedef struct switch_event_node switch_event_node;
+typedef void (*switch_event_callback_t)(switch_event_t, int, char *);
typedef struct switch_loadable_module switch_loadable_module;
typedef struct switch_frame switch_frame;
typedef struct switch_channel switch_channel;
exit(-1);
}
+ switch_event_fire(SWITCH_EVENT_STARTUP, "Ready");
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "freeswitch Version %s Started\n\n", SWITCH_GLOBAL_VERSION);
/* wait for console input */
return duped;
}
+
+SWITCH_DECLARE(char *) switch_core_strdup(switch_memory_pool *pool, char *todup)
+{
+ char *duped = NULL;
+
+ assert(pool != NULL);
+ assert(todup != NULL);
+
+ if (todup && (duped = apr_palloc(pool, strlen(todup)+1))) {
+ strcpy(duped, todup);
+ }
+ return duped;
+}
+
SWITCH_DECLARE(void *) switch_core_session_get_private(switch_core_session *session)
{
assert(session != NULL);
return SWITCH_STATUS_MEMERR;
}
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Allocated memory pool.\n");
-
+ switch_event_init(runtime.memory_pool);
+
#ifdef EMBED_PERL
if (! (my_perl = perl_alloc())) {
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Could not allocate perl intrepreter\n");