more tellyscript tweaks
This commit is contained in:
@@ -1,12 +1,3 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int dterate;
|
int dterate;
|
||||||
int dcerate;
|
int dcerate;
|
||||||
int protocol;
|
int protocol;
|
||||||
|
|||||||
@@ -1,468 +0,0 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int dterate;
|
|
||||||
int dcerate;
|
|
||||||
int protocol;
|
|
||||||
int compression;
|
|
||||||
int connected;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
parseResult(int result)
|
|
||||||
{
|
|
||||||
int retcode = 0;
|
|
||||||
char *comment = "";
|
|
||||||
|
|
||||||
if (result == 0)
|
|
||||||
{
|
|
||||||
comment = " OK";
|
|
||||||
retcode = 1;
|
|
||||||
}
|
|
||||||
else if (result == 3)
|
|
||||||
{
|
|
||||||
comment = "NO CARRIER";
|
|
||||||
retcode = 12;
|
|
||||||
}
|
|
||||||
else if (result == 6)
|
|
||||||
{
|
|
||||||
comment = "NO DIALTONE";
|
|
||||||
retcode = 5;
|
|
||||||
}
|
|
||||||
else if (result == 7)
|
|
||||||
{
|
|
||||||
comment = "BUSY";
|
|
||||||
retcode = 7;
|
|
||||||
}
|
|
||||||
else if (result == 8)
|
|
||||||
{
|
|
||||||
comment = "NO ANSWER";
|
|
||||||
retcode = 6;
|
|
||||||
}
|
|
||||||
else if (result == 18)
|
|
||||||
{
|
|
||||||
comment = "Connected!";
|
|
||||||
dterate = 0xe100;
|
|
||||||
connected = 1;
|
|
||||||
}
|
|
||||||
else if (result == 19)
|
|
||||||
{
|
|
||||||
comment = "Connected!";
|
|
||||||
dterate = 0x1c200;
|
|
||||||
connected = 1;
|
|
||||||
}
|
|
||||||
else if (result == 20)
|
|
||||||
{
|
|
||||||
comment = "Connected!";
|
|
||||||
dterate = 0x39210;
|
|
||||||
connected = 1;
|
|
||||||
}
|
|
||||||
else if (result == 46)
|
|
||||||
{
|
|
||||||
dcerate = 0x4b0;
|
|
||||||
}
|
|
||||||
else if (result == 47)
|
|
||||||
{
|
|
||||||
dcerate = 0x960;
|
|
||||||
}
|
|
||||||
else if (result == 48)
|
|
||||||
{
|
|
||||||
dcerate = 0x12c0;
|
|
||||||
}
|
|
||||||
else if (result == 49)
|
|
||||||
{
|
|
||||||
dcerate = 0x1c20;
|
|
||||||
}
|
|
||||||
else if (result == 50)
|
|
||||||
{
|
|
||||||
dcerate = 0x2580;
|
|
||||||
}
|
|
||||||
else if (result == 51)
|
|
||||||
{
|
|
||||||
dcerate = 0x2ee0;
|
|
||||||
}
|
|
||||||
else if (result == 52)
|
|
||||||
{
|
|
||||||
dcerate = 0x3840;
|
|
||||||
}
|
|
||||||
else if (result == 53)
|
|
||||||
{
|
|
||||||
dcerate = 0x41a0;
|
|
||||||
}
|
|
||||||
else if (result == 54)
|
|
||||||
{
|
|
||||||
dcerate = 0x4b00;
|
|
||||||
}
|
|
||||||
else if (result == 55)
|
|
||||||
{
|
|
||||||
dcerate = 0x5460;
|
|
||||||
}
|
|
||||||
else if (result == 56)
|
|
||||||
{
|
|
||||||
dcerate = 0x5dc0;
|
|
||||||
}
|
|
||||||
else if (result == 57)
|
|
||||||
{
|
|
||||||
dcerate = 0x6720;
|
|
||||||
}
|
|
||||||
else if (result == 58)
|
|
||||||
{
|
|
||||||
dcerate = 0x7080;
|
|
||||||
}
|
|
||||||
else if (result == 66)
|
|
||||||
{
|
|
||||||
compression = 1;
|
|
||||||
}
|
|
||||||
else if (result == 67)
|
|
||||||
{
|
|
||||||
compression = 2;
|
|
||||||
}
|
|
||||||
else if (result == 69)
|
|
||||||
{
|
|
||||||
compression = 0;
|
|
||||||
}
|
|
||||||
else if (result == 76)
|
|
||||||
{
|
|
||||||
protocol = 0;
|
|
||||||
}
|
|
||||||
else if (result == 77)
|
|
||||||
{
|
|
||||||
protocol = 1;
|
|
||||||
}
|
|
||||||
else if (result == 78 || result == 60)
|
|
||||||
{
|
|
||||||
dcerate = 0x79e0;
|
|
||||||
}
|
|
||||||
else if (result == 79 || result == 65)
|
|
||||||
{
|
|
||||||
dcerate = 0x8340;
|
|
||||||
}
|
|
||||||
else if (result == 80)
|
|
||||||
{
|
|
||||||
protocol = 2;
|
|
||||||
}
|
|
||||||
else if (result == 81)
|
|
||||||
{
|
|
||||||
protocol = 3;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
printf("TellyScript: ParseResult -- %d unknown", result);
|
|
||||||
retcode = 9;
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("TellyScript: ParseResult -- %d %s (retcode=%d)", result,
|
|
||||||
comment, retcode);
|
|
||||||
return retcode;
|
|
||||||
}
|
|
||||||
|
|
||||||
ConfigureModem(char *cmd, char *response)
|
|
||||||
{
|
|
||||||
int retries;
|
|
||||||
int len = strlen(response);
|
|
||||||
|
|
||||||
retries = 0;
|
|
||||||
while (retries++ <= 3)
|
|
||||||
{
|
|
||||||
flush();
|
|
||||||
|
|
||||||
sendstr(cmd);
|
|
||||||
if (waitfor(response, len, 120))
|
|
||||||
{
|
|
||||||
printf("TellyScript: Configured modem.");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
printf("TellyScript: TIMEOUT waiting for OK");
|
|
||||||
builtin_winkdtr();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (retries > 3)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
main()
|
|
||||||
{
|
|
||||||
int count, i, result;
|
|
||||||
int start = ticks();
|
|
||||||
int end;
|
|
||||||
char *number;
|
|
||||||
char buffer[32];
|
|
||||||
char *settings = getphonesettings();
|
|
||||||
char *accessNumber = &settings[108];
|
|
||||||
char *dialOutsidePrefix = &settings[32];
|
|
||||||
char *dialLDPrefix = &settings[140];
|
|
||||||
char *callWaitingPrefix = &settings[0];
|
|
||||||
char usePulseDialing = settings[96];
|
|
||||||
char audibleDialing = settings[97];
|
|
||||||
char disableCallWaiting = settings[98];
|
|
||||||
char dialOutsideLine = settings[99];
|
|
||||||
char changedCity = settings[100];
|
|
||||||
char waitForTone = settings[101];
|
|
||||||
char hasCallWaiting = settings[102];
|
|
||||||
char useCallWaitingHack = settings[103];
|
|
||||||
char dialSpeed = settings[104];
|
|
||||||
char brokenPBX = settings[106];
|
|
||||||
char numberToDial[32];
|
|
||||||
char secondConfigCommand[80];
|
|
||||||
char dialCommand[80];
|
|
||||||
char *configurationCommand = "ATS38=0S30=180S95=36S11=60&D2V1E0L3&Q5&K3\r";
|
|
||||||
char *defaultNumber = "18006138199";
|
|
||||||
char *nvOverRide = getpreregnumber();
|
|
||||||
char *secret = getsecret();
|
|
||||||
char *serial_number = getserialnumber();
|
|
||||||
char username[32];
|
|
||||||
char password[32];
|
|
||||||
|
|
||||||
printf("TellyScript: 800 Registration Script 4.1-zefie");
|
|
||||||
setprogressmode(1);
|
|
||||||
setprogresstext("Preparing to call");
|
|
||||||
setprogresspercentage(16);
|
|
||||||
setprogressdirty(1);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (nvOverRide != 0)
|
|
||||||
{
|
|
||||||
defaultNumber = nvOverRide;
|
|
||||||
printf("TellyScript: Over-riding default preregistration number with %s from NVRAM", nvOverRide);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (accessNumber[0])
|
|
||||||
strcpy(numberToDial, accessNumber);
|
|
||||||
else
|
|
||||||
strcpy(numberToDial, defaultNumber);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (brokenPBX)
|
|
||||||
if (numberToDial[0] == 49)
|
|
||||||
strcpy(numberToDial, &numberToDial[1]);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
strcpy(secondConfigCommand, "ATV0");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (audibleDialing)
|
|
||||||
strcat(secondConfigCommand, "M1");
|
|
||||||
else
|
|
||||||
strcat(secondConfigCommand, "M0");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (waitForTone)
|
|
||||||
strcat(secondConfigCommand, "S6=10X4");
|
|
||||||
else
|
|
||||||
strcat(secondConfigCommand, "S6=4X3");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
strcat(secondConfigCommand, "S10=14");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (dialSpeed == 0)
|
|
||||||
strcat(secondConfigCommand, "S11=200");
|
|
||||||
else if (dialSpeed == 1)
|
|
||||||
strcat(secondConfigCommand, "S11=110");
|
|
||||||
else if (dialSpeed == 2)
|
|
||||||
strcat(secondConfigCommand, "S11=60");
|
|
||||||
else if (dialSpeed == 3)
|
|
||||||
strcat(secondConfigCommand, "S11=1");
|
|
||||||
|
|
||||||
strcat(secondConfigCommand, "\r");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (usePulseDialing)
|
|
||||||
strcpy(dialCommand, "ATDP");
|
|
||||||
else
|
|
||||||
strcpy(dialCommand, "ATDT");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (disableCallWaiting)
|
|
||||||
{
|
|
||||||
strcat(dialCommand, callWaitingPrefix);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (strlen(dialLDPrefix) > 0)
|
|
||||||
{
|
|
||||||
strcat(dialCommand, dialLDPrefix);
|
|
||||||
strcat(dialCommand, ",");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
if (dialOutsideLine)
|
|
||||||
{
|
|
||||||
strcat(dialCommand, dialOutsidePrefix);
|
|
||||||
strcat(dialCommand, ",");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
setwindowsize(3);
|
|
||||||
printf("TellyScript: TCP Window Size set to 3 (USR).");
|
|
||||||
|
|
||||||
enablemodem();
|
|
||||||
|
|
||||||
builtin_winkdtr();
|
|
||||||
setflowcontrol(3);
|
|
||||||
setbaud(0xe100);
|
|
||||||
|
|
||||||
if (!ConfigureModem(configurationCommand, "OK"))
|
|
||||||
{
|
|
||||||
printf("TellyScript: Couldn't get OK from modem during first config cmd");
|
|
||||||
setdtr(0);
|
|
||||||
return 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
flush();
|
|
||||||
|
|
||||||
if (!ConfigureModem(secondConfigCommand, "0"))
|
|
||||||
{
|
|
||||||
printf("TellyScript: Couldn't get OK from modem during second config cmd");
|
|
||||||
setdtr(0);
|
|
||||||
return 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
flush();
|
|
||||||
|
|
||||||
setprogresstext("Dialing HackTV...");
|
|
||||||
setprogresspercentage(32);
|
|
||||||
setprogressdirty(1);
|
|
||||||
|
|
||||||
printf("TellyScript: Overriding exclusion circuit...");
|
|
||||||
setforcehook(1);
|
|
||||||
|
|
||||||
printf("TellyScript: Dialing %s...", numberToDial);
|
|
||||||
if ((numberToDial[0] != 65) && (numberToDial[0] != 97))
|
|
||||||
sendstr(dialCommand);
|
|
||||||
sendstr(numberToDial);
|
|
||||||
|
|
||||||
sendstr(";\r");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
sprintf(buffer, "prereg: %s", numberToDial);
|
|
||||||
setworkingnumber(buffer);
|
|
||||||
|
|
||||||
flush();
|
|
||||||
|
|
||||||
i = 0;
|
|
||||||
connected = 0;
|
|
||||||
while (!connected && i < 6) {
|
|
||||||
count = getline(buffer, 31, 0x1068);
|
|
||||||
i++;
|
|
||||||
|
|
||||||
if (count == 0) {
|
|
||||||
printf("TellyScript: TIMEOUT waiting for dial result.");
|
|
||||||
setdtr(0);
|
|
||||||
if (i == 1)
|
|
||||||
return 4;
|
|
||||||
else
|
|
||||||
return 8;
|
|
||||||
}
|
|
||||||
|
|
||||||
result = parseResult(atoi(buffer));
|
|
||||||
if (result == 1) {
|
|
||||||
if (i == 1) {
|
|
||||||
setprogresstext("Waiting for answer...");
|
|
||||||
setprogresspercentage(48);
|
|
||||||
setprogressdirty(1);
|
|
||||||
sendstr("ATD\r");
|
|
||||||
result = 0;
|
|
||||||
} else {
|
|
||||||
|
|
||||||
setdtr(0);
|
|
||||||
printf("TellyScript: got '%s' at odd time", buffer);
|
|
||||||
return 8;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result != 0) {
|
|
||||||
setdtr(0);
|
|
||||||
if (result == 12 && i > 2) {
|
|
||||||
|
|
||||||
return 8;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
} else {
|
|
||||||
if (i > 1) {
|
|
||||||
setprogresstext("HackTV answered...");
|
|
||||||
setprogresspercentage(64);
|
|
||||||
setprogressdirty(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("TellyScript: Setting NameServers: 10.0.0.50, 8.8.8.8");
|
|
||||||
setnameservice(0xa000032, 0x8080808);
|
|
||||||
|
|
||||||
printf("TellyScript: dterate = %d, dcerate = %d, protocol = %d, compression = %d",
|
|
||||||
dterate, dcerate, protocol, compression);
|
|
||||||
setconnectionstats(dterate, dcerate, protocol, compression);
|
|
||||||
|
|
||||||
setprogresstext("Starting communication...");
|
|
||||||
setprogresspercentage(80);
|
|
||||||
setprogressdirty(1);
|
|
||||||
|
|
||||||
sprintf(username, "wtv_%s", serial_number);
|
|
||||||
sprintf(password, "%d", computefcs(serial_number));
|
|
||||||
|
|
||||||
printf("TellyScript: Using '%s' for username", username);
|
|
||||||
printf("TellyScript: Using '%s' for password", password);
|
|
||||||
|
|
||||||
setusername(username);
|
|
||||||
setpassword(password);
|
|
||||||
setpapmode(1);
|
|
||||||
|
|
||||||
if (!startppp())
|
|
||||||
{
|
|
||||||
setdtr(0);
|
|
||||||
if (getpppresult() == 3)
|
|
||||||
{
|
|
||||||
printf("TellyScript: PAP authentification failure");
|
|
||||||
return 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("TellyScript: PPP negotiation failed");
|
|
||||||
return 11;
|
|
||||||
}
|
|
||||||
|
|
||||||
setprogresstext("Connected to HackTV");
|
|
||||||
setprogresspercentage(100);
|
|
||||||
setprogressdirty(1);
|
|
||||||
|
|
||||||
printf("TellyScript: Link connected.");
|
|
||||||
printf("TellyScript: total time = %d (seconds)", (ticks() - start) / 60);
|
|
||||||
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
Binary file not shown.
@@ -1,463 +0,0 @@
|
|||||||
int dterate;
|
|
||||||
int dcerate;
|
|
||||||
int protocol;
|
|
||||||
int compression;
|
|
||||||
|
|
||||||
parseResult(int result)
|
|
||||||
{
|
|
||||||
int retcode = 0;
|
|
||||||
|
|
||||||
printf("TellyScript: parseResult -- %d", result);
|
|
||||||
|
|
||||||
if (result == 0)
|
|
||||||
{
|
|
||||||
retcode = 0;
|
|
||||||
}
|
|
||||||
else if (result == 1)
|
|
||||||
{
|
|
||||||
dterate = 300;
|
|
||||||
}
|
|
||||||
else if (result == 3)
|
|
||||||
{
|
|
||||||
printf("TellyScript: Got NO CARRIER");
|
|
||||||
retcode = 8;
|
|
||||||
}
|
|
||||||
else if (result == 5)
|
|
||||||
{
|
|
||||||
dterate = 0x4b0;
|
|
||||||
}
|
|
||||||
else if (result == 6)
|
|
||||||
{
|
|
||||||
printf("TellyScript: Got NO DIALTONE");
|
|
||||||
retcode = 5;
|
|
||||||
}
|
|
||||||
else if (result == 7)
|
|
||||||
{
|
|
||||||
printf("TellyScript: Got BUSY");
|
|
||||||
retcode = 7;
|
|
||||||
}
|
|
||||||
else if (result == 8)
|
|
||||||
{
|
|
||||||
retcode = 7;
|
|
||||||
}
|
|
||||||
else if (result == 9)
|
|
||||||
{
|
|
||||||
dterate = 0x258;
|
|
||||||
}
|
|
||||||
else if (result == 10)
|
|
||||||
{
|
|
||||||
dterate = 0x960;
|
|
||||||
}
|
|
||||||
else if (result == 11)
|
|
||||||
{
|
|
||||||
dterate = 0x12c0;
|
|
||||||
}
|
|
||||||
else if (result == 12)
|
|
||||||
{
|
|
||||||
dterate = 0x2580;
|
|
||||||
}
|
|
||||||
else if (result == 13)
|
|
||||||
{
|
|
||||||
dterate = 0x1c20;
|
|
||||||
}
|
|
||||||
else if (result == 14)
|
|
||||||
{
|
|
||||||
dterate = 0x2ee0;
|
|
||||||
}
|
|
||||||
else if (result == 15)
|
|
||||||
{
|
|
||||||
dterate = 0x3840;
|
|
||||||
}
|
|
||||||
else if (result == 16)
|
|
||||||
{
|
|
||||||
dterate = 0x4b00;
|
|
||||||
}
|
|
||||||
else if (result == 17)
|
|
||||||
{
|
|
||||||
dterate = 0x9600;
|
|
||||||
}
|
|
||||||
else if (result == 18)
|
|
||||||
{
|
|
||||||
dterate = 0xe100;
|
|
||||||
}
|
|
||||||
else if (result == 19)
|
|
||||||
{
|
|
||||||
dterate = 0x1c200;
|
|
||||||
}
|
|
||||||
else if (result == 22)
|
|
||||||
{
|
|
||||||
printf("TellyScript: Got a CONNECT 75TX/1200RX and I don't know why");
|
|
||||||
dterate = 75;
|
|
||||||
}
|
|
||||||
else if (result == 23)
|
|
||||||
{
|
|
||||||
printf("TellyScript: Got a CONNECT 75TX/1200RX and I don't know why");
|
|
||||||
dterate = 0x4b0
|
|
||||||
}
|
|
||||||
else if (result == 40)
|
|
||||||
{
|
|
||||||
dcerate = 300;
|
|
||||||
}
|
|
||||||
else if (result == 44)
|
|
||||||
{
|
|
||||||
printf("TellyScript: Got a CONNECT 75TX/1200RX and I don't know why");
|
|
||||||
dcerate = 0x4b0;
|
|
||||||
}
|
|
||||||
else if (result == 45)
|
|
||||||
{
|
|
||||||
printf("TellyScript: Got a CONNECT 75TX/1200RX and I don't know why");
|
|
||||||
dcerate = 0x4b0;
|
|
||||||
}
|
|
||||||
else if (result == 46)
|
|
||||||
{
|
|
||||||
dcerate = 0x4b0;
|
|
||||||
}
|
|
||||||
else if (result == 47)
|
|
||||||
{
|
|
||||||
dcerate = 0x960;
|
|
||||||
}
|
|
||||||
else if (result == 48)
|
|
||||||
{
|
|
||||||
dcerate = 0x12c0;
|
|
||||||
}
|
|
||||||
else if (result == 49)
|
|
||||||
{
|
|
||||||
dcerate = 0x1c20;
|
|
||||||
}
|
|
||||||
else if (result == 50)
|
|
||||||
{
|
|
||||||
dcerate = 0x2580;
|
|
||||||
}
|
|
||||||
else if (result == 51)
|
|
||||||
{
|
|
||||||
dcerate = 0x2ee0;
|
|
||||||
}
|
|
||||||
else if (result == 52)
|
|
||||||
{
|
|
||||||
dcerate = 0x3840;
|
|
||||||
}
|
|
||||||
else if (result == 53)
|
|
||||||
{
|
|
||||||
dcerate = 0x41a0;
|
|
||||||
}
|
|
||||||
else if (result == 54)
|
|
||||||
{
|
|
||||||
dcerate = 0x4b00;
|
|
||||||
}
|
|
||||||
else if (result == 55)
|
|
||||||
{
|
|
||||||
dcerate = 0x5460;
|
|
||||||
}
|
|
||||||
else if (result == 56)
|
|
||||||
{
|
|
||||||
dcerate = 0x5dc0;
|
|
||||||
}
|
|
||||||
else if (result == 57)
|
|
||||||
{
|
|
||||||
dcerate = 0x6720;
|
|
||||||
}
|
|
||||||
else if (result == 58)
|
|
||||||
{
|
|
||||||
dcerate = 0x7080;
|
|
||||||
}
|
|
||||||
else if (result == 59)
|
|
||||||
{
|
|
||||||
dcerate = 0x41a0;
|
|
||||||
}
|
|
||||||
else if (result == 61)
|
|
||||||
{
|
|
||||||
dcerate = 0x5460;
|
|
||||||
}
|
|
||||||
else if (result == 62)
|
|
||||||
{
|
|
||||||
dcerate = 0x5dc0;
|
|
||||||
}
|
|
||||||
else if (result == 63)
|
|
||||||
{
|
|
||||||
dcerate = 0x6720;
|
|
||||||
}
|
|
||||||
else if (result == 64)
|
|
||||||
{
|
|
||||||
dcerate = 0x7080;
|
|
||||||
}
|
|
||||||
else if (result == 66)
|
|
||||||
{
|
|
||||||
compression = 1;
|
|
||||||
}
|
|
||||||
else if (result == 67)
|
|
||||||
{
|
|
||||||
compression = 2;
|
|
||||||
}
|
|
||||||
else if (result == 69)
|
|
||||||
{
|
|
||||||
compression = 0;
|
|
||||||
}
|
|
||||||
else if (result == 76)
|
|
||||||
{
|
|
||||||
protocol = 0;
|
|
||||||
}
|
|
||||||
else if (result == 77)
|
|
||||||
{
|
|
||||||
protocol = 1;
|
|
||||||
}
|
|
||||||
else if (result == 78)
|
|
||||||
{
|
|
||||||
dcerate = 0x79e0;
|
|
||||||
}
|
|
||||||
else if (result == 79)
|
|
||||||
{
|
|
||||||
dcerate = 0x8340;
|
|
||||||
}
|
|
||||||
else if (result == 80)
|
|
||||||
{
|
|
||||||
protocol = 2;
|
|
||||||
}
|
|
||||||
else if (result == 81)
|
|
||||||
{
|
|
||||||
protocol = 3;
|
|
||||||
}
|
|
||||||
else if (result == 84)
|
|
||||||
{
|
|
||||||
dcerate = 0x8340;
|
|
||||||
}
|
|
||||||
else if (result == 91)
|
|
||||||
{
|
|
||||||
dcerate = 0x79e0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
printf("TellyScript: Unknown result code %d", result);
|
|
||||||
retcode = 9;
|
|
||||||
}
|
|
||||||
|
|
||||||
return retcode;
|
|
||||||
}
|
|
||||||
|
|
||||||
winkdtr()
|
|
||||||
{
|
|
||||||
setdtr(0);
|
|
||||||
delay(30);
|
|
||||||
setdtr(1);
|
|
||||||
delay(30);
|
|
||||||
}
|
|
||||||
|
|
||||||
main()
|
|
||||||
{
|
|
||||||
int count, i, retries, result;
|
|
||||||
int start = ticks();
|
|
||||||
int end;
|
|
||||||
char *number;
|
|
||||||
char buffer[32];
|
|
||||||
char *settings = getphonesettings();
|
|
||||||
char *accessNumber = &settings[64];
|
|
||||||
char *dialOutsidePrefix = &settings[32];
|
|
||||||
char *callWaitingPrefix = &settings[0];
|
|
||||||
char usePulseDialing = settings[96];
|
|
||||||
char audibleDialing = settings[97];
|
|
||||||
char disableCallWaiting = settings[98];
|
|
||||||
char dialOutsideLine = settings[99];
|
|
||||||
char changedCity = settings[100];
|
|
||||||
char waitForTone = settings[101];
|
|
||||||
char hasCallWaiting = settings[102];
|
|
||||||
char useCallWaitingHack = settings[103];
|
|
||||||
char dialSpeed = settings[104];
|
|
||||||
char numberToDial[32];
|
|
||||||
char dialCommand[80];
|
|
||||||
char *configurationCommand = "ATS38=0S30=180S95=36S11=60&D2V1E0L2&Q5&K3\r";
|
|
||||||
char *defaultNumber = "18006138199";
|
|
||||||
char *nvOverRide = getpreregnumber();
|
|
||||||
char *secret = getsecret();
|
|
||||||
char *serial_number = getserialnumber();
|
|
||||||
char username[32];
|
|
||||||
char password[32];
|
|
||||||
|
|
||||||
printf("TellyScript: 800 Registration Script 3.1-zefie");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (nvOverRide != 0)
|
|
||||||
{
|
|
||||||
defaultNumber = nvOverRide;
|
|
||||||
printf("TellyScript: Over-riding default preregistration number with %s from NVRAM", nvOverRide);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (accessNumber[0])
|
|
||||||
strcpy(numberToDial, accessNumber);
|
|
||||||
else
|
|
||||||
strcpy(numberToDial, defaultNumber);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
strcpy(dialCommand, "ATV0");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (audibleDialing)
|
|
||||||
strcat(dialCommand, "M1");
|
|
||||||
else
|
|
||||||
strcat(dialCommand, "M0");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (waitForTone)
|
|
||||||
strcat(dialCommand, "S6=10X4");
|
|
||||||
else
|
|
||||||
strcat(dialCommand, "S6=4X3");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
strcat(dialCommand, "S10=14");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (dialSpeed == 0)
|
|
||||||
strcat(dialCommand, "S11=200");
|
|
||||||
else if (dialSpeed == 1)
|
|
||||||
strcat(dialCommand, "S11=110");
|
|
||||||
else if (dialSpeed == 2)
|
|
||||||
strcat(dialCommand, "S11=60");
|
|
||||||
else if (dialSpeed == 3)
|
|
||||||
strcat(dialCommand, "S11=1");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (usePulseDialing)
|
|
||||||
strcat(dialCommand, "DP");
|
|
||||||
else
|
|
||||||
strcat(dialCommand, "DT");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (disableCallWaiting)
|
|
||||||
{
|
|
||||||
strcat(dialCommand, callWaitingPrefix);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (dialOutsideLine)
|
|
||||||
{
|
|
||||||
strcat(dialCommand, dialOutsidePrefix);
|
|
||||||
strcat(dialCommand, ",");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
setwindowsize(3);
|
|
||||||
printf("TellyScript: TCP Window Size set to 3 (USR).");
|
|
||||||
|
|
||||||
enablemodem();
|
|
||||||
|
|
||||||
winkdtr();
|
|
||||||
setflowcontrol(3);
|
|
||||||
setbaud(0xe100);
|
|
||||||
|
|
||||||
setstatus(6);
|
|
||||||
retries = 0;
|
|
||||||
while (retries++ <= 2)
|
|
||||||
{
|
|
||||||
flush();
|
|
||||||
|
|
||||||
sendstr(configurationCommand);
|
|
||||||
if (waitfor("OK", 2, 120))
|
|
||||||
{
|
|
||||||
printf("TellyScript: Configured modem.");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
printf("TellyScript: TIMEOUT waiting for OK");
|
|
||||||
winkdtr();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (retries > 3)
|
|
||||||
{
|
|
||||||
printf("TellyScript: Couldn't get OK from modem");
|
|
||||||
setdtr(0);
|
|
||||||
return 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
setstatus(3);
|
|
||||||
|
|
||||||
printf("TellyScript: Overriding exclusion circuit...");
|
|
||||||
setforcehook(1);
|
|
||||||
|
|
||||||
printf("TellyScript: Dialing %s...", numberToDial);
|
|
||||||
if ((numberToDial[0] != 65) && (numberToDial[0] != 97))
|
|
||||||
sendstr(dialCommand);
|
|
||||||
sendstr(numberToDial);
|
|
||||||
|
|
||||||
sendstr(";\r");
|
|
||||||
|
|
||||||
flush();
|
|
||||||
|
|
||||||
i = 0;
|
|
||||||
while (i++ < 4)
|
|
||||||
{
|
|
||||||
count = getline(buffer, 31, 0xe10);
|
|
||||||
|
|
||||||
if (count == 0)
|
|
||||||
{
|
|
||||||
printf("TellyScript: TIMEOUT waiting for dial result.");
|
|
||||||
setdtr(0);
|
|
||||||
return 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
result = parseResult(atoi(buffer));
|
|
||||||
if ((result == 0) && (i == 1))
|
|
||||||
{
|
|
||||||
setstatus(7);
|
|
||||||
sendstr("ATD\r");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result != 0)
|
|
||||||
{
|
|
||||||
setdtr(0);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("TellyScript: Setting NameServers: 10.0.0.50, 8.8.8.8");
|
|
||||||
setnameservice(0xa000032, 0x8080808);
|
|
||||||
|
|
||||||
printf("TellyScript: dterate = %d, dcerate = %d, protocol = %d, compression = %d",
|
|
||||||
dterate, dcerate, protocol, compression);
|
|
||||||
setconnectionstats(dterate, dcerate, protocol, compression);
|
|
||||||
setstatus(2);
|
|
||||||
|
|
||||||
sprintf(username, "wtv_%s", serial_number);
|
|
||||||
sprintf(password, "%d", computefcs(serial_number));
|
|
||||||
|
|
||||||
printf("TellyScript: Using '%s' for username", username);
|
|
||||||
printf("TellyScript: Using '%s' for password", password);
|
|
||||||
|
|
||||||
setusername(username);
|
|
||||||
setpassword(password);
|
|
||||||
setnameservice(0xa000032, 0x8080808);
|
|
||||||
setpapmode(1);
|
|
||||||
setstatus(5);
|
|
||||||
|
|
||||||
if (!startppp())
|
|
||||||
{
|
|
||||||
setdtr(0);
|
|
||||||
if (getpppresult() == 3)
|
|
||||||
{
|
|
||||||
printf("TellyScript: PAP authentification failure");
|
|
||||||
return 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("TellyScript: PPP negotiation failed");
|
|
||||||
return 8;
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("TellyScript: Link connected.");
|
|
||||||
setstatus(1);
|
|
||||||
|
|
||||||
printf("TellyScript: total time = %d (seconds)", (ticks() - start) / 60);
|
|
||||||
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
Binary file not shown.
@@ -87,7 +87,6 @@ if (session_data.data_store.wtvsec_login) {
|
|||||||
// if wtv-open-access: true then client expects OpenISP
|
// if wtv-open-access: true then client expects OpenISP
|
||||||
if (session_data.get("wtv-open-access")) file_path = wtvshared.getServiceDep("/wtv-1800/tellyscripts/LC2/LC2_OpenISP_56k.tok", true);
|
if (session_data.get("wtv-open-access")) file_path = wtvshared.getServiceDep("/wtv-1800/tellyscripts/LC2/LC2_OpenISP_56k.tok", true);
|
||||||
else template_path = wtvshared.getServiceDep("/wtv-1800/tellyscripts/LC2/LC2.prereg.template.txt", true);
|
else template_path = wtvshared.getServiceDep("/wtv-1800/tellyscripts/LC2/LC2.prereg.template.txt", true);
|
||||||
//else file_path = wtvshared.getServiceDep("/wtv-1800/tellyscripts/LC2/LC2_WTV_18006138199.tok", true);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "US-DTV-disk-0MB-32MB-softmodem-CPU5230":
|
case "US-DTV-disk-0MB-32MB-softmodem-CPU5230":
|
||||||
@@ -111,7 +110,6 @@ if (session_data.data_store.wtvsec_login) {
|
|||||||
// if wtv-open-access: true then client expects OpenISP
|
// if wtv-open-access: true then client expects OpenISP
|
||||||
if (session_data.get("wtv-open-access")) file_path = wtvshared.getServiceDep("/wtv-1800/tellyscripts/bf0app/bf0app_OISP.tok", true);
|
if (session_data.get("wtv-open-access")) file_path = wtvshared.getServiceDep("/wtv-1800/tellyscripts/bf0app/bf0app_OISP.tok", true);
|
||||||
else template_path = wtvshared.getServiceDep("/wtv-1800/tellyscripts/bf0app/bf0app.prereg.template.txt", true);
|
else template_path = wtvshared.getServiceDep("/wtv-1800/tellyscripts/bf0app/bf0app.prereg.template.txt", true);
|
||||||
//else file_path = wtvshared.getServiceDep("/wtv-1800/tellyscripts/bf0app/bf0app_WTV_18006138199.tok", true);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// the following are not yet zefie generated and may have an unknown username/password attached
|
// the following are not yet zefie generated and may have an unknown username/password attached
|
||||||
|
|||||||
@@ -918,7 +918,7 @@ class WTVTellyScriptMinifier {
|
|||||||
tokenize(input) {
|
tokenize(input) {
|
||||||
// Define token specs as pairs: [regex, tokenType]
|
// Define token specs as pairs: [regex, tokenType]
|
||||||
const tokenSpecs = [
|
const tokenSpecs = [
|
||||||
[/^\s+/, 'WHITESPACE'], // Whitespace (skip)
|
[/^\s+/, 'WHITESPACE'], // Whitespace
|
||||||
[/^\/\/.*/, null], // Single-line comment (skip)
|
[/^\/\/.*/, null], // Single-line comment (skip)
|
||||||
[/^\/\*[\s\S]*?\*\//, null], // Multi-line comment (skip)
|
[/^\/\*[\s\S]*?\*\//, null], // Multi-line comment (skip)
|
||||||
// Keywords (update with your TellyScript keywords as needed)
|
// Keywords (update with your TellyScript keywords as needed)
|
||||||
@@ -967,7 +967,14 @@ class WTVTellyScriptMinifier {
|
|||||||
let output = "";
|
let output = "";
|
||||||
for (let i = 0; i < tokens.length; i++) {
|
for (let i = 0; i < tokens.length; i++) {
|
||||||
const token = tokens[i];
|
const token = tokens[i];
|
||||||
|
|
||||||
|
if (token.type === 'WHITESPACE') {
|
||||||
|
//token.value = token.value.replaceAll("\r", " ");
|
||||||
|
if (token.value.indexOf("\n") !== -1) output += token.value.replaceAll("\n\n\n", "\n\n");
|
||||||
|
else output += " ";
|
||||||
|
} else {
|
||||||
output += token.value;
|
output += token.value;
|
||||||
|
}
|
||||||
|
|
||||||
// Look ahead to the next token
|
// Look ahead to the next token
|
||||||
if (i < tokens.length - 1) {
|
if (i < tokens.length - 1) {
|
||||||
|
|||||||
@@ -30,6 +30,8 @@ wtv-script-mod: 0
|
|||||||
|
|
||||||
`
|
`
|
||||||
|
|
||||||
|
//wtv-client-rom-type: US-LC2-disk-0MB-8MB
|
||||||
|
|
||||||
const net = require('net');
|
const net = require('net');
|
||||||
|
|
||||||
// Create a socket connection to localhost on port 1615
|
// Create a socket connection to localhost on port 1615
|
||||||
|
|||||||
Reference in New Issue
Block a user