I got sick of trying to explain to normal phone users about having to dial an international code for local calls and follow the number with a '#' to initiate the call.
The international code thing is really up to skype to fix, but I've hacked kb2k for the short term.
I think the more interesting hack is to the b2kinterface that effectively 'times out' after a given number of digits have been dialed and calls that number. It's pretty ugly - and hard coded atm - but it works.
if(q.contains("KEY ",false)){
// first keypress stops dial tone
- if (currentMode == USB)
+ if (currentMode == USB) {
+ timer->start(2000, TRUE);
if (phoneNumber == "")
stoptDialTone();
+ }
}
if(q.contains("USB DEVICE INIT ERROR", false)){
#ifdef USESYSLOG
@@ -411,7 +415,7 @@
{
QString* send = new QString("CALL ");
stoptDialTone();
- //ignore leading *, if any
+ //ignore leading *, if any (shouldn't be).
if (phoneNumber.find("*") == 0){
send->append(phoneNumber.right(phoneNumber.length() - 1));
}
@@ -435,6 +439,21 @@
}
+//
+void B2kInterface::dialTimeout(){
+ QString* send = new QString("CALL ");
+ stoptDialTone();
+ //ignore leading *, if any (shouldn't be).
+ if (phoneNumber.find("*") == 0){
+ send->append(phoneNumber.right(phoneNumber.length() - 1));
+ }
+ else{
+ send->append(phoneNumber.mid(0,100));
+ }
+ sendb2kMessageEvent(send);
+}
+
+
// set the status of the phone position
//
// Args: Status
--- kb2kskype-0.3.7/src/skypeapidlg.cpp 2008-02-06 13:25:38.000000000 +1300
+++ kb2kskype-0.3.7-NZcustom/src/skypeapidlg.cpp 2008-03-05 21:04:03.000000000 +1300
@@ -895,6 +895,19 @@
}else if (!incall){
incall = true;
b->stoptDialTone();
+ if (!str.startsWith("0", false)) {
+ message = QString("CALL "); // reset the message.
+ message.append("+64 "); // append the country code,
+ message.append("4 "); // the area code,
+ message.append(str); // and the original number.
+ }
+ else if (!str.startsWith("00", false)) {
+ message = QString("CALL "); // reset the message.
+ message.append("+64 "); // append the country code,
+ message.append(str.right(str.length() - 1)); // and the number minus leading 0.
+ }
+ // else it's an international call and should be sent as is...??
+ // END
sendMessage(message);
}
}
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Well I dont understand what you have done here, but it looks nice to me and it is what I have been looking for. Im using skype in windows right now because of this, my wife hates having to dial 001 for every call.
So I have one problems...how can I get what you did? I dont understand what you have done. Is this in the source and it has to be recompiled? Is it just a scrit I can stick somewhere?
Surprised no one responded to this. Are we the only ones that hate dial the country code?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have an alarm I wanted to be able to dial out. It has a limited space for the number and I dont have a # button on it . I need to get rid of the # and the 001 from the phone number going into b2k. I looked around in the code but thought it was messy and a bit over my head right now. I couldnt find where the numbers were
Is there a way to get kb2kskype to accept a number without a #, and stick the "001" in the front of the number before sending it to skype ?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I can add a default country code to the ini file, to remove the need for the 00 at the start. However the # at the end is more of a problem, as that is used as teh trigger to send the number to skype. (do you have a start button ?)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I see what you did now;very nice. I read through your patch file and apllied it to version 0.3.8 , but some stuff was changed like sendb2kFeedbackMessageEvent(QString) and sendb2kMessageEvent(QString) dont pass a pointer anynore it seems. nothing major to change i think. Redaing the complaints of the compiler can seem misleading sometimes though lol.
Doesn't if (!str.startsWith("0", false)) mean it is true if the leadning zeros are missing?
Also, i will only be using USB mode, so i can hack my k2bk as much as I need to let my just dial like a normal phone and not need the 001 , or the # right?
"(do you have a start button ?)" Do you mean do i have a send button on my phone? If so , yes I do.
However, on the alarm dialer, I think it just sends the tones for the 7 or so digits over the phone line and waits for the phone companie to do its thing? Not sure on that. Do the normal phone network require phones to send a special signal to say this is the end of the transmission of the number requested? Either way, the alarm dialer operates like a normal phone except I dont have the * or the # key on it to save those in the alarm dialers memory as part of the number.
kb2k doesn't actually send the # to skype does it? if so, we can just put it back in there automatically right?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hah, cool. Thanks Richard for figuring out how to do this. I got it working in version 0.3.8 but had to change some stuff because some functions pass values rather than addresses and stuff. I might try to put a couple of places in the form to enter default area codes and country codes and stuff if i have time. I think it would be cool if some of this were options in the actual releases. :) Fun stuff
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I got sick of trying to explain to normal phone users about having to dial an international code for local calls and follow the number with a '#' to initiate the call.
The international code thing is really up to skype to fix, but I've hacked kb2k for the short term.
I think the more interesting hack is to the b2kinterface that effectively 'times out' after a given number of digits have been dialed and calls that number. It's pretty ugly - and hard coded atm - but it works.
--- kb2kskype-0.3.7/src/b2kinterface.cpp 2008-02-06 13:33:29.000000000 +1300
+++ kb2kskype-0.3.7-NZcustom/src/b2kinterface.cpp 2008-03-05 21:03:42.000000000 +1300
@@ -38,6 +38,8 @@
currentMode = PSTN;
defaultMode = PSTN;
defaultModeString = "PSTN";
+ timer = new QTimer(this);
+ connect( timer, SIGNAL(timeout()), this, SLOT(dialTimout()) );
}
@@ -240,7 +242,7 @@
// Returns: void
void B2kInterface::clientQuiting(){
char str[50];
- strcpy(str,"Quit\n" );
+ strcpy(str,"QUIT\n" );
if (write(s, str,strlen(str)) == -1) {
#ifdef USESYSLOG
syslog(LOG_ERR,"Send ERROR 1");
@@ -331,9 +333,11 @@
if(q.contains("KEY ",false)){
// first keypress stops dial tone
- if (currentMode == USB)
+ if (currentMode == USB) {
+ timer->start(2000, TRUE);
if (phoneNumber == "")
stoptDialTone();
+ }
}
if(q.contains("USB DEVICE INIT ERROR", false)){
#ifdef USESYSLOG
@@ -411,7 +415,7 @@
{
QString* send = new QString("CALL ");
stoptDialTone();
- //ignore leading *, if any
+ //ignore leading *, if any (shouldn't be).
if (phoneNumber.find("*") == 0){
send->append(phoneNumber.right(phoneNumber.length() - 1));
}
@@ -435,6 +439,21 @@
}
+//
+void B2kInterface::dialTimeout(){
+ QString* send = new QString("CALL ");
+ stoptDialTone();
+ //ignore leading *, if any (shouldn't be).
+ if (phoneNumber.find("*") == 0){
+ send->append(phoneNumber.right(phoneNumber.length() - 1));
+ }
+ else{
+ send->append(phoneNumber.mid(0,100));
+ }
+ sendb2kMessageEvent(send);
+}
+
+
// set the status of the phone position
//
// Args: Status
--- kb2kskype-0.3.7/src/b2kinterface.h 2008-01-17 02:22:34.000000000 +1300
+++ kb2kskype-0.3.7-NZcustom/src/b2kinterface.h 2008-03-05 21:03:55.000000000 +1300
@@ -27,6 +27,7 @@
#include <qmessagebox.h>
#include <unistd.h>
#include "customeventsenumeration.h"
+#include <qtimer.h>
//added from b2k example most probably ain;t needed
//#include <stdio.h>
@@ -69,6 +70,7 @@
bool getOnHook();
int getCurrentMode();
void requestINFO();
+ void dialTimeout();
//signals:
// void b2kmessage (QString);
@@ -92,6 +94,7 @@
struct sockaddr_un remote;
char str[100];
//end addition
+ QTimer *timer;
};
#endif
--- kb2kskype-0.3.7/src/skypeapidlg.cpp 2008-02-06 13:25:38.000000000 +1300
+++ kb2kskype-0.3.7-NZcustom/src/skypeapidlg.cpp 2008-03-05 21:04:03.000000000 +1300
@@ -895,6 +895,19 @@
}else if (!incall){
incall = true;
b->stoptDialTone();
+ if (!str.startsWith("0", false)) {
+ message = QString("CALL "); // reset the message.
+ message.append("+64 "); // append the country code,
+ message.append("4 "); // the area code,
+ message.append(str); // and the original number.
+ }
+ else if (!str.startsWith("00", false)) {
+ message = QString("CALL "); // reset the message.
+ message.append("+64 "); // append the country code,
+ message.append(str.right(str.length() - 1)); // and the number minus leading 0.
+ }
+ // else it's an international call and should be sent as is...??
+ // END
sendMessage(message);
}
}
Well I dont understand what you have done here, but it looks nice to me and it is what I have been looking for. Im using skype in windows right now because of this, my wife hates having to dial 001 for every call.
So I have one problems...how can I get what you did? I dont understand what you have done. Is this in the source and it has to be recompiled? Is it just a scrit I can stick somewhere?
Surprised no one responded to this. Are we the only ones that hate dial the country code?
I have an alarm I wanted to be able to dial out. It has a limited space for the number and I dont have a # button on it . I need to get rid of the # and the 001 from the phone number going into b2k. I looked around in the code but thought it was messy and a bit over my head right now. I couldnt find where the numbers were
Is there a way to get kb2kskype to accept a number without a #, and stick the "001" in the front of the number before sending it to skype ?
I can add a default country code to the ini file, to remove the need for the 00 at the start. However the # at the end is more of a problem, as that is used as teh trigger to send the number to skype. (do you have a start button ?)
I see what you did now;very nice. I read through your patch file and apllied it to version 0.3.8 , but some stuff was changed like sendb2kFeedbackMessageEvent(QString) and sendb2kMessageEvent(QString) dont pass a pointer anynore it seems. nothing major to change i think. Redaing the complaints of the compiler can seem misleading sometimes though lol.
Doesn't if (!str.startsWith("0", false)) mean it is true if the leadning zeros are missing?
Also, i will only be using USB mode, so i can hack my k2bk as much as I need to let my just dial like a normal phone and not need the 001 , or the # right?
"(do you have a start button ?)" Do you mean do i have a send button on my phone? If so , yes I do.
However, on the alarm dialer, I think it just sends the tones for the 7 or so digits over the phone line and waits for the phone companie to do its thing? Not sure on that. Do the normal phone network require phones to send a special signal to say this is the end of the transmission of the number requested? Either way, the alarm dialer operates like a normal phone except I dont have the * or the # key on it to save those in the alarm dialers memory as part of the number.
kb2k doesn't actually send the # to skype does it? if so, we can just put it back in there automatically right?
Hmm, Simon, I didnt look at the name of the prev post and thought it was quiffman(original post) talking to me :)
Hah, cool. Thanks Richard for figuring out how to do this. I got it working in version 0.3.8 but had to change some stuff because some functions pass values rather than addresses and stuff. I might try to put a couple of places in the form to enter default area codes and country codes and stuff if i have time. I think it would be cool if some of this were options in the actual releases. :) Fun stuff
Said by Octo:
> Doesn't if (!str.startsWith("0", false)) mean it is true if the leadning zeros are missing?
By now you've most likely figured out what happens, but if a leading zero is not found it must mean the dialled number begins with the digits 1 to 9.
Your query about pressing the # key: this tells kb2kskype to send the dialled number plus any prepended digits to skype; skype doesn't see the #.
Depending on what you protecting it is interesting you are using what can be an unreliable medium for an alarm : ).