Skip to content
Snippets Groups Projects
muted.c 17.07 KiB
/*
 * Asterisk -- An open source telephony toolkit.
 *
 * Copyright (C) 1999 - 2005, Digium, Inc.
 *
 * Mark Spencer <markster@digium.com>
 *
 * Updated for Mac OSX CoreAudio 
 * by Josh Roberson <josh@asteriasgi.com>
 *
 * See http://www.asterisk.org for more information about
 * the Asterisk project. Please do not directly contact
 * any of the maintainers of this project for assistance;
 * the project provides a web site, mailing lists and IRC
 * channels for your use.
 *
 * This program is free software, distributed under the terms of
 * the GNU General Public License Version 2. See the LICENSE file
 * at the top of the source tree.
 */

/*! \file
 *
 * \brief Mute Daemon
 *
 * \author Mark Spencer <markster@digium.com>
 *
 * Updated for Mac OSX CoreAudio 
 * \arg Josh Roberson <josh@asteriasgi.com>
 *
 * \note Specially written for Malcolm Davenport, but I think I'll use it too
 * Connects to the Asterisk Manager Interface, AMI, and listens for events
 * on certain devices. If a phone call is connected to one of the devices (phones)
 * the local sound is muted to a lower volume during the call.
 *
 */

/*** MODULEINFO
	<support_level>extended</support_level>
 ***/

#include "asterisk/autoconfig.h"

#ifdef __Darwin__
#include <CoreAudio/AudioHardware.h> 
#include <sys/types.h>
#include <pwd.h>
#include <sys/stat.h>
#elif defined(__linux__) || defined(__FreeBSD__) || defined(__GLIBC__)
#include <sys/soundcard.h>
#endif
#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>

#define ast_strlen_zero(a)	(!(*(a)))

static char *config = "/etc/asterisk/muted.conf";

static char host[256] = "";
static char user[256] = "";
static char pass[256] = "";