[Asterisk-Dev] Voicemail Envelope (cid, date/time playback)

John Todd jtodd at loligo.com
Fri Jun 27 10:36:38 MST 2003


This is a good start!  However, your inspiration was perhaps too 
well-founded.  Tilghman has created some really well thought-out 
patches to do just what you're doing, with customizable date/time 
zone speech syntax and per-user methods for date/time readout.  He's 
said that he'll have some additional time to finish the patches and 
apply to Voicemail and Voicemail2 shortly, but they're already almost 
done from what I've seen.

His patches play the received times at the beginning of the message, 
instead of as a DTMF sequence trigger inside the message.  I don't 
find that to be too much of a problem, especially with the 
customizable date/timestamps for each user or group (yes, there are 
defaults.)

There is additional delay in that I have to get a handful of 
recordings done to support the extensions, but that should be no big 
deal.

JT

>Inspired by Tilghman Lesher's "Patch for voicemail date/time" and the
>voicemail details that can be displayed on an ADSI phone, I thought I'd
>see what I could do about an audible message envelope feature--something
>that's commonly available on various voicemail systems. Not being a
>programmer, I'd hesitate to call this a patch, more something worth (if
>anything) a look, and I thought I'd see if anyone has any thoughts.
>
>A couple of obvious deficiencies: it relies on the precious spare '3' key
>to trigger the envelope playback, the envelope can't be interrupted by any
>DTMF sequence, and it uses voice prompts that don't exist... other than
>that it seems to me to work okay.
>
>
>diff -rcs app_voicemail2.c app_voicemail2.c.bwb
>*** app_voicemail2.c 2003-06-27 03:14:43.000000000 -0600
>--- app_voicemail2.c.bwb 2003-06-27 03:14:30.000000000 -0600
>***************
>*** 1999,2004 ****
>--- 1999,2006 ----
>             if (!res)
>              res = play_and_wait(chan, "vm-toforward");
>             if (!res)
>+            res = play_and_wait(chan, "vm-getenvelope");
>+           if (!res)
>              res = play_and_wait(chan, "vm-savemessage");
>           }
>          }
>***************
>*** 2277,2282 ****
>--- 2279,2289 ----
>              cmd = play_and_wait(chan, "vm-messages");
>             vms.starting = 1;
>             break;
>+
>+         case '3':
>+           cmd = message_envelope(chan, vms.fn);
>+                                 break;
>+
>           case '4':
>             if (vms.curmsg) {
>              vms.curmsg--;
>***************
>*** 2613,2618 ****
>--- 2620,2695 ----
>         }
>   }
>
>+
>+ static int message_envelope(struct ast_channel *chan, char *fn)
>+ {
>+         int res = 0;
>+         char filename[256], buf[256];
>+         char cid[256];
>+         char *name, *num;
>+         char datetime[21]="";
>+         char *val;
>+         FILE *f;
>+
>+         time_t t;
>+         /* Get envelope info */
>+
>+         snprintf(filename, sizeof(filename), "%s.txt", fn);
>+
>+         f = fopen(filename, "r");
>+
>+         if (f) {
>+
>+                 while(!feof(f)) {
>+                         fgets(buf, sizeof(buf), f);
>+                         if (!feof(f)) {
>+                                 char *stringp = NULL;
>+                                 stringp=buf;
>+                                 strsep(&stringp, "=");
>+                                 val = strsep(&stringp, "=");
>+                                 if (val && strlen(val)) {
>+                                         if (!strcmp(buf, "callerid"))
>+                                          
>+                                                 strncpy(cid, val,
>sizeof(cid) -1);
>+                                         if (!strcmp(buf, "origtime"))
>+                                                 strncpy(datetime, val,
>sizeof(datetime) - 1);
>+                                 }
>+                         }
>+                 }
>+                 fclose(f);
>+
>+           /* Read calling party number */
>+
>+           if (strlen(cid)) {
>+                  ast_streamfile(chan, "vm-from", chan->language);
>+                  ast_waitstream(chan, "");
>+                  ast_callerid_parse(cid, &name, &num);
>+                  ast_say_digit_str(chan, num, "", chan->language);
>+
>+
>+               } else {
>+                  ast_streamfile(chan, "unknown-caller", chan->language);
>+                  ast_waitstream(chan, "");
>+           }
>+
>+           /* Read date */
>+
>+           ast_streamfile(chan, "vm-received", chan->language);
>+           ast_waitstream(chan, "");
>+
>+           sscanf(datetime,"%i",&t);
>+
>+           res = ast_say_datetime(chan, t, "", chan->language);
>+
>+           return res;
>+
>+               }
>+
>+
>+         return res;
>+ }
>+
>+
>   int reload(void)
>   {
>         return(load_config());
>
>
>
>
>
>_______________________________________________
>Asterisk-Dev mailing list
>Asterisk-Dev at lists.digium.com
>http://lists.digium.com/mailman/listinfo/asterisk-dev




More information about the asterisk-dev mailing list