[Asterisk-Users] voicemail

Moises Silva moises.silva at gmail.com
Sat Jan 14 08:56:29 MST 2006


Hi Dov. I cannot make guarantees because i did not test it, but you
could try applying this small patch i have made for you ;)

--- apps/app_voicemail.c.orig   2006-01-14 09:46:36.745550865 -0600
+++ apps/app_voicemail.c        2006-01-14 09:53:28.635280667 -0600
@@ -1755,8 +1755,13 @@
                }
                fclose(p);
                snprintf(tmp2, sizeof(tmp2), "( %s < %s ; rm -f %s )
&", mailcmd, tmp, tmp);
-               ast_safe_system(tmp2);
-               ast_log(LOG_DEBUG, "Sent mail to %s with command
'%s'\n", vmu->email, mailcmd);
+               if ( ast_safe_system(tmp2) ) {
+                       ast_log(LOG_DEBUG, "Sent mail to %s with
command '%s'\n", vmu->email, mailcmd);
+                       return 0;
+               } else {
+                       ast_log(LOG_WARNING, "Failed to send mail with
command: %s\n", tmp2);
+                       return -1;
+               }
        } else {
                ast_log(LOG_WARNING, "Unable to launch '%s'\n", mailcmd);
                return -1;
@@ -3291,7 +3296,7 @@
        make_dir(todir, sizeof(todir), vmu->context, vmu->mailbox, "INBOX");
        make_file(fn, sizeof(fn), todir, msgnum);
        snprintf(ext_context, sizeof(ext_context), "%s@%s",
vmu->mailbox, vmu->context);
-
+       int sentmail = 0;
        /* Attach only the first format */
        fmt = ast_strdupa(fmt);
        if (fmt) {
@@ -3304,7 +3309,7 @@
                        attach_user_voicemail = ast_test_flag(vmu, VM_ATTACH);
                        if (!ast_strlen_zero(vmu->serveremail))
                                myserveremail = vmu->serveremail;
-                       sendmail(myserveremail, vmu, msgnum,
vmu->context, vmu->mailbox, cidnum, cidname, fn, fmt, duration,
attach_user_voicemail);
+                       sentmail = sendmail(myserveremail, vmu,
msgnum, vmu->context, vmu->mailbox, cidnum, cidname, fn, fmt,
duration, attach_user_voicemail);
                }

                if (!ast_strlen_zero(vmu->pager)) {
@@ -3317,7 +3322,7 @@
                ast_log(LOG_ERROR, "Out of memory\n");
        }

-       if (ast_test_flag(vmu, VM_DELETE)) {
+       if ( sentmail == 0 && ast_test_flag(vmu, VM_DELETE) ) {
                DELETE(todir, msgnum, fn);
        }


Best Regards.

On 1/13/06, Dov Bigio <dovb at terra.com.br> wrote:
>
> Hi,
>
> I have my voicemails accounts configured with delete=yes|attach=yes
>
> Today I had problems with my smtp server and messages were not sent to
> users, BUT were deleted from the server.
> Is there a way to delete voicemail msgs only if e-mail is sent
> successfully???
>
> Thank you
> Dov
> _______________________________________________
> --Bandwidth and Colocation provided by Easynews.com --
>
> Asterisk-Users mailing list
> To UNSUBSCRIBE or update options visit:
>
> http://lists.digium.com/mailman/listinfo/asterisk-users
>
>
>


--
"Su nombre es GNU/Linux, no solamente Linux, mas info en http://www.gnu.org"



More information about the asterisk-users mailing list