Skip to content
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

Headset button support please #32

Closed
Northernn opened this issue May 31, 2022 · 51 comments
Closed

Headset button support please #32

Northernn opened this issue May 31, 2022 · 51 comments

Comments

@Northernn
Copy link

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

@tomek-o
Copy link
Owner

tomek-o commented May 31, 2022

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

@Northernn
Copy link
Author

Northernn commented May 31, 2022

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

@tomek-o
Copy link
Owner

tomek-o commented May 31, 2022

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.

@Northernn
Copy link
Author

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.

@tomek-o
Copy link
Owner

tomek-o commented May 31, 2022

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.

@Northernn
Copy link
Author

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?

@Northernn
Copy link
Author

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

@tomek-o
Copy link
Owner

tomek-o commented May 31, 2022

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.

@Northernn
Copy link
Author

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

@tomek-o
Copy link
Owner

tomek-o commented May 31, 2022

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.

@Northernn
Copy link
Author

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

@Northernn
Copy link
Author

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

@tomek-o
Copy link
Owner

tomek-o commented Jan 19, 2023

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?

@Northernn
Copy link
Author

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.

@tomek-o
Copy link
Owner

tomek-o commented Mar 30, 2023

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.

@Northernn
Copy link
Author

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.

@Northernn
Copy link
Author

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.

@mesb1
Copy link

mesb1 commented Sep 21, 2023

Hi.
I was planning to buy gigaset ion speakerphone.
It looks like they have shared some data about hid communication as it has soma buttons like answer\end\mute\etc:
https://teamwork.gigaset.com/gigawiki/display/GPPPO/FAQ+ION+-+USB+HID+commands

Maybe someone already tried it and might confirm if it will work out of the box or tsip should be configured somehow?

@mesb1
Copy link

mesb1 commented Sep 21, 2023

Not sure i did something right.
Installed plugin, restarted tsip, fixed hid cfg to:

  "usbPid" : 111D,
  "usbUsagePage" : 11,
  "usbVid" : 1E85

Right after new tsip run it's log shows:

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

When i stop it it just goes back to old settings inside of cfg file :(

@tomek-o
Copy link
Owner

tomek-o commented Sep 21, 2023

"usbPid" : 111D,
"usbVid" : 1E85

You have to convert these numbers from hex to decimal (4381 and 7813 respectively, similar to 11 being used as 0xB HID usage page) as hex numbers are not valid in plain JSON and default values were used instead (VID 0x1395, PID 0x0026).

I think I would recommend trying HidPhone.dll first if you haven't - it is supposed to at least recognize OFFHOOK action without any additional configuration and it would enumerate USB devices looking for 0xB page, not requiring entering VID/PID if there is only one device.

@mesb1
Copy link

mesb1 commented Sep 21, 2023

Looks like i got some updates, i assume those pids is in hex, so i need to convert it for tsip:

  "usbPid" : 4381,
  "usbUsagePage" : 11,
  "usbVid" : 7813

Errors was stopped, but behaviour has changed to smoething weird, initiated call from tsip to my mobile, and speakerphone started with disabled microphone.
When i pressed offhook button nothing happens, but when i was press mute\unmute tsip has ends the call:

[HidControl.dll] HID REPORT_IN received 65 B: 0x09 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x01 0x02 0x00 0x00 0x00 0x08 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 0x0C 0x05 0x00 0x00 0xF4 0x04 0x00 0x00
[HidControl.dll] HID REPORT_IN received 64 B: 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x01 0x02 0x00 0x00 0x00 0x08 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 0x0C 0x05 0x00 0x00 0xF4 0x04 0x00
[HidControl.dll] Running script #0:
local callState = GetCallState()
if callState == 1 then -- INCOMING
Answer()
else
Hangup()
end

@mesb1
Copy link

mesb1 commented Sep 21, 2023

Oh, you already found my errors.
I will take a look to HidPhone.

@mesb1
Copy link

mesb1 commented Sep 21, 2023

Not really sure what is giong on, but tsip frequently quits with HidPhone plugin enabled.
This time speakerphone started with light blue light enabled just like it does with teams.

But nothing shows on the log windows of tsip when i pressed mute button, just ends the call :(

@tomek-o
Copy link
Owner

tomek-o commented Sep 21, 2023

HidControl.dll default configuration is for Mairdi M890BTD and this is a headset with basically single button, recognized by single 0x01 byte with Answer/Hangup action assigned (in HidControl.cfg JSON file there is a single entry in the reportActions array). It looks like accidentally ION is sending report starting with 0x01 for Mute button. If you would see some reports in log when Answer and Hangup buttons are pressed (maybe one of them is the one starting with 0x09 above), you could use them to create actions. Each action consists of bytes array to check against (just 0x01 in default configuration) for match and script to be executed.
I'm not sure if ION would send button reports if call state would not be set first though - this was the case for Jabra.

Regarding quitting when using with HidPhone.dll - it could be dll crashing. Are you interested in installing Code::Blocks 16.01/MinGW and trying to debug it by any chance?

@mesb1
Copy link

mesb1 commented Sep 21, 2023

Regarding quitting - it could be dll crashing. Are you interested in installing Code::Blocks 16.01/MinGW and trying to debug it by any chance?

Only on the weekend i can try to search what does code::blocks mean as iam not really used mingw in my life, only some apps build with it.
Right now i will try to do clean install of 0.3.00 and HidPhone instead of upgrade 0.2.10 -> 0.3.00 by overwrite.

@mesb1
Copy link

mesb1 commented Sep 21, 2023

Yep, clean install doesn't help.
I have started tsip with plugin, open log windows and press answer button. (no any call initiated at all)
Last thing i was able to see some information from plugin and tsip closes.

image

@mesb1
Copy link

mesb1 commented Sep 21, 2023

Can't get anything for offhook, as tsip just quits right after press now.

Also i have tried microsip also with ticked headset support.
Behaviour looks fine, it can drop call and mute button works correctly.
But i like your app. Will proceed on weekend with mingw search and install.

@tomek-o
Copy link
Owner

tomek-o commented Sep 21, 2023

I would assume that you don't have prior experience with C/C++/MinG, adding new IDE and initial setup to that - it might be too much for a weekend. In the past I've done some debugging remotely over TeamViewer, but the guy that gave me the access had a fresh, separate PC so there were no privacy concerns. I could also try to add more logs to dll, but this could be painful, iterative and slow comparing to catching it with debugger.

It might be worth trying again HidControl.dll (both plugins can be "installed" same time, just activate/deactivate them one at the time) and checking if it logs any reports for Answer/Hangup handset buttons.

@mesb1
Copy link

mesb1 commented Sep 21, 2023

You are right, i am not a programmer so it might take more time.

Right now activated HidControl, opens log window and pressed answer button i got this after some time:

[HidControl.dll] HID REPORT_IN received 64 B: 0x00 0x00 0xFF 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x01 0x02 0x00 0x00 0x00 0x08 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 0x14 0x05 0x00 0x00 0x80 0x04 0x00 0x00 0x68 0x04 0x00
[HidControl.dll] HID REPORT_IN received 64 B: 0x01 0x00 0xFF 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x01 0x02 0x00 0x00 0x00 0x08 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 0x14 0x05 0x00 0x00 0x80 0x04 0x00 0x00 0x68 0x04 0x00
[HidControl.dll] Running script #0:
local callState = GetCallState()
if callState == 1 then -- INCOMING
Answer()
else
Hangup()
end

Nothing happens for end call and mute buttons.

When i initiated a call, nothing happens for end call button.

But this happens for answer button and tsip ends the call:

[HidControl.dll] HID REPORT_IN received 65 B: 0x00 0x00 0xFF 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x01 0x02 0x00 0x00 0x00 0x08 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 0x14 0x05 0x00 0x00 0x80 0x04 0x00 0x00 0x68 0x04 0x00 0x00
[HidControl.dll] HID REPORT_IN received 64 B: 0x01 0x00 0xFF 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x01 0x02 0x00 0x00 0x00 0x08 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 0x14 0x05 0x00 0x00 0x80 0x04 0x00 0x00 0x68 0x04 0x00
[HidControl.dll] Running script #0:
local callState = GetCallState()
if callState == 1 then -- INCOMING
Answer()
else
Hangup()
end

And this one happens for mute button and tsip ends the call:

[HidControl.dll] HID REPORT_IN received 65 B: 0x09 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x01 0x02 0x00 0x00 0x00 0x08 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 0x14 0x05 0x00 0x00 0x80 0x04 0x00 0x00 0x68 0x04 0x00 0x00
[HidControl.dll] HID REPORT_IN received 64 B: 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x01 0x02 0x00 0x00 0x00 0x08 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 0x14 0x05 0x00 0x00 0x80 0x04 0x00 0x00 0x68 0x04 0x00
[HidControl.dll] Running script #0:
local callState = GetCallState()
if callState == 1 then -- INCOMING
Answer()
else
Hangup()
end

Btw, unlike with HidPhone, no light blue light on the speaker phone, it looks like HidControl doesn't provide some data to the speaker.

@tomek-o
Copy link
Owner

tomek-o commented Sep 21, 2023

Your observation seems correct, Gigaset is probably stateful like Jabra and basic report matching from HidControl.dll is not enough (at least hangup button would not work).

Another idea: I've attached debug build of HidPhone.dll and https://github.com/jrfonseca/drmingw (I've installed 64-bit version locally by running "drmingw -i" from command line in administrator mode) seems to be catching my test crash with useful trace.
Could you try it?

HidPhone.zip

@mesb1
Copy link

mesb1 commented Sep 21, 2023

Sure.
Now tsip isn't silently quits :)

tSIP_nocalls_answerbutton.log
tSIP_outcall_answerbutton.log
tSIP_outcall_endbutton.log
tSIP_outcall_handsfree-headsetbutton_endedbyotherside.log
tSIP_outcall_mutebutton.log

All this time light blue ring led also works correctly from my side.
But the actions for the buttons itself isn't the one that is needed.

For now i haven't tried incoming calls, as i don't understand how to call to the tsip directly from my ipphone and it cannot dial something like 3001@192.168.1.80:5060, only 192.168.1.80:5060.

@tomek-o
Copy link
Owner

tomek-o commented Sep 21, 2023

Now tsip isn't silently quits :)

Nasty. If debug build works, it might be something like uninitiated variable. I would recommend using debug build for now then.

For now i haven't tried incoming calls, as i don't understand how to call to the tsip directly from my ipphone and it cannot dial something like 3001@192.168.1.80:5060, only 192.168.1.80:5060.

Calling "192.168.1.80:5060" should also work, assuming that in tSIP Account settings "Answer any call" is checked and tSIP is bound to port 5060 (Network: Local IP address = 0.0.0.0:5060 plus optionally selected network adapter below if needed). If there are multiple softphones and/or other clients then each one should have unique bind port. If binding address is empty then semi-random port assigned by OS is used that need to be checked in log.
Personally I'm often calling from one softphone to another or using free SIP accounts at sip2sip.info or iptel.org. Softphone that is making the call does not even necessary need account at sip2sip.info, only the one that is receiving the call.
Here are also few URIs for outgoing test calls:
sip:3333@sip2sip.info
sip:4444@sip2sip.info
sip:music@iptel.org
("sip:" prefix is important for tSIP, by convention user input is treated as full URI, not just user/number part then)

@mesb1
Copy link

mesb1 commented Sep 21, 2023

Now i got incall (in theory buttons should allow accept call or reject).
In this mode i got some dark blue light while incoming call, end button in theory should work as reject.
But not answer, not end(reject) do nothing.

tSIP_incall_answerbutton_endbyotherside.log
tSIP_incall_endbutton_endbyotherside.log

@tomek-o
Copy link
Owner

tomek-o commented Sep 21, 2023

In some of these logs I'm seeing few "Device connected" with capabilities enumeration logs but nothing in between, also not a lot of log lines related to actual calls - I feel like something important might be cut out. Is handset connected continuously?

@mesb1
Copy link

mesb1 commented Sep 22, 2023

Yes, it is connected continuously.

About logs, if there is a way to produce more logs just share it with me, as of now it was logs window opened via view - logs and ticked save to file option.

With last incall logs I haven't touched interface buttons of the app, so it was ringing some time, I was touched ION answer or reject and then I have cancelled call on my ipphone.

@tomek-o
Copy link
Owner

tomek-o commented Sep 22, 2023

I'll be back with update in ~10 hours. Right now I'm thinking that this might be some device opening error that I'm not logging.

@mesb1
Copy link

mesb1 commented Sep 22, 2023

Got it.
For the logs, as far as I can see there is some HID REPORT_IN may be it was my button push during incoming ringing or outgoing established call.
So I assume it is visible by tsip plugin?

@tomek-o
Copy link
Owner

tomek-o commented Sep 22, 2023

In the last logs there was no hook reports but mostly strange reconnections. Now I think that this could be caused by buffer overflow I've found few minutes ago. It probably won't fix all functionality (if any), but this was very likely the reason for the crash (depending on USB device) in the release build and it could also cause some erratic behavior in debug build.
Updated binary: https://tomeko.net/tmp/HidPhone.dll

@mesb1
Copy link

mesb1 commented Sep 22, 2023

Well, first of all - tsip doesn't crash\quits\etc.

Now it was able to answer for incoming call with answer button.
But second answer button press during call - leads to call end.

Mute button during incoming or outgoing call also leads tsip to ends call.

During incoming rings press for end call button doesn't leads to reject - nothing happens.

tSIP_incall_answer_end-worksfine.log
tSIP_incall_answer-ok_answer-endscall.log
tSIP_incall_answer-ok_mute-endscall.log
tSIP_incall_reject-notwork.log
tSIP_outcall_answer-endscall.log
tSIP_outcall_end-worksfine.log
tSIP_outcall_mute-endscall.log

@mesb1
Copy link

mesb1 commented Sep 22, 2023

Hm, it looks like inside of the HidPhone.cfg there is some script also, and if i replace it with:

  "scriptOffHook" : ""

Answer/end doesn't work, but atleast mute is working during call, but i thing locally, as mute button on the tsip doen't moves.
I think for now logic isn't clear for me:

https://tomeko.net/software/SIPclient/HidPhone/

@tomek-o
Copy link
Owner

tomek-o commented Sep 22, 2023

I've updated https://tomeko.net/tmp/HidPhone.dll.
It uses now separate scripts for devices with absolute and relative USB usages. For end user this should not be important as default scripts should be fine. When upgrading, HidPhone.cfg should be deleted (when tSIP is not running) as my previous custom reject handling for Jabra headset should not be needed anymore.

Mute would not work out of the box yet. I'm using scripting for passing commands and while it can be very flexible I surprisingly don't have "Mute" Lua function - probably because I'm not using it myself. The workaround would be defining "Mute" programmable button and then using ProgrammableButtonClick(BUTTON_ID) in HidPhone.cfg as "scriptMuteToggle" value. BUTTON_ID = id of defined Mute button.

@mesb1
Copy link

mesb1 commented Sep 22, 2023

Something goes wrong and now answer button works as reject while incoming ring.

tSIP_incomingring_answer-rejected.log
tSIP_incomingring_reject-ok.log

@mesb1
Copy link

mesb1 commented Sep 22, 2023

Hm, changed scriptoffhook numbers and now endcall accepts it and answer rejects)

image

@mesb1
Copy link

mesb1 commented Sep 22, 2023

Looks like i am not clearly understand monents of different hooks running.
Could you please explain those:
"scriptOffHook0" :
"scriptOffHook1" :
"scriptOffHookToggle" :

Which of them runs for which moments?

At this screen there is a moment of incoming ring and my press of answer button, but log shows run hook0 and hook1 also.

image

@tomek-o
Copy link
Owner

tomek-o commented Sep 22, 2023

Could you please explain those:
"scriptOffHook0" :
"scriptOffHook1" :
"scriptOffHookToggle" :

"scriptOffHookToggle" is running if device is sending OffHook usage and its OffHook is not absolute - I suppose these would be devices without internal state, maybe without call state LEDs. For devices with absolute OffHook (these seem to be my Jabra and your Gigaset), either "scriptOffHook0" or "scriptOffHook1" depending on if report contains OffHook usage or not.

I've updated https://tomeko.net/tmp/HidPhone.dll once again. Looking into MicroSIP source code I see some tricky looking (at least it looks to me like a trick) code with call rejecting requiring two events in a row. This isn't breaking interoperability with my Jabra, but it should help with your Gigaset that when answering first is sending OffHook = 0 and then OffHook = 1.

@mesb1
Copy link

mesb1 commented Sep 22, 2023

It looks like now it works in a proper way.
Answers (repeated press doesn't affect now), rejects incoming rings, ends calls during talking, mute works locally (on speaker itself)
Will try to set mute with your recommendations via provided options for mute on the weekend.

Thank you for spending your time on me.
Is there anything i can help you with?

@mesb1
Copy link

mesb1 commented Sep 22, 2023

Just for history purposes, it looks like mute also was trying to run offhook1 along with mutetoggle:
image

@tomek-o
Copy link
Owner

tomek-o commented Sep 22, 2023

Just for history purposes, it looks like mute also was trying to run offhook1 along with mutetoggle

I'm not checking for offHook state changes, but offHook1 script checks if there is an incoming call on itself, so calling it multiple times would be harmless and I think it would be not possible to use "Answer" button on stateful/"absolute" phone for multiple purposes (contrary to stateless phone where each report would be equal to single press).
If mute would work locally on the handset then perhaps passing its state to softphone would be only partially useful, maybe only for visual feedback.

I'll bump dll version number / create release probably tomorrow. I would hope that non-debug build would not crash anymore (all the temporary compilation were debug builds), though I'll upload both just in case.

@mesb1
Copy link

mesb1 commented Sep 22, 2023

Ok, i will check released version also.
The one you provided last time looks stable, atleast i have made about ten calls between tsip and my home ipphone with no issue with different directions.

@mesb1
Copy link

mesb1 commented Sep 23, 2023

It looks like page:
https://tomeko.net/software/SIPclient/HidPhone/

Was updated with this archive:
https://tomeko.net/software/SIPclient/HidPhone/bin/tSIP-plugin-HidPhone-0.2.zip

I have got Release version, added it to the tsip with removing cfg file before tsip starts.

Did a few calls from\to ipphone so far so good.
Right now i leaved it online just to keep it online for a long talk.

@tomek-o
Copy link
Owner

tomek-o commented Sep 23, 2023

Thanks. I'm closing this issue as I believe it is fulfilled now by HidPhone.dll and any further problems should probably be assigned directly to either HidPhone.dll or HidControl.dll plugin projects.

@tomek-o tomek-o closed this as completed Sep 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants