[Asterisk-Users] voicemail: fromstring and delete

2004-10-25 Thread Duraid Abbas
I have set the fromstring and delete=yes in my voicemail.conf but none
of them is working. I always receive messages about my voicmail from
root cz im running asterisk as root and my messages are not getting
deleted after they are sent. Do you know what might be the problem?

___
Asterisk-Users mailing list
[EMAIL PROTECTED]
http://lists.digium.com/mailman/listinfo/asterisk-users
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [Asterisk-Users] VoiceMail fromstring?

2003-10-13 Thread Martin Pycko
I just tested fromstring and emailbody with voicemail2 and a farily new
code and it's working.  I don't know what you're doing wrong ... but
something for sure.

regards
Martin

On Mon, 13 Oct 2003, John Todd wrote:

 I would recommend then doing grep fromstring
 /usr/src/asterisk/apps/app_voicemail2.c 
 
 Martin
 
 On Fri, 19 Sep 2003, Ben Bloomberg wrote:
 
   I'm having tons of trouble getting the fromstring to work in
   voicemail.conf. I've tried both voicemail and voicemail2 but the emails
   still seem to be coming from asterisk pbx. Has anyone had any luck with
this?
 [snip]

 Martin -
I examined the source, but I am still un-enlightened.  :-)   I
 cannot get fromstring or emailbody working reliably.  Even with the
 minimalist settings below, the header or body did not change (other
 than serveremail which seems to be set appropriately.)
 Interestingly and perhaps as an additional problem, the timezones
 also don't seem to work correctly in the voicemail message, either -
 the time in the email message is Eastern time (the TZ to which that
 server is set.)  My CVS is Asterisk CVS-10/13/03-18:38:10.

What I am doing incorrectly?

 JT




 [general]
 format=wav
 [EMAIL PROTECTED]
 attach=yes
 fromstring=Foo
 emailbody=New vm now

 [zonemessages]
 eastern=US/NewYork|'vm-received' Q 'digits/at' IMp
 central=US/Central|'vm-received' Q 'digits/at' IMp
 mountain=US/Mountain|'vm-received' Q 'digits/at' IMp
 pacific=US/Pacific|'vm-received' Q 'digits/at' IMp

 [default]
 2413669780 = ,john todd,[EMAIL PROTECTED],,|tz=pacific


 A message left in that mailbox results in:

 Date: Mon, 13 Oct 2003 18:53:49 -0400
 From: Asterisk PBX [EMAIL PROTECTED]
 To: john todd [EMAIL PROTECTED]
 Subject: [PBX]: New message 2 in mailbox 2413669780
 
 Dear john todd:
 
  Just wanted to let you know you were just left a 0:01 long
 message (number 2)
 in mailbox 2413669780 from 2155821314, on Monday, October 13, 2003
 at 06:53:49 PM so you might
 want to check it when you get a chance.  Thanks!
 
  --Asterisk
 
 Content-Type: audio/x-wav; name=msg0002.wav
 Content-Description: Voicemail sound attachment.
 Content-Disposition: attachment; filename=msg0002.wav
 


 ___
 Asterisk-Users mailing list
 [EMAIL PROTECTED]
 http://lists.digium.com/mailman/listinfo/asterisk-users



___
Asterisk-Users mailing list
[EMAIL PROTECTED]
http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [Asterisk-Users] VoiceMail fromstring?

2003-10-13 Thread Martin Pycko
 However, the timezone is still not straight in the message body.
 ${VM_DATE} doesn't seem to use the timezone matching routines defined
 by the user's tz= setting.
Well it's the task for those who add features to have a global-system
thinking. The emailbody was added way before the timezones ...


 Also, there seems to be a character limit for the length of
 emailbody= that is a bit short - I get the last part of my messages
 chopped off at a predictable point (seems to be around the 500th
 character of the emailbody= line that it gets snipped.)
That can be easily changes since the static array is used.

Martin


 JT

 ___
 Asterisk-Users mailing list
 [EMAIL PROTECTED]
 http://lists.digium.com/mailman/listinfo/asterisk-users


___
Asterisk-Users mailing list
[EMAIL PROTECTED]
http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [Asterisk-Users] VoiceMail fromstring?

2003-10-13 Thread Tilghman Lesher
On Monday 13 October 2003 22:18, Martin Pycko wrote:
  However, the timezone is still not straight in the message body.
  ${VM_DATE} doesn't seem to use the timezone matching routines
  defined by the user's tz= setting.

 Well it's the task for those who add features to have a global-system
 thinking. The emailbody was added way before the timezones ...

You could have just said it was a bug, instead of insulting a
contributing developer.  Patch attached.

  Also, there seems to be a character limit for the length of
  emailbody= that is a bit short - I get the last part of my
  messages chopped off at a predictable point (seems to be around the
  500th character of the emailbody= line that it gets snipped.)

 That can be easily changes since the static array is used.

Actually, no, a static array is not used.  The code assumes that a
minimum of twice the length of the email body (or 100 minimum) is of
sufficient length.  But it's easily changed.

int vmlen = strlen(emailbody)*2;
if (vmlen  20)
vmlen = 100;
passdata = alloca(vmlen);
bzero( passdata, vmlen );

-Tilghman
Index: apps/app_voicemail2.c
===
RCS file: /usr/cvsroot/asterisk/apps/app_voicemail2.c,v
retrieving revision 1.56
diff -u -r1.56 app_voicemail2.c
--- apps/app_voicemail2.c	4 Oct 2003 22:08:02 -	1.56
+++ apps/app_voicemail2.c	14 Oct 2003 04:42:47 -
@@ -25,6 +25,7 @@
 #include asterisk/app.h
 #include asterisk/manager.h
 #include asterisk/dsp.h
+#include asterisk/localtime.h
 #include stdlib.h
 #include errno.h
 #include unistd.h
@@ -631,7 +632,7 @@
 	return 1;
 }
 
-static int sendmail(char *srcemail, char *email, char *name, int msgnum, char *mailbox, char *callerid, char *attach, char *format, long duration, int attach_user_voicemail)
+static int sendmail(char *srcemail, struct ast_vm_user *vmu, int msgnum, char *mailbox, char *callerid, char *attach, char *format, long duration, int attach_user_voicemail)
 {
 	FILE *p;
 	char date[256];
@@ -642,6 +643,8 @@
 	char dur[256];
 	time_t t;
 	struct tm tm;
+	struct vm_zone *the_zone = NULL;
+
 	if (!strcmp(format, wav49))
 		format = WAV;
 	ast_log(LOG_DEBUG, Attaching file '%s', format '%s', uservm is '%d', global is %d\n, attach, format, attach_user_voicemail, attach_voicemail);
@@ -655,7 +658,25 @@
 		}
 		snprintf(dur, sizeof(dur), %ld:%02ld, duration / 60, duration % 60);
 		time(t);
-		localtime_r(t,tm);
+
+		/* Does this user have a timezone specified? */
+		if (strlen(vmu-zonetag)) {
+			/* Find the zone in the list */
+			struct vm_zone *z;
+			z = zones;
+			while (z) {
+if (!strcmp(z-name, vmu-zonetag)) {
+	the_zone = z;
+	break;
+}
+z = z-next;
+			}
+		}
+
+		if (the_zone)
+			ast_localtime(t,tm,the_zone-timezone);
+		else
+			ast_localtime(t,tm,NULL);
 		strftime(date, sizeof(date), %a, %d %b %Y %H:%M:%S %z, tm);
 		fprintf(p, Date: %s\n, date);
 		
@@ -663,7 +684,7 @@
 			fprintf(p, From: %s %s\n, fromstring, who);
 		else
 			fprintf(p, From: Asterisk PBX %s\n, who);
-		fprintf(p, To: %s %s\n, name, email);
+		fprintf(p, To: %s %s\n, vmu-fullname, vmu-email);
 
 		if( *emailtitle)
 		{
@@ -696,7 +717,7 @@
 	vmlen = 100;
 passdata = alloca(vmlen);
 bzero( passdata, vmlen );
-pbx_builtin_setvar_helper(ast, VM_NAME, name);
+pbx_builtin_setvar_helper(ast, VM_NAME, vmu-fullname);
 pbx_builtin_setvar_helper(ast, VM_DUR, dur);
 sprintf(passdata,%d,msgnum);
 pbx_builtin_setvar_helper(ast, VM_MSGNUM, passdata);
@@ -711,7 +732,7 @@
 			fprintf(p, Dear %s:\n\n\tJust wanted to let you know you were just left a %s long message (number %d)\n
 
 			in mailbox %s from %s, on %s so you might\n
-			want to check it when you get a chance.  Thanks!\n\n\t\t\t\t--Asterisk\n\n, name, 
+			want to check it when you get a chance.  Thanks!\n\n\t\t\t\t--Asterisk\n\n, vmu-fullname, 
 			dur, msgnum + 1, mailbox, (callerid ? callerid : an unknown caller), date);
 		}
 		if (attach_user_voicemail) {
@@ -733,7 +754,7 @@
 	return 0;
 }
 
-static int sendpage(char *srcemail, char *pager, int msgnum, char *mailbox, char *callerid, long duration)
+static int sendpage(char *srcemail, char *pager, int msgnum, char *mailbox, char *callerid, long duration, struct ast_vm_user *vmu)
 {
 	FILE *p;
 	char date[256];
@@ -742,6 +763,7 @@
 	char dur[256];
 	time_t t;
 	struct tm tm;
+	struct vm_zone *the_zone = NULL;
 	p = popen(SENDMAIL, w);
 
 	if (p) {
@@ -753,7 +775,26 @@
 		}
 		snprintf(dur, sizeof(dur), %ld:%02ld, duration / 60, duration % 60);
 		time(t);
-		localtime_r(t,tm);
+
+		/* Does this user have a timezone specified? */
+		if (strlen(vmu-zonetag)) {
+			/* Find the zone in the list */
+			struct vm_zone *z;
+			z = zones;
+			while (z) {
+if (!strcmp(z-name, vmu-zonetag)) {
+	the_zone = z;
+	break;
+}
+z = z-next;
+			}
+		}
+
+		if (the_zone)
+			

[Asterisk-Users] VoiceMail fromstring?

2003-09-19 Thread Ben Bloomberg
I'm having tons of trouble getting the fromstring to work in 
voicemail.conf. I've tried both voicemail and voicemail2 but the emails 
still seem to be coming from asterisk pbx. Has anyone had any luck with 
this?
=
Here's my voicemail.conf:
;
; Voicemail Configuration
;
[general]
; Default formats for writing Voicemail
;format=g723sf|wav49|wav
format=wav49|gsm|wav
; Who the e-mail notification should appear to come from
serveremail=vmoperator
;[EMAIL PROTECTED]
; Should the email contain the voicemail as an attachment
attach=yes
; Maximum length of a voicemail message
;maxmessage=180
; Maximum length of greetings
;maxgreet=60
; How many miliseconds to skip forward/back when rew/ff in message 
playback
skipms=3000
; How many seconds of silence before we end the recording
maxsilence=10
; Silence threshold (what we consider silence, the lower, the more 
sensitive)
silencethreshold=128
; Max number of failed login attempts
maxlogins=3

; Skip the [PBX]: string from the message title
;pbxskip=yes
; Change the From: string
fromstring=VoiceMail System ; Whats wrong??? (this comment isn't here 
in the real file)
; Change the email body, variables: VM_NAME, VM_DUR, VM_MSGNUM, 
VM_MAILBOX, VM_CALLERID, VM_DATE
;emailbody=Dear ${VM_NAME}:\n\n\tjust wanted to let you know you were 
just left a ${VM_DUR} long message (number ${VM_MSGNUM})\nin mailbox 
${VM_MAILBOX} from ${VM_CALLERID}, on ${VM_DATE} so you might\nwant to 
check it when you get a chance.  Thanks!\n\n\t\t\t\t--Asterisk\n

;
; Users may be located in different timezones, or may have different
; message announcements for their introductory message when they enter
; the voicemail system. Set the message and the timezone each user
; hears here. Set the user into one of these zones with the tz= 
attribute
; in the options field of the mailbox. Of course, language substitution
; still applies here so you may have several directory trees that have
; alternate language choices.
;
; Look in /usr/share/zoneinfo/ for names of timezones.
; Look at the manual page for strftime for a quick tutorial on how the
; variable substitution is done on the values below.
;
; Supported values:
; 'filename'filename of a soundfile (single ticks around the 
filename required)
; ${VAR}variable substitution
; A or aDay of week (Saturday, Sunday, ...)
; B or b or h   Month name (January, February, ...)
; d or enumeric day of month (first, second, ..., thirty-first)
; Y Year
; I or lHour, 12 hour clock
; H Hour, 24 hour clock (single digit hours preceded by 
oh)
; k Hour, 24 hour clock (single digit hours NOT preceded by 
oh)
; M Minute
; P or pAM or PM
; Q today, yesterday or ABdY (*note: not standard 
strftime value)
; q  (for today), yesterday, weekday, or ABdY (*note: 
not standard strftime value)
; R 24 hour time, including minute
;
;
[zonemessages]
eastern=America/NewYork|'vm-received' Q 'digits/at' IMp
central=America/Chicago|'vm-received' Q 'digits/at' IMp
central24=America/Chicago|'vm-received' q 'digits/at' H 
'digits/hundred' M 'digits/hours'

;
; Each mailbox is listed in the form 
mailbox=password,name,email,pager_email,options
; if the e-mail is specified, a message will be sent when a message is
; received, to the given mailbox. If pager is specified, a message will 
be sent there as well.
;
[default]
100 = ,Ben Bloomberg,[EMAIL PROTECTED],tz=eastern
101 = ,Kiki Bloomberg,[EMAIL PROTECTED],tz=eastern
201 = ,Brenda Philips,[EMAIL PROTECTED],tz=eastern
202 = ,David Bloomberg,[EMAIL PROTECTED],tz=eastern
300 = ,Rosalind Philips
301 = ,Lisa Philips
302 = ,Glenda Philips
303 = ,Owen Hooks-Davis,[EMAIL PROTECTED]

Thanks

___
Asterisk-Users mailing list
[EMAIL PROTECTED]
http://lists.digium.com/mailman/listinfo/asterisk-users