new fields for cdr exports:
TIMEZONE:
a. call to offnet destination: take source subscriber's inherited tz
b. offnet to local destination: take destination subscriber's inherited tz
c. onnet calls: take the *source* subscriber's inherited tz
(see cdr-exporter.pl -> source reseller folder will contain the
cdr only)
d. transit calls: take system timezone
INIT_TIME_LOCALIZED: init time with timezone applied
START_TIME: start time with timezone applied
END_TIME: end time with timezone applied
Change-Id: I29590fc1b6f37269294518cfece4b4e16f25c3e6
(SELECT data.[%- val_col -%] FROM accounting.[%- data_table -%] AS data INNER JOIN accounting.[%- dict_table -%] AS dict ON data.[%- dict_col -%] = dict.id WHERE data.event_id = accounting.events.id AND dict.type="[%- type -%]")
[%- END %]
[% MACRO cdr_timezone BLOCK -%]
[%
source_subscriber_timezone = "(SELECT COALESCE(tz.name,@@global.time_zone) FROM billing.v_subscriber_timezone tz WHERE tz.uuid = accounting.cdr.source_user_id)";
destination_subscriber_timezone = "(SELECT COALESCE(tz.name,@@global.time_zone) FROM billing.v_subscriber_timezone tz WHERE tz.uuid = accounting.cdr.destination_user_id)";
transit_timezone = "(SELECT COALESCE(t.name,@@global.time_zone) FROM ngcp.timezone t LIMIT 1)";
#X_cdr_id_map.PRIMARY_NUMBER = "(select username from provisioning.voip_dbaliases tmp where tmp.subscriber_id = provisioning.voip_subscribers.id order by is_primary, id limit 1)";