Merge branch 'master' into smgmaster

This commit is contained in:
Moises Silva committed 2010-09-20 12:31:15 -04:00
commit d4232aa8cc
13 files changed
+175 -45

No files matched your search

@@ -4063,7 +4063,7 @@ SWITCH_STANDARD_API(uuid_dump_function)
return SWITCH_STATUS_SUCCESS;
}
#define GLOBAL_SETVAR_SYNTAX "<var> <value> [<value2>]"
#define GLOBAL_SETVAR_SYNTAX "<var>=<value> [=<value2>]"
SWITCH_STANDARD_API(global_setvar_function)
{
char *mycmd = NULL, *argv[3] = { 0 };
@@ -120,6 +120,21 @@ static struct {
int thread_running;
} t38_state_list;
static void wake_thread(int force)
{
if (force) {
switch_thread_cond_signal(globals.cond);
return;
}
if (switch_mutex_trylock(globals.cond_mutex) == SWITCH_STATUS_SUCCESS) {
switch_thread_cond_signal(globals.cond);
switch_mutex_unlock(globals.cond_mutex);
}
}
static int add_pvt(pvt_t *pvt)
{
int r = 0;
@@ -130,7 +145,7 @@ static int add_pvt(pvt_t *pvt)
t38_state_list.head = pvt;
switch_mutex_unlock(t38_state_list.mutex);
r = 1;
switch_thread_cond_broadcast(globals.cond);
wake_thread(0);
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error launching thread\n");
}
@@ -165,7 +180,7 @@ static int del_pvt(pvt_t *del_pvt)
switch_mutex_unlock(t38_state_list.mutex);
switch_thread_cond_broadcast(globals.cond);
wake_thread(0);
return r;
}
@@ -1335,7 +1350,7 @@ void mod_spandsp_fax_shutdown(void)
switch_status_t tstatus = SWITCH_STATUS_SUCCESS;
t38_state_list.thread_running = 0;
switch_thread_cond_broadcast(globals.cond);
wake_thread(1);
switch_thread_join(&tstatus, t38_state_list.thread);
memset(&globals, 0, sizeof(globals));
}
+22 -2
View File
@@ -3166,6 +3166,21 @@ static switch_status_t cmd_profile(char **argv, int argc, switch_stream_handle_t
goto done;
}
if (!strcasecmp(argv[1], "gwlist")) {
int up = 1;
if (argc > 2) {
if (!strcasecmp(argv[2], "down")) {
up = 0;
}
}
sofia_glue_gateway_list(profile, stream, up);
goto done;
}
stream->write_function(stream, "-ERR Unknown command!\n");
done:
@@ -4707,8 +4722,10 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load)
switch_console_set_complete("add sofia help");
switch_console_set_complete("add sofia status");
switch_console_set_complete("add sofia xmlstatus");
switch_console_set_complete("add sofia loglevel");
switch_console_set_complete("add sofia tracelevel");
switch_console_set_complete("add sofia loglevel ::[all:default:tport:iptsec:nea:nta:nth_client:nth_server:nua:soa:sresolv:stun ::[0:1:2:3:4:5:6:7:8:9");
switch_console_set_complete("add sofia tracelevel ::[console:alert:crit:err:warning:notice:info:debug");
switch_console_set_complete("add sofia profile");
switch_console_set_complete("add sofia profile restart all");
@@ -4724,6 +4741,9 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load)
switch_console_set_complete("add sofia profile ::sofia::list_profiles siptrace on");
switch_console_set_complete("add sofia profile ::sofia::list_profiles siptrace off");
switch_console_set_complete("add sofia profile ::sofia::list_profiles gwlist up");
switch_console_set_complete("add sofia profile ::sofia::list_profiles gwlist down");
switch_console_set_complete("add sofia status profile ::sofia::list_profiles");
switch_console_set_complete("add sofia status profile ::sofia::list_profiles reg");
switch_console_set_complete("add sofia status gateway ::sofia::list_gateways");
+1
View File
@@ -942,6 +942,7 @@ switch_status_t sofia_glue_tech_set_video_codec(private_object_t *tech_pvt, int
const char *sofia_glue_strip_proto(const char *uri);
switch_status_t reconfig_sofia(sofia_profile_t *profile);
void sofia_glue_del_gateway(sofia_gateway_t *gp);
void sofia_glue_gateway_list(sofia_profile_t *profile, switch_stream_handle_t *stream, int up);
void sofia_glue_del_every_gateway(sofia_profile_t *profile);
void sofia_reg_send_reboot(sofia_profile_t *profile, const char *user, const char *host, const char *contact, const char *user_agent,
const char *network_ip);
+3 -2
View File
@@ -4109,7 +4109,8 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status
}
}
if (tech_pvt && tech_pvt->remote_sdp_str && switch_stristr("m=image", tech_pvt->remote_sdp_str)) {
if (sip->sip_payload && sip->sip_payload->pl_data && switch_stristr("m=image", sip->sip_payload->pl_data)) {
has_t38 = 1;
}
@@ -4164,12 +4165,12 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status
}
if (status == 200 && sofia_test_flag(tech_pvt, TFLAG_T38_PASSTHRU) && has_t38) {
switch_core_session_receive_message(other_session, msg);
if (switch_rtp_ready(tech_pvt->rtp_session) && switch_rtp_ready(other_tech_pvt->rtp_session)) {
switch_rtp_udptl_mode(tech_pvt->rtp_session);
switch_rtp_udptl_mode(other_tech_pvt->rtp_session);
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Activating T38 Passthru\n");
}
switch_core_session_receive_message(other_session, msg);
} else {
switch_core_session_queue_message(other_session, msg);
}
+22
View File
@@ -4267,6 +4267,28 @@ void sofia_glue_del_every_gateway(sofia_profile_t *profile)
}
void sofia_glue_gateway_list(sofia_profile_t *profile, switch_stream_handle_t *stream, int up)
{
sofia_gateway_t *gp = NULL;
char *r = (char *) stream->data;
switch_mutex_lock(mod_sofia_globals.hash_mutex);
for (gp = profile->gateways; gp; gp = gp->next) {
int reged = (gp->status == SOFIA_GATEWAY_UP);
if (up ? reged : !reged) {
stream->write_function(stream, "%s ", gp->name);
}
}
if (r) {
end_of(r) = '\0';
}
switch_mutex_unlock(mod_sofia_globals.hash_mutex);
}
void sofia_glue_del_gateway(sofia_gateway_t *gp)
{
if (!gp->deleted) {