brian_p - 2009-05-06

In the UK (and for all I know, in other countries) some services are provided
by the telephone system using network service codes. These codes may start with
an asterisk; for example, *411# sets charge advice for all calls. Also, a SIP
ATA may offer star services such as *00 to choose a quick-dial number. Having
kb2kskype use a * to switch from a default PSTN mode to USB mode means, of
course, that any PSTN or SIP ATA service beginning with * is inaccessible.

In my search to use ** for mode switching it appears the only way to achieve
this is though a change in the source code. These are the changes I made. I am
not a programmer so  fully expect them to lack elegence and even to be
incorrect. However, the recompiled program works for me so I offer them here in
case they may be useful to anyone else.

Brian.

-------------------------------------------------------------------------

josie@laptop:~$ diff -u /home/josie/b2kinterface.h /home/josie/kb2kskype-0.3.8/src/b2kinterface.h
--- /home/josie/b2kinterface.h  2009-02-07 12:34:10.000000000 +0000
+++ /home/josie/kb2kskype-0.3.8/src/b2kinterface.h      2009-05-05 17:20:23.000000000 +0100
@@ -82,7 +82,7 @@
                        void processCommands(const char*);
                        bool started;
                        QWidget* parent;
-                       QString phoneNumber, b2kinput;
+                       QString phoneNumber, stars, b2kinput;
                        int currentMode;
                        int defaultMode;
                        QString defaultModeString;

---------------------------------------------------------------------------

josie@laptop:~$ diff -u /home/josie/b2kinterface.cpp /home/josie/kb2kskype-0.3.8/src/b2kinterface.cpp
--- /home/josie/b2kinterface.cpp        2009-02-07 12:34:10.000000000 +0000
+++ /home/josie/kb2kskype-0.3.8/src/b2kinterface.cpp    2009-05-05 19:48:29.000000000 +0100
@@ -35,6 +35,7 @@
        parent = parentWindow;
        started = false;
        phoneNumber = "";
+       stars = "";
        currentMode = PSTN;
        defaultMode = PSTN;
        defaultModeString = "PSTN";
@@ -100,6 +101,7 @@
//     etat = O_NONBLOCK;
//     fcntl(s,F_SETFL,etat);
        phoneNumber = "";
+       stars = "";
        onhook = true;
        return true;
}
@@ -232,6 +234,7 @@
//     }
        dialtone = true;
        phoneNumber = "";
+       stars = "";
}

@@ -368,6 +371,7 @@
        }
        else if(q.contains("HANDSET ON", false)){
                phoneNumber = "";
+               stars = "";
                onhook = false;
                sendb2kMessageEvent(QString("HANDSET ON"));
                sendb2kMessageEvent(QString("FOCUS"));

@@ -376,6 +380,7 @@
        }
        else if(q.contains("HANDSET ON", false)){
                phoneNumber = "";
+               stars = "";
                onhook = false;
                sendb2kMessageEvent(QString("HANDSET ON"));
                sendb2kMessageEvent(QString("FOCUS"));
@@ -376,6 +380,7 @@
        }
        else if(q.contains("HANDSET OFF", false)){
                phoneNumber = "";
+               stars = "";
                onhook = true;
                sendb2kMessageEvent(QString("HANDSET OFF"));
                if (currentMode == USB){
@@ -414,10 +419,12 @@
        else if(q.contains("KEY  00", false)){
                phoneNumber.append ("0");
        }
-       else if(q.contains("KEY  0b", false)){
-               if (phoneNumber.length() == 0){
+       //We really want to change mode when ** alone is dialed
+       else if(q.contains("KEY  0b", false) && (phoneNumber == "")){
+               stars.append ("*");
+               if (stars.length() == 2){
+                       stars = "";
                        sendb2kUSB();
-            if (phoneNumber == "")
                 startDialTone();
         }
        }