[Freeswitch-dev] mod_voicemail.c
Peder @ NetworkOblivion
peder at networkoblivion.com
Tue Jun 3 13:39:17 EDT 2008
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
More information about the Freeswitch-dev
mailing list