busytone.c
上传用户:sy_wanhua
上传日期:2013-07-25
资源大小:3048k
文件大小:1k
- #include <sys/types.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <strings.h>
- #include <sys/ioctl.h>
- #include <unistd.h>
- #include <fcntl.h>
- #include "ixjuser.h"
- int main(int argc, char *argv[])
- {
- int ixj1, hook, m_hook, digit, state, cnt;
- char pname1[80], pname2[80];
- sprintf(pname1, "/dev/ixj%s", argv[1]);
- ixj1 = open(pname1, O_RDWR);
- if(ixj1 <= 0)
- {
- printf("Open failed %sn", pname1);
- exit(0);
- }
- hook = m_hook = ioctl(ixj1, IXJCTL_HOOKSTATE);
- printf("hook state %dn", hook);
- // if(!ioctl(ixj1, IXJCTL_RING))
- // exit(0);
- hook = ioctl(ixj1, IXJCTL_HOOKSTATE);
- while(!hook)
- {
- hook = ioctl(ixj1, IXJCTL_HOOKSTATE);
- }
- printf("hook state %dn", hook);
- fflush(stdout);
- ioctl(ixj1, IXJCTL_AEC_STOP);
- printf("Starting busy signaln");
- ioctl(ixj1, IXJCTL_BUSY);
- getchar();
- printf("Stopping busy signaln");
- ioctl(ixj1, IXJCTL_CPT_STOP);
- getchar();
- printf("Starting ringback signaln");
- ioctl(ixj1, IXJCTL_RINGBACK);
- getchar();
- printf("Stopping ringback signaln");
- ioctl(ixj1, IXJCTL_CPT_STOP);
- getchar();
- close(ixj1);
- }