mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-07-24 13:12:03 +00:00
Merge branch 'master' of git.freeswitch.org:freeswitch
This commit is contained in:
@@ -235,9 +235,9 @@ SWITCH_STANDARD_API(time_test_function)
|
||||
}
|
||||
|
||||
for (x = 1; x <= max; x++) {
|
||||
then = switch_time_now();
|
||||
then = switch_time_ref();
|
||||
switch_yield(mss);
|
||||
now = switch_time_now();
|
||||
now = switch_time_ref();
|
||||
diff = (int) (now - then);
|
||||
stream->write_function(stream, "test %d sleep %ld %d\n", x, mss, diff);
|
||||
total += diff;
|
||||
@@ -299,17 +299,17 @@ SWITCH_STANDARD_API(timer_test_function)
|
||||
goto end;
|
||||
}
|
||||
|
||||
start = switch_time_now();
|
||||
start = switch_time_ref();
|
||||
for (x = 1; x <= max; x++) {
|
||||
then = switch_time_now();
|
||||
then = switch_time_ref();
|
||||
switch_core_timer_next(&timer);
|
||||
now = switch_time_now();
|
||||
now = switch_time_ref();
|
||||
diff = (int) (now - then);
|
||||
//stream->write_function(stream, "test %d sleep %ld %d\n", x, mss, diff);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Timer Test: %d sleep %d %d\n", x, mss, diff);
|
||||
total += diff;
|
||||
}
|
||||
end = switch_time_now();
|
||||
end = switch_time_ref();
|
||||
|
||||
switch_yield(250000);
|
||||
|
||||
@@ -1599,7 +1599,7 @@ SWITCH_STANDARD_API(ctl_function)
|
||||
arg = atoi(argv[1]);
|
||||
}
|
||||
switch_core_session_ctl(SCSC_MAX_SESSIONS, &arg);
|
||||
stream->write_function(stream, "+OK max sessions: %f\n", arg);
|
||||
stream->write_function(stream, "+OK max sessions: %d\n", arg);
|
||||
} else if (!strcasecmp(argv[0], "min_idle_cpu")) {
|
||||
double d = -1;
|
||||
|
||||
@@ -4279,12 +4279,17 @@ end:
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
#define LIMIT_HASH_USAGE_USAGE "<backend> <realm> <id> [rate]"
|
||||
#define LIMIT_HASH_USAGE_USAGE "<realm> <id> [rate] (Using deprecated limit api, check limit_usage with backend param)"
|
||||
SWITCH_STANDARD_API(limit_hash_usage_function)
|
||||
{
|
||||
char *mydata = NULL;
|
||||
mydata = switch_core_session_sprintf(session, "hash %s", cmd);
|
||||
return limit_usage_function(mydata, session, stream);
|
||||
if (!zstr(cmd)) {
|
||||
mydata = switch_core_session_sprintf(session, "hash %s", cmd);
|
||||
return limit_usage_function(mydata, session, stream);
|
||||
} else {
|
||||
stream->write_function(stream, "USAGE: limit_hash_usage %s\n", LIMIT_HASH_USAGE_USAGE);
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
#define LIMIT_STATUS_USAGE "<backend>"
|
||||
|
||||
@@ -2688,20 +2688,22 @@ static switch_call_cause_t user_outgoing_channel(switch_core_session_t *session,
|
||||
}
|
||||
|
||||
|
||||
switch_event_create(¶ms, SWITCH_EVENT_REQUEST_PARAMS);
|
||||
switch_assert(params);
|
||||
switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "as_channel", "true");
|
||||
switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "action", "user_call");
|
||||
|
||||
if (var_event) {
|
||||
switch_event_merge(params, var_event);
|
||||
}
|
||||
|
||||
if (var_event && (skip = switch_event_get_header(var_event, "user_recurse_variables")) && switch_false(skip)) {
|
||||
if ((var = switch_event_get_header(var_event, SWITCH_CALL_TIMEOUT_VARIABLE)) || (var = switch_event_get_header(var_event, "leg_timeout"))) {
|
||||
timelimit = atoi(var);
|
||||
}
|
||||
var_event = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
switch_event_create(¶ms, SWITCH_EVENT_REQUEST_PARAMS);
|
||||
switch_assert(params);
|
||||
switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "as_channel", "true");
|
||||
switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "action", "user_call");
|
||||
|
||||
|
||||
if (switch_xml_locate_user("id", user, domain, NULL, &xml, &x_domain, &x_user, &x_group, params) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Can't find user [%s@%s]\n", user, domain);
|
||||
cause = SWITCH_CAUSE_SUBSCRIBER_ABSENT;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -486,8 +486,35 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_hash_load)
|
||||
|
||||
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_hash_shutdown)
|
||||
{
|
||||
switch_hash_index_t *hi = NULL;
|
||||
|
||||
switch_scheduler_del_task_group("mod_hash");
|
||||
|
||||
switch_thread_rwlock_wrlock(globals.limit_hash_rwlock);
|
||||
switch_thread_rwlock_wrlock(globals.db_hash_rwlock);
|
||||
|
||||
while ((hi = switch_hash_first(NULL, globals.limit_hash))) {
|
||||
void *val = NULL;
|
||||
const void *key;
|
||||
switch_ssize_t keylen;
|
||||
switch_hash_this(hi, &key, &keylen, &val);
|
||||
free(val);
|
||||
switch_core_hash_delete(globals.limit_hash, key);
|
||||
}
|
||||
|
||||
while ((hi = switch_hash_first(NULL, globals.db_hash))) {
|
||||
void *val = NULL;
|
||||
const void *key;
|
||||
switch_ssize_t keylen;
|
||||
switch_hash_this(hi, &key, &keylen, &val);
|
||||
free(val);
|
||||
switch_core_hash_delete(globals.db_hash, key);
|
||||
}
|
||||
|
||||
|
||||
switch_thread_rwlock_unlock(globals.limit_hash_rwlock);
|
||||
switch_thread_rwlock_unlock(globals.db_hash_rwlock);
|
||||
|
||||
switch_thread_rwlock_destroy(globals.db_hash_rwlock);
|
||||
switch_thread_rwlock_destroy(globals.limit_hash_rwlock);
|
||||
|
||||
|
||||
@@ -1311,11 +1311,11 @@ static switch_call_cause_t lcr_outgoing_channel(switch_core_session_t *session,
|
||||
if (lcr_do_lookup(&routes) == SWITCH_STATUS_SUCCESS) {
|
||||
if (channel) {
|
||||
if (zstr(switch_channel_get_variable(channel, "import"))) {
|
||||
switch_channel_set_variable(channel, "import", "lcr_carrier,lcr_rate");
|
||||
switch_channel_set_variable(channel, "import", "lcr_carrier,lcr_rate,lcr_user_rate");
|
||||
} else {
|
||||
const char *tmp = switch_channel_get_variable(channel, "import");
|
||||
if (!strstr(tmp, "lcr_carrier,lcr_rate")) {
|
||||
switch_channel_set_variable_printf(channel, "import", "%s,lcr_carrier,lcr_rate", tmp);
|
||||
if (!strstr(tmp, "lcr_carrier,lcr_rate,lcr_user_rate")) {
|
||||
switch_channel_set_variable_printf(channel, "import", "%s,lcr_carrier,lcr_rate,lcr_user_rate", tmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1440,11 +1440,11 @@ SWITCH_STANDARD_DIALPLAN(lcr_dialplan_hunt)
|
||||
switch_channel_set_variable(channel, SWITCH_CONTINUE_ON_FAILURE_VARIABLE, "true");
|
||||
switch_channel_set_variable(channel, SWITCH_HANGUP_AFTER_BRIDGE_VARIABLE, "true");
|
||||
if (zstr(switch_channel_get_variable(channel, "import"))) {
|
||||
switch_channel_set_variable(channel, "import", "lcr_carrier,lcr_rate");
|
||||
switch_channel_set_variable(channel, "import", "lcr_carrier,lcr_rate,lcr_user_rate");
|
||||
} else {
|
||||
const char *tmp = switch_channel_get_variable(channel, "import");
|
||||
if (!strstr(tmp, "lcr_carrier,lcr_rate")) {
|
||||
switch_channel_set_variable_printf(channel, "import", "%s,lcr_carrier,lcr_rate", tmp);
|
||||
if (!strstr(tmp, "lcr_carrier,lcr_rate,lcr_user_rate")) {
|
||||
switch_channel_set_variable_printf(channel, "import", "%s,lcr_carrier,lcr_rate,lcr_user_rate", tmp);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1589,11 +1589,11 @@ SWITCH_STANDARD_APP(lcr_app_function)
|
||||
switch_channel_set_variable(channel, "lcr_route_count", vbuf);
|
||||
switch_channel_set_variable(channel, "lcr_auto_route", (char *)dig_stream.data);
|
||||
if (zstr(switch_channel_get_variable(channel, "import"))) {
|
||||
switch_channel_set_variable(channel, "import", "lcr_carrier,lcr_rate");
|
||||
switch_channel_set_variable(channel, "import", "lcr_carrier,lcr_rate,lcr_user_rate");
|
||||
} else {
|
||||
const char *tmp = switch_channel_get_variable(channel, "import");
|
||||
if (!strstr(tmp, "lcr_carrier,lcr_rate")) {
|
||||
switch_channel_set_variable_printf(channel, "import", "%s,lcr_carrier,lcr_rate", tmp);
|
||||
if (!strstr(tmp, "lcr_carrier,lcr_rate,lcr_user_rate")) {
|
||||
switch_channel_set_variable_printf(channel, "import", "%s,lcr_carrier,lcr_rate,lcr_user_rate", tmp);
|
||||
}
|
||||
}
|
||||
free(dig_stream.data);
|
||||
|
||||
@@ -684,6 +684,12 @@ void sofia_event_callback(nua_event_t event,
|
||||
int locked = 0;
|
||||
int check_destroy = 1;
|
||||
|
||||
|
||||
if (!sofia_test_pflag(profile, PFLAG_RUNNING)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Profile is shutting down.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* sofia_private will be == &mod_sofia_globals.keep_private whenever a request is done with a new handle that has to be
|
||||
freed whenever the request is done */
|
||||
if (nh && sofia_private == &mod_sofia_globals.keep_private) {
|
||||
|
||||
@@ -1823,7 +1823,7 @@ static JSBool session_set_variable(JSContext * cx, JSObject * obj, uintN argc, j
|
||||
|
||||
var = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
|
||||
val = JS_GetStringBytes(JS_ValueToString(cx, argv[1]));
|
||||
switch_channel_set_variable(channel, var, val);
|
||||
switch_channel_set_variable_var_check(channel, var, val, SWITCH_FALSE);
|
||||
*rval = BOOLEAN_TO_JSVAL(JS_TRUE);
|
||||
} else {
|
||||
*rval = BOOLEAN_TO_JSVAL(JS_FALSE);
|
||||
|
||||
Reference in New Issue
Block a user