mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-07-24 05:02:10 +00:00
format
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5925 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
@@ -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,22 +101,22 @@ 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",
|
||||
"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",
|
||||
"IAX_EVENT_URL", "IAX_EVENT_LDCOMPLETE", "IAX_EVENT_TRANSFER", "IAX_EVENT_DPREQ",
|
||||
"IAX_EVENT_DPREP", "IAX_EVENT_DIAL", "IAX_EVENT_QUELCH", "IAX_EVENT_UNQUELCH",
|
||||
"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"
|
||||
};
|
||||
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",
|
||||
"IAX_EVENT_URL", "IAX_EVENT_LDCOMPLETE", "IAX_EVENT_TRANSFER", "IAX_EVENT_DPREQ",
|
||||
"IAX_EVENT_DPREP", "IAX_EVENT_DIAL", "IAX_EVENT_QUELCH", "IAX_EVENT_UNQUELCH",
|
||||
"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)
|
||||
{
|
||||
@@ -695,7 +695,7 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
|
||||
|
||||
return SWITCH_STATUS_FALSE;
|
||||
|
||||
cng:
|
||||
cng:
|
||||
data = (switch_byte_t *) tech_pvt->read_frame.data;
|
||||
data[0] = 65;
|
||||
data[1] = 0;
|
||||
@@ -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,
|
||||
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 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);
|
||||
|
||||
/*
|
||||
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;
|
||||
@@ -583,12 +584,12 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
|
||||
|
||||
goto hold;
|
||||
}
|
||||
cng:
|
||||
cng:
|
||||
switch_yield(globals.read_codec.implementation->microseconds_per_frame);
|
||||
*frame = &globals.cng_frame;
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
|
||||
hold:
|
||||
hold:
|
||||
|
||||
{
|
||||
switch_size_t olen = globals.read_codec.implementation->samples_per_frame;
|
||||
@@ -1040,7 +1041,7 @@ static void PrintSupportedStandardSampleRates(const PaStreamParameters * inputPa
|
||||
int i, printCount, cr = 7;
|
||||
PaError err;
|
||||
static double standardSampleRates[] = { 8000.0, 9600.0, 11025.0, 12000.0, 16000.0, 22050.0, 24000.0, 32000.0,
|
||||
44100.0, 48000.0, 88200.0, 96000.0, 192000.0, -1
|
||||
44100.0, 48000.0, 88200.0, 96000.0, 192000.0, -1
|
||||
};
|
||||
|
||||
printCount = cr;
|
||||
@@ -1184,7 +1185,7 @@ static int dump_info(void)
|
||||
|
||||
return 0;
|
||||
|
||||
error:
|
||||
error:
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_ERROR, "An error occured while using the portaudio stream\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_ERROR, "Error number: %d\n", err);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_ERROR, "Error message: %s\n", Pa_GetErrorText(err));
|
||||
@@ -1370,7 +1371,7 @@ static switch_status_t switch_call(char **argv, int argc, switch_stream_handle_t
|
||||
stream->write_function(stream, "NO SUCH CALL\n");
|
||||
}
|
||||
|
||||
done:
|
||||
done:
|
||||
switch_mutex_unlock(globals.pvt_lock);
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
@@ -1436,7 +1437,7 @@ static switch_status_t answer_call(char **argv, int argc, switch_stream_handle_t
|
||||
break;
|
||||
}
|
||||
}
|
||||
done:
|
||||
done:
|
||||
switch_mutex_unlock(globals.pvt_lock);
|
||||
|
||||
stream->write_function(stream, "Answered %d channels.\n", x);
|
||||
@@ -1490,7 +1491,7 @@ static switch_status_t do_flags(char **argv, int argc, switch_stream_handle_t *s
|
||||
goto bad;
|
||||
}
|
||||
|
||||
desc:
|
||||
desc:
|
||||
x = 0;
|
||||
stream->write_function(stream, "FLAGS: ");
|
||||
if (switch_test_flag((&globals), GFLAG_EAR)) {
|
||||
@@ -1507,9 +1508,9 @@ static switch_status_t do_flags(char **argv, int argc, switch_stream_handle_t *s
|
||||
|
||||
goto done;
|
||||
|
||||
bad:
|
||||
bad:
|
||||
stream->write_function(stream, "Usage: flags [on|off] <flags>\n");
|
||||
done:
|
||||
done:
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -1796,7 +1797,7 @@ SWITCH_STANDARD_API(pa_cmd)
|
||||
}
|
||||
}
|
||||
|
||||
done:
|
||||
done:
|
||||
|
||||
if (http) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user