mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-07-24 13:12:03 +00:00
FS-5106 fire an event when a sip client doesn't respond to option-ping
When all-reg-options-ping is enabled, this adds a new custom event to mod_sofia
(sofia::sip_user_state), which is fired when a client stops responding to such
ping packets (or when it is reachable again).
Add two needed new columns to the sip_registrations table:
- ping_status, which is "Reachable" or "Unreachable" depending on the client
status;
- ping_count, which tracks the number of ping responses received and is used
to provide some kind of hysteresis to avoid firing the event in case of
transitory network failures.
Then ping_count is checked against two threshold values, sip-user-ping-min
and sip-user-ping-max in a similar fashion as the ping-{max,min} options for
the gateways. These two values are configurable in the profile's xml
configuration file.
Also, if unregister-on-options-fail is enabled, the client is unregistered
based on the number of OPTIONS failure which is also checked against the
sip-user-ping-{min,max} values.
This commit is contained in:
@@ -84,6 +84,7 @@ typedef struct private_object private_object_t;
|
||||
#define MY_EVENT_UNREGISTER "sofia::unregister"
|
||||
#define MY_EVENT_EXPIRE "sofia::expire"
|
||||
#define MY_EVENT_GATEWAY_STATE "sofia::gateway_state"
|
||||
#define MY_EVENT_SIP_USER_STATE "sofia::sip_user_state"
|
||||
#define MY_EVENT_NOTIFY_REFER "sofia::notify_refer"
|
||||
#define MY_EVENT_REINVITE "sofia::reinvite"
|
||||
#define MY_EVENT_GATEWAY_ADD "sofia::gateway_add"
|
||||
@@ -426,6 +427,13 @@ typedef enum {
|
||||
SOFIA_GATEWAY_INVALID
|
||||
} sofia_gateway_status_t;
|
||||
|
||||
typedef enum {
|
||||
SOFIA_REG_REACHABLE,
|
||||
SOFIA_REG_UNREACHABLE,
|
||||
|
||||
SOFIA_REG_INVALID
|
||||
} sofia_sip_user_status_t;
|
||||
|
||||
typedef enum {
|
||||
SUB_STATE_UNSUBED,
|
||||
SUB_STATE_TRYING,
|
||||
@@ -603,6 +611,8 @@ struct sofia_profile {
|
||||
char *challenge_realm;
|
||||
char *pnp_prov_url;
|
||||
char *pnp_notify_profile;
|
||||
int sip_user_ping_max;
|
||||
int sip_user_ping_min;
|
||||
sofia_cid_type_t cid_type;
|
||||
switch_core_media_dtmf_t dtmf_type;
|
||||
int auto_restart;
|
||||
@@ -1124,6 +1134,9 @@ void sofia_profile_destroy(sofia_profile_t *profile);
|
||||
switch_status_t sip_dig_function(_In_opt_z_ const char *cmd, _In_opt_ switch_core_session_t *session, _In_ switch_stream_handle_t *stream);
|
||||
const char *sofia_gateway_status_name(sofia_gateway_status_t status);
|
||||
void sofia_reg_fire_custom_gateway_state_event(sofia_gateway_t *gateway, int status, const char *phrase);
|
||||
const char *sofia_sip_user_status_name(sofia_sip_user_status_t status);
|
||||
void sofia_reg_fire_custom_sip_user_state_event(sofia_profile_t *profile, const char *sip_user, const char *contact,
|
||||
const char* from_user, const char* from_host, const char *call_id, sofia_sip_user_status_t status, int options_res, const char *phrase);
|
||||
uint32_t sofia_reg_reg_count(sofia_profile_t *profile, const char *user, const char *host);
|
||||
char *sofia_media_get_multipart(switch_core_session_t *session, const char *prefix, const char *sdp, char **mp_type);
|
||||
int sofia_glue_tech_simplify(private_object_t *tech_pvt);
|
||||
|
||||
Reference in New Issue
Block a user