Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5998101
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T00:21:27+00:00 2026-05-23T00:21:27+00:00

We have a VOIP server that stores wav files for call recordings. My intention

  • 0

We have a VOIP server that stores wav files for call recordings. My intention was to put together a PHP file, where i can pass the calldate and uniqueid value in the URL for the file (since the server stores these as part of the filename) to retrieve a link to the file.

However, i get the following error when trying to do so:

“Parse error: syntax error, unexpected $end in /var/www/html/maint/helloworld.php on line 42”

<?php 

function getRecordingLink($callDate, $uniqueId){

$callDate_arr = explode(' ', $callDate);

$removeChar = array('-',':');
foreach($callDate_arr as $value){
    $callDate_arr_adj[] = str_replace($removeChar,'',$value);
}

$audioDirectory_array = array();
if ($handle = opendir('/var/spool/asterisk/monitor/')) {
    while (false != ($file = readdir($handle))) { 
        if ($file != "." && $file != "..") { 
            $audioDirectory_array[] = $file; 
        } 
    }
    closedir($handle); 
}

foreach($audioDirectory_array as $key => $value){

    if (preg_match ("/".$uniqueId."/i", $value)) {
        if(file_exists('/var/spool/asterisk/monitor/'.$value)){
            $wavFile = $value;
            //return '<a href="/maint/modules/cdrreport/monitor/'.$wavFile.'" target="_blank">Recorded File</a>';
            return '/maint/cache/monitor/' . $wavFile;
        }
    }else{
        //return "Not Recorded";
    }

getRecordingLink ('20110513','1305274000.2'); //sample calldate and uniqueid values for testing

?>

Here is the description of the MySQL table from where i will be picking up values to pass to this URL for calldate and uniqueid`

    mysql> describe cdr
    -> ;
+-------------+--------------+------+-----+---------------------+-------+
| Field       | Type         | Null | Key | Default             | Extra |
+-------------+--------------+------+-----+---------------------+-------+
| calldate    | datetime     | NO   |     | 0000-00-00 00:00:00 |       |
| clid        | varchar(80)  | NO   |     |                     |       |
| src         | varchar(80)  | NO   |     |                     |       |
| dst         | varchar(80)  | NO   |     |                     |       |
| dcontext    | varchar(80)  | NO   |     |                     |       |
| channel     | varchar(80)  | NO   |     |                     |       |
| dstchannel  | varchar(80)  | NO   |     |                     |       |
| lastapp     | varchar(80)  | NO   |     |                     |       |
| lastdata    | varchar(80)  | NO   |     |                     |       |
| duration    | int(11)      | NO   |     | 0                   |       |
| billsec     | int(11)      | NO   |     | 0                   |       |
| disposition | varchar(45)  | NO   |     |                     |       |
| amaflags    | int(11)      | NO   |     | 0                   |       |
| accountcode | varchar(20)  | NO   |     |                     |       |
| uniqueid    | varchar(32)  | NO   |     |                     |       |
| userfield   | varchar(255) | NO   |     |                     |       |
+-------------+--------------+------+-----+---------------------+-------+
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T00:21:28+00:00Added an answer on May 23, 2026 at 12:21 am

    Right, just had another good hard look at this :-p

    You are missing two curly braces from the bottom of the file above getRecordingLink():

    function getRecordingLink($callDate, $uniqueId){
    
        $callDate_arr = explode(' ', $callDate);
    
        $removeChar = array('-',':');
        foreach($callDate_arr as $value){
            $callDate_arr_adj[] = str_replace($removeChar,'',$value);
        }
    
        $audioDirectory_array = array();
        if ($handle = opendir('/var/spool/asterisk/monitor/')) {
            while (false != ($file = readdir($handle))) { 
                if ($file != "." && $file != "..") { 
                    $audioDirectory_array[] = $file; 
                } 
            }
            closedir($handle); 
        }
    
        foreach($audioDirectory_array as $key => $value){
            if (preg_match ("/".$uniqueId."/i", $value)) {
                if(file_exists('/var/spool/asterisk/monitor/'.$value)){
                    $wavFile = $value;
                    //return '<a href="/maint/modules/cdrreport/monitor/'.$wavFile.'" target="_blank">Recorded File</a>';
                    return '/maint/cache/monitor/' . $wavFile;
                }
            }else{
                //return "Not Recorded";
            }
        }
    }
    getRecordingLink ('20110513','1305274000.2'); 
    

    The error I got from here was:

    Parse error: syntax error, unexpected $end in /homepages/26/d94605010/htdocs/lz/writecodeonline.com/php/index.php(98): eval()’d code on line 32

    The file parses for me now, but I can’t test what it actually does. If this doesn’t work, please follow my advice in the comments.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have a Service in Android that is a sample VOIP client so
Have a SomeLib.pro file that contains: CONFIG += debug TEMPLATE = lib TARGET =
I have already created my own VOIP server and client using pure sockets. All
I'm having some confusion if a VOIP App can have multiple tcp sockets monitored
I would like to know how I can have VoIP on a godaddy Linux
I have to make an application that make pc-phone and pc - pc call
I have a voip app that has a serious performance issues when it runs
Im trying to create a Speex Voip client and server. I have the basics
I have an iPhone VOIP app that copes with multi-multi transmit and receive (ie
I have a VOIP Based app which needs to be run 24/7..But System is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.