{"id":3793,"date":"2023-10-25T09:07:48","date_gmt":"2023-10-25T13:07:48","guid":{"rendered":"https:\/\/dialer.one\/?p=3793"},"modified":"2024-12-05T18:37:33","modified_gmt":"2024-12-05T23:37:33","slug":"how-to-create-a-simple-cdr-report-for-vicidial","status":"publish","type":"post","link":"https:\/\/dialer.one\/index.php\/how-to-create-a-simple-cdr-report-for-vicidial\/","title":{"rendered":"How to &#8211; Create a simple CDR report for ViciDial"},"content":{"rendered":"\n<h1 class=\"wp-block-heading\">How to &#8211; Create a simple CDR report for ViciDial<\/h1>\n\n\n\n<p>This article will go over how to create a simple CDR report for ViciDial using MySQL and PHP. I will provide the code I&#8217;ve used to accomplish this report which can be altered to fit your needs. First off, I have to thank Nik from <a href=\"http:\/\/www.amdy.io\" target=\"_blank\" rel=\"noreferrer noopener\">www.amdy.io<\/a> for helping me with the MySQL query for it. Check out his site and his amazing AMD(Answering Machine Detection) service they offer for ViciDial and other dialer systems. Ok so lets get started.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 1 &#8211; Create the directory on your web server<\/h2>\n\n\n\n<p>First move into your web directory by the following commands for both RedHat(CentOS, Alma or Rocky) and OpenSuSE(Leap) distros.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">RedHat:<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>cd \/var\/www\/html\nmkdir reports\ncd reports<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">OpenSuSE:<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>cd \/srv\/www\/htdocs\nmkdir reports\ncd reports<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Step 2 &#8211; Copy the code below and create the PHP file to serve it up<\/h2>\n\n\n\n<p>Now just copy and paste the code below into a .php file to use with ViciDial after typing the following command: nano cdr-report.php<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><mark style=\"background-color:#abb8c3\" class=\"has-inline-color has-black-color\">&lt;?php\n\n$servername = \"localhost\";\n$username = \"cron\";\n$password = \"1234\";\n$dbname = \"asterisk\";\n\n\/\/ Create connection\n$conn = new mysqli($servername, $username, $password, $dbname);\n\/\/ Check connection\nif ($conn->connect_error) {\n  die(\"Connection failed: \" . $conn->connect_error);\n}\n\n$sql = \"SELECT vc.`lead_id`, `campaign_id`, va.`user`, `phone_number`, `first_name`, `last_name`, `outbound_cid`, vd.`call_date`, `dial_time`, va.`status` FROM vicidial_carrier_log vc,  vicidial_agent_log va, vicidial_list vl, vicidial_dial_log vd WHERE vc.`lead_id`= vl.`lead_id` AND va.uniqueid = vc.uniqueid AND vl.lead_id = vd.lead_id and va.`status` NOT LIKE 'NEW'  and vc.caller_code = vd.caller_code;\";\n$result = $conn->query($sql);\n\nif ($result->num_rows > 0) {\n  \/\/ output data of each row\n  while($row = $result->fetch_assoc()) {\n    echo \"&lt;b>&lt;font color=red>Lead ID:&lt;\/b>&lt;\/font> \" . $row&#91;\"lead_id\"]. \" -|- &lt;b>&lt;font color=red>Campaign:&lt;\/font>&lt;\/b> \" . $row&#91;\"campaign_id\"]. \" -|- &lt;font color=red>&lt;b>Agent:&lt;\/b>&lt;\/font> \" . $row&#91;\"user\"]. \" -|- &lt;b>&lt;font color=red>Customer Number:&lt;\/b>&lt;\/font> \" . $row&#91;\"phone_number\"]. \" -|- &lt;b>&lt;font color=red>First Name:&lt;\/b>&lt;\/font> \" . $row&#91;\"first_name\"]. \" -|- &lt;b>&lt;font color=red>Last Name:&lt;\/b>&lt;\/font> \" . $row&#91;\"last_name\"]. \" -|- &lt;b>&lt;font color=red>Outbound Caller ID:&lt;\/b>&lt;\/font> \" . $row&#91;\"outbound_cid\"]. \" -|- &lt;b>&lt;font color=red>Dial Time:&lt;\/b>&lt;\/font> \" . $row&#91;\"dial_time\"]. \" -|- &lt;b>&lt;font color=red>Dispo:&lt;\/b>&lt;\/font> \" . $row&#91;\"status\"]. \" -|- &lt;b>&lt;font color=red>Call Date:&lt;\/b>&lt;\/font> \" . $row&#91;\"call_date\"]. \"&lt;br>\";\n  }\n} else {\n  echo \"0 results\";\n}\n$conn->close();\n?>\n<\/mark><\/code><\/pre>\n\n\n\n<p>After you save and exit, you should be able to access this page by going to https:\/\/yourserver.com\/reports\/cdr-report.php and you should see something like the image below:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"152\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" src=\"https:\/\/dialer.one\/wp-content\/uploads\/2023\/10\/image-8-1024x152.png\" alt=\"CDR Report\" class=\"wp-image-3794\" title=\"\" srcset=\"https:\/\/dialer.one\/wp-content\/uploads\/2023\/10\/image-8-1024x152.png 1024w, https:\/\/dialer.one\/wp-content\/uploads\/2023\/10\/image-8-300x45.png 300w, https:\/\/dialer.one\/wp-content\/uploads\/2023\/10\/image-8-768x114.png 768w, https:\/\/dialer.one\/wp-content\/uploads\/2023\/10\/image-8-1536x228.png 1536w, https:\/\/dialer.one\/wp-content\/uploads\/2023\/10\/image-8-600x89.png 600w, https:\/\/dialer.one\/wp-content\/uploads\/2023\/10\/image-8.png 1771w\" \/><\/figure>\n<\/div>\n\n\n<h2 class=\"wp-block-heading\">Step 3 &#8211; Add this report into ViciDial through custom reports<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Login to your admin panel and go to the reports page<\/li>\n\n\n\n<li>Click on Admin Utilities as shown below<\/li>\n<\/ul>\n\n\n<div class=\"wp-block-image is-style-default\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"909\" height=\"829\" sizes=\"auto, (max-width: 909px) 100vw, 909px\" src=\"https:\/\/dialer.one\/wp-content\/uploads\/2023\/10\/image-9.png\" alt=\"ViciDial Admin Utilities\" class=\"wp-image-3795\" style=\"aspect-ratio:1.0965018094089265;width:684px;height:auto\" title=\"\" srcset=\"https:\/\/dialer.one\/wp-content\/uploads\/2023\/10\/image-9.png 909w, https:\/\/dialer.one\/wp-content\/uploads\/2023\/10\/image-9-300x274.png 300w, https:\/\/dialer.one\/wp-content\/uploads\/2023\/10\/image-9-768x700.png 768w, https:\/\/dialer.one\/wp-content\/uploads\/2023\/10\/image-9-600x547.png 600w\" \/><\/figure>\n<\/div>\n\n\n<ul class=\"wp-block-list\">\n<li>Click on &#8220;Custom Reports Admin Page&#8221;<\/li>\n<\/ul>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"655\" height=\"273\" sizes=\"auto, (max-width: 655px) 100vw, 655px\" src=\"https:\/\/dialer.one\/wp-content\/uploads\/2023\/10\/image-10.png\" alt=\"Custom Reports Admin Page\" class=\"wp-image-3796\" title=\"\" srcset=\"https:\/\/dialer.one\/wp-content\/uploads\/2023\/10\/image-10.png 655w, https:\/\/dialer.one\/wp-content\/uploads\/2023\/10\/image-10-300x125.png 300w, https:\/\/dialer.one\/wp-content\/uploads\/2023\/10\/image-10-600x250.png 600w\" \/><\/figure>\n<\/div>\n\n\n<ul class=\"wp-block-list\">\n<li>Fill out the first line with &#8220;CDR Report&#8221;<\/li>\n\n\n\n<li>Fill out the third line with &#8220;..\/reports\/cdr-report.php<\/li>\n<\/ul>\n\n\n<div class=\"wp-block-image is-style-rounded\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1008\" height=\"398\" sizes=\"auto, (max-width: 1008px) 100vw, 1008px\" src=\"https:\/\/dialer.one\/wp-content\/uploads\/2023\/10\/image-11.png\" alt=\"Create Custom Report\" class=\"wp-image-3797\" title=\"\" srcset=\"https:\/\/dialer.one\/wp-content\/uploads\/2023\/10\/image-11.png 1008w, https:\/\/dialer.one\/wp-content\/uploads\/2023\/10\/image-11-300x118.png 300w, https:\/\/dialer.one\/wp-content\/uploads\/2023\/10\/image-11-768x303.png 768w, https:\/\/dialer.one\/wp-content\/uploads\/2023\/10\/image-11-600x237.png 600w\" \/><\/figure>\n<\/div>\n\n\n<h2 class=\"wp-block-heading\">Step 4 &#8211; Update User Group Permissions<\/h2>\n\n\n\n<p>Now you need to make sure the User Groups that you want to have access to this new report have the proper permissions.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Click on User Groups and &#8220;Show User Groups&#8221;<\/li>\n\n\n\n<li>Click on the User Group you want to have access to this report<\/li>\n\n\n\n<li>Scroll down to the &#8220;Allowed Cutom Reports&#8221; area and click on &#8220;All Reports&#8221; or specify the new report we just created only.<\/li>\n<\/ol>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"553\" height=\"333\" sizes=\"auto, (max-width: 553px) 100vw, 553px\" src=\"https:\/\/dialer.one\/wp-content\/uploads\/2023\/10\/image-12.png\" alt=\"Allowed Custom Reports\" class=\"wp-image-3798\" title=\"\" srcset=\"https:\/\/dialer.one\/wp-content\/uploads\/2023\/10\/image-12.png 553w, https:\/\/dialer.one\/wp-content\/uploads\/2023\/10\/image-12-300x181.png 300w\" \/><\/figure>\n<\/div>\n\n\n<h2 class=\"wp-block-heading\">Step 5 &#8211; Check the Reports page for your newly created Custom Report<\/h2>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"713\" height=\"695\" sizes=\"auto, (max-width: 713px) 100vw, 713px\" src=\"https:\/\/dialer.one\/wp-content\/uploads\/2023\/10\/image-13.png\" alt=\"CDR Report\" class=\"wp-image-3799\" title=\"\" srcset=\"https:\/\/dialer.one\/wp-content\/uploads\/2023\/10\/image-13.png 713w, https:\/\/dialer.one\/wp-content\/uploads\/2023\/10\/image-13-300x292.png 300w, https:\/\/dialer.one\/wp-content\/uploads\/2023\/10\/image-13-600x585.png 600w\" \/><\/figure>\n<\/div>\n\n\n<p>That&#8217;s it, You&#8217;ve now created a custom report to retrieve your CDR details. This article can be followed to create other custom reports as well, just modify the code as needed or create links to outside web pages or links to access through your reports page within ViciDial. I hope you will find this useful. Feel free to join our <a href=\"https:\/\/join.skype.com\/ujkQ7i5lV78O\" target=\"_blank\" rel=\"noreferrer noopener\">Skype Live Support<\/a> if you need assistance.<\/p>\n\n\n\n<p>-Chris aka carpenox<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How to &#8211; Create a simple CDR report for ViciDial This article will go over how to create a simple CDR report for ViciDial using MySQL and PHP. I will provide the code I&#8217;ve used to accomplish this report which can be altered to fit your needs. First off, I have to thank Nik from [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":3797,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"content-type":"","_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[96],"tags":[533,536],"class_list":["post-3793","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-vicidial","tag-howto","tag-vicidial"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/dialer.one\/wp-content\/uploads\/2023\/10\/image-11.png","jetpack-related-posts":[{"id":4110,"url":"https:\/\/dialer.one\/index.php\/how-to-fix-the-you-dont-have-permission-to-access-recordings-mp3-error-within-vicidial\/","url_meta":{"origin":3793,"position":0},"title":"How to &#8211; Fix the &#8220;You don&#8217;t have permission to access \/RECORDINGS\/MP3\/&#8221; error within ViciDial","author":"carpenox","date":"February 21, 2024","format":false,"excerpt":"How to - Fix the \"You don't have permission to access \/RECORDINGS\/MP3\/\" error within ViciDial A problem arises when people do a scratch install of ViciDial and you do not set the proper permissions for the directory that the recordings are stored. I will go over a couple of things\u2026","rel":"","context":"In &quot;Vicidial&quot;","block_context":{"text":"Vicidial","link":"https:\/\/dialer.one\/index.php\/category\/vicidial\/"},"img":{"alt_text":"Artificial intelligence","src":"https:\/\/i0.wp.com\/dialer.one\/wp-content\/uploads\/2023\/11\/OIG.HD2N4.jpeg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/dialer.one\/wp-content\/uploads\/2023\/11\/OIG.HD2N4.jpeg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/dialer.one\/wp-content\/uploads\/2023\/11\/OIG.HD2N4.jpeg?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/dialer.one\/wp-content\/uploads\/2023\/11\/OIG.HD2N4.jpeg?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":4086,"url":"https:\/\/dialer.one\/index.php\/how-to-setup-a-vicidial-cluster-with-scratch-installs\/","url_meta":{"origin":3793,"position":1},"title":"How to &#8211; Setup a ViciDial Cluster with scratch installs","author":"carpenox","date":"January 27, 2024","format":false,"excerpt":"How to - Setup a ViciDial Cluster with scratch installs This article is going to go over the steps I suggest to take in order to setup a ViciDial Cluster when using scratch install methods. I do things a little different when it comes to this to prepare for worst\u2026","rel":"","context":"In &quot;CyburDial&quot;","block_context":{"text":"CyburDial","link":"https:\/\/dialer.one\/index.php\/category\/cyburdial\/"},"img":{"alt_text":"Vicidial cluster","src":"https:\/\/i0.wp.com\/dialer.one\/wp-content\/uploads\/2023\/12\/image-2.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/dialer.one\/wp-content\/uploads\/2023\/12\/image-2.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/dialer.one\/wp-content\/uploads\/2023\/12\/image-2.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/dialer.one\/wp-content\/uploads\/2023\/12\/image-2.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":4511,"url":"https:\/\/dialer.one\/index.php\/custom-vicidial-reports-on-github\/","url_meta":{"origin":3793,"position":2},"title":"Custom VICIdial Reports on GitHub","author":"carpenox","date":"January 11, 2025","format":false,"excerpt":"Custom VICIdial Reports on GitHub Introducing My New GitHub Repository for Custom VICIdial Reports Hey there, fellow VICIdial enthusiasts! I am thrilled to announce the launch of my latest GitHub repository, dedicated to creating custom reports for VICIdial. As a long-time user and developer in the VICIdial community, I understand\u2026","rel":"","context":"In &quot;CyburDial&quot;","block_context":{"text":"CyburDial","link":"https:\/\/dialer.one\/index.php\/category\/cyburdial\/"},"img":{"alt_text":"Custom Reports","src":"https:\/\/i0.wp.com\/dialer.one\/wp-content\/uploads\/2025\/01\/image-png.webp?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/dialer.one\/wp-content\/uploads\/2025\/01\/image-png.webp?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/dialer.one\/wp-content\/uploads\/2025\/01\/image-png.webp?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":2378,"url":"https:\/\/dialer.one\/index.php\/table-of-contents\/","url_meta":{"origin":3793,"position":3},"title":"Table of Contents &#8211; Knowledge Base","author":"carpenox","date":"March 7, 2022","format":false,"excerpt":"Welcome to my blog, some of you may know me from the ViciDial forums, I am carpenox and I am here to share my knowledge with everyone, for free!","rel":"","context":"In &quot;Vicidial&quot;","block_context":{"text":"Vicidial","link":"https:\/\/dialer.one\/index.php\/category\/vicidial\/"},"img":{"alt_text":"CyburDial","src":"https:\/\/i0.wp.com\/dialer.one\/wp-content\/uploads\/2022\/02\/image.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/dialer.one\/wp-content\/uploads\/2022\/02\/image.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/dialer.one\/wp-content\/uploads\/2022\/02\/image.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/dialer.one\/wp-content\/uploads\/2022\/02\/image.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/dialer.one\/wp-content\/uploads\/2022\/02\/image.png?resize=1050%2C600&ssl=1 3x"},"classes":[]},{"id":1504,"url":"https:\/\/dialer.one\/index.php\/how-to-backup-and-restore-your-vicidial-cyburdial-server\/","url_meta":{"origin":3793,"position":4},"title":"How to &#8211; Backup and Restore your Vicidial server","author":"carpenox","date":"February 4, 2021","format":false,"excerpt":"How to - Backup and Restore your Vicidial server Why would you need to backup and restore your vicidial server? Suppose you need to\u00a0migrate or duplicate Vicidial data\u00a0(campaigns, leads, phones and so on) from one\u00a0Vicibox\u00a0server to another. In case two\u00a0Vicidial\u00a0boxes of the same versions the process will be simpler. In\u2026","rel":"","context":"Similar post","block_context":{"text":"Similar post","link":""},"img":{"alt_text":"Cyburity - vicidial hosting","src":"https:\/\/i0.wp.com\/dialer.one\/wp-content\/uploads\/2021\/02\/server1.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/dialer.one\/wp-content\/uploads\/2021\/02\/server1.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/dialer.one\/wp-content\/uploads\/2021\/02\/server1.jpg?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":5029,"url":"https:\/\/dialer.one\/index.php\/how-to-fix-unable-to-open-master-device-dev-dahdi-ctl-for-dahdi\/","url_meta":{"origin":3793,"position":5},"title":"How to &#8211; Fix: Unable to open master device &#8216;\/dev\/dahdi\/ctl&#8217; for Dahdi","author":"carpenox","date":"July 7, 2025","format":false,"excerpt":"How to - Fix: Unable to open master device '\/dev\/dahdi\/ctl' for Dahdi This happens after updating your operating system for redhat distro's such as Alma, Rocky or CentOS. Its an easy fix thats outlined below: Step 1 - Browse to proper directory cd \/usr\/src\/dahdi-linux-complete-3.4.0+3.4.0\/ Step 2 - Recompile Dahdi make\u2026","rel":"","context":"In &quot;Vicidial&quot;","block_context":{"text":"Vicidial","link":"https:\/\/dialer.one\/index.php\/category\/vicidial\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_likes_enabled":true,"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/dialer.one\/index.php\/wp-json\/wp\/v2\/posts\/3793","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dialer.one\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dialer.one\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dialer.one\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dialer.one\/index.php\/wp-json\/wp\/v2\/comments?post=3793"}],"version-history":[{"count":0,"href":"https:\/\/dialer.one\/index.php\/wp-json\/wp\/v2\/posts\/3793\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dialer.one\/index.php\/wp-json\/wp\/v2\/media\/3797"}],"wp:attachment":[{"href":"https:\/\/dialer.one\/index.php\/wp-json\/wp\/v2\/media?parent=3793"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dialer.one\/index.php\/wp-json\/wp\/v2\/categories?post=3793"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dialer.one\/index.php\/wp-json\/wp\/v2\/tags?post=3793"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}