mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-11-10 11:50:53 +00:00
add timezone support to mod_say_{de,es,ja,nl,th,zh}
This is nothing more than a shameless copy/paste from another mod_say module, which already had timezone support. It simply checks if the timezone variable is set and if it contains a valid timezone, then this timezone will be used when announcing times/dates. FS-7048 #resolve
This commit is contained in:
1 parent
b9c25eae2a
commit
a8c5a0c87b
6 files changed
+84
-6
No files matched your search
@@ -220,6 +220,8 @@ static switch_status_t es_say_time(switch_core_session_t *session, char *tosay,
|
||||
switch_time_t target = 0;
|
||||
switch_time_exp_t tm;
|
||||
uint8_t say_date = 0, say_time = 0;
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
const char *tz = switch_channel_get_variable(channel, "timezone");
|
||||
|
||||
if (say_args->type == SST_TIME_MEASUREMENT) {
|
||||
int64_t hours = 0;
|
||||
@@ -304,7 +306,18 @@ static switch_status_t es_say_time(switch_core_session_t *session, char *tosay,
|
||||
} else {
|
||||
target = switch_micro_time_now();
|
||||
}
|
||||
switch_time_exp_lt(&tm, target);
|
||||
|
||||
if (tz) {
|
||||
int check = atoi(tz);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Timezone is [%s]\n", tz);
|
||||
if (check) {
|
||||
switch_time_exp_tz(&tm, target, check);
|
||||
} else {
|
||||
switch_time_exp_tz_name(tz, &tm, target);
|
||||
}
|
||||
} else {
|
||||
switch_time_exp_lt(&tm, target);
|
||||
}
|
||||
|
||||
switch (say_args->type) {
|
||||
case SST_CURRENT_DATE_TIME:
|
||||
|
||||
Reference in new issue
Block a user