int ston = -1;
int cton = -1;
int wdon = -1;
+ int stbyon = -1;
if (argc > 1) {
if (!strcasecmp(argv[1], "debug")) {
}
}
+ if (!strcasecmp(argv[1], "standby")) {
+ if (argc > 2) {
+ stbyon = switch_true(argv[2]);
+ }
+ }
+
if (!strcasecmp(argv[1], "capture")) {
if (argc > 2) {
cton = switch_true(argv[2]);
sofia_glue_global_siptrace(ston);
stream->write_function(stream, "+OK Global siptrace %s", ston ? "on" : "off");
} else if (cton != -1) {
- sofia_glue_global_capture(cton);
- stream->write_function(stream, "+OK Global capture %s", cton ? "on" : "off");
+ sofia_glue_global_capture(cton);
+ stream->write_function(stream, "+OK Global capture %s", cton ? "on" : "off");
} else if (wdon != -1) {
sofia_glue_global_watchdog(wdon);
stream->write_function(stream, "+OK Global watchdog %s", wdon ? "on" : "off");
+ } else if (stbyon != -1) {
+ sofia_glue_global_standby(stbyon);
+ stream->write_function(stream, "+OK Global standby %s", stbyon ? "on" : "off");
} else {
stream->write_function(stream, "-ERR Usage: siptrace <on|off>|capture <on|off>|watchdog <on|off>|debug <sla|presence|none");
}
*new_session = NULL;
+ if (sofia_test_pflag(profile, PFLAG_STANDBY)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "System Paused\n");
+ goto error;
+ }
+
if (!outbound_profile || zstr(outbound_profile->destination_number)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Invalid Empty Destination\n");
goto error;
switch_console_set_complete("add sofia tracelevel ::[console:alert:crit:err:warning:notice:info:debug");
switch_console_set_complete("add sofia global siptrace ::[on:off");
+ switch_console_set_complete("add sofia global standby ::[on:off");
switch_console_set_complete("add sofia global capture ::[on:off");
switch_console_set_complete("add sofia global watchdog ::[on:off");
PFLAG_UUID_AS_CALLID,
PFLAG_SCROOGE,
PFLAG_MANAGE_SHARED_APPEARANCE,
- PFLAG_MANAGE_SHARED_APPEARANCE_SYLANTRO_DELETED_USE_ME,
+ PFLAG_STANDBY,
PFLAG_DISABLE_SRV,
PFLAG_DISABLE_SRV503,
PFLAG_DISABLE_NAPTR,
/* Function Prototypes */
/*************************************************************************************************************************************************************/
+void sofia_glue_global_standby(switch_bool_t on);
+
switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_flag_t myflags);
void sofia_glue_deactivate_rtp(private_object_t *tech_pvt);
int locked = 0;
int check_destroy = 1;
-
if (sofia_private && sofia_private->is_call && sofia_private->de) {
sofia_dispatch_event_t *qde = sofia_private->de;
sofia_private->de = NULL;
sofia_dispatch_event_t *de;
+ if (sofia_test_pflag(profile, PFLAG_STANDBY)) {
+ if (event < nua_r_set_params || event > nua_r_authenticate) {
+ nua_respond(nh, 503, "System Paused", TAG_END());
+ }
+ return;
+ }
+
+
switch_mutex_lock(profile->flag_mutex);
profile->queued_events++;
switch_mutex_unlock(profile->flag_mutex);
/* While we're running, or there is a pending sql statment that we haven't appended to sqlbuf yet, because of a lack of buffer space */
while ((mod_sofia_globals.running == 1 && sofia_test_pflag(profile, PFLAG_RUNNING)) || sql) {
+
+ if (sofia_test_pflag(profile, PFLAG_STANDBY)) {
+ switch_yield(1000000);
+ continue;
+ }
+
if (sofia_test_pflag(profile, PFLAG_SQL_IN_TRANS)) {
/* Do we have enough statements or is the timeout expired */
while (sql || (sofia_test_pflag(profile, PFLAG_RUNNING) && mod_sofia_globals.running == 1 &&
} else {
sofia_clear_pflag(profile, PFLAG_PRESENCE_MAP);
}
+ } else if (!strcasecmp(var, "profile-standby")) {
+ if (switch_true(val)) {
+ sofia_set_pflag(profile, PFLAG_STANDBY);
+ } else {
+ sofia_clear_pflag(profile, PFLAG_STANDBY);
+ }
} else if (!strcasecmp(var, "liberal-dtmf")) {
if (switch_true(val)) {
sofia_set_pflag(profile, PFLAG_LIBERAL_DTMF);
} else {
sofia_clear_pflag(profile, PFLAG_PRESENCE_MAP);
}
+ } else if (!strcasecmp(var, "profile-standby")) {
+ if (switch_true(val)) {
+ sofia_set_pflag(profile, PFLAG_STANDBY);
+ } else {
+ sofia_clear_pflag(profile, PFLAG_STANDBY);
+ }
} else if (!strcasecmp(var, "liberal-dtmf")) {
if (switch_true(val)) {
sofia_set_pflag(profile, PFLAG_LIBERAL_DTMF);
}
+void sofia_glue_global_standby(switch_bool_t on)
+{
+ switch_hash_index_t *hi;
+ const void *var;
+ void *val;
+ sofia_profile_t *pptr;
+
+ switch_mutex_lock(mod_sofia_globals.hash_mutex);
+ if (mod_sofia_globals.profile_hash) {
+ for (hi = switch_hash_first(NULL, mod_sofia_globals.profile_hash); hi; hi = switch_hash_next(hi)) {
+ switch_hash_this(hi, &var, NULL, &val);
+ if ((pptr = (sofia_profile_t *) val)) {
+ if (on) {
+ sofia_set_pflag_locked(pptr, PFLAG_STANDBY);
+ } else {
+ sofia_clear_pflag_locked(pptr, PFLAG_STANDBY);
+ }
+ }
+ }
+ }
+ switch_mutex_unlock(mod_sofia_globals.hash_mutex);
+
+}
+
void sofia_glue_global_capture(switch_bool_t on)
{
switch_hash_index_t *hi;
h.profile = profile;
h.total = 0;
+ sofia_clear_pflag_locked(profile, PFLAG_STANDBY);
+
if (flush) {
sql = switch_mprintf("delete from sip_recovery where profile_name='%q'", profile->name);
sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);