Allow both an external application and SMDI to do voicemail notification at the same time. (issue #8625 reported by lters)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@55410 f38db490-d61c-443f-a65b-d21fe96a405b
This commit is contained in:
parent
12c3f59287
commit
c016e76f98
|
@ -2817,7 +2817,7 @@ static void run_externnotify(char *context, char *extension)
|
|||
else
|
||||
ast_copy_string(ext_context, extension, sizeof(ext_context));
|
||||
|
||||
if (!strcasecmp(externnotify, "smdi")) {
|
||||
if (smdi_iface) {
|
||||
if (ast_app_has_voicemail(ext_context, NULL))
|
||||
ast_smdi_mwi_set(smdi_iface, extension);
|
||||
else
|
||||
|
@ -2835,7 +2835,9 @@ static void run_externnotify(char *context, char *extension)
|
|||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "Successfully executed SMDI MWI change for %s on %s\n", extension, smdi_iface->name);
|
||||
}
|
||||
} else if (!ast_strlen_zero(externnotify)) {
|
||||
}
|
||||
|
||||
if (!ast_strlen_zero(externnotify)) {
|
||||
if (inboxcount(ext_context, &newvoicemails, &oldvoicemails)) {
|
||||
ast_log(LOG_ERROR, "Problem in calculating number of voicemail messages available for extension %s\n", extension);
|
||||
} else {
|
||||
|
@ -7294,34 +7296,33 @@ static int load_config(void)
|
|||
}
|
||||
#endif
|
||||
/* External voicemail notify application */
|
||||
|
||||
if ((notifystr = ast_variable_retrieve(cfg, "general", "externnotify"))) {
|
||||
ast_copy_string(externnotify, notifystr, sizeof(externnotify));
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "found externnotify: %s\n", externnotify);
|
||||
if (!strcasecmp(externnotify, "smdi")) {
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "Using SMDI for external voicemail notification\n");
|
||||
if ((smdistr = ast_variable_retrieve(cfg, "general", "smdiport"))) {
|
||||
smdi_iface = ast_smdi_interface_find(smdistr);
|
||||
} else {
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "No SMDI interface set, trying default (/dev/ttyS0)\n");
|
||||
smdi_iface = ast_smdi_interface_find("/dev/ttyS0");
|
||||
}
|
||||
|
||||
if (!smdi_iface) {
|
||||
ast_log(LOG_ERROR, "No valid SMDI interface specfied, disabling external voicemail notification\n");
|
||||
externnotify[0] = '\0';
|
||||
} else {
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "Using SMDI port %s\n", smdi_iface->name);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
externnotify[0] = '\0';
|
||||
}
|
||||
|
||||
/* SMDI voicemail notification */
|
||||
if ((s = ast_variable_retrieve(cfg, "general", "smdienable")) && ast_true(s)) {
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "Enabled SMDI voicemail notification\n");
|
||||
if ((smdistr = ast_variable_retrieve(cfg, "general", "smdiport"))) {
|
||||
smdi_iface = ast_smdi_interface_find(smdistr);
|
||||
} else {
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "No SMDI interface set, trying default (/dev/ttyS0)\n");
|
||||
smdi_iface = ast_smdi_interface_find("/dev/ttyS0");
|
||||
}
|
||||
if (!smdi_iface) {
|
||||
ast_log(LOG_ERROR, "No valid SMDI interface specfied, disabling SMDI voicemail notification\n");
|
||||
} else {
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "Using SMDI port %s\n", smdi_iface->name);
|
||||
}
|
||||
}
|
||||
|
||||
/* Silence treshold */
|
||||
silencethreshold = 256;
|
||||
if ((thresholdstr = ast_variable_retrieve(cfg, "general", "silencethreshold")))
|
||||
|
|
|
@ -58,11 +58,13 @@ maxlogins=3
|
|||
;
|
||||
; If you need to have an external program, i.e. /usr/bin/myapp
|
||||
; called when a voicemail is left, delivered, or your voicemailbox
|
||||
; is checked, uncomment this. It can also be set to 'smdi' to use
|
||||
; smdi for external notification. If it is 'smdi', smdiport should
|
||||
; be set to a valid port as specified in smdi.conf.
|
||||
|
||||
; is checked, uncomment this.
|
||||
;externnotify=/usr/bin/myapp
|
||||
|
||||
; If you would also like to enable SMDI notification then set smdienable to yes.
|
||||
; You will also need to make sure smdiport is set to a valid port as specified in
|
||||
; smdi.conf.
|
||||
;smdienable=yes
|
||||
;smdiport=/dev/ttyS0
|
||||
|
||||
; If you need to have an external program, i.e. /usr/bin/myapp
|
||||
|
|
Reference in New Issue