MODENDP-281

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16319 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Mathieu Rene 2010-01-15 15:18:07 +00:00
parent a86cce9149
commit 306c52ece5
1 changed files with 11 additions and 5 deletions

View File

@ -93,11 +93,17 @@ static void sofia_reg_kill_reg(sofia_gateway_t *gateway_ptr)
}
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 @@ void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now)
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 @@ void sofia_reg_handle_sip_r_register(int status,
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 @@ auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile,
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 @@ auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile,
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 {