[Freeswitch-svn] [commit] r8881 - in freeswitch/trunk/src: . include mod/endpoints/mod_sofia
Freeswitch SVN
anthm at freeswitch.org
Wed Jul 2 13:18:35 EDT 2008
Author: anthm
Date: Wed Jul 2 13:18:34 2008
New Revision: 8881
Modified:
freeswitch/trunk/src/include/switch_cpp.h
freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c
freeswitch/trunk/src/switch_cpp.cpp
freeswitch/trunk/src/switch_event.c
Log:
tweak ping behaviour
Modified: freeswitch/trunk/src/include/switch_cpp.h
==============================================================================
--- freeswitch/trunk/src/include/switch_cpp.h (original)
+++ freeswitch/trunk/src/include/switch_cpp.h Wed Jul 2 13:18:34 2008
@@ -136,6 +136,16 @@
};
+ 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:
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c Wed Jul 2 13:18:34 2008
@@ -1532,7 +1532,7 @@
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;
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c Wed Jul 2 13:18:34 2008
@@ -112,7 +112,7 @@
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),
Modified: freeswitch/trunk/src/switch_cpp.cpp
==============================================================================
--- freeswitch/trunk/src/switch_cpp.cpp (original)
+++ freeswitch/trunk/src/switch_cpp.cpp Wed Jul 2 13:18:34 2008
@@ -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,
Modified: freeswitch/trunk/src/switch_event.c
==============================================================================
--- freeswitch/trunk/src/switch_event.c (original)
+++ freeswitch/trunk/src/switch_event.c Wed Jul 2 13:18:34 2008
@@ -541,15 +541,7 @@
(*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);
}
More information about the Freeswitch-svn
mailing list