tomek-o/tSIP

Headset button support please

Northernn opened this issue · 51 comments

So headset buttons can be used to answer/hangup calls, it works in microsip but not in tsip, would be really nice to have it working in tsip

Depending on headset type try either hotkeys (media keys) or HidControl plugin (might require manual configuration).

Thanks I will try hotkeys, I tried HidControl without any success.

Only reason I mentioned microsip works is because you only have to tick a box "headset support" and it works right out of the box. I will let you know if I find a solution with hotkeys.

The headset is the Jabra Evolve 65 wireless

HidControl.dll should generate some logs and should also be pretty easy to compile and debug. First step should be probably determining whether headset works as HID Telephony or media keys. One I've described, M890DBT uses actually both modes (one at the time) depending on whether microphone is in use or not.

I kept getting this in the log
[HidControl.dll] Error opening USB device (USB VID 0x1395, PID 0x0026, usage page 0xB): Device not found

I tried to find the PID and VID but the only thing I could find was this:

Parent Device: USB\VID_0B0E&PID_245E&MI_00\6&3390c61d&1&0000
Putting these in to HID gave the same message about device not found

I did find this though on their website, but whatever I try it just says "Error opening USB device"
https://developer.jabra.com/site/global/sdks/web/documentation/index.gsp

[HidControl.dll] Error opening USB device (USB VID 0x1395, PID 0x0026, usage page 0xB): Device not found

Doesn't seem to matter what I put into the cfg file it always says that same message.

Try putting into HidControl.cfg: usbPid = 9310, usbVid = 2830 (these are 0x245E and 0x0B0E converted to decimal). Note: file should be edited when plugin/application is not running, otherwise user changes might disappear.

If you want to make sure if headset is using or not using media keys you might try https://w3c.github.io/uievents/tools/key-event-viewer.html.

That seemed to pick up the device, when it rings it now shows:

Skipping playing - 2 seconds not passed
[HidControl.dll] HID REPORT_IN received 65 B: 0x04 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x30 0x78 0x37 0x37 0x20 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x08 0x05 0x00 0x00 0xCC 0x05 0x00 0x00 0xAC 0x05 0x00 0x00

But the button still does nothing.

I set a hotkey too to media play/pause = anser/hangup but the button still does nothing, just tells you the battery status.

Nothing comes up on the webpage at all when you press the button, so I assume it isn't using media keys?

If I run MicroSIP at the same time and answer with that one I get this in the logs

delta = 7
[HidControl.dll] HID REPORT_IN received 65 B: 0x07 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x30 0x78 0x37 0x37 0x20 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0xE0 0x05 0x00 0x00 0xE8 0x05 0x00 0x00 0xA0 0x05 0x00 0x00
Running Lua script: on_dialog_info_20220128_201544_594.lua
on_blf_state: number 170 state = 1
[HidControl.dll] HID REPORT_IN received 65 B: 0x06 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x30 0x78 0x37 0x37 0x20 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0xE0 0x05 0x00 0x00 0xE8 0x05 0x00 0x00 0xA0 0x05 0x00 0x00
[HidControl.dll] HID REPORT_IN received 65 B: 0x04 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x30 0x78 0x37 0x37 0x20 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0xE0 0x05 0x00 0x00 0xE8 0x05 0x00 0x00 0xA0 0x05 0x00 0x00
[HidControl.dll] HID REPORT_IN received 65 B: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x30 0x78 0x37 0x37 0x20 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0xE0 0x05 0x00 0x00 0xE8 0x05 0x00 0x00 0xA0 0x05 0x00 0x00

Let's assume media keys would not be in use (if you have configured hotkeys for them you might delete or disable them temporarily).

[HidControl.dll] HID REPORT_IN received 65 B: 0x04 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x30 0x78 0x37 0x37 0x20 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x08 0x05 0x00 0x00 0xCC 0x05 0x00 0x00 0xAC 0x05 0x00 0x00

Let's look for these events. In HidControl.cfg they can be matched byte-by-byte and then associated script is started (different scripts for different reports).
Is there some REPORT_IN like this when button is pressed or is this one really just related to ringing (and are there no reports if MicroSIP is not running)?
It might be also worth checking if received reports are same for button each time and how does long pressing button works. There is also slim chance that reports while in call might look different.
Mairdi Headset required checking option "Audio I/O" / "Start audio input before call is confirmed" (last one from the "Audio I/O" settings page), it might be worth trying.

If MicroSIP is not running I only get the one starting 0x04, and thats before I press anything, then when I press something nothing happens.

If I open Microsip and press the button it answers the call and i get the 0x07, etc in the logs on tsip, I think 7 is the button press and 4 might be the hangup or 0 not sure.

I did follow that page on that headset and ticked that box just in case it made a difference, but it hasn't

From jabra documentation it looks like this headset might work in a stateful way, so it might not send any event until it receives "ring" or "off hook" event. This might be hard for me to debug remotely and I don't have much experience with USB headsets. Maybe I'll get my hands on similar headset later.

Well thanks very much for your time looking at this, shame it wasn't an easy fix!

Do you know which headsets do work with the buttons to answer/hang up?
I want to get one and test it to make sure as the Jabra deffo doesn't.

Thanks

I can't tell much as I've tested only a few devices: EX-03 USB phone, some keyboard with integrated headset, Mairdi M890 (and this one looks dead at the moment, maybe it self-discharged below critical point, so I would be cautious about it). Philips VoIP 151 is waiting, but that's corded again, AIKELA M100C - also untested yet.

Regarding jabra: could you tell me if https://github.com/nondebug/jabra-webhid-demo works with your model and what would be correct event sequence to get answer/hangup events?

No, you can see it in the list when you click connect:
"Jabra Link 370 - Paired"
but it doesn't do anything when you click connect so everything remains grayed out.

The 370 is the usb dongle it uses to connect, and the headset is evolve 35,.
I did find this, but it seems to be python.

https://github.com/lalmeras/jabra_link_370

and this one which is c#

https://github.com/edgarleonz/jabra-end-interaction-extension-for-genesys-workspace-desktop-edition

but I haven't worked out how to test them yet.

I've got now Jabra Evolve 65 "old model" (as there are two models apparently - old model has silver ring and new one is all black I think). Unfortunately I don't have Jabra Link 370, but I'm hoping that direct USB connection to the headset that I'm testing would work the same way as connection through Jabra Link 370. Please see how this would work for you:
https://github.com/tomek-o/tSIP-plugin-HidPhone/releases/tag/v0.1
Single tap answers incoming call.
Double tap rejects incoming call.
Single tap terminates - with weird 3 s delay - confirmed or outgoing call.

Initial test works fine on Wireless button press, Jabra 65 also via the Link 370, mine has the silver ring, but we have others I will check them. I will do sme more testing today.

Been testing this, it works fine on the headset with the silver ring on the edge, but not at all on the black egde headset, just as you thought it would. On the black one the button just doesn't do anything, and yes it works via the 370, but again not with the black edge headset.