small core refactoring use -hp arg to gain high priority mode, add fsctl command USAGE: fsctl [hupall|pause|resume|shutdown]

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@2765 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale committed 2006-09-20 20:25:26 +00:00
1 parent fadbb9d401
commit 90815616cc
9 files changed
+262 -100

No files matched your search

@@ -87,6 +87,49 @@ static switch_status_t status_function(char *cmd, switch_core_session_t *session
return SWITCH_STATUS_SUCCESS;
}
static switch_status_t ctl_function(char *data, switch_core_session_t *session, switch_stream_handle_t *stream)
{
int argc;
char *mydata, *argv[5];
uint32_t arg = 0;
if (switch_strlen_zero(data)) {
stream->write_function(stream, "USAGE: fsctl [hupall|pause|resume|shutdown]\n");
return SWITCH_STATUS_SUCCESS;
}
if ((mydata = strdup(data))) {
argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
if (!strcmp(argv[0], "hupall")) {
arg = 1;
switch_core_session_ctl(SCSC_HUPALL, &arg);
} else if (!strcmp(argv[0], "pause")) {
arg = 1;
switch_core_session_ctl(SCSC_PAUSE_INBOUND, &arg);
} else if (!strcmp(argv[0], "resume")) {
arg = 0;
switch_core_session_ctl(SCSC_PAUSE_INBOUND, &arg);
} else if (!strcmp(argv[0], "shutdown")) {
arg = 0;
switch_core_session_ctl(SCSC_SHUTDOWN, &arg);
} else {
stream->write_function(stream, "INVALID COMMAND [%s]\n", argv[0]);
goto end;
}
stream->write_function(stream, "OK\n");
end:
free(mydata);
} else {
stream->write_function(stream, "MEM ERR\n");
}
return SWITCH_STATUS_SUCCESS;
}
static switch_status_t load_function(char *mod, switch_core_session_t *session, switch_stream_handle_t *stream)
{
@@ -436,11 +479,18 @@ static switch_status_t show_function(char *cmd, switch_core_session_t *session,
static switch_api_interface_t ctl_api_interface = {
/*.interface_name */ "fsctl",
/*.desc */ "control messages",
/*.function */ ctl_function,
/*.next */
};
static switch_api_interface_t uuid_bridge_api_interface = {
/*.interface_name */ "uuid_bridge",
/*.desc */ "uuid_bridge",
/*.function */ uuid_bridge_function,
/*.next */ NULL
/*.next */ &ctl_api_interface
};
static switch_api_interface_t status_api_interface = {
+2 -3
View File
@@ -727,7 +727,7 @@ static switch_status_t activate_rtp(private_object_t *tech_pvt)
bw = tech_pvt->read_codec.implementation->bits_per_second;
ms = tech_pvt->read_codec.implementation->microseconds_per_frame;
flags = (switch_rtp_flag_t) (SWITCH_RTP_FLAG_RAW_WRITE | SWITCH_RTP_FLAG_MINI | SWITCH_RTP_FLAG_AUTOADJ);
flags = (switch_rtp_flag_t) (SWITCH_RTP_FLAG_RAW_WRITE | SWITCH_RTP_FLAG_MINI | SWITCH_RTP_FLAG_AUTOADJ | SWITCH_RTP_FLAG_DATAWAIT);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "RTP [%s] %s:%d->%s:%d codec: %u ms: %d\n",
switch_channel_get_name(channel),
@@ -812,6 +812,7 @@ static switch_status_t sofia_read_frame(switch_core_session_t *session, switch_f
size_t bytes = 0, samples = 0, frames = 0, ms = 0;
switch_channel_t *channel = NULL;
int payload = 0;
//switch_time_t now, started = switch_time_now(), last_act = switch_time_now();
//unsigned int elapsed;
//uint32_t hard_timeout = 60000 * 3;
@@ -903,8 +904,6 @@ static switch_status_t sofia_read_frame(switch_core_session_t *session, switch_f
tech_pvt->read_frame.samples = (int) samples;
break;
}
switch_yield(1000);
}
}