[Freeswitch-dev] mod_voicemail.c

Peder @ NetworkOblivion peder at networkoblivion.com
Wed Jun 4 13:14:23 EDT 2008


One issue.  If you have both email and notify set, you get the email 
with the attachment, a notify to the notify address, but you also get a 
notify to the email address (3 messages total).  It appears that the 
notify message is using the email header and then adding the notify 
email to the existing header, so you are getting the notify sent to two 
places.  I haven't tried using a separate notify template yet.

Anthony Minessale wrote:
> This feature was a patch we probably should have looked at closer?
> 
> I reverted it and wrote a new one, please test as i am not able to atm 
> this is a blind commit.
> 
> vm-mailto (default undef) "the addr you want main email"
> vm-notify-mailto (default same as vm-mailto) "the addr you want 
> notifications sent to"
> vm-email-all-messages (default false) "send all messages to vm-mailto 
> addr (attachment based on vm-attach-file param)"
> vm-notify-email-all-messages (default false) "send a notify email to 
> vm-notify-mailto when a vm is left (never has attachment)"
> vm-keep-local-after-email (default true) when you email the main message 
> also keep it locally as new vm for the phone.
>                                       when false means delete it as if 
> it never happened and just email it.
> vm-attach-file (default true) attach the audio file to the main email
> 
> the notify email will use the same template as the main email unless you 
> define the new profile param "notify-template-file"
> 
> 
> 
> 
> 
> On Tue, Jun 3, 2008 at 1:25 PM, Peder @ NetworkOblivion 
> <peder at networkoblivion.com <mailto:peder at networkoblivion.com>> wrote:
> 
>     Right, but if you don't have "vm-email-all-messages" and "vm-mailto",
>     you can't send a notify.  In other words it is either email only, or
>     email and notify.  You can't just do notify.
> 
>     Anthony Minessale wrote:
>      > vm-mailto is just the value of your email address if you want to
>     send or
>      > not which is more specific than email-addr
>      > vm-email-all-messages is the actual param to adjust the
>     functionality.
>      >
>      >
>      > On Tue, Jun 3, 2008 at 12:39 PM, Peder @ NetworkOblivion
>      > <peder at networkoblivion.com <mailto:peder at networkoblivion.com>
>     <mailto:peder at networkoblivion.com
>     <mailto:peder at networkoblivion.com>>> wrote:
>      >
>      >     So I was messing with the voicemail to email and notify and
>     ran into an
>      >     "issue".  It appears that you have to have
>     vm-email-all-messages set to
>      >     true and have an address in vm-mailto to send a notify.  This
>     may or may
>      >     not be the intention, but it just doesn't sound right to me.
>      I should
>      >     be able to send a notify without sending an email as well.  I
>     think I
>      >     found the culprit at line 1926, it is:
>      >
>      >      if (send_mail && !switch_strlen_zero(email_vm) &&
>      >     switch_file_exists(file_path,
>     switch_core_session_get_pool(session)) ==
>      >     SWITCH_STATUS_SUCCESS) {
>      >
>      >
>      >     My thought was to instead say "if you have email-all and an
>     email, or
>      >     you have notify", then you are ok, which I think the below
>     will do:
>      >
>      >      if (((send_mail && !switch_strlen_zero(email_vm)) ||
>      >     !switch_strlen_zero(email_vm_notify)) &&
>     switch_file_exists(file_path,
>      >     switch_core_session_get_pool(session)) ==
>     SWITCH_STATUS_SUCCESS) {
>      >
>      >
>      >     The issue is that I kind of got lost in the logic below as to
>     how I
>      >     would change these lines.  This sends an email with attach
>     AND a notify
>      >     if notify  is set.  If both are set, that is fine, but if
>     only notify is
>      >     set, I don't want to send an email. Line 2014:
>      >
>      >
>      >       if (email_attach) {
>      >                             switch_simple_email(email_vm, from,
>      >     header_string, body, file_path);
>      >                     } else {
>      >                             switch_simple_email(email_vm, from,
>      >     header_string, body, NULL);
>      >                     }
>      >                     if (!switch_strlen_zero(email_vm_notify)) {
>      >                             switch_simple_email(email_vm_notify,
>     from,
>      >     header_string, body, NULL);
>      >                     }
>      >
>      >                     switch_log_printf(SWITCH_CHANNEL_LOG,
>     SWITCH_LOG_DEBUG,
>      >     "Sending message to %s\n", email_vm);
>      >
>      >
>      >     I wasn't sure if I needed to say "if email_attach and
>     send_mail and
>      >     !zero(email_vm)" and then the else would be an elseif of "if
>      >     email_attach and send_mail and zero(email_vm)" to make sure
>     that I don't
>      >     match either of these with only notify set.  Or is there an
>     easier way
>      >     to say it to make sure I don't miss something?
>      >
>      >     Also, I think the log message would be better if there was
>     one per
>      >     if/then/if so that we can see if it is with an attach,
>     without, or just
>      >     a notify.
>      >
>      >              if (email_attach) {
>      >                             switch_simple_email(email_vm, from,
>      >     header_string, body, file_path);
>      >                             switch_log_printf(SWITCH_CHANNEL_LOG,
>      >     SWITCH_LOG_DEBUG, "Sending email with attachment to %s\n",
>     email_vm);
>      >                     } else {
>      >                             switch_simple_email(email_vm, from,
>      >     header_string, body, NULL);
>      >                             switch_log_printf(SWITCH_CHANNEL_LOG,
>      >     SWITCH_LOG_DEBUG, "Sending email without attachment to %s\n",
>     email_vm);
>      >                     }
>      >                     if (!switch_strlen_zero(email_vm_notify)) {
>      >                             switch_simple_email(email_vm_notify,
>     from,
>      >     header_string, body, NULL);
>      >                             switch_log_printf(SWITCH_CHANNEL_LOG,
>      >     SWITCH_LOG_DEBUG, "Sending email notify to %s\n",
>     email_vm_notify);
>      >                     }
>      >
>      >                     switch_safe_free(body);
>      >
>      >
>      >     And before anybody says it, I don't have cvs commit access
>     and I am a
>      >     rookie programmer and don't want to commit something that is
>     totally
>      >     f'd up.
>      >
>      >     Peder
>      >
>      >     _______________________________________________
>      >     Freeswitch-dev mailing list
>      >     Freeswitch-dev at lists.freeswitch.org
>     <mailto:Freeswitch-dev at lists.freeswitch.org>
>      >     <mailto:Freeswitch-dev at lists.freeswitch.org
>     <mailto:Freeswitch-dev at lists.freeswitch.org>>
>      >     http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
>      >    
>     UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
>      >     http://www.freeswitch.org
>      >
>      >
>      >
>      >
>      > --
>      > Anthony Minessale II
>      >
>      > FreeSWITCH http://www.freeswitch.org/
>      > ClueCon http://www.cluecon.com/
>      >
>      > AIM: anthm
>      > MSN:anthony_minessale at hotmail.com
>     <mailto:MSN%3Aanthony_minessale at hotmail.com>
>      > <mailto:MSN%3Aanthony_minessale at hotmail.com
>     <mailto:MSN%253Aanthony_minessale at hotmail.com>>
>      > GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com
>     <mailto:PAYPAL%3Aanthony.minessale at gmail.com>
>      > <mailto:PAYPAL%3Aanthony.minessale at gmail.com
>     <mailto:PAYPAL%253Aanthony.minessale at gmail.com>>
>      > IRC: irc.freenode.net <http://irc.freenode.net>
>     <http://irc.freenode.net> #freeswitch
>      >
>      > FreeSWITCH Developer Conference
>      > sip:888 at conference.freeswitch.org
>     <mailto:sip%3A888 at conference.freeswitch.org>
>      > <mailto:sip%3A888 at conference.freeswitch.org
>     <mailto:sip%253A888 at conference.freeswitch.org>>
>      > iax:guest at conference.freeswitch.org/888
>     <http://iax:guest@conference.freeswitch.org/888>
>      > <http://iax:guest@conference.freeswitch.org/888>
>      > googletalk:conf+888 at conference.freeswitch.org
>     <mailto:googletalk%3Aconf%2B888 at conference.freeswitch.org>
>      > <mailto:googletalk%3Aconf%2B888 at conference.freeswitch.org
>     <mailto:googletalk%253Aconf%252B888 at conference.freeswitch.org>>
>      > pstn:213-799-1400
>      >
>      >
>      >
>     ------------------------------------------------------------------------
>      >
>      > _______________________________________________
>      > Freeswitch-dev mailing list
>      > Freeswitch-dev at lists.freeswitch.org
>     <mailto:Freeswitch-dev at lists.freeswitch.org>
>      > http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
>      >
>     UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
>      > http://www.freeswitch.org
> 
>     _______________________________________________
>     Freeswitch-dev mailing list
>     Freeswitch-dev at lists.freeswitch.org
>     <mailto:Freeswitch-dev at lists.freeswitch.org>
>     http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
>     UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
>     http://www.freeswitch.org
> 
> 
> 
> 
> -- 
> Anthony Minessale II
> 
> FreeSWITCH http://www.freeswitch.org/
> ClueCon http://www.cluecon.com/
> 
> AIM: anthm
> MSN:anthony_minessale at hotmail.com 
> <mailto:MSN%3Aanthony_minessale at hotmail.com>
> GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com 
> <mailto:PAYPAL%3Aanthony.minessale at gmail.com>
> IRC: irc.freenode.net <http://irc.freenode.net> #freeswitch
> 
> FreeSWITCH Developer Conference
> sip:888 at conference.freeswitch.org 
> <mailto:sip%3A888 at conference.freeswitch.org>
> iax:guest at conference.freeswitch.org/888 
> <http://iax:guest@conference.freeswitch.org/888>
> googletalk:conf+888 at conference.freeswitch.org 
> <mailto:googletalk%3Aconf%2B888 at conference.freeswitch.org>
> pstn:213-799-1400
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Freeswitch-dev mailing list
> Freeswitch-dev at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
> http://www.freeswitch.org



More information about the Freeswitch-dev mailing list