-
Notifications
You must be signed in to change notification settings - Fork 485
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ISAPI audio input not working to Hikvision DS-2CD2386G2-ISU/SL #962
Comments
@f1d094 I have an Anpviz camera with two-way audio that I think uses ISAPI. But I am having trouble getting any access to it via the command line using curl. Any suggestions? I can connect to the camera using the go2rtc instance in Frigate, but not the go2rtc add-on in Home Assistant. |
@Cold-Lemonade: I don't know anything about Anpviz cameras. The ISAPI I am referring to is unique to Hikvision. Unless the Anpviz cameras are hikvision clones and use the same API I would guess it is entirely different. I cobbled together those commands from the Hikvision ISAPI reference, which I will note has several typos. For example, Using GET in one example where it should be PUT and entirely failing to state that they require digest authentication. But if you can't get it to work on the command line using curl, then it is certain to not work via HASS. Frigate has no microphone support. |
@Cold-Lemonade: I just realized this is under my original issue. I created my own workaround and put in a PR for the fix PR#967. I think it might be done better but it works. I am now using my own version of go2rtc 1.8.5 and I can chat with people at the front door via HASS using the Frigate Card. Check the frigate docs on how to use an external go2rtc. It is pretty straightforward. |
Additional Note: Using the WebRTC card trick of unloading and reloading when you turn the microphone on and off was too much for it to handle and everything winds up in an unusable state. I think the Frigate Card keeps the channel open and just mutes/enables the microphone client side...maybe not, but it is stable in any case. The WebRTC card was highly problematic. |
Hey @f1d094 , i have same issue on my intercom
When i start two way audio with the card:
If i then press the mic button again, to stop two way audio AND i send this command afterwards:
I still see the enabled = true when i do the curl to see the channels, is that normal?
It seems it goes back to false, when i browse away from the lovelace card, maybe its because the RTSP stream is still active |
Hi @pergolafabio. It is my understanding that the channel will stay open, expecting data, until it either receives an explicit call to close or it receives audio data and the audio stream terminates. Either of these then closing the channel, which should result in Just testing this now I see that if I explicitly close the homeassistant app after enabling the mic (iPhone/iPad apps) the channel appears to stay open until I reopen homeassistant or visit via my browser on PC... |
Gonna go a real test tomorrow when I'm home, gonna start two way audio with frigate, the stop the audio using the mic button on frigate card, then send the curl to close the channel... |
It's strange that I notice the issue only with frigate card... With the webrtc card I can start/stop two way audio without an issue |
I'm afraid I had already abandoned the WebRTC card in favor of the Frigate Lovelace Card well-before I had any idea of any of the underlying problems...largely because of cosmetic reasons on how I wanted to integrate into my setup. The Frigate Card has more flexibility where I needed it. I do however remember that as long as I was super slow-motion about my changing state of the microphone that the WebRTC card worked well. I suspect that is because it fully closes the audio channel each time you turn off the mic, which is an alternate trigger to cause the ISAPI interface to close. I no longer have a WebRTC card setup to test with however, I'll be curious to see what you find. |
Will test tomorrow!! :-) |
@AlexxIT - FYI...I've been using my fork for a while now and it seems solid, except as noted here: #967 (comment) I think there is an issue with the way the Frigate Lovelace Card enables the mic but have not found the bandwidth to do any testing. YMMV. |
@AlexxIT - Following up - @dermotduffy clued me in on setting the mic to always-enabled which has resolved my remaining issue. Using my patched go2rtc the microphone consistently and smoothly loads and works as expected |
Hey, can this ticket openend again? I just updated to 1.9.0 , but the audio is not open again the second time
how can i debug this? |
I don't have this cameras, so can't help |
Hey @f1d094 , how can I troubleshoot this ? Seems the close command is not used? |
@pergolafabio The proposed fix was accepted and merged :) https://github.com/AlexxIT/go2rtc/releases/tag/v1.9.0 |
Yes, I tried 1.9.0, but it doesn't solve the problem for me... When intercom was in use with an two way audio session , if I stop the intercom from ringing, and I start two way audio, I doesn't initiate it... I still need to send the curl before I start the two way audio |
I'm afraid I only have a regluar camera with microphone...my doorbell is just a doorbell. Looks like it might be time to get some .pcap dumps and use wireshark to look over what is actually happening. The process is probably different. Also have a look at the Hikvision ISAPI docs; somewhere in there should tell you what the expected steps are for the doorbell function and how it works with the TwoWayAudio. |
Yeah, I know the docs... The process is like.. If the second call comes in, I stop the ringing, if I then start two way audio with frigate, I can't hear the audio, unless I send the close channel command.. unless, if I close or browse away from the frigate card, and I refresh the card, then I can initiate again the two way audio.,. If I don't do that, it never works the second time... So it's still related my guess to go2rtc or frigate... |
It is impossible to say at this point. The only way to find out is...to find out. Do a tcpdump of the traffic and open the capture file in wireshark and see what is actually happening. On your Frigate box, try: The way my setup works the card is closed and/or opened when I browse to it via the app and it opens and ISAPI two-way audio connection which it keeps open until I close the card. This now works great. One other thing I can think of to do: Be certain to restart your frigate a couple of times after changing go2rtc version. There is definitely some caching of some sort going on and I find that Frigate will not run smoothly unless I bounce it twice after any major update. No idea why... |
Ok, I will do that later... Thnx.. I don't use frigate add-on, only the frigate card |
ok, i did a wireshark, and i see indeed ISAPI commands |
@pergolafabio have you using webrtc card? There is good example in first message. |
No, I use the frigate card... |
The webrtc card is purposely made to have the stream stops when switching to another stream. Exactly because of these problems with two way audio. |
Ok, makes sense, I think the issue can be closed again, it's indeed related to frigate... I need to find a way to actually restart the stream when toggling the mic button |
FYI: The Frigate card does restart the stream on the first press of the unmute button. This is how the microphone stream gets attached into it in the first place. The only exception is if you use If you'd like to discuss further, lets discuss over here: https://github.com/dermotduffy/frigate-hass-card/issues |
Ok, I had an issue open here: |
@f1d094 i have the exact same camera but behind the hikvision nvr. I setup the webrtc card but no mic is getting to the camera. It is recording in app or browser well, but no sound. Even tested with curl, everything look likes oke (opening/closing just status OK and sessionid), after sending 8khz ulaw, but do not hear anything. |
Although I am able to send audio to the camera via curl, audio via the ISAPI connection via go2rtc fails to send. Modifying client.go to call '/ISAPI/System/TwoWayAudio/channels/1/close' before '/ISAPI/System/TwoWayAudio/channels/1/open' allows the connection to actually open...but it isn't reliable.
curl --digest "http://$USER:[email protected]/ISAPI/System/TwoWayAudio/channels"
Output:
curl --digest -X PUT "http://$USER:[email protected]/ISAPI/System/TwoWayAudio/channels/1/close"
Output:
curl --digest -X PUT "http://$USER:[email protected]/ISAPI/System/TwoWayAudio/channels/1/open"
Output:
Finally, sending audio file which works:
curl --digest -X PUT -H "Content-Length: 0" -H "Content-Type: application/octet-stream" -d @duck.ulaw "http://$USER:[email protected]/ISAPI/System/TwoWayAudio/channels/1/audioData"
Review of .pcaps revealed constant authorization errors. After a lot of poking, I found that if I did:
curl --digest -X PUT "http://$USER:[email protected]/ISAPI/System/TwoWayAudio/channels/1/close"
Before opening the MicOn view then it would work. This is the card config:
I tried to modify /pkg/isapi/client.go to do a 'close' before 'open' and that kindof works but isn't reliable, go2rtc sometimes not returning with a stream when switching the from microphone off/on.
The text was updated successfully, but these errors were encountered: