[Asterisk-Dev] Call notification from voicemail box

Robin van Leyden rvleyden at call4me.nl
Tue Nov 23 12:41:23 MST 2004


Hi all,

I made a small patch to the app_voicemail.c so it will be able to turn call
notification on or off. The destination that has to be notified can be set.

In the voicemail.conf there is a little addition in the user box

E.q.

1234 => 5678,Company2 User,root at localhost,,callnotify=sip/1234

This will call sip extension 1234 via a outgoing dial command. When
connected the extension will be directed to a section in extension.conf the
app_voicemail will pass a parameter called 'vmbox' witch contains the
voicemail box number who is notifying.

E.q. extension.conf

[voicemail_callnotify]
exten => a,1,voicemailmain(${vmbox})

This addition is patched in version : Asterisk CVS-v1-0-11/06/04-15:58:54

Find attached the CVS diff.

diff -r1.151.2.6 app_voicemail.c
142a143,145
>
/*21-11-2004----------------------------------------------------------------
--------------------*/
>       char callnotify[160];
>
/*--------------------------------------------------------------------------
--------------------*/
326a330,334
>
/*21-11-2004----------------------------------------------------------------
--------------------*/
>                       /*notification via a call*/
>                       } else if (!strcasecmp(var, "callnotify")) {
>                               strncpy(vmu->callnotify, value,
sizeof(vmu->callnotify) - 1);
>
/*--------------------------------------------------------------------------
--------------------*/
2221a2230
>       FILE *outb;
2225a2235,2254
>
>
/*21-11-2004----------------------------------------------------------------
--------------------*/
>       if(!ast_strlen_zero(vmu->callnotify)) {
>               ast_verbose( VERBOSE_PREFIX_3 "Preparing call notification
outbound file\n");
>               outb = fopen("/var/spool/asterisk/outgoing/call","w");
>               if (outb) {
>                       fprintf(outb,"Channel:%s\n",vmu->callnotify);
>                       fprintf(outb,"MaxRetries:5\n");
>                       fprintf(outb,"RetryTime:300\n");
>                       fprintf(outb,"WaitTime:20\n");
>                       fprintf(outb,"Context:voicemail_callnotify\n");
>                       fprintf(outb,"Extension:a\n");
>                       fprintf(outb,"Priority:1\n");
>                       fprintf(outb,"SetVar:vmbox=%s\n",vmu->mailbox);
>                       fprintf(outb,"Account:VM_CallNotify\n");
>                       fclose(outb);
>               } else
>                       ast_log(LOG_WARNING, "Error opening outbound file
for call notification\n");
>       }
>
/*--------------------------------------------------------------------------
--------------------*/

Succes





More information about the asterisk-dev mailing list