dave@arnold.UUCP (Dave Arnold) (07/25/87)
Following is a small program that gives an example of placing outgoing data calls using ioctl calls and the UNIXpc onboard modem. Most of the changes I made to C-Kermit did exactly what this program does. Basically, I created a new modem type in ckudia.c, and had the new type make calls to ttdial in ckutio.c. Could somebody post an example of using the dial(3c) routine for the OBM? Anyway, ttdial did the following: --------------------------- Cut Here --------------------------------- /* See phone(7) for more details */ #include <sys/types.h> #include <signal.h> #include <sys/phone.h> #include <fcntl.h> #include <stdio.h> static int fd; static struct updata phc; static char digit; void tthangup() { ioctl(fd, PIOCDISC, &phc); close(fd); exit(1); } main(argc, argv) int argc; char **argv; { int i; char *s; if(argc != 3) { fprintf(stderr, "usage: dial device tele#\n"); exit(1); } if((fd = open(argv[1], O_RDWR | O_NDELAY)) < 0) { fprintf(stderr, "error opening device\n"); exit(1); } /* ttdial stuff */ signal(SIGQUIT, hangup); signal(SIGINT, hangup); signal(SIGHUP, hangup); ioctl(fd, PIOCGETP, &phc); phc.c_lineparam |= DTMF; phc.c_lineparam &= ~INCMNG; phc.c_waitdailtone = 5; phc.c_waitflash = 500; phc.c_feedback = SPEAKERON | NORMSPK; ioctl(fd, PIOCSETP, &phc); ioctl(fd, PIOCOFFHOOK, &phc); while(1) { ioctl(fd, PIOCGETP, &phc); if(phc.c_linestatus & DIALTONE) break; } printf("Dialing %s...\n", argv[2]); s = argv[2]; while(*s) { digit = *s++; ioctl(fd, PIOCDIAL, &digit); } digit = '$'; if(ioctl(fd, PIOCDIAL, &digit) < 0) hangup(); printf("connected\n"); /* then ttdial would return, but this is an example */ pause(); hangup(); } ------------------------- End Example ------------------------- Disclaimer: Usual disclaimers apply. I'm not responsible for any loss or damage due to the above example. Use at your own risk!! This was typed from a program listing I had lying around, so there may be typos. ---- Hope somebody finds this useful! Dave Arnold UUCP: ...!seismo!uunet!arnold!dave