mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-27 20:59:50 +00:00
move some modules to use the new module interface macros.
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5344 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
b67f9c5b2a
commit
784c7f8c3d
@ -31,9 +31,8 @@
|
|||||||
*/
|
*/
|
||||||
#include <switch.h>
|
#include <switch.h>
|
||||||
|
|
||||||
|
SWITCH_MODULE_LOAD_FUNCTION(mod_ivrtest_load);
|
||||||
static const char modname[] = "mod_ivrtest";
|
SWITCH_MODULE_DEFINITION(mod_ivrtest, mod_ivrtest_load, NULL, NULL);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
dtmf handler function you can hook up to be executed when a digit is dialed during playback
|
dtmf handler function you can hook up to be executed when a digit is dialed during playback
|
||||||
@ -499,7 +498,7 @@ static const switch_application_interface_t asrtest_application_interface = {
|
|||||||
/*.next */ &ivrtest_application_interface
|
/*.next */ &ivrtest_application_interface
|
||||||
};
|
};
|
||||||
|
|
||||||
static const switch_loadable_module_interface_t mod_ivrtest_module_interface = {
|
static const switch_loadable_module_interface_t ivrtest_module_interface = {
|
||||||
/*.module_name = */ modname,
|
/*.module_name = */ modname,
|
||||||
/*.endpoint_interface = */ NULL,
|
/*.endpoint_interface = */ NULL,
|
||||||
/*.timer_interface = */ NULL,
|
/*.timer_interface = */ NULL,
|
||||||
@ -508,11 +507,11 @@ static const switch_loadable_module_interface_t mod_ivrtest_module_interface = {
|
|||||||
/*.application_interface */ &asrtest_application_interface
|
/*.application_interface */ &asrtest_application_interface
|
||||||
};
|
};
|
||||||
|
|
||||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
|
SWITCH_MODULE_LOAD_FUNCTION(mod_ivrtest_load)
|
||||||
{
|
{
|
||||||
|
|
||||||
/* connect my internal structure to the blank pointer passed to me */
|
/* connect my internal structure to the blank pointer passed to me */
|
||||||
*module_interface = &mod_ivrtest_module_interface;
|
*module_interface = &ivrtest_module_interface;
|
||||||
|
|
||||||
/* test global state handlers */
|
/* test global state handlers */
|
||||||
switch_core_add_state_handler(&state_handlers);
|
switch_core_add_state_handler(&state_handlers);
|
||||||
@ -521,12 +520,6 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_mod
|
|||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 'switch_module_runtime' will start up in a thread by itself just by having it exist
|
|
||||||
if it returns anything but SWITCH_STATUS_TERM it will be called again automaticly
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
//switch_status_t switch_module_runtime(void)
|
|
||||||
|
|
||||||
/* For Emacs:
|
/* For Emacs:
|
||||||
* Local Variables:
|
* Local Variables:
|
||||||
|
@ -32,7 +32,11 @@
|
|||||||
*/
|
*/
|
||||||
#include <switch.h>
|
#include <switch.h>
|
||||||
|
|
||||||
static const char modname[] = "mod_skel";
|
//SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_skel_shutdown);
|
||||||
|
//SWITCH_MODULE_RUNTIME_FUNCTION(mod_skel_runtime);
|
||||||
|
|
||||||
|
SWITCH_MODULE_LOAD_FUNCTION(mod_skel_load);
|
||||||
|
SWITCH_MODULE_DEFINITION(mod_skel, mod_skel_load, NULL, NULL);
|
||||||
|
|
||||||
static switch_loadable_module_interface_t skel_module_interface = {
|
static switch_loadable_module_interface_t skel_module_interface = {
|
||||||
/*.module_name */ modname,
|
/*.module_name */ modname,
|
||||||
@ -47,7 +51,7 @@ static switch_loadable_module_interface_t skel_module_interface = {
|
|||||||
/*.directory_interface */ NULL
|
/*.directory_interface */ NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
|
SWITCH_MODULE_LOAD_FUNCTION(mod_skel_load)
|
||||||
{
|
{
|
||||||
/* connect my internal structure to the blank pointer passed to me */
|
/* connect my internal structure to the blank pointer passed to me */
|
||||||
*module_interface = &skel_module_interface;
|
*module_interface = &skel_module_interface;
|
||||||
@ -60,7 +64,7 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_mod
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
Called when the system shuts down
|
Called when the system shuts down
|
||||||
SWITCH_MOD_DECLARE(switch_status) switch_module_shutdown(void)
|
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_skel_shutdown);
|
||||||
{
|
{
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
@ -69,7 +73,7 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_shutdown(void)
|
|||||||
/*
|
/*
|
||||||
If it exists, this is called in it's own thread when the module-load completes
|
If it exists, this is called in it's own thread when the module-load completes
|
||||||
If it returns anything but SWITCH_STATUS_TERM it will be called again automaticly
|
If it returns anything but SWITCH_STATUS_TERM it will be called again automaticly
|
||||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_runtime(void)
|
SWITCH_MODULE_RUNTIME_FUNCTION(mod_skel_runtime);
|
||||||
{
|
{
|
||||||
while(looping)
|
while(looping)
|
||||||
{
|
{
|
||||||
|
@ -35,12 +35,12 @@
|
|||||||
using namespace soundtouch;
|
using namespace soundtouch;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
|
||||||
#include <switch.h>
|
#include <switch.h>
|
||||||
#define STSTART 1024 * 2
|
#define STSTART 1024 * 2
|
||||||
#define STBLOCK 1024
|
#define STBLOCK 1024
|
||||||
|
|
||||||
static const char modname[] = "mod_soundtouch";
|
SWITCH_MODULE_LOAD_FUNCTION(mod_soundtouch_load);
|
||||||
|
SWITCH_MODULE_DEFINITION(mod_soundtouch, mod_soundtouch_load, NULL, NULL);
|
||||||
|
|
||||||
struct soundtouch_helper {
|
struct soundtouch_helper {
|
||||||
SoundTouch *st;
|
SoundTouch *st;
|
||||||
@ -331,7 +331,7 @@ static switch_loadable_module_interface_t soundtouch_module_interface = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
|
SWITCH_MODULE_LOAD_FUNCTION(mod_soundtouch_load)
|
||||||
{
|
{
|
||||||
/* connect my internal structure to the blank pointer passed to me */
|
/* connect my internal structure to the blank pointer passed to me */
|
||||||
*module_interface = &soundtouch_module_interface;
|
*module_interface = &soundtouch_module_interface;
|
||||||
|
@ -38,7 +38,9 @@
|
|||||||
#include <switch.h>
|
#include <switch.h>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
static const char modname[] = "mod_lumenvox";
|
SWITCH_MODULE_LOAD_FUNCTION(mod_lumenvox_load);
|
||||||
|
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_lumenvox_shutdown);
|
||||||
|
SWITCH_MODULE_DEFINITION(mod_lumenvox, mod_lumenvox_load, mod_lumenvox_shutdown, NULL);
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
LVFLAG_HAS_TEXT = (1 << 0),
|
LVFLAG_HAS_TEXT = (1 << 0),
|
||||||
@ -441,7 +443,7 @@ static const switch_loadable_module_interface_t lumenvox_module_interface = {
|
|||||||
/*.asr_interface */ &lumenvox_asr_interface
|
/*.asr_interface */ &lumenvox_asr_interface
|
||||||
};
|
};
|
||||||
|
|
||||||
switch_status_t switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
|
SWITCH_MODULE_LOAD_FUNCTION(mod_lumenvox_load)
|
||||||
{
|
{
|
||||||
LVSpeechPort::RegisterAppLogMsg(log_callback, NULL, 5);
|
LVSpeechPort::RegisterAppLogMsg(log_callback, NULL, 5);
|
||||||
//LVSpeechPort::SetClientPropertyEx(PROP_EX_SRE_SERVERS, PROP_EX_VALUE_TYPE_STRING, (void *)"127.0.0.1");
|
//LVSpeechPort::SetClientPropertyEx(PROP_EX_SRE_SERVERS, PROP_EX_VALUE_TYPE_STRING, (void *)"127.0.0.1");
|
||||||
@ -453,7 +455,7 @@ switch_status_t switch_module_load(const switch_loadable_module_interface_t **mo
|
|||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_shutdown(void)
|
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_lumenvox_shutdown)
|
||||||
{
|
{
|
||||||
return SWITCH_STATUS_UNLOAD;
|
return SWITCH_STATUS_UNLOAD;
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,9 @@
|
|||||||
|
|
||||||
#define MY_EVENT_RINGING "alsa::ringing"
|
#define MY_EVENT_RINGING "alsa::ringing"
|
||||||
|
|
||||||
static const char modname[] = "mod_alsa";
|
SWITCH_MODULE_LOAD_FUNCTION(mod_alsa_load);
|
||||||
|
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_alsa_shutdown);
|
||||||
|
SWITCH_MODULE_DEFINITION(mod_alsa, mod_alsa_load, mod_alsa_shutdown, NULL);
|
||||||
|
|
||||||
static switch_memory_pool_t *module_pool = NULL;
|
static switch_memory_pool_t *module_pool = NULL;
|
||||||
//static int running = 1;
|
//static int running = 1;
|
||||||
@ -825,7 +827,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
|
SWITCH_MODULE_LOAD_FUNCTION(mod_alsa_load);
|
||||||
{
|
{
|
||||||
|
|
||||||
switch_status_t status;
|
switch_status_t status;
|
||||||
@ -943,7 +945,7 @@ static switch_status_t load_config(void)
|
|||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_shutdown(void)
|
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_alsa_shutdown)
|
||||||
{
|
{
|
||||||
deactivate_audio_device();
|
deactivate_audio_device();
|
||||||
|
|
||||||
|
@ -41,7 +41,9 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
//#define DOTRACE
|
//#define DOTRACE
|
||||||
static const char modname[] = "mod_wanpipe";
|
SWITCH_MODULE_LOAD_FUNCTION(mod_wanpipe_load);
|
||||||
|
SWITCH_MODULE_DEFINITION(mod_wanpipe, mod_wanpipe_load, NULL, NULL);
|
||||||
|
|
||||||
#define STRLEN 15
|
#define STRLEN 15
|
||||||
|
|
||||||
static switch_memory_pool_t *module_pool = NULL;
|
static switch_memory_pool_t *module_pool = NULL;
|
||||||
@ -1308,7 +1310,7 @@ static void s_pri_message(struct pri *pri, char *s)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **interface, char *filename)
|
SWITCH_MODULE_LOAD_FUNCTION(mod_wanpipe_load)
|
||||||
{
|
{
|
||||||
switch_status_t status = SWITCH_STATUS_SUCCESS;
|
switch_status_t status = SWITCH_STATUS_SUCCESS;
|
||||||
|
|
||||||
|
@ -37,14 +37,13 @@
|
|||||||
#include <lame.h>
|
#include <lame.h>
|
||||||
#include <curl/curl.h>
|
#include <curl/curl.h>
|
||||||
|
|
||||||
|
|
||||||
#define OUTSCALE 8192
|
#define OUTSCALE 8192
|
||||||
#define MP3_SCACHE 16384
|
#define MP3_SCACHE 16384
|
||||||
#define MP3_DCACHE 8192
|
#define MP3_DCACHE 8192
|
||||||
|
|
||||||
static const char modname[] = "mod_shout";
|
SWITCH_MODULE_LOAD_FUNCTION(mod_shout_load);
|
||||||
|
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_shout_shutdown);
|
||||||
|
SWITCH_MODULE_DEFINITION(mod_shout, mod_shout_load, mod_shout_shutdown, NULL);
|
||||||
|
|
||||||
static char *supported_formats[SWITCH_MAX_CODECS] = { 0 };
|
static char *supported_formats[SWITCH_MAX_CODECS] = { 0 };
|
||||||
|
|
||||||
@ -890,7 +889,7 @@ static switch_loadable_module_interface_t shout_module_interface = {
|
|||||||
/*.directory_interface */ NULL
|
/*.directory_interface */ NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
|
SWITCH_MODULE_LOAD_FUNCTION(mod_shout_load)
|
||||||
{
|
{
|
||||||
supported_formats[0] = "shout";
|
supported_formats[0] = "shout";
|
||||||
supported_formats[1] = "mp3";
|
supported_formats[1] = "mp3";
|
||||||
@ -909,7 +908,7 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_mod
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_shutdown(void)
|
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_shout_shutdown)
|
||||||
{
|
{
|
||||||
curl_global_cleanup();
|
curl_global_cleanup();
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
|
@ -50,7 +50,10 @@ MonoClass *mod_mono_find_assembly_class(MonoImage * image);
|
|||||||
/* Managed functions */
|
/* Managed functions */
|
||||||
void mod_mono_switch_console_printf(switch_text_channel_t channel, char *file, const char *func, int line, char *fmt, char *msg);
|
void mod_mono_switch_console_printf(switch_text_channel_t channel, char *file, const char *func, int line, char *fmt, char *msg);
|
||||||
|
|
||||||
static const char modname[] = "mod_mono";
|
SWITCH_MODULE_LOAD_FUNCTION(mod_mono_load);
|
||||||
|
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_mono_shutdown);
|
||||||
|
SWITCH_MODULE_DEFINITION(mod_mono, mod_mono_load, mod_mono_shutdown, NULL);
|
||||||
|
|
||||||
static switch_memory_pool_t *mono_pool = NULL;
|
static switch_memory_pool_t *mono_pool = NULL;
|
||||||
|
|
||||||
static struct {
|
static struct {
|
||||||
@ -74,9 +77,9 @@ static switch_loadable_module_interface_t mono_module_interface = {
|
|||||||
* This function will initialise the memory pool and plugin hash for this module,
|
* This function will initialise the memory pool and plugin hash for this module,
|
||||||
* it will then initialise a new mono domain.
|
* it will then initialise a new mono domain.
|
||||||
*/
|
*/
|
||||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **interface, char *filename)
|
SWITCH_MODULE_LOAD_FUNCTION(mod_mono_load)
|
||||||
{
|
{
|
||||||
*interface = &mono_module_interface;
|
*module_interface = &mono_module_interface;
|
||||||
|
|
||||||
/* Initialise memory pool */
|
/* Initialise memory pool */
|
||||||
if (switch_core_new_memory_pool(&mono_pool) != SWITCH_STATUS_SUCCESS) {
|
if (switch_core_new_memory_pool(&mono_pool) != SWITCH_STATUS_SUCCESS) {
|
||||||
@ -158,7 +161,7 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_mod
|
|||||||
* Function for cleanly shutting down mod_mono
|
* Function for cleanly shutting down mod_mono
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_shutdown(void)
|
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_mono_shutdown)
|
||||||
{
|
{
|
||||||
if (globals.domain) {
|
if (globals.domain) {
|
||||||
mono_jit_cleanup(globals.domain);
|
mono_jit_cleanup(globals.domain);
|
||||||
|
@ -49,7 +49,9 @@ PyThreadState *mainThreadState = NULL;
|
|||||||
void init_freeswitch(void);
|
void init_freeswitch(void);
|
||||||
static switch_api_interface_t python_run_interface;
|
static switch_api_interface_t python_run_interface;
|
||||||
|
|
||||||
const char modname[] = "mod_python";
|
SWITCH_MODULE_LOAD_FUNCTION(mod_python_load);
|
||||||
|
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_python_shutdown);
|
||||||
|
SWITCH_MODULE_DEFINITION(mod_python, mod_python_load, mod_python_shutdown, NULL);
|
||||||
|
|
||||||
static void eval_some_python(char *uuid, char *args)
|
static void eval_some_python(char *uuid, char *args)
|
||||||
{
|
{
|
||||||
@ -221,7 +223,7 @@ static switch_loadable_module_interface_t python_module_interface = {
|
|||||||
/*.directory_interface */ NULL
|
/*.directory_interface */ NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
|
SWITCH_MODULE_LOAD_FUNCTION(mod_python_load)
|
||||||
{
|
{
|
||||||
/* connect my internal structure to the blank pointer passed to me */
|
/* connect my internal structure to the blank pointer passed to me */
|
||||||
*module_interface = &python_module_interface;
|
*module_interface = &python_module_interface;
|
||||||
@ -242,7 +244,7 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_mod
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
Called when the system shuts down*/
|
Called when the system shuts down*/
|
||||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_shutdown(void)
|
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_python_shutdown)
|
||||||
{
|
{
|
||||||
PyInterpreterState *mainInterpreterState;
|
PyInterpreterState *mainInterpreterState;
|
||||||
PyThreadState *myThreadState;
|
PyThreadState *myThreadState;
|
||||||
|
@ -39,7 +39,10 @@
|
|||||||
#define DEFAULT_FORMAT "[message]"
|
#define DEFAULT_FORMAT "[message]"
|
||||||
#define MAX_LENGTH 1024
|
#define MAX_LENGTH 1024
|
||||||
|
|
||||||
static const char modname[] = "mod_syslog";
|
SWITCH_MODULE_LOAD_FUNCTION(mod_syslog_load);
|
||||||
|
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_syslog_shutdown);
|
||||||
|
SWITCH_MODULE_DEFINITION(mod_syslog, mod_syslog_load, mod_syslog_shutdown, NULL);
|
||||||
|
|
||||||
static switch_status_t load_config(void);
|
static switch_status_t load_config(void);
|
||||||
|
|
||||||
static struct {
|
static struct {
|
||||||
@ -148,7 +151,7 @@ static switch_status_t load_config(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **interface, char *filename)
|
SWITCH_MODULE_LOAD_FUNCTION(mod_syslog_load)
|
||||||
{
|
{
|
||||||
switch_status_t status;
|
switch_status_t status;
|
||||||
*interface = &console_module_interface;
|
*interface = &console_module_interface;
|
||||||
@ -164,7 +167,7 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_mod
|
|||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_unload(const switch_loadable_module_interface_t **interface)
|
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_syslog_shutdown)
|
||||||
{
|
{
|
||||||
closelog();
|
closelog();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user