man am I OCD about this stuff or what
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9966 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
0ecfc14d68
commit
f1bc3e6bb2
|
@ -42,7 +42,6 @@ SWITCH_MODULE_DEFINITION(mod_enum, mod_enum_load, mod_enum_shutdown, NULL);
|
||||||
|
|
||||||
static switch_mutex_t *MUTEX = NULL;
|
static switch_mutex_t *MUTEX = NULL;
|
||||||
|
|
||||||
|
|
||||||
struct enum_record {
|
struct enum_record {
|
||||||
int order;
|
int order;
|
||||||
int preference;
|
int preference;
|
||||||
|
@ -108,7 +107,6 @@ static void add_route(char *service, char *regex, char *replace)
|
||||||
switch_mutex_unlock(MUTEX);
|
switch_mutex_unlock(MUTEX);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static switch_status_t load_config(void)
|
static switch_status_t load_config(void)
|
||||||
{
|
{
|
||||||
char *cf = "enum.conf";
|
char *cf = "enum.conf";
|
||||||
|
@ -168,10 +166,8 @@ static switch_status_t load_config(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static char *reverse_number(char *in, char *root)
|
static char *reverse_number(char *in, char *root)
|
||||||
{
|
{
|
||||||
switch_size_t len;
|
switch_size_t len;
|
||||||
|
@ -210,7 +206,6 @@ static void dnserror(enum_query_t *q, int errnum)
|
||||||
q->errs++;
|
q->errs++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void add_result(enum_query_t *q, int order, int preference, char *service, char *route, int supported)
|
static void add_result(enum_query_t *q, int order, int preference, char *service, char *route, int supported)
|
||||||
{
|
{
|
||||||
enum_record_t *new_result, *rp, *prev = NULL;
|
enum_record_t *new_result, *rp, *prev = NULL;
|
||||||
|
@ -256,7 +251,6 @@ static void add_result(enum_query_t *q, int order, int preference, char *service
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void free_results(enum_record_t **results)
|
static void free_results(enum_record_t **results)
|
||||||
{
|
{
|
||||||
enum_record_t *fp, *rp;
|
enum_record_t *fp, *rp;
|
||||||
|
@ -395,7 +389,7 @@ static void parse_rr(const struct dns_parse *p, enum_query_t *q, struct dns_rr *
|
||||||
return;
|
return;
|
||||||
|
|
||||||
xperr:
|
xperr:
|
||||||
//printf("<parse error>\n");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -453,7 +447,6 @@ static void dnscb(struct dns_ctx *ctx, void *result, void *data)
|
||||||
free(result);
|
free(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static switch_status_t enum_lookup(char *root, char *in, enum_record_t **results)
|
static switch_status_t enum_lookup(char *root, char *in, enum_record_t **results)
|
||||||
{
|
{
|
||||||
switch_status_t sstatus = SWITCH_STATUS_SUCCESS;
|
switch_status_t sstatus = SWITCH_STATUS_SUCCESS;
|
||||||
|
@ -567,7 +560,6 @@ static switch_status_t enum_lookup(char *root, char *in, enum_record_t **results
|
||||||
return sstatus;
|
return sstatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SWITCH_STANDARD_DIALPLAN(enum_dialplan_hunt)
|
SWITCH_STANDARD_DIALPLAN(enum_dialplan_hunt)
|
||||||
{
|
{
|
||||||
switch_caller_extension_t *extension = NULL;
|
switch_caller_extension_t *extension = NULL;
|
||||||
|
@ -603,7 +595,6 @@ SWITCH_STANDARD_DIALPLAN(enum_dialplan_hunt)
|
||||||
}
|
}
|
||||||
|
|
||||||
return extension;
|
return extension;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SWITCH_STANDARD_APP(enum_app_function)
|
SWITCH_STANDARD_APP(enum_app_function)
|
||||||
|
@ -666,10 +657,8 @@ SWITCH_STANDARD_APP(enum_app_function)
|
||||||
free_results(&results);
|
free_results(&results);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SWITCH_STANDARD_API(enum_api)
|
SWITCH_STANDARD_API(enum_api)
|
||||||
{
|
{
|
||||||
int argc = 0;
|
int argc = 0;
|
||||||
|
@ -729,7 +718,6 @@ SWITCH_STANDARD_API(enum_api)
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void do_load(void)
|
static void do_load(void)
|
||||||
{
|
{
|
||||||
switch_mutex_lock(MUTEX);
|
switch_mutex_lock(MUTEX);
|
||||||
|
@ -745,8 +733,6 @@ static void do_load(void)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
SWITCH_STANDARD_API(enum_function)
|
SWITCH_STANDARD_API(enum_function)
|
||||||
{
|
{
|
||||||
int argc = 0;
|
int argc = 0;
|
||||||
|
@ -854,7 +840,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_enum_load)
|
||||||
|
|
||||||
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_enum_shutdown)
|
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_enum_shutdown)
|
||||||
{
|
{
|
||||||
|
|
||||||
switch_event_unbind(&NODE);
|
switch_event_unbind(&NODE);
|
||||||
|
|
||||||
if (globals.pool) {
|
if (globals.pool) {
|
||||||
|
|
|
@ -40,6 +40,7 @@ struct ls_control_packet {
|
||||||
uint32_t ip;
|
uint32_t ip;
|
||||||
uint32_t port;
|
uint32_t port;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct ls_control_packet ls_control_packet_t;
|
typedef struct ls_control_packet ls_control_packet_t;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
@ -78,7 +79,6 @@ SWITCH_STANDARD_APP(bcast_function)
|
||||||
char *mcast_port_str = "34567";
|
char *mcast_port_str = "34567";
|
||||||
const char *esf_broadcast_ip = NULL, *var;
|
const char *esf_broadcast_ip = NULL, *var;
|
||||||
|
|
||||||
|
|
||||||
if (!switch_strlen_zero((char *) data)) {
|
if (!switch_strlen_zero((char *) data)) {
|
||||||
mydata = switch_core_session_strdup(session, data);
|
mydata = switch_core_session_strdup(session, data);
|
||||||
assert(mydata != NULL);
|
assert(mydata != NULL);
|
||||||
|
@ -103,7 +103,6 @@ SWITCH_STANDARD_APP(bcast_function)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (switch_true(switch_channel_get_variable(channel, SWITCH_BYPASS_MEDIA_VARIABLE))) {
|
if (switch_true(switch_channel_get_variable(channel, SWITCH_BYPASS_MEDIA_VARIABLE))) {
|
||||||
switch_core_session_message_t msg = { 0 };
|
switch_core_session_message_t msg = { 0 };
|
||||||
|
|
||||||
|
@ -259,7 +258,6 @@ SWITCH_STANDARD_APP(bcast_function)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SWITCH_MODULE_LOAD_FUNCTION(mod_esf_load)
|
SWITCH_MODULE_LOAD_FUNCTION(mod_esf_load)
|
||||||
{
|
{
|
||||||
switch_application_interface_t *app_interface;
|
switch_application_interface_t *app_interface;
|
||||||
|
|
|
@ -52,9 +52,6 @@ struct fifo_node {
|
||||||
|
|
||||||
typedef struct fifo_node fifo_node_t;
|
typedef struct fifo_node fifo_node_t;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static switch_status_t on_dtmf(switch_core_session_t *session, void *input, switch_input_type_t itype, void *buf, unsigned int buflen)
|
static switch_status_t on_dtmf(switch_core_session_t *session, void *input, switch_input_type_t itype, void *buf, unsigned int buflen)
|
||||||
{
|
{
|
||||||
switch_core_session_t *bleg = (switch_core_session_t *) buf;
|
switch_core_session_t *bleg = (switch_core_session_t *) buf;
|
||||||
|
@ -102,10 +99,8 @@ static switch_status_t on_dtmf(switch_core_session_t *session, void *input, swit
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static switch_status_t moh_on_dtmf(switch_core_session_t *session, void *input, switch_input_type_t itype, void *buf, unsigned int buflen)
|
static switch_status_t moh_on_dtmf(switch_core_session_t *session, void *input, switch_input_type_t itype, void *buf, unsigned int buflen)
|
||||||
{
|
{
|
||||||
|
|
||||||
switch (itype) {
|
switch (itype) {
|
||||||
case SWITCH_INPUT_TYPE_DTMF:
|
case SWITCH_INPUT_TYPE_DTMF:
|
||||||
{
|
{
|
||||||
|
@ -181,10 +176,9 @@ struct fifo_chime_data {
|
||||||
int do_orbit;
|
int do_orbit;
|
||||||
char *orbit_exten;
|
char *orbit_exten;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct fifo_chime_data fifo_chime_data_t;
|
typedef struct fifo_chime_data fifo_chime_data_t;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static switch_status_t caller_read_frame_callback(switch_core_session_t *session, switch_frame_t *frame, void *user_data)
|
static switch_status_t caller_read_frame_callback(switch_core_session_t *session, switch_frame_t *frame, void *user_data)
|
||||||
{
|
{
|
||||||
fifo_chime_data_t *cd = (fifo_chime_data_t *) user_data;
|
fifo_chime_data_t *cd = (fifo_chime_data_t *) user_data;
|
||||||
|
@ -222,7 +216,6 @@ static switch_status_t caller_read_frame_callback(switch_core_session_t *session
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static switch_status_t consumer_read_frame_callback(switch_core_session_t *session, switch_frame_t *frame, void *user_data)
|
static switch_status_t consumer_read_frame_callback(switch_core_session_t *session, switch_frame_t *frame, void *user_data)
|
||||||
{
|
{
|
||||||
fifo_node_t *node, **node_list = (fifo_node_t **) user_data;
|
fifo_node_t *node, **node_list = (fifo_node_t **) user_data;
|
||||||
|
@ -252,7 +245,6 @@ static struct {
|
||||||
switch_event_node_t *node;
|
switch_event_node_t *node;
|
||||||
} globals;
|
} globals;
|
||||||
|
|
||||||
|
|
||||||
static fifo_node_t *create_node(const char *name, uint32_t importance)
|
static fifo_node_t *create_node(const char *name, uint32_t importance)
|
||||||
{
|
{
|
||||||
fifo_node_t *node;
|
fifo_node_t *node;
|
||||||
|
@ -310,7 +302,6 @@ static void send_presence(fifo_node_t *node)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void pres_event_handler(switch_event_t *event)
|
static void pres_event_handler(switch_event_t *event)
|
||||||
{
|
{
|
||||||
char *to = switch_event_get_header(event, "to");
|
char *to = switch_event_get_header(event, "to");
|
||||||
|
@ -443,7 +434,6 @@ SWITCH_STANDARD_APP(fifo_function)
|
||||||
if (argc > 4) {
|
if (argc > 4) {
|
||||||
moh = argv[4];
|
moh = argv[4];
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (argc > 2) {
|
if (argc > 2) {
|
||||||
announce = argv[2];
|
announce = argv[2];
|
||||||
|
@ -493,7 +483,6 @@ SWITCH_STANDARD_APP(fifo_function)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (chime_freq) {
|
if (chime_freq) {
|
||||||
ftmp = atoi(chime_freq);
|
ftmp = atoi(chime_freq);
|
||||||
if (ftmp > 0) {
|
if (ftmp > 0) {
|
||||||
|
@ -501,8 +490,6 @@ SWITCH_STANDARD_APP(fifo_function)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
switch_channel_answer(channel);
|
switch_channel_answer(channel);
|
||||||
|
|
||||||
switch_mutex_lock(node->mutex);
|
switch_mutex_lock(node->mutex);
|
||||||
|
@ -510,7 +497,6 @@ SWITCH_STANDARD_APP(fifo_function)
|
||||||
|
|
||||||
switch_core_hash_insert(node->caller_hash, uuid, session);
|
switch_core_hash_insert(node->caller_hash, uuid, session);
|
||||||
|
|
||||||
|
|
||||||
if ((pri = switch_channel_get_variable(channel, "fifo_priority"))) {
|
if ((pri = switch_channel_get_variable(channel, "fifo_priority"))) {
|
||||||
p = atoi(pri);
|
p = atoi(pri);
|
||||||
}
|
}
|
||||||
|
@ -688,7 +674,6 @@ SWITCH_STANDARD_APP(fifo_function)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (argc > 2) {
|
if (argc > 2) {
|
||||||
if (!strcasecmp(argv[2], "nowait")) {
|
if (!strcasecmp(argv[2], "nowait")) {
|
||||||
do_wait = 0;
|
do_wait = 0;
|
||||||
|
@ -698,12 +683,10 @@ SWITCH_STANDARD_APP(fifo_function)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!(my_id = switch_channel_get_variable(channel, "fifo_consumer_id"))) {
|
if (!(my_id = switch_channel_get_variable(channel, "fifo_consumer_id"))) {
|
||||||
my_id = switch_core_session_get_uuid(session);
|
my_id = switch_core_session_get_uuid(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (do_wait) {
|
if (do_wait) {
|
||||||
for (i = 0; i < node_count; i++) {
|
for (i = 0; i < node_count; i++) {
|
||||||
if (!(node = node_list[i])) {
|
if (!(node = node_list[i])) {
|
||||||
|
@ -792,7 +775,6 @@ SWITCH_STANDARD_APP(fifo_function)
|
||||||
importance = node->importance;
|
importance = node->importance;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (winner > -1) {
|
if (winner > -1) {
|
||||||
|
@ -823,7 +805,6 @@ SWITCH_STANDARD_APP(fifo_function)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!pop) {
|
if (!pop) {
|
||||||
if (!do_wait) {
|
if (!do_wait) {
|
||||||
break;
|
break;
|
||||||
|
@ -872,7 +853,6 @@ SWITCH_STANDARD_APP(fifo_function)
|
||||||
switch_ivr_sleep(session, 500, NULL);
|
switch_ivr_sleep(session, 500, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
switch_channel_set_variable(other_channel, "fifo_serviced_by", my_id);
|
switch_channel_set_variable(other_channel, "fifo_serviced_by", my_id);
|
||||||
switch_channel_set_variable(other_channel, "fifo_serviced_uuid", switch_core_session_get_uuid(session));
|
switch_channel_set_variable(other_channel, "fifo_serviced_uuid", switch_core_session_get_uuid(session));
|
||||||
|
|
||||||
|
@ -891,7 +871,6 @@ SWITCH_STANDARD_APP(fifo_function)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
switch_channel_answer(channel);
|
switch_channel_answer(channel);
|
||||||
cloned_profile = switch_caller_profile_clone(other_session, switch_channel_get_caller_profile(channel));
|
cloned_profile = switch_caller_profile_clone(other_session, switch_channel_get_caller_profile(channel));
|
||||||
switch_assert(cloned_profile);
|
switch_assert(cloned_profile);
|
||||||
|
@ -945,7 +924,6 @@ SWITCH_STANDARD_APP(fifo_function)
|
||||||
send_presence(node);
|
send_presence(node);
|
||||||
switch_core_session_rwunlock(other_session);
|
switch_core_session_rwunlock(other_session);
|
||||||
|
|
||||||
|
|
||||||
if (!do_wait) {
|
if (!do_wait) {
|
||||||
done = 1;
|
done = 1;
|
||||||
}
|
}
|
||||||
|
@ -1044,7 +1022,6 @@ SWITCH_STANDARD_APP(fifo_function)
|
||||||
switch_mutex_unlock(node->mutex);
|
switch_mutex_unlock(node->mutex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1097,7 +1074,6 @@ static int xml_hash(switch_xml_t xml, switch_hash_t *hash, char *container, char
|
||||||
|
|
||||||
switch_ivr_set_xml_chan_vars(variables, channel, c_off);
|
switch_ivr_set_xml_chan_vars(variables, channel, c_off);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return cc_off;
|
return cc_off;
|
||||||
|
@ -1105,7 +1081,6 @@ static int xml_hash(switch_xml_t xml, switch_hash_t *hash, char *container, char
|
||||||
|
|
||||||
static void list_node(fifo_node_t *node, switch_xml_t x_report, int *off, int verbose)
|
static void list_node(fifo_node_t *node, switch_xml_t x_report, int *off, int verbose)
|
||||||
{
|
{
|
||||||
|
|
||||||
switch_xml_t x_fifo;
|
switch_xml_t x_fifo;
|
||||||
int cc_off = 0;
|
int cc_off = 0;
|
||||||
char buffer[35];
|
char buffer[35];
|
||||||
|
@ -1126,7 +1101,6 @@ static void list_node(fifo_node_t *node, switch_xml_t x_report, int *off, int ve
|
||||||
|
|
||||||
cc_off = xml_hash(x_fifo, node->caller_hash, "callers", "caller", cc_off, verbose);
|
cc_off = xml_hash(x_fifo, node->caller_hash, "callers", "caller", cc_off, verbose);
|
||||||
cc_off = xml_hash(x_fifo, node->consumer_hash, "consumers", "consumer", cc_off, verbose);
|
cc_off = xml_hash(x_fifo, node->consumer_hash, "consumers", "consumer", cc_off, verbose);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define FIFO_API_SYNTAX "list|list_verbose|count|importance [<fifo name>]"
|
#define FIFO_API_SYNTAX "list|list_verbose|count|importance [<fifo name>]"
|
||||||
|
@ -1142,7 +1116,6 @@ SWITCH_STANDARD_API(fifo_api_function)
|
||||||
const void *var;
|
const void *var;
|
||||||
int x = 0, verbose = 0;
|
int x = 0, verbose = 0;
|
||||||
|
|
||||||
|
|
||||||
if (!globals.running) {
|
if (!globals.running) {
|
||||||
return SWITCH_STATUS_FALSE;
|
return SWITCH_STATUS_FALSE;
|
||||||
}
|
}
|
||||||
|
@ -1229,13 +1202,11 @@ SWITCH_STANDARD_API(fifo_api_function)
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SWITCH_MODULE_LOAD_FUNCTION(mod_fifo_load)
|
SWITCH_MODULE_LOAD_FUNCTION(mod_fifo_load)
|
||||||
{
|
{
|
||||||
switch_application_interface_t *app_interface;
|
switch_application_interface_t *app_interface;
|
||||||
switch_api_interface_t *commands_api_interface;
|
switch_api_interface_t *commands_api_interface;
|
||||||
|
|
||||||
|
|
||||||
/* create/register custom event message type */
|
/* create/register custom event message type */
|
||||||
if (switch_event_reserve_subclass(FIFO_EVENT) != SWITCH_STATUS_SUCCESS) {
|
if (switch_event_reserve_subclass(FIFO_EVENT) != SWITCH_STATUS_SUCCESS) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!", FIFO_EVENT);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!", FIFO_EVENT);
|
||||||
|
@ -1305,7 +1276,6 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_fifo_shutdown)
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* For Emacs:
|
/* For Emacs:
|
||||||
* Local Variables:
|
* Local Variables:
|
||||||
* mode:c
|
* mode:c
|
||||||
|
|
|
@ -55,17 +55,13 @@ static char limit_sql[] =
|
||||||
"CREATE TABLE limit_data (\n"
|
"CREATE TABLE limit_data (\n"
|
||||||
" hostname VARCHAR(255),\n" " realm VARCHAR(255),\n" " id VARCHAR(255),\n" " uuid VARCHAR(255)\n" ");\n";
|
" hostname VARCHAR(255),\n" " realm VARCHAR(255),\n" " id VARCHAR(255),\n" " uuid VARCHAR(255)\n" ");\n";
|
||||||
|
|
||||||
|
|
||||||
static char db_sql[] =
|
static char db_sql[] =
|
||||||
"CREATE TABLE db_data (\n"
|
"CREATE TABLE db_data (\n"
|
||||||
" hostname VARCHAR(255),\n" " realm VARCHAR(255),\n" " data_key VARCHAR(255),\n" " data VARCHAR(255)\n" ");\n";
|
" hostname VARCHAR(255),\n" " realm VARCHAR(255),\n" " data_key VARCHAR(255),\n" " data VARCHAR(255)\n" ");\n";
|
||||||
|
|
||||||
|
|
||||||
static char group_sql[] =
|
static char group_sql[] =
|
||||||
"CREATE TABLE group_data (\n" " hostname VARCHAR(255),\n" " groupname VARCHAR(255),\n" " url VARCHAR(255)\n" ");\n";
|
"CREATE TABLE group_data (\n" " hostname VARCHAR(255),\n" " groupname VARCHAR(255),\n" " url VARCHAR(255)\n" ");\n";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static switch_status_t limit_execute_sql(char *sql, switch_mutex_t *mutex)
|
static switch_status_t limit_execute_sql(char *sql, switch_mutex_t *mutex)
|
||||||
{
|
{
|
||||||
switch_core_db_t *db;
|
switch_core_db_t *db;
|
||||||
|
@ -102,7 +98,6 @@ static switch_status_t limit_execute_sql(char *sql, switch_mutex_t *mutex)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
end:
|
end:
|
||||||
if (mutex) {
|
if (mutex) {
|
||||||
switch_mutex_unlock(mutex);
|
switch_mutex_unlock(mutex);
|
||||||
|
@ -111,7 +106,6 @@ static switch_status_t limit_execute_sql(char *sql, switch_mutex_t *mutex)
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static switch_bool_t limit_execute_sql_callback(switch_mutex_t *mutex, char *sql, switch_core_db_callback_func_t callback, void *pdata)
|
static switch_bool_t limit_execute_sql_callback(switch_mutex_t *mutex, char *sql, switch_core_db_callback_func_t callback, void *pdata)
|
||||||
{
|
{
|
||||||
switch_bool_t ret = SWITCH_FALSE;
|
switch_bool_t ret = SWITCH_FALSE;
|
||||||
|
@ -152,10 +146,8 @@ static switch_bool_t limit_execute_sql_callback(switch_mutex_t *mutex, char *sql
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static switch_status_t do_config()
|
static switch_status_t do_config()
|
||||||
{
|
{
|
||||||
char *cf = "limit.conf";
|
char *cf = "limit.conf";
|
||||||
|
@ -191,7 +183,6 @@ static switch_status_t do_config()
|
||||||
#else
|
#else
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ODBC IS NOT AVAILABLE!\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ODBC IS NOT AVAILABLE!\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -254,7 +245,6 @@ static switch_status_t do_config()
|
||||||
switch_xml_free(xml);
|
switch_xml_free(xml);
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static switch_status_t hanguphook(switch_core_session_t *session)
|
static switch_status_t hanguphook(switch_core_session_t *session)
|
||||||
|
@ -282,7 +272,9 @@ struct callback {
|
||||||
size_t len;
|
size_t len;
|
||||||
int matches;
|
int matches;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct callback callback_t;
|
typedef struct callback callback_t;
|
||||||
|
|
||||||
static int sql2str_callback(void *pArg, int argc, char **argv, char **columnNames)
|
static int sql2str_callback(void *pArg, int argc, char **argv, char **columnNames)
|
||||||
{
|
{
|
||||||
callback_t *cbt = (callback_t *) pArg;
|
callback_t *cbt = (callback_t *) pArg;
|
||||||
|
@ -292,7 +284,6 @@ static int sql2str_callback(void *pArg, int argc, char **argv, char **columnName
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int group_callback(void *pArg, int argc, char **argv, char **columnNames)
|
static int group_callback(void *pArg, int argc, char **argv, char **columnNames)
|
||||||
{
|
{
|
||||||
callback_t *cbt = (callback_t *) pArg;
|
callback_t *cbt = (callback_t *) pArg;
|
||||||
|
@ -301,7 +292,6 @@ static int group_callback(void *pArg, int argc, char **argv, char **columnNames)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SWITCH_STANDARD_API(db_api_function)
|
SWITCH_STANDARD_API(db_api_function)
|
||||||
{
|
{
|
||||||
int argc = 0;
|
int argc = 0;
|
||||||
|
@ -360,7 +350,6 @@ SWITCH_STANDARD_API(db_api_function)
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
error:
|
error:
|
||||||
stream->write_function(stream, "!err!");
|
stream->write_function(stream, "!err!");
|
||||||
|
|
||||||
|
@ -369,10 +358,8 @@ SWITCH_STANDARD_API(db_api_function)
|
||||||
switch_mutex_unlock(globals.mutex);
|
switch_mutex_unlock(globals.mutex);
|
||||||
switch_safe_free(mydata);
|
switch_safe_free(mydata);
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define DB_USAGE "[insert|delete]/<realm>/<key>/<val>"
|
#define DB_USAGE "[insert|delete]/<realm>/<key>/<val>"
|
||||||
#define DB_DESC "save data"
|
#define DB_DESC "save data"
|
||||||
|
|
||||||
|
@ -414,8 +401,6 @@ SWITCH_STANDARD_APP(db_function)
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "USAGE: db %s\n", DB_USAGE);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "USAGE: db %s\n", DB_USAGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
SWITCH_STANDARD_API(group_api_function)
|
SWITCH_STANDARD_API(group_api_function)
|
||||||
{
|
{
|
||||||
int argc = 0;
|
int argc = 0;
|
||||||
|
@ -493,7 +478,6 @@ SWITCH_STANDARD_API(group_api_function)
|
||||||
switch_mutex_unlock(globals.mutex);
|
switch_mutex_unlock(globals.mutex);
|
||||||
switch_safe_free(mydata);
|
switch_safe_free(mydata);
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define GROUP_USAGE "[insert|delete]:<group name>:<val>"
|
#define GROUP_USAGE "[insert|delete]:<group name>:<val>"
|
||||||
|
@ -527,7 +511,6 @@ SWITCH_STANDARD_APP(group_function)
|
||||||
limit_execute_sql(sql, globals.mutex);
|
limit_execute_sql(sql, globals.mutex);
|
||||||
switch_safe_free(sql);
|
switch_safe_free(sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define LIMIT_USAGE "<realm> <id> <max> [transfer_destination_number]"
|
#define LIMIT_USAGE "<realm> <id> <max> [transfer_destination_number]"
|
||||||
|
@ -600,7 +583,6 @@ SWITCH_STANDARD_APP(limit_function)
|
||||||
switch_mutex_unlock(globals.mutex);
|
switch_mutex_unlock(globals.mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SWITCH_MODULE_LOAD_FUNCTION(mod_limit_load)
|
SWITCH_MODULE_LOAD_FUNCTION(mod_limit_load)
|
||||||
{
|
{
|
||||||
switch_status_t status;
|
switch_status_t status;
|
||||||
|
@ -637,8 +619,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_limit_load)
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* For Emacs:
|
/* For Emacs:
|
||||||
* Local Variables:
|
* Local Variables:
|
||||||
* mode:c
|
* mode:c
|
||||||
|
|
Loading…
Reference in New Issue