#include <linux/soundcard.h>
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include <netdb.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <netinet/in.h>
#include <arpa/inet.h>
Go to the source code of this file.
Functions | |
int | main (int argc, char *argv[]) |
|
Definition at line 503 of file muted.c. 00504 { 00505 int x; 00506 while((x = getopt(argc, argv, "fhd")) > 0) { 00507 switch(x) { 00508 case 'd': 00509 debug = 1; 00510 needfork = 0; 00511 break; 00512 case 'f': 00513 needfork = 0; 00514 break; 00515 case 'h': 00516 /* Fall through */ 00517 default: 00518 usage(); 00519 exit(1); 00520 } 00521 } 00522 if (load_config()) 00523 exit(1); 00524 if (open_mixer()) 00525 exit(1); 00526 if (connect_asterisk()) { 00527 close(mixfd); 00528 exit(1); 00529 } 00530 if (login_asterisk()) { 00531 close(mixfd); 00532 fclose(astf); 00533 exit(1); 00534 } 00535 if (needfork) 00536 daemon(0,0); 00537 for(;;) { 00538 if (wait_event()) { 00539 fclose(astf); 00540 while(connect_asterisk()) { 00541 sleep(5); 00542 } 00543 if (login_asterisk()) { 00544 fclose(astf); 00545 exit(1); 00546 } 00547 } 00548 } 00549 exit(0); 00550 }
|