[asterisk-users] Custom Voicemail emails
Steve Edwards
asterisk.org at sedwards.com
Mon Sep 22 14:15:06 CDT 2008
(Replying to my own reply...)
On Mon, 22 Sep 2008, Steve Edwards wrote:
> On Thu, 18 Sep 2008, Steve Anness wrote:
>
>> So here is the deal. I have an Asterisk server here at work that I
>> have recently taken over and the boss is wanting the server to do a
>> lot of things that it didn't do before. I have already configured much
>> of what he wanted including a voice messaging line where anyone can
>> call in and leave a message and then he would get that message in his
>> email. However, the boss wants his email subject to read something
>> like "This is an urgent message through the HISG voice messaging
>> system" so he knows that that message came through that number as
>> opposed to his voicemail box that already gets forwarded there. The
>> default is the "[PBX]: New Message 10 in mailbox 0307". At second
>> glance he would know which voicemail box is his line but he wants
>> things to be different and so I am trying to make that happen.
>>
>> I know there is the 'emailsubject' option. I haven't tried this yet
>> but my concern is that it will set the subject the same on every
>> single box (obviously what the command is designed for). I can I
>> customize a voicemail message so that if something comes in on our
>> 0307 line it has a certain message and then we might get a message on
>> 1942 line that we want a different subject.
>
> The text file that accompanies the voicemail
> (/var/spool/asterisk/voicemail/default/xxxx/INBOX/msg0000.txt) contains a
> bunch of useful stuff:
>
> [message]
> origmailbox=xxxx
> context=macro-stdexten
> macrocontext=from-xxxxxxxx.net
> exten=s-NOANSWER
> priority=1
> callerchan=SIP/sedwards-08d04618
> callerid="xxxxxxxxxx" <xxxxxxxxxx>
> origdate=Mon Sep 22 11:22:26 AM PDT 2008
> origtime=1222107746
> category=
> duration=6
>
> Could you invoke a "wrapper script" using mailcmd (in voicemail.conf) to
> extract "origmailbox" and base your "custom" subject header based on that?
>
> I've never done this, but would like to know if it worked :)
The msg000.txt file is not available to the command invoked by "mailcmd"
so scratch that suggestion.
The "mailcmd" variable in voicemail.conf appears to be a "per user"
variable (1.2). It's stored in the ast_vm_user linked list.
The "emailsubject" variable is global, but it is munged using
"prep_email_sub_vars()" and "pbx_substitute_variables_helper()." You may
have some luck setting "emailsubject" to something like "[PBX]: ${URGENT}
New message ${VM_MSGNUM} in mailbox ${VM_MAILBOX}" and the setting URGENT
appropriately in the dialplan. I didn't try it, but it may work.
Failing the above, the "mailcmd" variable invokes the "wrapper" with the
SMTP headers, the body, and (if any) attachment (base64 encoded) all as a
stream on stdin. All you need to do is read stdin and mung the "Subject"
header as you feed everything off to "sendmail -t."
Failing either of the above approaches, you can always break out your
code hatchet :)
Thanks in advance,
------------------------------------------------------------------------
Steve Edwards sedwards at sedwards.com Voice: +1-760-468-3867 PST
Newline Fax: +1-760-731-3000
More information about the asterisk-users
mailing list