[Freeswitch-dev] mod_voicemail.c
Peder @ NetworkOblivion
peder at networkoblivion.com
Tue Jun 3 14:25:51 EDT 2008
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>> 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>
> 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