Index: channels/chan_dahdi.c =================================================================== --- channels/chan_dahdi.c (revision 218222) +++ channels/chan_dahdi.c (working copy) @@ -672,6 +672,7 @@ MWI_SEND_SA_WAIT, MWI_SEND_PAUSE, MWI_SEND_SPILL, + MWI_SEND_VMWI, MWI_SEND_CLEANUP, MWI_SEND_DONE, } mwisend_states; @@ -9669,6 +9670,9 @@ } else if (pvt->mwisend_fsk) { pvt->mwisend_data.mwisend_current = MWI_SEND_SPILL; pvt->mwisendactive = 1; + } else if (pvt->mwisend_setting.vmwi_type) { + pvt->mwisend_data.mwisend_current = MWI_SEND_VMWI; + pvt->mwisendactive = 1; } else { pvt->mwisendactive = 0; return 0; @@ -9745,20 +9749,20 @@ } #ifdef HAVE_DAHDI_LINEREVERSE_VMWI } else { /* support for mwisendtype=nofsk */ - pvt->mwisend_data.mwisend_current = MWI_SEND_CLEANUP; + pvt->mwisend_data.mwisend_current = MWI_SEND_VMWI; } #endif break; case MWI_SEND_SPILL: /* We read some number of bytes. Write an equal amount of data */ - if(0 < num_read) { + if (0 < num_read) { if (num_read > pvt->cidlen - pvt->cidpos) num_read = pvt->cidlen - pvt->cidpos; res = write(pvt->subs[SUB_REAL].dfd, pvt->cidspill + pvt->cidpos, num_read); if (res > 0) { pvt->cidpos += res; if (pvt->cidpos >= pvt->cidlen) { - pvt->mwisend_data.mwisend_current = MWI_SEND_CLEANUP; + pvt->mwisend_data.mwisend_current = MWI_SEND_VMWI; } } else { ast_log(LOG_WARNING, "MWI FSK Send Write failed: %s\n", strerror(errno)); @@ -9766,6 +9770,13 @@ } } break; + case MWI_SEND_VMWI: + res = has_voicemail(pvt); + /* Set driver resources for signalling VMWI */ + if (!ioctl(pvt->subs[SUB_REAL].dfd, DAHDI_VMWI, &res)) { + pvt->mwisend_data.mwisend_current = MWI_SEND_DONE; + } + break; case MWI_SEND_CLEANUP: /* For now, do nothing */ pvt->mwisend_data.mwisend_current = MWI_SEND_DONE; @@ -10204,13 +10215,7 @@ !ast_strlen_zero(last->mailbox) && (thispass - analog_p->onhooktime > 3)) { res = has_voicemail(last); if (analog_p->msgstate != res) { - /* Set driver resources for signalling VMWI */ - res2 = ioctl(last->subs[SUB_REAL].dfd, DAHDI_VMWI, &res); - if (res2) { - /* TODO: This message will ALWAYS be generated on some cards; any way to restrict it to those cards where it is interesting? */ - ast_debug(3, "Unable to control message waiting led on channel %d: %s\n", last->channel, strerror(errno)); - } - /* If enabled for FSK spill then initiate it */ + /* Start MWI indications, rpas, fsk and neon etc.. */ if (mwi_send_init(last)) { ast_log(LOG_WARNING, "Unable to initiate mwi send sequence on channel %d\n", last->channel); } Index: channels/sig_analog.c =================================================================== --- channels/sig_analog.c (revision 218222) +++ channels/sig_analog.c (working copy) @@ -2675,6 +2675,8 @@ analog_cancel_cidspill(p); p->callwaitcas = 0; } + /* Cause message update after ringing */ + p->msgstate = -1; p->subs[index].f.frametype = AST_FRAME_CONTROL; p->subs[index].f.subclass = AST_CONTROL_RINGING; break;