Voicemail Email Body Replaces link

I have created a custom page called vm_calls.php which shows the last 30 inbound + outbound calls to the number that has left the voicemail.

When I try to setup the URL within the voicemail body, the URL gets replaced by the UCP URL.

What am I doing wrong?

This is what I’m using

Note - I’ve tried the link with both http:// and https:// but same result

${VM_NAME},

There is a new voicemail in mailbox ${VM_MAILBOX}:

	From:	${VM_CALLERID}
	Length:	${VM_DUR} seconds
	Date:	${VM_DATE} (US - Central Time)

To view call history for this number - http://mypbxurl/vm_calls.php?numb=${VM_CIDNUM} do a Google search for the phone number - http://www.google.com/search?q=${VM_CIDNUM}

The voicemail is attached as an audio file with this email. 

Alternatively, you can dial *97 to access your voicemail by phone OR visit https://mypbxurl/ucp to check your voicemail with a web browser. 

Please keep your voicemail-box clean as there is a limit of a maximum of 100 messages that can be saved. New messages will not be saved if your mailbox is full. Old messages will be automatically removed after 180 days. 

You can record a personalized voicemail greeting by pressing 0 in the voicemail menu (accessed by dialing *97 from your extension)

This is what happens after I click submit + apply + refresh the page

${VM_NAME},

There is a new voicemail in mailbox ${VM_MAILBOX}:

	From:	${VM_CALLERID}
	Length:	${VM_DUR} seconds
	Date:	${VM_DATE} (US - Central Time)

To view call history for this number - https://https://mypbxurl:4443} do a Google search for the phone number - http://www.google.com/search?q=${VM_CIDNUM}

The voicemail is attached as an audio file with this email. 

Alternatively, you can dial *97 to access your voicemail by phone OR visit https://mypbxurl/ucp to check your voicemail with a web browser. 

Please keep your voicemail-box clean as there is a limit of a maximum of 100 messages that can be saved. New messages will not be saved if your mailbox is full. Old messages will be automatically removed after 180 days. 

You can record a personalized voicemail greeting by pressing 0 in the voicemail menu (accessed by dialing *97 from your extension)```

In case anyone needs the code for vm_calls.php for their own use it is below;

<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "asteriskcdrdb";

$VM_CALLERID = $_REQUEST["numb"];

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
} 
$message = "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
<html><head><meta http-equiv='Content-Type' content='text/html charset=UTF-8' /><title>Last 30 calls to/from $VM_CALLERID</title>
<link href='https://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css' rel='stylesheet'>
<script src='https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js'></script>
<script src='https://netdna.bootstrapcdn.com/bootstrap/3.0.0-wip/js/bootstrap.min.js'></script>
<script src='https://code.jquery.com/jquery-latest.js'></script>

<meta name='viewport' content='width=device-width, initial-scale=1.0'>
<!-- <link href='bootstrap/css/bootstrap-responsive.css' rel='stylesheet'> -->
</head><body><style>tr:nth-child(even) {    background-color: #ffffff;}
tr:nth-child(odd) {    background-color: #F2F3F4;}
table, tr, th, td {    border-collapse: collapse; 	line-height: 1.5em;     height: 3em; 	overflow: hidden;     white-space: nowrap;     text-overflow: ellipsis;}
tbody tr th {height: 32px;aline-height: 32px; text-align: center; color: #1c5d79; background: '#cbdfee'; background-repeat: repeat; border-left: solid 1px  #000000;border-right:solid 1px #000000;border-collapse: collapse;}</style>
<br><div style='font-size:200%;text-align:center;'>Displaying last 30 calls to/from $VM_CALLERID (maximum 30)</div> <br>
	<table width='99%' border='1' cellpadding='2' cellspacing='2' style='border-collapse: collapse;line-height: 1.5em;height: 3em;overflow: hidden;white-space: nowrap;text-overflow: ellipsis; '>
			<tr>
				<th>Call Date & Time</th>
				<th>Caller</th>
				<th>Destination</th>
				<th>Duration<br>(mm:ss) </th>
				<th>Disposition</th>
			</tr>
";
$sql = "select calldate,dst,billsec,disposition,accountcode,cnum,cnam from asteriskcdrdb.cdr where src like '%$VM_CALLERID' 
UNION 
select calldate,dst,billsec,disposition,accountcode,cnum,cnam from asteriskcdrdb.cdr where dst like '%$VM_CALLERID' 
order by calldate desc LIMIT 30;";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
  // output data of each row
  while($row = $result->fetch_assoc()) {
    $content = $content .''."<tr>
				<td align=center>" . $row["calldate"] . "</td>
				<td align=center>" . $row["cnam"] . " <i>(" . $row["cnum"]. ")    (" . $row["accountcode"]. ")</i></td>
				<td align=center>" . $row["dst"] . "</td>
				<td align=center>" . gmdate("i:s", $row["billsec"]) . "</td>
				<td align=center>" . $row["disposition"] . "</td>
			</tr>
	";
  }
$message =  $message .''. $content .''.'</table></body></html>';
echo $message;
} else {
  echo "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
<html><head><meta http-equiv='Content-Type' content='text/html charset=UTF-8' /></head><body>0 results</body></html>";
}
$conn->close();
?>
1 Like

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.