|
|
8ae8a99 |
diff -up mgetty-1.1.36/callback/callback.c.caller_name mgetty-1.1.36/callback/callback.c
|
|
|
8ae8a99 |
--- mgetty-1.1.36/callback/callback.c.caller_name 2009-01-30 08:47:53.000000000 +0100
|
|
|
8ae8a99 |
+++ mgetty-1.1.36/callback/callback.c 2009-01-30 08:49:15.000000000 +0100
|
|
|
8ae8a99 |
@@ -396,7 +396,7 @@ char * r;
|
|
|
8ae8a99 |
/* provide some "dummy" things for do_chat(), otherwise callback won't link */
|
|
|
8ae8a99 |
/*!!! FIXME - we don't really want this */
|
|
|
8ae8a99 |
int virtual_ring = FALSE;
|
|
|
8ae8a99 |
-void cndfind _P1( (p), char * p ) { /* DUMMY */ }
|
|
|
8ae8a99 |
+int cndfind _P1( (p), char * p ) { /* DUMMY */ }
|
|
|
8ae8a99 |
|
|
|
8ae8a99 |
int main _P2((argc, argv), int argc, char ** argv)
|
|
|
8ae8a99 |
{
|
|
|
8ae8a99 |
diff -up mgetty-1.1.36/cnd.c.caller_name mgetty-1.1.36/cnd.c
|
|
|
8ae8a99 |
--- mgetty-1.1.36/cnd.c.caller_name 2009-01-30 08:48:07.000000000 +0100
|
|
|
8ae8a99 |
+++ mgetty-1.1.36/cnd.c 2009-01-30 09:09:36.000000000 +0100
|
|
|
8ae8a99 |
@@ -104,7 +104,7 @@ struct cndtable cndtable[] =
|
|
|
8ae8a99 |
};
|
|
|
8ae8a99 |
|
|
|
8ae8a99 |
|
|
|
8ae8a99 |
-void
|
|
|
8ae8a99 |
+int
|
|
|
8ae8a99 |
cndfind _P1((str), char *str)
|
|
|
8ae8a99 |
{
|
|
|
8ae8a99 |
struct cndtable *cp;
|
|
|
8ae8a99 |
@@ -124,56 +124,82 @@ cndfind _P1((str), char *str)
|
|
|
8ae8a99 |
asked for it with AT\O. The CID will simply get sent on a single
|
|
|
8ae8a99 |
line consisting only of digits. So, if we get a line starting
|
|
|
8ae8a99 |
with a digit, let's assume that it's the CID...
|
|
|
8ae8a99 |
+ The USRobotics can send unformatted caller id data. Allow for that as well.
|
|
|
8ae8a99 |
*/
|
|
|
8ae8a99 |
if ( isdigit(*str) )
|
|
|
8ae8a99 |
{
|
|
|
8ae8a99 |
- CallerId = p = strdup(str);
|
|
|
8ae8a99 |
- while( isdigit(*p) ) p++;
|
|
|
8ae8a99 |
- *p = 0;
|
|
|
8ae8a99 |
- lprintf( L_NOISE, "CND: ELink caller ID: '%s'", CallerId );
|
|
|
8ae8a99 |
- return;
|
|
|
8ae8a99 |
+ int CheckSum=0; // to validate possible unformatted display
|
|
|
8ae8a99 |
+ int digit;
|
|
|
8ae8a99 |
+ CallerId = p = strdup(str);
|
|
|
8ae8a99 |
+ while( isxdigit(*p) ) p++;
|
|
|
8ae8a99 |
+ *p = 0;
|
|
|
8ae8a99 |
+ // Check for an unformatted display of caller id. Calculate FSK checksum...
|
|
|
8ae8a99 |
+ p = CallerId;
|
|
|
8ae8a99 |
+ while (*p)
|
|
|
8ae8a99 |
+ {
|
|
|
8ae8a99 |
+ if (isdigit(*p))
|
|
|
8ae8a99 |
+ digit = (*p - '0');
|
|
|
8ae8a99 |
+ else digit = 10 + (tolower(*p) - 'a');
|
|
|
8ae8a99 |
+ CheckSum += (digit << 4);
|
|
|
8ae8a99 |
+ p++;
|
|
|
8ae8a99 |
+ if (!*p)
|
|
|
8ae8a99 |
+ break; // odd number of characters, not proper hex, cannot be FSK
|
|
|
8ae8a99 |
+ if (isdigit(*p))
|
|
|
8ae8a99 |
+ digit = (*p - '0');
|
|
|
8ae8a99 |
+ else digit = 10 + (tolower(*p) - 'a');
|
|
|
8ae8a99 |
+ CheckSum += digit;
|
|
|
8ae8a99 |
+ CheckSum &= 255;
|
|
|
8ae8a99 |
+ p++;
|
|
|
8ae8a99 |
+ }
|
|
|
8ae8a99 |
+ if (CheckSum == 0)
|
|
|
8ae8a99 |
+ {
|
|
|
8ae8a99 |
+ lprintf( L_NOISE, "CND: ELink caller ID: '%s'", CallerId );
|
|
|
8ae8a99 |
+ return 4;
|
|
|
8ae8a99 |
+ }
|
|
|
8ae8a99 |
+ return 1;
|
|
|
8ae8a99 |
}
|
|
|
8ae8a99 |
|
|
|
8ae8a99 |
for (cp = cndtable; cp->string; cp++)
|
|
|
8ae8a99 |
{
|
|
|
8ae8a99 |
- len = strlen(cp->string);
|
|
|
8ae8a99 |
- if (strncmp(cp->string, str, len) == 0)
|
|
|
8ae8a99 |
- {
|
|
|
8ae8a99 |
- if (!cp->variable)
|
|
|
8ae8a99 |
- return;
|
|
|
8ae8a99 |
-
|
|
|
8ae8a99 |
- /* special case: Rockwell sends *two* MESG=... lines */
|
|
|
8ae8a99 |
- if (cp->variable == &CallMsg1 && CallMsg1[0] != 0)
|
|
|
8ae8a99 |
- continue;
|
|
|
8ae8a99 |
-
|
|
|
8ae8a99 |
- /* special case for CONNECT on Rockwell-Based modems */
|
|
|
8ae8a99 |
- if ( ( cnd_carrier[0] != 0 || cnd_protocol[0] != 0 ) &&
|
|
|
8ae8a99 |
- strncmp( str, "CONNECT ", 8 ) == 0 )
|
|
|
8ae8a99 |
- {
|
|
|
8ae8a99 |
- *(cp->variable) = malloc( strlen(str) - len +
|
|
|
8ae8a99 |
- strlen( cnd_carrier ) +
|
|
|
8ae8a99 |
- strlen( cnd_protocol ) + 5 );
|
|
|
8ae8a99 |
- sprintf( *(cp->variable), "%s/%s %s",
|
|
|
8ae8a99 |
- str+len, cnd_carrier, cnd_protocol );
|
|
|
8ae8a99 |
- }
|
|
|
8ae8a99 |
- else /* normal case */
|
|
|
8ae8a99 |
- {
|
|
|
8ae8a99 |
- *(cp->variable) = p = malloc(strlen(str) - len + 1);
|
|
|
8ae8a99 |
- (void) strcpy(*(cp->variable), str+len);
|
|
|
8ae8a99 |
-
|
|
|
8ae8a99 |
- /* nuke quotes and non-printable characters (some of this
|
|
|
8ae8a99 |
- * stuff is passed to shell commands and environment vars)
|
|
|
8ae8a99 |
- */
|
|
|
8ae8a99 |
- while( *p != '\0' )
|
|
|
8ae8a99 |
- {
|
|
|
8ae8a99 |
- if ( *p == '\'' || *p == '\"' || !isprint(*p) ) *p = ' ';
|
|
|
8ae8a99 |
- p++;
|
|
|
8ae8a99 |
- }
|
|
|
8ae8a99 |
- }
|
|
|
8ae8a99 |
- lprintf(L_JUNK, "CND: found: %s", *(cp->variable));
|
|
|
8ae8a99 |
- return;
|
|
|
8ae8a99 |
- }
|
|
|
8ae8a99 |
+ len = strlen(cp->string);
|
|
|
8ae8a99 |
+ if (strncmp(cp->string, str, len) == 0)
|
|
|
8ae8a99 |
+ {
|
|
|
8ae8a99 |
+ if (!cp->variable)
|
|
|
8ae8a99 |
+ return 0;
|
|
|
8ae8a99 |
+
|
|
|
8ae8a99 |
+ /* special case: Rockwell sends *two* MESG=... lines */
|
|
|
8ae8a99 |
+ if (cp->variable == &CallMsg1 && CallMsg1[0] != 0)
|
|
|
8ae8a99 |
+ continue;
|
|
|
8ae8a99 |
+
|
|
|
8ae8a99 |
+ /* special case for CONNECT on Rockwell-Based modems */
|
|
|
8ae8a99 |
+ if ( ( cnd_carrier[0] != 0 || cnd_protocol[0] != 0 ) &&
|
|
|
8ae8a99 |
+ strncmp( str, "CONNECT ", 8 ) == 0 )
|
|
|
8ae8a99 |
+ {
|
|
|
8ae8a99 |
+ *(cp->variable) = malloc( strlen(str) - len +
|
|
|
8ae8a99 |
+ strlen( cnd_carrier ) +
|
|
|
8ae8a99 |
+ strlen( cnd_protocol ) + 5 );
|
|
|
8ae8a99 |
+ sprintf( *(cp->variable), "%s/%s %s",
|
|
|
8ae8a99 |
+ str+len, cnd_carrier, cnd_protocol );
|
|
|
8ae8a99 |
+ }
|
|
|
8ae8a99 |
+ else /* normal case */
|
|
|
8ae8a99 |
+ {
|
|
|
8ae8a99 |
+ *(cp->variable) = p = malloc(strlen(str) - len + 1);
|
|
|
8ae8a99 |
+ (void) strcpy(*(cp->variable), str+len);
|
|
|
8ae8a99 |
+
|
|
|
8ae8a99 |
+ /* nuke quotes and non-printable characters (some of this
|
|
|
8ae8a99 |
+ * stuff is passed to shell commands and environment vars)
|
|
|
8ae8a99 |
+ */
|
|
|
8ae8a99 |
+ while( *p != '\0' )
|
|
|
8ae8a99 |
+ {
|
|
|
8ae8a99 |
+ if ( *p == '\'' || *p == '\"' || !isprint(*p) ) *p = ' ';
|
|
|
8ae8a99 |
+ p++;
|
|
|
8ae8a99 |
+ }
|
|
|
8ae8a99 |
+ }
|
|
|
8ae8a99 |
+ lprintf(L_JUNK, "CND: found: %s", *(cp->variable));
|
|
|
8ae8a99 |
+ return 1;
|
|
|
8ae8a99 |
+ }
|
|
|
8ae8a99 |
}
|
|
|
8ae8a99 |
+ return 0;
|
|
|
8ae8a99 |
}
|
|
|
8ae8a99 |
|
|
|
8ae8a99 |
/* process Rockwell-style caller ID. Weird */
|
|
|
8ae8a99 |
diff -up mgetty-1.1.36/mgetty.h.caller_name mgetty-1.1.36/mgetty.h
|
|
|
8ae8a99 |
--- mgetty-1.1.36/mgetty.h.caller_name 2009-01-30 08:48:28.000000000 +0100
|
|
|
8ae8a99 |
+++ mgetty-1.1.36/mgetty.h 2009-01-30 09:39:28.000000000 +0100
|
|
|
8ae8a99 |
@@ -300,7 +300,7 @@ extern char *CallTime;
|
|
|
8ae8a99 |
extern char *CallName;
|
|
|
8ae8a99 |
extern char *CalledNr;
|
|
|
8ae8a99 |
|
|
|
8ae8a99 |
-void cndfind _PROTO((char *str));
|
|
|
8ae8a99 |
+int cndfind _PROTO((char *str));
|
|
|
8ae8a99 |
int cndlookup _PROTO((void));
|
|
|
8ae8a99 |
int cnd_call _PROTO((char *name, char *tty, int dist_ring ));
|
|
|
8ae8a99 |
|
|
|
8ae8a99 |
diff -up mgetty-1.1.36/ring.c.caller_name mgetty-1.1.36/ring.c
|
|
|
8ae8a99 |
--- mgetty-1.1.36/ring.c.caller_name 2009-01-30 08:48:17.000000000 +0100
|
|
|
8ae8a99 |
+++ mgetty-1.1.36/ring.c 2009-01-30 09:47:03.000000000 +0100
|
|
|
8ae8a99 |
@@ -219,6 +219,7 @@ int wait_for_ring _P6((fd, msn_list, tim
|
|
|
8ae8a99 |
char buf[BUFSIZE], ch, *p;
|
|
|
8ae8a99 |
int i, w, r;
|
|
|
8ae8a99 |
int rc = SUCCESS;
|
|
|
8ae8a99 |
+int need_cnd_items = 4;
|
|
|
8ae8a99 |
boolean got_dle; /* for <DLE><char> events (voice mode) */
|
|
|
8ae8a99 |
|
|
|
8ae8a99 |
lprintf( L_MESG, "wfr: waiting for ``RING''" );
|
|
|
8ae8a99 |
@@ -311,7 +312,7 @@ boolean got_dle; /* for <DLE><char> eve
|
|
|
8ae8a99 |
/* got a full line */
|
|
|
8ae8a99 |
if ( w == 0 ) { continue; } /* ignore empty lines */
|
|
|
8ae8a99 |
buf[w] = '\0';
|
|
|
8ae8a99 |
- cndfind( buf ); /* grab caller ID */
|
|
|
8ae8a99 |
+ need_cnd_items -= cndfind( buf ); /* grab caller ID, adjust count of needed data items for cnd-program */
|
|
|
8ae8a99 |
|
|
|
8ae8a99 |
/* ZyXEL CallerID/MSN display? */
|
|
|
8ae8a99 |
if ( strncmp( buf, "FM:", 3 ) == 0 ||
|
|
|
8ae8a99 |
@@ -323,7 +324,8 @@ boolean got_dle; /* for <DLE><char> eve
|
|
|
8ae8a99 |
* instead of waiting for the next "real" RING
|
|
|
8ae8a99 |
* (but don't do this for V253 DRON/DROF modems!)
|
|
|
8ae8a99 |
*/
|
|
|
8ae8a99 |
- if ( strncmp( buf, "NMBR", 4 ) == 0 && drox_count == 0 ) { break; }
|
|
|
8ae8a99 |
+ //if ( strncmp( buf, "NMBR", 4 ) == 0 && drox_count == 0 ) { break; }
|
|
|
8ae8a99 |
+ if ( (need_cnd_items <= 0) && (drox_count == 0) ) { break; }
|
|
|
8ae8a99 |
|
|
|
8ae8a99 |
/* V.253 ring cadences */
|
|
|
8ae8a99 |
if ( strncmp( buf, "DRON", 4 ) == 0 ||
|