Email Voicemail URL

tknman0700

Joined
Oct 30, 2009
Messages
49
Likes
0
Points
0
#1
Is there a way to change the text of the content that is delivered in the email when Asterisk delivers a voicemail to an email box?

Right now it reads: http://AMPWEBADDRESS/recordings/index.php

1. Shouldnt AMPWEBADDRESS be replaced with an IP address?
2. I see this is configured through /etc/asterisk/vm_email.inc is there a way to change this in the UI that I am just missing?
3. How does this device handle how the email is delivered. Does it do an MX lookup or does it use smarthost by default?

Thank you for your assistance.
 

tknman0700

Joined
Oct 30, 2009
Messages
49
Likes
0
Points
0
#2

mismatrix

Joined
Aug 16, 2009
Messages
11
Likes
0
Points
0
#3
I'm having the same problem. I was able to do it on an older box but we just built a new box with Elastix 1-6.12 and it's still using the default text in the e-mail. I've tried modifying the vm_email.inc & voicemail.conf but no luck. Is this a bug maybe with the new version?
 

mismatrix

Joined
Aug 16, 2009
Messages
11
Likes
0
Points
0
#4
Got it fixed...forgot to restart
 

linuxmill

Joined
Dec 6, 2013
Messages
3
Likes
0
Points
0
#5
It doesn't seem like the .inc file should be manually edited. It somehow automatically gets the host IP address or hostname set from some process within elastix. (I know this because I set the machine's IP address and NEVER entered the address in this file.). So, if I manually edit it, it is likely to be later overwritten by the same process that created it in the first place.

I just burned up 4 hours hunting for the routine the creates this file and have not yet found it. The date of the file (today) tells me _something_ is touching it, but I cannot find out what.

A little help? :cry:
 

linuxmill

Joined
Dec 6, 2013
Messages
3
Likes
0
Points
0
#6
I just edited vm_email.inc via the "tools" interface in elastix. Saved it. Reloaded Asterisk. The file changed back magically to the original state. There is a master template somewhere. Anyone know where this file is sourced?

Thanks,

Jim
 

linuxmill

Joined
Dec 6, 2013
Messages
3
Likes
0
Points
0
#7
linuxmill said:
I just edited vm_email.inc via the "tools" interface in elastix. Saved it. Reloaded Asterisk. The file changed back magically to the original state. There is a master template somewhere. Anyone know where this file is sourced?

Thanks,

Jim
For others looking to do the same... the file is in /var/www/html/libs/misc.lib.php in the function verifyTemplate_vm_email().
It actively looks for the system's IP address and changes the vm_email.inc file to reflect the current IP address. If you want a different behaior, change the $ip var to place what you want. In my case, I used a URL.
 

Amphibian

Joined
Sep 8, 2009
Messages
1,128
Likes
2
Points
38
#8
linuxmill,

you stated "If you want a different behaior, change the $ip var to place what you want. In my case, I used a URL."

So me being old and out dated I have to ask, change what portion of the $ip ?

function verifyTemplate_vm_email()
{
$ip = $_SERVER['SERVER_ADDR']; (then one would change this to say something like $ip = "mydomain.com"; )
$login = "?login=\${VM_MAILBOX}";
$file = "/etc/asterisk/vm_email.inc";
//http://AMPWEBADDRESS/recordings/index.php?login=${VM_MAILBOX}
$file_string = file_get_contents($file);
if($file_string){
$file_string_new = str_replace("*98","*97", $file_string);
 

Amphibian

Joined
Sep 8, 2009
Messages
1,128
Likes
2
Points
38
#9
How it's done for those looking on how to get the correct "URL" displayed within the email notification:

1: Edit the following file with your fav text editor, (as linuxmill stated prior), or you can goto the file found under PBX-Tools-Asterisk File Editor within your PBX:

/var/www/html/libs/misc.lib.php (misc.lib.php is the file to change)

Look around line number 587 and you will see the following code:

function verifyTemplate_vm_email()
{
$ip = $_SERVER['SERVER_ADDR'];
$login = "?login=\${VM_MAILBOX}";
$file = "/etc/asterisk/vm_email.inc";
//http://AMPWEBADDRESS/recordings/index.php?login=${VM_MAILBOX}
$file_string = file_get_contents($file);
if($file_string){
$file_string_new = str_replace("*98","*97", $file_string);

Change only the following line $ip = $_SERVER['SERVER_ADDR'] to your required IP Address or proper URL. Should look like the following:

$ip = $_SERVER['myserver.dyndns.org']; or $ip = $_SERVER['mypbx.com'];

Then hit save, then goto /etc/asterisk/vm_email.inc (vm_email.inc is the file you want to modify)

Look around line five (5) and see the following:

emailbody=${VM_NAME},\n\nThere is a new voicemail in mailbox ${VM_MAILBOX}:\n\n\tFrom:\t${VM_CALLERID}\n\tLength:\t${VM_DUR} seconds\n\tDate:\t${VM_DATE}\n\nDial *97 to access your voicemail from your registered assigned extension phone, or,\nVisit https://mypbxserver.com/recordings/index.php?login=${VM_MAILBOX} to check your voicemail with a web browser.\n

Change it to look like I have it listed. Two things to change 1: within that file see where it says "Dial *97 to access .....
I changed it to look like the following as that is the proper english in the U S
Dial *97 to access your voicemail from your registered assigned extension phone, or,
2:at the end of that statement where "\nVisit" begins, change it to look like I have (remember to change "mypbxserver.com to your required IP Address or URL) so that it will now send emails with the proper link enclosed.

Then hit save. Once saved, go to the "System" tab on your PBX GUI, on the right under "Processes Status" select "EMail Service" and restart email services, then once thats restarted hit "Telephone Services" and restart it. Now your changes you made within the two file should take affect. Dial your extension, leave a voicemail and the check your email to see if it displays what you are looking for, the proper URL link to click on to check you vm thru your email.

Note: make sure that you keep all else the same as it is or your vm will not deliver the email notice. In other words be careful of spaces, brackets "[ ]" and others. If you copy and paste what I have listed it should work just be sure to put the URL.

That should be all you need, may be a little redundent and posted before, but what the heck. If it helps it helps.

Be sure to increase user "linuxmill" carma for assisting us with his help.

Thanks
amphibian
 

roundtree

Joined
Mar 10, 2015
Messages
2
Likes
0
Points
0
#10
I chased my own tail for about two hours before I finally found this. I modified this line in the function:

Code:
$ip = $_SERVER['SERVER_ADDR'];
With this one instead:

Code:
$ip = $_SERVER['SERVER_NAME'];
Why isn't the server name the default, especially since the system forces HTTPS out of the box?

--
Justin White, MBA, CCIE#14745
roundtree@gmx.us
 

Members online

No members online now.

Latest posts

Forum statistics

Threads
30,902
Messages
130,887
Members
17,565
Latest member
omarmenichetti
Top