Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c (16318 => 16319)
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c 2010-01-15 04:05:17 UTC (rev 16318)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c 2010-01-15 15:18:07 UTC (rev 16319)
@@ -93,11 +93,17 @@
}
-static void sofia_reg_fire_custom_gateway_state_event(sofia_gateway_t *gateway) {
+static void sofia_reg_fire_custom_gateway_state_event(sofia_gateway_t *gateway, int status, const char *phrase) {
switch_event_t *s_event;
if (switch_event_create_subclass(&s_event, SWITCH_EVENT_CUSTOM, MY_EVENT_GATEWAY_STATE) == SWITCH_STATUS_SUCCESS) {
switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "Gateway", gateway->name);
switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "State", sofia_state_string(gateway->state));
+ if (!zstr(phrase)) {
+ switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "Phrase", phrase);
+ }
+ if (status) {
+ switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "Status", "%d", status);
+ }
switch_event_fire(&s_event);
}
}
@@ -398,7 +404,7 @@
break;
}
if (ostate != gateway_ptr->state) {
- sofia_reg_fire_custom_gateway_state_event(gateway_ptr);
+ sofia_reg_fire_custom_gateway_state_event(gateway_ptr, 0, NULL);
}
}
}
@@ -1477,7 +1483,7 @@
break;
}
if (ostate != sofia_private->gateway->state) {
- sofia_reg_fire_custom_gateway_state_event(sofia_private->gateway);
+ sofia_reg_fire_custom_gateway_state_event(sofia_private->gateway, status, phrase);
}
}
}
@@ -2169,7 +2175,7 @@
gateway_ptr->state = REG_STATE_UNREGISTER;
}
if (ostate != gateway_ptr->state) {
- sofia_reg_fire_custom_gateway_state_event(gateway_ptr);
+ sofia_reg_fire_custom_gateway_state_event(gateway_ptr, 0, NULL);
}
sofia_reg_release_gateway(gateway_ptr);
}
@@ -2195,7 +2201,7 @@
gateway_ptr->state = REG_STATE_UNREGISTER;
}
if (ostate != gateway_ptr->state) {
- sofia_reg_fire_custom_gateway_state_event(gateway_ptr);
+ sofia_reg_fire_custom_gateway_state_event(gateway_ptr, 0, NULL);
}
sofia_reg_release_gateway(gateway_ptr);
} else {