I've made some changes to get kb2kskype to play with a mixed PSTN and Skype hookup. I will clean the code up this weekend and post here, but in the meantime I should ask a few questions about how it should be set up.
Currently, the mods force the telbox into PSTN mode, and switch to Skype when a number is dialed with a leading "*". The line flips back to PSTN mode after the call is completed. It handles a problem in the interaction with usbb2k_api, that emits cruft output on the socket (the previous two keys pressed ... ?) at random times when the handset is off-hook. At the weekend, I'll look into getting the thing ringing the phone for incoming Skype calls.
Before this stuff can be merged, it will have to be refactored to provide for a Skype-only environment; without the dial tone provided by the PSTN connection, the box goes dead, so it will only work in a mixed environment.
I'm wondering how the additional functionality should be set up? Some means of setting the default mode during an unattended startup needs to be in there. There's no option parsing infrastructure in the code yet. Would anyone be willing to add that in? I don't know C++ at all (I've been working by guess and by gosh based on a limited knowledge of Python), and wouldn't know where to start myself.
I'll check back here from time to time for a response. Or feel free to write direct on biercenator@gmail.com.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
From my point of view the problem that I have is that I have no clue how the hardware works so I don't know how to work out if there is a PSTN tone, but I'm guessing the people using this application will or won't be using a phone line, so a solution would be to add a flag upon launching the program to say use PSTN so you would start the program as kb2kskype -pstn and behave as you have it otherwise stay as it is now. (I think stick with USB as default as that is what people are used to now?) And add it to the instructions.
Then just parse argc and argv for the flag. You could then set a global flag to know which mode it is working in and take it from there. Unfortunately I don't have a PSTN line so I can't help with debugging but if you want to send me your changes I will gladly add them to the code.
As for making the box ring when you get a call from skype I guess you need to switch mode to usb then start ringing.(also set the ringing flag / incall flags) Is there a way to tell if its currently in a call on the PSTN line ? if not then you will end that call when you switch to USB to turn on the ringer. (Any idea how the windows version handles this situation?)
p.s. what was the bug in usbb2k_api ? Have you seen the other patch that I need to include about every 32nd key press being set to 0.
Simon
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I've placed the two patches in the kb2kskype tracker. I hope they work for you.
Basically, these make the telbox behave in the same way as it does under the Windows driver, using the * key as a prefix to select Skype when in PSTN mode.
The usbb2k_api layer was spewing an endless stream of messages onto the socket, which made it hard to control what was going on (you had to assume that a HANDSET ON or message or spurious keypress might come down the pike at any moment). The patch to usbb2k_api seems to clear this problem up, and will simplify things on the kb2kskype side (although that does not show in my coding, I'm afraid).
I floundered around quite a bit getting things into a working state, and I'm afraid that I've made a mess of the formatting, but it should compile and run. Apart from the details given under the patches, there are a few specific things I would like to apologize for. I converted phoneNumber from a char (?) to a pointer, when I was trying to figure out where old characters were creeping back into the processCommands machinery. I now realize that this was completely unnecessary, but I decided to be lazy and not change it back. The other item I should mention is the "**#" mode-switch keystrokes. At the very final stage, when everything else was (touch wood) working as expected, I restored the code for these, and it wouldn't behave smoothly for some reason. I've commented it out, but if you find that it does actually still work, there's no reason to drop it. Again, I've just been lazy. About the options this, once I looked inside the config file, I realized that the simplest thing to do would be to just make the setting persistent. That's what the Windows driver does too, I think, no harm in following the crowd, I guess.
Hope it works for you. And thanks for this app, it's going to make a big difference in our home (after my wife recovers from the horror of seeing me grind away at debugging for the past day and a half :).
Frank Bennett
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
One other apology item that I forgot to mention is the commenting out of the initial "Connected to USB device" message. During debugging, I sometimes had quite a few b2kFeedbackMessage signals going, and lots of traffic in the debugging box. I started seeing frequent "Xlib: unexpected async" errors,
which brought kb2kskype to a halt, sometimes crashing, sometimes freezing.
Apparently this is a side-ffect of writing to the GUI from outside the
GUI thread. I have no idea whether that is something that applies to
kb2kskype, but to be on the safe side I commented out the startup
connection message as well, so that startup is "silent".
It's not like I know what I'm doing, but at least that was the reason
for quashing all routine messages.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
(For incoming Skype calls, usbb2k_api passes through HANDSET ON and HANDSET OFF events even when in PSTN mode, so I just hooked that up to the incall flag, so that the existing call handler will not attempt to clobber a call when the handset is in use.)
Frank
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I've made some changes to get kb2kskype to play with a mixed PSTN and Skype hookup. I will clean the code up this weekend and post here, but in the meantime I should ask a few questions about how it should be set up.
Currently, the mods force the telbox into PSTN mode, and switch to Skype when a number is dialed with a leading "*". The line flips back to PSTN mode after the call is completed. It handles a problem in the interaction with usbb2k_api, that emits cruft output on the socket (the previous two keys pressed ... ?) at random times when the handset is off-hook. At the weekend, I'll look into getting the thing ringing the phone for incoming Skype calls.
Before this stuff can be merged, it will have to be refactored to provide for a Skype-only environment; without the dial tone provided by the PSTN connection, the box goes dead, so it will only work in a mixed environment.
I'm wondering how the additional functionality should be set up? Some means of setting the default mode during an unattended startup needs to be in there. There's no option parsing infrastructure in the code yet. Would anyone be willing to add that in? I don't know C++ at all (I've been working by guess and by gosh based on a limited knowledge of Python), and wouldn't know where to start myself.
I'll check back here from time to time for a response. Or feel free to write direct on biercenator@gmail.com.
From my point of view the problem that I have is that I have no clue how the hardware works so I don't know how to work out if there is a PSTN tone, but I'm guessing the people using this application will or won't be using a phone line, so a solution would be to add a flag upon launching the program to say use PSTN so you would start the program as kb2kskype -pstn and behave as you have it otherwise stay as it is now. (I think stick with USB as default as that is what people are used to now?) And add it to the instructions.
Then just parse argc and argv for the flag. You could then set a global flag to know which mode it is working in and take it from there. Unfortunately I don't have a PSTN line so I can't help with debugging but if you want to send me your changes I will gladly add them to the code.
As for making the box ring when you get a call from skype I guess you need to switch mode to usb then start ringing.(also set the ringing flag / incall flags) Is there a way to tell if its currently in a call on the PSTN line ? if not then you will end that call when you switch to USB to turn on the ringer. (Any idea how the windows version handles this situation?)
p.s. what was the bug in usbb2k_api ? Have you seen the other patch that I need to include about every 32nd key press being set to 0.
Simon
Simon,
I've placed the two patches in the kb2kskype tracker. I hope they work for you.
Basically, these make the telbox behave in the same way as it does under the Windows driver, using the * key as a prefix to select Skype when in PSTN mode.
The usbb2k_api layer was spewing an endless stream of messages onto the socket, which made it hard to control what was going on (you had to assume that a HANDSET ON or message or spurious keypress might come down the pike at any moment). The patch to usbb2k_api seems to clear this problem up, and will simplify things on the kb2kskype side (although that does not show in my coding, I'm afraid).
I floundered around quite a bit getting things into a working state, and I'm afraid that I've made a mess of the formatting, but it should compile and run. Apart from the details given under the patches, there are a few specific things I would like to apologize for. I converted phoneNumber from a char (?) to a pointer, when I was trying to figure out where old characters were creeping back into the processCommands machinery. I now realize that this was completely unnecessary, but I decided to be lazy and not change it back. The other item I should mention is the "**#" mode-switch keystrokes. At the very final stage, when everything else was (touch wood) working as expected, I restored the code for these, and it wouldn't behave smoothly for some reason. I've commented it out, but if you find that it does actually still work, there's no reason to drop it. Again, I've just been lazy. About the options this, once I looked inside the config file, I realized that the simplest thing to do would be to just make the setting persistent. That's what the Windows driver does too, I think, no harm in following the crowd, I guess.
Hope it works for you. And thanks for this app, it's going to make a big difference in our home (after my wife recovers from the horror of seeing me grind away at debugging for the past day and a half :).
Frank Bennett
One other apology item that I forgot to mention is the commenting out of the initial "Connected to USB device" message. During debugging, I sometimes had quite a few b2kFeedbackMessage signals going, and lots of traffic in the debugging box. I started seeing frequent "Xlib: unexpected async" errors,
which brought kb2kskype to a halt, sometimes crashing, sometimes freezing.
Apparently this is a side-ffect of writing to the GUI from outside the
GUI thread. I have no idea whether that is something that applies to
kb2kskype, but to be on the safe side I commented out the startup
connection message as well, so that startup is "silent".
It's not like I know what I'm doing, but at least that was the reason
for quashing all routine messages.
(For incoming Skype calls, usbb2k_api passes through HANDSET ON and HANDSET OFF events even when in PSTN mode, so I just hooked that up to the incall flag, so that the existing call handler will not attempt to clobber a call when the handset is in use.)
Frank