Compare commits
5 Commits
bc1300a0d4
...
b65b0ca648
Author | SHA1 | Date |
---|---|---|
Érico Nogueira Rolim | b65b0ca648 | |
Andrey Volk | 5e82e4f305 | |
Andrey Volk | d895fdff60 | |
Érico Nogueira | ec0c59a798 | |
Érico Nogueira | aad8b0ecb4 |
|
@ -990,6 +990,8 @@ ESL_DECLARE(esl_status_t) esl_connect_timeout(esl_handle_t *handle, const char *
|
|||
}
|
||||
|
||||
memcpy(&handle->sockaddr, result->ai_addr, result->ai_addrlen);
|
||||
freeaddrinfo(result);
|
||||
|
||||
switch(handle->sockaddr.ss_family) {
|
||||
case AF_INET:
|
||||
sockaddr_in = (struct sockaddr_in*)&(handle->sockaddr);
|
||||
|
@ -1005,7 +1007,6 @@ ESL_DECLARE(esl_status_t) esl_connect_timeout(esl_handle_t *handle, const char *
|
|||
strncpy(handle->err, "Host resolves to unsupported address family", sizeof(handle->err));
|
||||
goto fail;
|
||||
}
|
||||
freeaddrinfo(result);
|
||||
|
||||
handle->sock = socket(handle->sockaddr.ss_family, SOCK_STREAM, IPPROTO_TCP);
|
||||
|
||||
|
|
|
@ -245,10 +245,6 @@ typedef intptr_t switch_ssize_t;
|
|||
#define SWITCH_INT64_T_FMT "lld"
|
||||
#define SWITCH_UINT64_T_FMT "llu"
|
||||
|
||||
#ifndef TIME_T_FMT
|
||||
#define TIME_T_FMT SWITCH_INT64_T_FMT
|
||||
#endif
|
||||
|
||||
#else
|
||||
#ifndef SWITCH_SSIZE_T_FMT
|
||||
#define SWITCH_SSIZE_T_FMT (sizeof (switch_ssize_t) == sizeof (long) ? "ld" : sizeof (switch_ssize_t) == sizeof (int) ? "d" : "lld")
|
||||
|
@ -266,25 +262,15 @@ typedef intptr_t switch_ssize_t;
|
|||
#define SWITCH_UINT64_T_FMT (sizeof (long) == 8 ? "lu" : "llu")
|
||||
#endif
|
||||
|
||||
#ifndef TIME_T_FMT
|
||||
#if defined(__FreeBSD__) && SIZEOF_VOIDP == 4
|
||||
#define TIME_T_FMT "d"
|
||||
#else
|
||||
#if __USE_TIME_BITS64
|
||||
#define TIME_T_FMT SWITCH_INT64_T_FMT
|
||||
#else
|
||||
#define TIME_T_FMT "ld"
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#if UINTPTR_MAX == 0xffffffffffffffff
|
||||
#define FS_64BIT 1
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#define TIME_T_FMT "lld"
|
||||
#define TIME_T_CAST(x) ((long long)(x))
|
||||
|
||||
#if defined(__sun__) && (defined(__x86_64) || defined(__arch64__))
|
||||
#define SWITCH_TIME_T_FMT SWITCH_SIZE_T_FMT
|
||||
#else
|
||||
|
|
|
@ -2742,7 +2742,7 @@ static switch_status_t write_meta_file(http_file_context_t *context, const char
|
|||
|
||||
switch_snprintf(write_data, sizeof(write_data),
|
||||
"%" TIME_T_FMT ":%s",
|
||||
switch_epoch_time_now(NULL) + ttl,
|
||||
TIME_T_CAST(switch_epoch_time_now(NULL) + ttl),
|
||||
data);
|
||||
|
||||
|
||||
|
|
|
@ -4197,7 +4197,8 @@ void sofia_presence_handle_sip_i_subscribe(int status,
|
|||
sql = switch_mprintf("insert into sip_dialogs (sip_from_user,sip_from_host,call_info,call_info_state,hostname,expires,rcd,profile_name) "
|
||||
"values ('%q','%q','%q','seized','%q',%"TIME_T_FMT",%ld,'%q')",
|
||||
to_user, to_host, switch_str_nil(p), mod_sofia_globals.hostname,
|
||||
switch_epoch_time_now(NULL) + exp_delta, (long)now, profile->name);
|
||||
TIME_T_CAST(switch_epoch_time_now(NULL) + exp_delta), (long)now,
|
||||
profile->name);
|
||||
|
||||
if (mod_sofia_globals.debug_sla > 1) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SEIZE SQL %s\n", sql);
|
||||
|
|
|
@ -4663,39 +4663,39 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_timestamps(switch_channel_t *
|
|||
|
||||
tt_created = (time_t) (caller_profile->times->created / 1000000);
|
||||
mtt_created = (time_t) (caller_profile->times->created / 1000);
|
||||
switch_snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, tt_created);
|
||||
switch_snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, TIME_T_CAST(tt_created));
|
||||
switch_channel_set_variable(channel, "start_epoch", tmp);
|
||||
switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->created);
|
||||
switch_channel_set_variable(channel, "start_uepoch", tmp);
|
||||
|
||||
tt_prof_created = (time_t) (caller_profile->times->profile_created / 1000000);
|
||||
switch_snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, tt_prof_created);
|
||||
switch_snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, TIME_T_CAST(tt_prof_created));
|
||||
switch_channel_set_variable(channel, "profile_start_epoch", tmp);
|
||||
switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->profile_created);
|
||||
switch_channel_set_variable(channel, "profile_start_uepoch", tmp);
|
||||
|
||||
tt_answered = (time_t) (caller_profile->times->answered / 1000000);
|
||||
mtt_answered = (time_t) (caller_profile->times->answered / 1000);
|
||||
switch_snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, tt_answered);
|
||||
switch_snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, TIME_T_CAST(tt_answered));
|
||||
switch_channel_set_variable(channel, "answer_epoch", tmp);
|
||||
switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->answered);
|
||||
switch_channel_set_variable(channel, "answer_uepoch", tmp);
|
||||
|
||||
tt_bridged = (time_t) (caller_profile->times->bridged / 1000000);
|
||||
mtt_bridged = (time_t) (caller_profile->times->bridged / 1000);
|
||||
switch_snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, tt_bridged);
|
||||
switch_snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, TIME_T_CAST(tt_bridged));
|
||||
switch_channel_set_variable(channel, "bridge_epoch", tmp);
|
||||
switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->bridged);
|
||||
switch_channel_set_variable(channel, "bridge_uepoch", tmp);
|
||||
|
||||
tt_last_hold = (time_t) (caller_profile->times->last_hold / 1000000);
|
||||
switch_snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, tt_last_hold);
|
||||
switch_snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, TIME_T_CAST(tt_last_hold));
|
||||
switch_channel_set_variable(channel, "last_hold_epoch", tmp);
|
||||
switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->last_hold);
|
||||
switch_channel_set_variable(channel, "last_hold_uepoch", tmp);
|
||||
|
||||
tt_hold_accum = (time_t) (caller_profile->times->hold_accum / 1000000);
|
||||
switch_snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, tt_hold_accum);
|
||||
switch_snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, TIME_T_CAST(tt_hold_accum));
|
||||
switch_channel_set_variable(channel, "hold_accum_seconds", tmp);
|
||||
switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->hold_accum);
|
||||
switch_channel_set_variable(channel, "hold_accum_usec", tmp);
|
||||
|
@ -4703,28 +4703,28 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_timestamps(switch_channel_t *
|
|||
switch_channel_set_variable(channel, "hold_accum_ms", tmp);
|
||||
|
||||
tt_resurrected = (time_t) (caller_profile->times->resurrected / 1000000);
|
||||
switch_snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, tt_resurrected);
|
||||
switch_snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, TIME_T_CAST(tt_resurrected));
|
||||
switch_channel_set_variable(channel, "resurrect_epoch", tmp);
|
||||
switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->resurrected);
|
||||
switch_channel_set_variable(channel, "resurrect_uepoch", tmp);
|
||||
|
||||
tt_progress = (time_t) (caller_profile->times->progress / 1000000);
|
||||
mtt_progress = (time_t) (caller_profile->times->progress / 1000);
|
||||
switch_snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, tt_progress);
|
||||
switch_snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, TIME_T_CAST(tt_progress));
|
||||
switch_channel_set_variable(channel, "progress_epoch", tmp);
|
||||
switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->progress);
|
||||
switch_channel_set_variable(channel, "progress_uepoch", tmp);
|
||||
|
||||
tt_progress_media = (time_t) (caller_profile->times->progress_media / 1000000);
|
||||
mtt_progress_media = (time_t) (caller_profile->times->progress_media / 1000);
|
||||
switch_snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, tt_progress_media);
|
||||
switch_snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, TIME_T_CAST(tt_progress_media));
|
||||
switch_channel_set_variable(channel, "progress_media_epoch", tmp);
|
||||
switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->progress_media);
|
||||
switch_channel_set_variable(channel, "progress_media_uepoch", tmp);
|
||||
|
||||
tt_hungup = (time_t) (caller_profile->times->hungup / 1000000);
|
||||
mtt_hungup = (time_t) (caller_profile->times->hungup / 1000);
|
||||
switch_snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, tt_hungup);
|
||||
switch_snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, TIME_T_CAST(tt_hungup));
|
||||
switch_channel_set_variable(channel, "end_epoch", tmp);
|
||||
switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->hungup);
|
||||
switch_channel_set_variable(channel, "end_uepoch", tmp);
|
||||
|
|
|
@ -3553,7 +3553,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_expire_registration(int force)
|
|||
if (force) {
|
||||
sql = switch_mprintf("delete from registrations where hostname='%q'", switch_core_get_switchname());
|
||||
} else {
|
||||
sql = switch_mprintf("delete from registrations where expires > 0 and expires <= %ld and hostname='%q'", now, switch_core_get_switchname());
|
||||
sql = switch_mprintf("delete from registrations where expires > 0 and expires <= %" TIME_T_FMT " and hostname='%q'", TIME_T_CAST(now), switch_core_get_switchname());
|
||||
}
|
||||
|
||||
switch_sql_queue_manager_push(sql_manager.qm, sql, 0, SWITCH_FALSE);
|
||||
|
|
|
@ -804,7 +804,7 @@ static uint8_t check_channel_status(originate_global_t *oglobals, uint32_t len,
|
|||
time_t elapsed = switch_epoch_time_now(NULL) - start;
|
||||
oglobals->originate_status[i].per_channel_progress_timelimit_sec = elapsed + extend_timeout;
|
||||
oglobals->originate_status[i].per_channel_timelimit_sec = elapsed + extend_timeout;
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "elapsed %" TIME_T_FMT ", timelimit extended to %u\n", elapsed, oglobals->originate_status[i].per_channel_timelimit_sec);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "elapsed %" TIME_T_FMT ", timelimit extended to %u\n", TIME_T_CAST(elapsed), oglobals->originate_status[i].per_channel_timelimit_sec);
|
||||
} else if (oglobals->cancel_timeout || cancel_timeout) {
|
||||
/* cancel timeout for this leg only */
|
||||
oglobals->originate_status[i].per_channel_progress_timelimit_sec = 0;
|
||||
|
|
Loading…
Reference in New Issue