mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-07-12 02:03:39 +00:00
FS-6413 stable-version
This commit is contained in:
parent
cbcd1fec96
commit
ffe0cf67ff
@ -5963,6 +5963,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load)
|
|||||||
switch_management_interface_t *management_interface;
|
switch_management_interface_t *management_interface;
|
||||||
switch_application_interface_t *app_interface;
|
switch_application_interface_t *app_interface;
|
||||||
struct in_addr in;
|
struct in_addr in;
|
||||||
|
struct tm tm = {0};
|
||||||
|
time_t now;
|
||||||
|
|
||||||
memset(&mod_sofia_globals, 0, sizeof(mod_sofia_globals));
|
memset(&mod_sofia_globals, 0, sizeof(mod_sofia_globals));
|
||||||
mod_sofia_globals.destroy_private.destroy_nh = 1;
|
mod_sofia_globals.destroy_private.destroy_nh = 1;
|
||||||
@ -5971,6 +5973,11 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load)
|
|||||||
mod_sofia_globals.pool = pool;
|
mod_sofia_globals.pool = pool;
|
||||||
switch_mutex_init(&mod_sofia_globals.mutex, SWITCH_MUTEX_NESTED, mod_sofia_globals.pool);
|
switch_mutex_init(&mod_sofia_globals.mutex, SWITCH_MUTEX_NESTED, mod_sofia_globals.pool);
|
||||||
|
|
||||||
|
now = switch_epoch_time_now(NULL);
|
||||||
|
tm = *(localtime(&now));
|
||||||
|
|
||||||
|
mod_sofia_globals.presence_epoch = now - (tm.tm_yday * 86400);
|
||||||
|
|
||||||
switch_find_local_ip(mod_sofia_globals.guess_ip, sizeof(mod_sofia_globals.guess_ip), &mod_sofia_globals.guess_mask, AF_INET);
|
switch_find_local_ip(mod_sofia_globals.guess_ip, sizeof(mod_sofia_globals.guess_ip), &mod_sofia_globals.guess_mask, AF_INET);
|
||||||
in.s_addr = mod_sofia_globals.guess_mask;
|
in.s_addr = mod_sofia_globals.guess_mask;
|
||||||
switch_set_string(mod_sofia_globals.guess_mask_str, inet_ntoa(in));
|
switch_set_string(mod_sofia_globals.guess_mask_str, inet_ntoa(in));
|
||||||
|
@ -400,6 +400,7 @@ struct mod_sofia_globals {
|
|||||||
int presence_flush;
|
int presence_flush;
|
||||||
switch_thread_t *presence_thread;
|
switch_thread_t *presence_thread;
|
||||||
uint32_t max_reg_threads;
|
uint32_t max_reg_threads;
|
||||||
|
time_t presence_epoch;
|
||||||
};
|
};
|
||||||
extern struct mod_sofia_globals mod_sofia_globals;
|
extern struct mod_sofia_globals mod_sofia_globals;
|
||||||
|
|
||||||
@ -705,7 +706,7 @@ struct sofia_profile {
|
|||||||
int watchdog_enabled;
|
int watchdog_enabled;
|
||||||
switch_mutex_t *gw_mutex;
|
switch_mutex_t *gw_mutex;
|
||||||
uint32_t queued_events;
|
uint32_t queued_events;
|
||||||
uint32_t cseq_base;
|
uint32_t last_cseq;
|
||||||
int tls_only;
|
int tls_only;
|
||||||
int tls_verify_date;
|
int tls_verify_date;
|
||||||
enum tport_tls_verify_policy tls_verify_policy;
|
enum tport_tls_verify_policy tls_verify_policy;
|
||||||
|
@ -2097,6 +2097,28 @@ static int sofia_dialog_probe_callback(void *pArg, int argc, char **argv, char *
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static uint32_t sofia_presence_get_cseq(sofia_profile_t *profile)
|
||||||
|
{
|
||||||
|
uint32_t callsequence;
|
||||||
|
uint32_t now = (uint32_t) switch_epoch_time_now(NULL);
|
||||||
|
|
||||||
|
switch_mutex_lock(profile->ireg_mutex);
|
||||||
|
|
||||||
|
callsequence = (now - mod_sofia_globals.presence_epoch) * 100;
|
||||||
|
|
||||||
|
if (profile->last_cseq && callsequence <= profile->last_cseq) {
|
||||||
|
callsequence = ++profile->last_cseq;
|
||||||
|
}
|
||||||
|
|
||||||
|
profile->last_cseq = callsequence;
|
||||||
|
|
||||||
|
switch_mutex_unlock(profile->ireg_mutex);
|
||||||
|
|
||||||
|
return callsequence;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#define send_presence_notify(_a,_b,_c,_d,_e,_f,_g,_h,_i,_j,_k,_l) \
|
#define send_presence_notify(_a,_b,_c,_d,_e,_f,_g,_h,_i,_j,_k,_l) \
|
||||||
_send_presence_notify(_a,_b,_c,_d,_e,_f,_g,_h,_i,_j,_k,_l,__FILE__, __SWITCH_FUNC__, __LINE__)
|
_send_presence_notify(_a,_b,_c,_d,_e,_f,_g,_h,_i,_j,_k,_l,__FILE__, __SWITCH_FUNC__, __LINE__)
|
||||||
|
|
||||||
@ -2268,13 +2290,7 @@ static void _send_presence_notify(sofia_profile_t *profile,
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
callsequence = sofia_presence_get_cseq(profile);
|
||||||
switch_mutex_lock(profile->ireg_mutex);
|
|
||||||
if (!profile->cseq_base) {
|
|
||||||
profile->cseq_base = (now - 1312693200) * 10;
|
|
||||||
}
|
|
||||||
callsequence = ++profile->cseq_base;
|
|
||||||
switch_mutex_unlock(profile->ireg_mutex);
|
|
||||||
|
|
||||||
if (cparams) {
|
if (cparams) {
|
||||||
send_contact = switch_mprintf("%s;%s", contact_str, cparams);
|
send_contact = switch_mprintf("%s;%s", contact_str, cparams);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user