select  
(case servicetype  
 when 'transit' then substring_index(siptranslatedrequesturi, '@'1)  
 else substring_index(callingstationid, '@'1)
 end ) as server_id,
concat('syd1''_2010_05_', radacctid) as unique_id,
acctstarttime as calldate,
substring_index(calledstationid, '@'1as did,
(case servicetype  
 when 'transit' then substring_index(callingstationid, '@'1)  
 else ''
 end ) as ani,
substring_index(calledstationid, '@'1as dialed_number,
destinationid as is_mobile,
acctsessiontime as duration,
acctsessiontime as billable_duration,
price as billed_amount,
price as customer_billed_amount,
acctterminatecause as disposition,
destinationid as country,
'symbio' as provider_type,
(case servicetype
 when 'outgoing' then 'outbound'
 else 'inbound'
 endas direction,
(case servicetype  
 when 'outbound' then destinationid  
 else ''
 endas international,
(case servicetype  
 when 'transit' then substring_index(calledstationid, '@'1)  
 else destinationid
 endas call_type
from radacct201005;
My tags:
 
Popular tags:
 
Powered by MojoMojo