mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-07-05 23:18:16 +00:00
format
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5925 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
511a6292af
commit
b099f96e4e
@ -286,7 +286,7 @@ SWITCH_DECLARE(switch_time_t) switch_str_time(const char *in);
|
||||
\param vname the name of the global pointer to modify with the new function
|
||||
*/
|
||||
#define SWITCH_DECLARE_GLOBAL_STRING_FUNC(fname, vname) static void fname(char *string) { if (!string) return;\
|
||||
if (vname) {free(vname); vname = NULL;}vname = strdup(string);}
|
||||
if (vname) {free(vname); vname = NULL;}vname = strdup(string);} static void fname(char *string)
|
||||
|
||||
/*!
|
||||
\brief Separate a string into an array based on a character delimeter
|
||||
|
@ -45,13 +45,13 @@ static struct {
|
||||
char *base;
|
||||
} globals;
|
||||
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_directory_name, globals.directory_name)
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_host, globals.host)
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_dn, globals.dn)
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_pass, globals.pass)
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_base, globals.base)
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_directory_name, globals.directory_name);
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_host, globals.host);
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_dn, globals.dn);
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_pass, globals.pass);
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_base, globals.base);
|
||||
|
||||
static void load_config(void)
|
||||
static void load_config(void)
|
||||
{
|
||||
char *cf = "dialplan_directory.conf";
|
||||
switch_xml_t cfg, xml, settings, param;
|
||||
|
@ -130,13 +130,13 @@ static struct {
|
||||
#define PA_SLAVE 0
|
||||
|
||||
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_dialplan, globals.dialplan)//;
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_cid_name, globals.cid_name)//;
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_cid_num, globals.cid_num)//;
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_ring_file, globals.ring_file)//;
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_hold_file, globals.hold_file)//;
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_timer_name, globals.timer_name)//;
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_device_name, globals.device_name)//;
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_dialplan, globals.dialplan);
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_cid_name, globals.cid_name);
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_cid_num, globals.cid_num);
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_ring_file, globals.ring_file);
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_hold_file, globals.hold_file);
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_timer_name, globals.timer_name);
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_device_name, globals.device_name);
|
||||
|
||||
#define is_master(t) switch_test_flag(t, TFLAG_MASTER)
|
||||
static void add_pvt(private_t * tech_pvt, int master);
|
||||
|
@ -191,9 +191,9 @@ struct rfc2833_digit {
|
||||
};
|
||||
|
||||
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_dialplan, globals.dialplan)
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_codec_string, globals.codec_string)
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_codec_rates_string, globals.codec_rates_string)
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_dialplan, globals.dialplan);
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_codec_string, globals.codec_string);
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_codec_rates_string, globals.codec_rates_string);
|
||||
|
||||
static switch_status_t dl_login(const char *arg, switch_core_session_t *session, switch_stream_handle_t *stream);
|
||||
static switch_status_t dl_logout(const char *profile_name, switch_core_session_t *session, switch_stream_handle_t *stream);
|
||||
|
@ -101,13 +101,13 @@ struct private_object {
|
||||
typedef struct private_object private_t;
|
||||
|
||||
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_dialplan, globals.dialplan)
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_codec_string, globals.codec_string)
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_codec_rates_string, globals.codec_rates_string)
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_ip, globals.ip)
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_dialplan, globals.dialplan);
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_codec_string, globals.codec_string);
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_codec_rates_string, globals.codec_rates_string);
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_ip, globals.ip);
|
||||
|
||||
|
||||
static char *IAXNAMES[] = { "IAX_EVENT_CONNECT", "IAX_EVENT_ACCEPT", "IAX_EVENT_HANGUP", "IAX_EVENT_REJECT", "IAX_EVENT_VOICE",
|
||||
static char *IAXNAMES[] = { "IAX_EVENT_CONNECT", "IAX_EVENT_ACCEPT", "IAX_EVENT_HANGUP", "IAX_EVENT_REJECT", "IAX_EVENT_VOICE",
|
||||
"IAX_EVENT_DTMF", "IAX_EVENT_TIMEOUT", "IAX_EVENT_LAGRQ", "IAX_EVENT_LAGRP", "IAX_EVENT_RINGA",
|
||||
"IAX_EVENT_PING", "IAX_EVENT_PONG", "IAX_EVENT_BUSY", "IAX_EVENT_ANSWER", "IAX_EVENT_IMAGE",
|
||||
"IAX_EVENT_AUTHRQ", "IAX_EVENT_AUTHRP", "IAX_EVENT_REGREQ", "IAX_EVENT_REGACK",
|
||||
@ -116,7 +116,7 @@ SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_dialplan, globals.dialplan)
|
||||
"IAX_EVENT_UNLINK", "IAX_EVENT_LINKREJECT", "IAX_EVENT_TEXT", "IAX_EVENT_REGREJ",
|
||||
"IAX_EVENT_LINKURL", "IAX_EVENT_CNG", "IAX_EVENT_REREQUEST", "IAX_EVENT_TXREPLY",
|
||||
"IAX_EVENT_TXREJECT", "IAX_EVENT_TXACCEPT", "IAX_EVENT_TXREADY"
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
struct ast_iana {
|
||||
@ -127,24 +127,24 @@ struct ast_iana {
|
||||
|
||||
//999 means it's wrong nad i dont know the real one
|
||||
static struct ast_iana AST_IANA[] = { {AST_FORMAT_G723_1, 4, "g723.1"},
|
||||
{AST_FORMAT_GSM, 3, "gsm"},
|
||||
{AST_FORMAT_ULAW, 0, "ulaw"},
|
||||
{AST_FORMAT_ALAW, 8, "alaw"},
|
||||
{AST_FORMAT_G726, 999, "g726"},
|
||||
{AST_FORMAT_ADPCM, 999, "adpcm"},
|
||||
{AST_FORMAT_SLINEAR, 10, "slinear"},
|
||||
{AST_FORMAT_LPC10, 7, "lpc10"},
|
||||
{AST_FORMAT_G729A, 18, "g729"},
|
||||
{AST_FORMAT_SPEEX, 97, "speex"},
|
||||
{AST_FORMAT_SPEEX, 98, "speex"},
|
||||
{AST_FORMAT_ILBC, 102, "ilbc"},
|
||||
{AST_FORMAT_MAX_AUDIO, 999, ""},
|
||||
{AST_FORMAT_JPEG, 999, ""},
|
||||
{AST_FORMAT_PNG, 999, ""},
|
||||
{AST_FORMAT_H261, 999, ""},
|
||||
{AST_FORMAT_H263, 999, ""},
|
||||
{AST_FORMAT_MAX_VIDEO, 999, ""},
|
||||
{0, 0}
|
||||
{AST_FORMAT_GSM, 3, "gsm"},
|
||||
{AST_FORMAT_ULAW, 0, "ulaw"},
|
||||
{AST_FORMAT_ALAW, 8, "alaw"},
|
||||
{AST_FORMAT_G726, 999, "g726"},
|
||||
{AST_FORMAT_ADPCM, 999, "adpcm"},
|
||||
{AST_FORMAT_SLINEAR, 10, "slinear"},
|
||||
{AST_FORMAT_LPC10, 7, "lpc10"},
|
||||
{AST_FORMAT_G729A, 18, "g729"},
|
||||
{AST_FORMAT_SPEEX, 97, "speex"},
|
||||
{AST_FORMAT_SPEEX, 98, "speex"},
|
||||
{AST_FORMAT_ILBC, 102, "ilbc"},
|
||||
{AST_FORMAT_MAX_AUDIO, 999, ""},
|
||||
{AST_FORMAT_JPEG, 999, ""},
|
||||
{AST_FORMAT_PNG, 999, ""},
|
||||
{AST_FORMAT_H261, 999, ""},
|
||||
{AST_FORMAT_H263, 999, ""},
|
||||
{AST_FORMAT_MAX_VIDEO, 999, ""},
|
||||
{0, 0}
|
||||
};
|
||||
|
||||
static char *ast2str(int ast)
|
||||
@ -449,9 +449,9 @@ static void tech_init(private_t * tech_pvt, switch_core_session_t *session)
|
||||
}
|
||||
|
||||
/*
|
||||
State methods they get called when the state changes to the specific state
|
||||
returning SWITCH_STATUS_SUCCESS tells the core to execute the standard state method next
|
||||
so if you fully implement the state you can return SWITCH_STATUS_FALSE to skip it.
|
||||
State methods they get called when the state changes to the specific state
|
||||
returning SWITCH_STATUS_SUCCESS tells the core to execute the standard state method next
|
||||
so if you fully implement the state you can return SWITCH_STATUS_FALSE to skip it.
|
||||
*/
|
||||
static switch_status_t channel_on_init(switch_core_session_t *session)
|
||||
{
|
||||
@ -784,7 +784,7 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s
|
||||
}
|
||||
|
||||
/* Make sure when you have 2 sessions in the same scope that you pass the appropriate one to the routines
|
||||
that allocate memory or you will have 1 channel with memory allocated from another channel's pool!
|
||||
that allocate memory or you will have 1 channel with memory allocated from another channel's pool!
|
||||
*/
|
||||
static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session,
|
||||
switch_caller_profile_t *outbound_profile,
|
||||
|
@ -128,41 +128,42 @@ static struct {
|
||||
#define PA_SLAVE 0
|
||||
|
||||
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_dialplan, globals.dialplan)
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_cid_name, globals.cid_name)
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_cid_num, globals.cid_num)
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_ring_file, globals.ring_file)
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_hold_file, globals.hold_file)
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_timer_name, globals.timer_name)
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_dialplan, globals.dialplan);
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_cid_name, globals.cid_name);
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_cid_num, globals.cid_num);
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_ring_file, globals.ring_file);
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_hold_file, globals.hold_file);
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_timer_name, globals.timer_name);
|
||||
#define is_master(t) switch_test_flag(t, TFLAG_MASTER)
|
||||
static void add_pvt(private_t * tech_pvt, int master);
|
||||
static void remove_pvt(private_t * tech_pvt);
|
||||
static switch_status_t channel_on_init(switch_core_session_t *session);
|
||||
static switch_status_t channel_on_hangup(switch_core_session_t *session);
|
||||
static switch_status_t channel_on_ring(switch_core_session_t *session);
|
||||
static switch_status_t channel_on_loopback(switch_core_session_t *session);
|
||||
static switch_status_t channel_on_transmit(switch_core_session_t *session);
|
||||
static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session,
|
||||
|
||||
static void add_pvt(private_t * tech_pvt, int master);
|
||||
static void remove_pvt(private_t * tech_pvt);
|
||||
static switch_status_t channel_on_init(switch_core_session_t *session);
|
||||
static switch_status_t channel_on_hangup(switch_core_session_t *session);
|
||||
static switch_status_t channel_on_ring(switch_core_session_t *session);
|
||||
static switch_status_t channel_on_loopback(switch_core_session_t *session);
|
||||
static switch_status_t channel_on_transmit(switch_core_session_t *session);
|
||||
static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session,
|
||||
switch_caller_profile_t *outbound_profile,
|
||||
switch_core_session_t **new_session, switch_memory_pool_t **pool);
|
||||
static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, int timeout, switch_io_flag_t flags, int stream_id);
|
||||
static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, int timeout, switch_io_flag_t flags, int stream_id);
|
||||
static switch_status_t channel_kill_channel(switch_core_session_t *session, int sig);
|
||||
static switch_status_t engage_device(int samplerate, int codec_ms);
|
||||
static switch_status_t engage_ring_device(int sample_rate, int channels);
|
||||
static void deactivate_ring_device(void);
|
||||
static int dump_info(void);
|
||||
static switch_status_t load_config(void);
|
||||
static int get_dev_by_name(char *name, int in);
|
||||
static int get_dev_by_number(int number, int in);
|
||||
static switch_status_t pa_cmd(const char *dest, switch_core_session_t *session, switch_stream_handle_t *stream);
|
||||
static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, int timeout, switch_io_flag_t flags, int stream_id);
|
||||
static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, int timeout, switch_io_flag_t flags, int stream_id);
|
||||
static switch_status_t channel_kill_channel(switch_core_session_t *session, int sig);
|
||||
static switch_status_t engage_device(int samplerate, int codec_ms);
|
||||
static switch_status_t engage_ring_device(int sample_rate, int channels);
|
||||
static void deactivate_ring_device(void);
|
||||
static int dump_info(void);
|
||||
static switch_status_t load_config(void);
|
||||
static int get_dev_by_name(char *name, int in);
|
||||
static int get_dev_by_number(int number, int in);
|
||||
static switch_status_t pa_cmd(const char *dest, switch_core_session_t *session, switch_stream_handle_t *stream);
|
||||
|
||||
/*
|
||||
State methods they get called when the state changes to the specific state
|
||||
returning SWITCH_STATUS_SUCCESS tells the core to execute the standard state method next
|
||||
so if you fully implement the state you can return SWITCH_STATUS_FALSE to skip it.
|
||||
*/
|
||||
static switch_status_t channel_on_init(switch_core_session_t *session)
|
||||
static switch_status_t channel_on_init(switch_core_session_t *session)
|
||||
{
|
||||
switch_channel_t *channel;
|
||||
private_t *tech_pvt = NULL;
|
||||
|
@ -53,10 +53,10 @@ static struct {
|
||||
int running;
|
||||
} globals;
|
||||
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_address, globals.address)
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_bindings, globals.bindings)
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_address, globals.address);
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_bindings, globals.bindings);
|
||||
#define MULTICAST_EVENT "multicast::event"
|
||||
static switch_status_t load_config(void)
|
||||
static switch_status_t load_config(void)
|
||||
{
|
||||
switch_status_t status = SWITCH_STATUS_SUCCESS;
|
||||
char *cf = "event_multicast.conf";
|
||||
|
@ -91,13 +91,13 @@ static struct {
|
||||
int threads;
|
||||
} prefs;
|
||||
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_pref_ip, prefs.ip)
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_pref_pass, prefs.password)
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_pref_ip, prefs.ip);
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_pref_pass, prefs.password);
|
||||
|
||||
static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t * thread, void *obj);
|
||||
static void launch_listener_thread(listener_t * listener);
|
||||
static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t * thread, void *obj);
|
||||
static void launch_listener_thread(listener_t * listener);
|
||||
|
||||
static switch_status_t socket_logger(const switch_log_node_t *node, switch_log_level_t level)
|
||||
static switch_status_t socket_logger(const switch_log_node_t *node, switch_log_level_t level)
|
||||
{
|
||||
listener_t *l;
|
||||
|
||||
|
@ -52,12 +52,12 @@ static struct {
|
||||
char *format;
|
||||
} globals;
|
||||
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_ident, globals.ident)
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_level, globals.level)
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_format, globals.format)
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_facility, globals.facility)
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_ident, globals.ident);
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_level, globals.level);
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_format, globals.format);
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_facility, globals.facility);
|
||||
|
||||
static switch_loadable_module_interface_t console_module_interface = {
|
||||
static switch_loadable_module_interface_t console_module_interface = {
|
||||
/*.module_name */ modname,
|
||||
/*.endpoint_interface */ NULL,
|
||||
/*.timer_interface */ NULL,
|
||||
@ -68,7 +68,7 @@ SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_ident, globals.ident)
|
||||
/*.file_interface */ NULL,
|
||||
/*.speech_interface */ NULL,
|
||||
/*.directory_interface */ NULL
|
||||
};
|
||||
};
|
||||
|
||||
static switch_status_t mod_syslog_logger(const switch_log_node_t *node, switch_log_level_t level)
|
||||
{
|
||||
|
@ -55,11 +55,11 @@ static struct {
|
||||
char *pass;
|
||||
} globals;
|
||||
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_realm, globals.realm)
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_user, globals.user)
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_pass, globals.pass)
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_realm, globals.realm);
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_user, globals.user);
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_pass, globals.pass);
|
||||
|
||||
static switch_status_t do_config(void)
|
||||
static switch_status_t do_config(void)
|
||||
{
|
||||
char *cf = "xml_rpc.conf";
|
||||
switch_xml_t cfg, xml, settings, param;
|
||||
@ -292,7 +292,7 @@ static xmlrpc_value *freeswitch_api(xmlrpc_env * const envP, xmlrpc_value * cons
|
||||
val = xmlrpc_build_value(envP, "s", "ERROR!");
|
||||
}
|
||||
|
||||
done:
|
||||
done:
|
||||
/* xmlrpc-c requires us to free memory it malloced from xmlrpc_decompose_value */
|
||||
switch_safe_free(command);
|
||||
switch_safe_free(arg);
|
||||
@ -347,7 +347,7 @@ static xmlrpc_value *freeswitch_man(xmlrpc_env * const envP, xmlrpc_value * cons
|
||||
/* Return our result. */
|
||||
val = xmlrpc_build_value(envP, "s", buf);
|
||||
|
||||
done:
|
||||
done:
|
||||
/* xmlrpc-c requires us to free memory it malloced from xmlrpc_decompose_value */
|
||||
switch_safe_free(oid);
|
||||
switch_safe_free(s_action);
|
||||
|
Loading…
x
Reference in New Issue
Block a user