Yuri Slobodyanyuk Blog on Information Security 2024年09月12日
Cisco CUCM CDR report - call duration and called numbers extraction script
index_new5.html
../../../zaker_core/zaker_tpl_static/wap/tpl_guoji1.html

 

本文介绍了使用AWK脚本从Cisco CDR报告中提取呼叫开始时间、通话时长和被叫号码等数据的技巧。脚本可以提取多个字段,并将数据以CSV格式输出,方便导入Excel进行分析。

👨‍💻 该脚本从CDR报告中提取了以下字段:呼叫开始时间(dateTimeOrigination)、主叫号码(callingPartyNumber)、被叫号码(finalCalledPartyNumber)和通话时长(duration)。

📊 脚本使用awk命令和-F参数指定分隔符,并利用BEGIN和print语句输出格式化的数据。

📑 脚本将提取的数据以CSV格式输出,方便导入到Microsoft Excel等工具进行进一步分析。

🚀 作者还提供了CDR报告中所有可用字段及其位置的完整列表,方便用户根据需要提取其他字段。

🤝 作者最后还分享了其他资源,包括Cisco CUCM、Cisco Unity Connection和IM&Presence的CLI命令,以及作者在LinkedIn、GitHub和博客上的其他内容。

Yesterday I had to extract some data from a CDR report for a client, namely call start time, its duration and the called number. And while I am sure Google has zillion scripts to be found, it was much faster to hack this one-liner in AWK .
The script extracts the following fields from the CDR report in this order:
dateTimeOrigination - for outgoing calls it is the time the device goes off hook
callingPartyNumber - initiator of the call
finalCalledPartyNumber - the reached/dialed number (after forwarding if any)
duration - duration of the call
The extracted data is placed in CSV format to be easily imported into Microsoft Excel.Enjoy. Any questions - feel free to ask.

 awk -F, 'BEGIN {OFS=","} {print strftime("%c",$5),$9,$31,$56}'  report_cdr 

Output:

Sun 04 May 2014 01:54:37 PM IDT,0555555555,2988,41Sun 04 May 2014 01:55:07 PM IDT,2908,0555555555,25

In case you want to extract some other fields from CDR , here is the full list of available values and their position. For explanation you can look here - Cisco Call Detail Records Field Descriptions

1 cdrRecordType2 globalCallID_callManagerId3 globalCallID_callId4 origLegCallIdentifier5 dateTimeOrigination6 origNodeId7 origSpan8 origIpAddr9 callingPartyNumber10 callingPartyUnicodeLoginUserID11 origCause_location12 origCause_value13 origPrecedenceLevel14 origMediaTransportAddress_IP15 origMediaTransportAddress_Port16 origMediaCap_payloadCapability17 origMediaCap_maxFramesPerPacket18 origMediaCap_g723BitRate19 origVideoCap_Codec20 origVideoCap_Bandwidth21 origVideoCap_Resolution22 origVideoTransportAddress_IP23 origVideoTransportAddress_Port24 origRSVPAudioStat25 origRSVPVideoStat26 destLegIdentifier27 destNodeId28 destSpan29 destIpAddr30 originalCalledPartyNumber31 finalCalledPartyNumber32 finalCalledPartyUnicodeLoginUserID33 destCause_location34 destCause_value35 destPrecedenceLevel36 destMediaTransportAddress_IP37 destMediaTransportAddress_Port38 destMediaCap_payloadCapability39 destMediaCap_maxFramesPerPacket40 destMediaCap_g723BitRate41 destVideoCap_Codec42 destVideoCap_Bandwidth43 destVideoCap_Resolution44 destVideoTransportAddress_IP45 destVideoTransportAddress_Port46 destRSVPAudioStat47 destRSVPVideoStat48 dateTimeConnect49 dateTimeDisconnect50 lastRedirectDn51 pkid52 originalCalledPartyNumberPartition53 callingPartyNumberPartition54 finalCalledPartyNumberPartition55 lastRedirectDnPartition56 duration57 origDeviceName58 destDeviceName59 origCallTerminationOnBehalfOf60 destCallTerminationOnBehalfOf61 origCalledPartyRedirectOnBehalfOf62 lastRedirectRedirectOnBehalfOf63 origCalledPartyRedirectReason64 lastRedirectRedirectReason65 destConversationId66 globalCallId_ClusterID67 joinOnBehalfOf68 comment69 authCodeDescription70 authorizationLevel71 clientMatterCode72 origDTMFMethod73 destDTMFMethod74 callSecuredStatus75 origConversationId76 origMediaCap_Bandwidth77 destMediaCap_Bandwidth78 authorizationCodeValue79 outpulsedCallingPartyNumber80 outpulsedCalledPartyNumber81 origIpv4v6Addr82 destIpv4v6Addr83 origVideoCap_Codec_Channel284 origVideoCap_Bandwidth_Channel285 origVideoCap_Resolution_Channel286 origVideoTransportAddress_IP_Channel287 origVideoTransportAddress_Port_Channel288 origVideoChannel_Role_Channel289 destVideoCap_Codec_Channel290 destVideoCap_Bandwidth_Channel291 destVideoCap_Resolution_Channel292 destVideoTransportAddress_IP_Channel293 destVideoTransportAddress_Port_Channel294 destVideoChannel_Role_Channel295 incomingProtocolID96 incomingProtocolCallRef97 outgoingProtocolID98 outgoingProtocolCallRef99 currentRoutingReason100 origRoutingReason101 lastRedirectingRoutingReason102 huntPilotDN103 huntPilotPartition104 calledPartyPatternUsage105 outpulsedOriginalCalledPartyNumber106 outpulsedLastRedirectingNumber107 wasCallQueued108 totalWaitTimeInQueue109 callingPartyNumber_uri110 originalCalledPartyNumber_uri111 finalCalledPartyNumber_uri112 lastRedirectDn_uri113 mobileCallingPartyNumber114 finalMobileCalledPartyNumber115 origMobileDeviceName116 destMobileDeviceName117 origMobileCallDuration118 destMobileCallDuration119 mobileCallType120 originalCalledPartyPattern121 finalCalledPartyPattern122 lastRedirectingPartyPattern123 huntPilotPattern

Additional Resources

Follow me on https://www.linkedin.com/in/yurislobodyanyuk/ not to miss what I publish on Linkedin, Github, blog, and more.

Fish AI Reader

Fish AI Reader

AI辅助创作,多种专业模板,深度分析,高质量内容生成。从观点提取到深度思考,FishAI为您提供全方位的创作支持。新版本引入自定义参数,让您的创作更加个性化和精准。

FishAI

FishAI

鱼阅,AI 时代的下一个智能信息助手,助你摆脱信息焦虑

联系邮箱 441953276@qq.com

相关标签

AWK CDR 数据提取 Cisco 脚本
相关文章