tweak ping behaviour
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8881 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
43b712b7b1
commit
eec83be1c9
|
@ -136,6 +136,16 @@ SWITCH_DECLARE(void) consoleCleanLog(char *msg);
|
|||
|
||||
};
|
||||
|
||||
class EventConsumer {
|
||||
protected:
|
||||
switch_event_types_t e_event_id;
|
||||
switch_event_node_t *node;
|
||||
char *e_callback;
|
||||
char *e_subclass_name;
|
||||
public:
|
||||
SWITCH_DECLARE_CONSTRUCTOR EventConsumer(switch_event_types_t event_id, const char *subclass_name = "", const char *callback = "event_consumer");
|
||||
SWITCH_DECLARE_CONSTRUCTOR ~ EventConsumer();
|
||||
};
|
||||
|
||||
class CoreSession {
|
||||
protected:
|
||||
|
|
|
@ -1532,7 +1532,7 @@ static void sofia_handle_sip_r_options(switch_core_session_t *session, int statu
|
|||
gateway->status = SOFIA_GATEWAY_DOWN;
|
||||
if (gateway->state == REG_STATE_REGED) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "unregister %s\n", gateway->name);
|
||||
gateway->state = REG_STATE_UNREGISTER;
|
||||
gateway->state = REG_STATE_FAILED;
|
||||
}
|
||||
}
|
||||
gateway->ping = switch_timestamp(NULL) + gateway->ping_freq;
|
||||
|
|
|
@ -112,7 +112,7 @@ void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now)
|
|||
break;
|
||||
case REG_STATE_UNREGED:
|
||||
gateway_ptr->status = SOFIA_GATEWAY_DOWN;
|
||||
sofia_reg_kill_reg(gateway_ptr, 1);
|
||||
sofia_reg_kill_reg(gateway_ptr, 0);
|
||||
|
||||
if ((gateway_ptr->nh = nua_handle(gateway_ptr->profile->nua, NULL,
|
||||
NUTAG_URL(gateway_ptr->register_proxy),
|
||||
|
|
|
@ -37,6 +37,40 @@
|
|||
#pragma warning(disable:4127 4003)
|
||||
#endif
|
||||
|
||||
static void event_handler(switch_event_t *event)
|
||||
{
|
||||
}
|
||||
|
||||
SWITCH_DECLARE_CONSTRUCTOR EventConsumer::EventConsumer(switch_event_types_t event_id, const char *subclass_name, const char *callback)
|
||||
{
|
||||
e_event_id = event_id;
|
||||
|
||||
if (!switch_strlen_zero(subclass_name)) {
|
||||
e_subclass_name = strdup(subclass_name);
|
||||
} else {
|
||||
e_subclass_name = "";
|
||||
}
|
||||
|
||||
if (switch_strlen_zero(callback)) {
|
||||
callback = "event_consumer";
|
||||
}
|
||||
|
||||
e_callback = strdup(callback);
|
||||
|
||||
|
||||
switch_event_bind_removable(__FILE__, e_event_id, subclass_name, event_handler, this, &node);
|
||||
}
|
||||
|
||||
|
||||
SWITCH_DECLARE_CONSTRUCTOR EventConsumer::~EventConsumer()
|
||||
{
|
||||
switch_safe_free(e_subclass_name);
|
||||
switch_safe_free(e_callback);
|
||||
|
||||
if (node) {
|
||||
switch_event_unbind(&node);
|
||||
}
|
||||
}
|
||||
|
||||
SWITCH_DECLARE_CONSTRUCTOR IVRMenu::IVRMenu(IVRMenu *main,
|
||||
const char *name,
|
||||
|
|
|
@ -541,15 +541,7 @@ SWITCH_DECLARE(switch_status_t) switch_event_create_subclass(switch_event_t **ev
|
|||
(*event)->event_id = event_id;
|
||||
|
||||
if (subclass_name) {
|
||||
switch_event_subclass_t *subclass;
|
||||
|
||||
if (!(subclass = switch_core_hash_find(CUSTOM_HASH, subclass_name))) {
|
||||
switch_event_reserve_subclass((char *) subclass_name);
|
||||
subclass = switch_core_hash_find(CUSTOM_HASH, subclass_name);
|
||||
}
|
||||
|
||||
(*event)->subclass_name = DUP(subclass_name);
|
||||
|
||||
switch_event_add_header_string(*event, SWITCH_STACK_BOTTOM, "Event-Subclass", subclass_name);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue