Number format in voicemail emails

I’ve been wondering if it’s possible to change the formatting of the caller ID number that displays in the emails that contain the voicemail recordings. Right now it’s just one monolithic number with no dashes. That makes it difficult to read the number. I’d like to put the dashes in there so it’s easier to read when you want to dial the callback.

That part of the system is Open Source, so you might be able to find where you want the change and make a change that works for you. Because of all of the different telephone formats in the world, settling on just one is going to be a challenge.

When you figure out the change, I suggest you submit a Feature Request with the code attached. Questions with answers supplied are usually easier to answer than questions without.

Editing the code is a bit beyond my skill level. I was hoping there might be some template edit that would allow for something simple with regular expressions or something like that.

(try this , It works like a charm :wink: throw an e164 number at it and get the ‘NATIONAL’ format for anywhere in the world. (It can do a lot more than that if you RTFM ))

Thanks dicko, but again, that’s beyond my skill level. Not really sure what to do to make use of that library. I’m an admin, not a programmer.

I got that , my post was parenthetical and to @cynjut who could.

These are the variables you can use in the Voicemail -> email config

Given Asterisk substring reference

You could reconstruct the ${VM_CIDNUM} to suit your concept of hyphenation, be careful with regexes, Asterisk’s concept needs to be understood, it’s not POSIX.

But using just substrings and assuming your calls are all NANP and we don’t know whether you are 10,11 or e164 dial compliant then lets start from the LSD (least significant digit) to reduce complexity, the ‘subscriber number’ will always be ${VM_CIDNUM:-4} the ‘office code’ always ${VM_CIDNUM:-7:3} and the ‘area code’ will be ${VM_CIDNUM:-10:3}, also always , so you could use

${VM_CIDNUM:-10:3}- ${VM_CIDNUM:-7:3}- ${VM_CIDNUM:-4}
1-${VM_CIDNUM:-10:3}- ${VM_CIDNUM:-7:3}- ${VM_CIDNUM:-4}
depending on your locale

perhaps more readable

1 (${VM_CIDNUM:-10:3}) ${VM_CIDNUM:-7:3}- ${VM_CIDNUM:-4}
(${VM_CIDNUM:-10:3}) ${VM_CIDNUM:-7:3}- ${VM_CIDNUM:-4}
also depending on your locale.

Add the ${VM_CIDNAME} as appropriate

That worked beautifully. Thanks!

For the benefit of anyone who stumbles on this thread from a search, here’s the template i used in the end.


A new voicemail arrived in mailbox ${VM_MAILBOX}:

	From:		${VM_CIDNAME}
	Number:	${VM_CIDNUM:-10:3}-${VM_CIDNUM:-7:3}-${VM_CIDNUM:-4}
	Length:		${VM_DUR} seconds
	Date:		${VM_DATE}

The voicemail is attached to this message.

*Remember to delete voicemails from your email folder if you no longer need them.

these are str_replace in php and NOT asterisk variables.

This would have to be a feature request to add something like ${FORMATTEDNUM} or something similar.

Well there you go, It obviously can’t work like that :wink:

(even though it does, Comedian mail as a legacy adoption by Asterisk behaves a little differently to other modules, if it ends up in /etc/asterisk/voicemail.conf and follows the comedian mail rules . . . you will note that we are NOT using ‘${VM_CALLERID}’, we are here splitting that up to ‘${VM_CIDNUM}’, and ‘${VM_CIDNAME}’ both untouched by php code )

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