I think this is a great idea- we have a voip phone that we basically just use for voicemail, and my family has had a lot of trouble with missing voicemails. Iād love to get this into hass!
Can I get a little better understanding of the intended operation? Right now it only appears to be updating once upon hass startup in my environment- it is supposed to be polling the asterisk_mbox server? I see events flying around on the asterisk_mbox side, but nothing coming back into hass.
I also didnāt get the delete or the playback going either- one thing at a time! On the delete end of things- i know the request is making it to the asterisk_mbox side, but havenāt looked much further than that.
This has obviously seen limited testing, Iām sure having others test it will help make it more robust.
It should work as followis:
The asterisk-mbox-serevr is started on the asterisk server. It will monitor the VM directory. and send all clients an update when there are changes.
The client connects to the server on HASS startup. It should receive changes in real time and display them as they come.
Playback is achieved by a requiest from the client to the server which does a real-time translation via LAME to mp3 and then streams the result back to the client.
Delete isnāt yet implemented on the server (though the client has all the necessary code already). The reason is because I implemented it at the same time as CDR monitoring, and the latter isnāt working, and then I got distracted with some other projects.
If you arenāt seeing updates, the most likely cause would be that the inotify code which monitors the VM directory isnāt working. That is something else Iāve redone in my development branch, and should work on other platforms. What OS is your asterisk running on? If it is linux, than it should work as is. If not, Iām not 100% sure.
Your HASS logs should indicate communication I think
okay thanks for the explanation there- just trying to get a general understanding before I dive deeper. Iāll fork your asterisk-mbox repo so I can contribute to it. I think the inotify piece is OK because I do see messages flying around when I run the service at the command line, and I leave a voicemail. Iām running it on archlinux.
The part I was missing was the part where HASS was to be notified. I think I missed the callback that is supposed to be sending something to connected clients. Iām running asterisk+asterisk_mbox_server all on 1 machine, and hass is on a separate box.
Anyway- iāll dig into it and let you know what I find.
Okay- havenāt had much time to work on this, but Iām starting to get a little further into why this isnāt working for me.
Upon first startup, hass calls over to mbox server, and parses the resulting JSON just fine.
However, when mbox server alerts hass to an update (after i leave a message), hass throws this error:
File ā/home/xxxx/home-assistant/homeassistant/components/asterisk_mbox.pyā, line 73, in
key=lambda item: item[āinfoā][āorigtimeā],
TypeError: string indices must be integers
Temporarily commenting out those lines causes hass to work.
I put in some extra debugging on the mbox server side to dump out the json so I could look at it- it looks fine- meaning it should find an āinfoā item and an āorigtimeā item.
Any ideas on what might be different between when hass asks for a mailbox status vs. mbox server alerting hass?
Can you dump out the jcon to the log at line 72 and either file a ticket on gthub with it, or PM me the json (leave the error in place temporarily to make sure the error actually occurs)? Hopefully it will be clear up the issue. I was thinking it may be a race condition where the file is read before it has fully been written, but Iāll need to see the JSON to see what is going on