Index: apps/app_voicemail.c =================================================================== --- apps/app_voicemail.c (revision 90000) +++ apps/app_voicemail.c (working copy) @@ -360,6 +360,8 @@ char pager[80]; /*!< E-mail address to pager (no attachment) */ char serveremail[80]; /*!< From: Mail address */ char mailcmd[160]; /*!< Configurable mail command */ + char usesmdi[4]; /*!< notify via SMDI */ + char smdistation[11]; /*!< SMDI station number if different than mailbox number */ char language[MAX_LANGUAGE]; /*!< Config: Language setting */ char zonetag[80]; /*!< Time zone */ char callback[80]; @@ -687,6 +689,10 @@ ast_copy_string(vmu->language, value, sizeof(vmu->language)); } else if (!strcasecmp(var, "tz")) { ast_copy_string(vmu->zonetag, value, sizeof(vmu->zonetag)); + } else if (!strcasecmp(var, "usesmdi")) { + ast_copy_string(vmu->usesmdi, value, sizeof(vmu->usesmdi)); + } else if (!strcasecmp(var, "smdistation")) { + ast_copy_string(vmu->smdistation, value, sizeof(vmu->smdistation)); #ifdef IMAP_STORAGE } else if (!strcasecmp(var, "imapuser")) { ast_copy_string(vmu->imapuser, value, sizeof(vmu->imapuser)); @@ -2908,7 +2914,7 @@ #endif -static void run_externnotify(char *context, char *extension) +static void run_externnotify(char *context, char *extension, char *usesmdi, char *smdistation) { char arguments[255]; char ext_context[256] = ""; @@ -2920,11 +2926,20 @@ else ast_copy_string(ext_context, extension, sizeof(ext_context)); - if (smdi_iface) { - if (ast_app_has_voicemail(ext_context, NULL)) - ast_smdi_mwi_set(smdi_iface, extension); - else - ast_smdi_mwi_unset(smdi_iface, extension); + if (smdi_iface && ast_true(usesmdi)) { + if (ast_app_has_voicemail(ext_context, NULL)) { + if (smdistation != NULL) { + ast_smdi_mwi_set(smdi_iface, smdistation); + } else { + ast_smdi_mwi_set(smdi_iface, extension); + } + } else { + if (smdistation != NULL) { + ast_smdi_mwi_unset(smdi_iface, smdistation); + } else { + ast_smdi_mwi_unset(smdi_iface, extension); + } + } if ((mwi_msg = ast_smdi_mwi_message_wait(smdi_iface, SMDI_MWI_WAIT_TIMEOUT))) { ast_log(LOG_ERROR, "Error executing SMDI MWI change for %s on %s\n", extension, smdi_iface->name); @@ -4151,7 +4166,7 @@ queue_mwi_event(ext_context, newmsgs, oldmsgs); manager_event(EVENT_FLAG_CALL, "MessageWaiting", "Mailbox: %s@%s\r\nWaiting: %d\r\nNew: %d\r\nOld: %d\r\n", vmu->mailbox, vmu->context, ast_app_has_voicemail(ext_context, NULL), newmsgs, oldmsgs); - run_externnotify(vmu->context, vmu->mailbox); + run_externnotify(vmu->context, vmu->mailbox, vmu->usesmdi, vmu->smdistation); return 0; } @@ -4380,7 +4395,7 @@ ast_log (LOG_ERROR,"IMAP mailstream for %s is NULL\n",vmtmp->mailbox); } else { STORE(todir, vmtmp->mailbox, vmtmp->context, dstvms->curmsg, chan, vmtmp, fmt, duration, dstvms); - run_externnotify(vmtmp->context, vmtmp->mailbox); + run_externnotify(vmtmp->context, vmtmp->mailbox, vmtmp->usesmdi, vmtmp->smdistation); } } else { ast_log (LOG_ERROR,"Could not find state information for mailbox %s\n",vmtmp->mailbox); @@ -7334,7 +7349,7 @@ int new = 0, old = 0; snprintf(ext_context, sizeof(ext_context), "%s@%s", vms.username, vmu->context); manager_event(EVENT_FLAG_CALL, "MessageWaiting", "Mailbox: %s\r\nWaiting: %d\r\n", ext_context, has_voicemail(ext_context, NULL)); - run_externnotify(vmu->context, vmu->mailbox); + run_externnotify(vmu->context, vmu->mailbox, vmu->usesmdi, vmu->smdistation); ast_app_inboxcount(ext_context, &new, &old); queue_mwi_event(ext_context, new, old); } Index: configs/voicemail.conf.sample =================================================================== --- configs/voicemail.conf.sample (revision 90000) +++ configs/voicemail.conf.sample (working copy) @@ -284,7 +284,7 @@ ;4300 => 3456,Ben Rigas,ben@american-computer.net ;4310 => -5432,Sales,sales@marko.net ;4069 => 6522,Matt Brooks,matt@marko.net,,|tz=central|attach=yes|saycid=yes|dialout=fromvm|callback=fromvm|review=yes|operator=yes|envelope=yes|moveheard=yes|sayduration=yes|saydurationm=1 -;4073 => 1099,Bianca Paige,bianca@biancapaige.com,,delete=1 +;4073 => 1099,Bianca Paige,bianca@biancapaige.com,,delete=1|usesmdi=yes|smdistation=8073 ;4110 => 3443,Rob Flynn,rflynn@blueridge.net ;4235 => 1234,Jim Holmes,jim@astricon.ips,,Tz=european