Asterisk - The Open Source Telephony Project  GIT-master-1f78ee9
Data Structures | Macros | Functions | Variables
muted.c File Reference

Mute Daemon. More...

#include "asterisk/autoconfig.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.

Data Structures

struct  channel
 
struct  subchannel
 

Macros

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

Functions

static void add_channel (char *tech, char *location)
 
static void append_sub (struct channel *chan, char *name)
 
static void check_mute (void)
 
static int connect_asterisk (void)
 
static void delete_sub (struct channel *chan, char *name)
 
static struct channelfind_channel (char *channel)
 
static char * get_line (void)
 
static int getvol (void)
 
static void hangup_chan (char *channel)
 
static int load_config (void)
 
static int login_asterisk (void)
 
int main (int argc, char *argv[])
 
static void mute (void)
 
static int mutedlevel (int orig, int level)
 
static void offhook_chan (char *channel)
 
static int open_mixer (void)
 
static int setvol (int vol)
 
static void unmute (void)
 
static void usage (void)
 
static int wait_event (void)
 

Variables

static FILE * astf
 
static struct channelchannels
 
static char * config = "/etc/asterisk/muted.conf"
 
static int debug = 0
 
static char host [256] = ""
 
static int mixchan = SOUND_MIXER_VOLUME
 
static int mixfd
 
static int muted = 0
 
static int mutelevel = 20
 
static int mutevol = 0
 
static int needfork = 1
 
static int oldvol = 0
 
static char pass [256] = ""
 
static int smoothfade = 0
 
static int stepsize = 3
 
static char user [256] = ""
 

Detailed Description

Mute Daemon.

Author
Mark Spencer marks.nosp@m.ter@.nosp@m.digiu.nosp@m.m.co.nosp@m.m

Updated for Mac OSX CoreAudio

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.

Definition in file muted.c.

Macro Definition Documentation

◆ ast_strlen_zero

#define ast_strlen_zero (   a)    (!(*(a)))
Examples:
/tmp/asterisk-shallow/include/asterisk/strings.h, and /tmp/asterisk-shallow/main/app.c.

Definition at line 73 of file muted.c.

Referenced by __analog_handle_event(), __analog_ss_thread(), __ast_bridge_technology_register(), __ast_bucket_scheme_register(), __ast_callerid_generate(), __ast_channel_alloc_ap(), __ast_channel_internal_alloc(), __ast_cli_generator(), __ast_cli_register(), __ast_datastore_alloc(), __ast_format_cache_get(), __ast_http_load(), __ast_pbx_run(), __ast_request_and_dial(), __ast_sorcery_apply_config(), __ast_sorcery_object_type_insert_wizard(), __ast_sorcery_wizard_register(), __astman_get_header(), __find_call(), __has_voicemail(), __init_manager(), __manager_event_sessions_va(), __queues_show(), __set_address_from_contact(), __sip_alloc(), __sip_subscribe_mwi_do(), __ssl_setup(), __state_find_or_add(), _iax2_show_peers_one(), _macro_exec(), _sip_show_peer(), _sip_show_peers(), _sip_show_peers_one(), _skinny_show_devices(), _skinny_show_lines(), acf_curl_exec(), acf_curl_write(), acf_if(), acf_isexten_exec(), acf_jabberreceive_read(), acf_jabberstatus_read(), acf_meetme_info(), acf_odbc_read(), acf_odbc_write(), acf_rand_exec(), acf_retrieve_docs(), acf_strptime(), acf_transaction_read(), acf_transaction_write(), acf_version_exec(), acf_vm_info(), acf_vmcount_exec(), acl_to_str(), aco_option_register_deprecated(), aco_process_var(), aco_set_defaults(), action_add_agi_cmd(), action_agent_logoff(), action_agents(), action_aocmessage(), action_atxfer(), action_blind_transfer(), action_bridge(), action_cancel_atxfer(), action_challenge(), action_command(), action_confbridgekick(), action_confbridgelist(), action_confbridgelistrooms(), action_confbridgesetsinglevideosrc(), action_confbridgestartrecord(), action_confbridgestoprecord(), action_coresettings(), action_coreshowchannels(), action_corestatus(), action_dahdidialoffhook(), action_dahdidndoff(), action_dahdidndon(), action_dahdishowchannels(), action_devicestatelist(), action_events(), action_extensionstate(), action_extensionstatelist(), action_getconfig(), action_getconfigjson(), action_getvar(), action_hangup(), action_listcategories(), action_lock_unlock_helper(), action_mailboxcount(), action_mailboxstatus(), action_meetmelist(), action_meetmelistrooms(), action_messagesend(), action_mute_unmute_helper(), action_originate(), action_ping(), action_presencestate(), action_presencestatelist(), action_redirect(), action_sendtext(), action_setvar(), action_status(), action_timeout(), action_transfer(), action_transferhangup(), action_updateconfig(), action_waitevent(), actual_load_config(), add_action_to_menu_entry(), add_calltoken_ignore(), add_cc_call_info_to_response(), add_diversion(), add_diversion_header(), add_extension(), add_format_information_cb(), add_header(), add_header_from_channel_var(), add_hints(), add_item(), add_menu_entry(), add_msid_to_stream(), add_peer_mailboxes(), add_realm_authentication(), add_rpid(), add_sdp(), add_sip_domain(), add_text(), add_vm_recipients_from_string(), admin_exec(), adsi_exec(), adsi_input_format(), adsi_message(), advanced_options(), aes_helper(), agent_alert(), agent_function_read(), agent_handle_logoff_cmd(), agent_handle_show_specific(), agent_login_channel_config(), agent_login_exec(), agent_pvt_destructor(), agent_request_exec(), agent_show_requested(), agi_exec_full(), agi_handle_command(), alarmreceiver_exec(), alsa_new(), ami_register(), ami_show_endpoint(), ami_sip_qualify(), ami_unregister(), analog_call(), analog_ss_thread(), anonymous_identify(), answer_exec_enable(), aoc_create_ie_data(), aoc_create_ie_data_charging_rate(), aoc_parse_ie_charging_rate(), aoc_to_ami(), aocmessage_get_unit_entry(), aor_apply_handler(), app_event_filter_set(), app_exec(), app_is_subscribed_bridge_id(), app_is_subscribed_channel_id(), app_is_subscribed_endpoint_id(), app_subscribe(), append_mailbox(), append_mailbox_mapping(), append_source_stream(), append_transaction(), append_vmu_info_astman(), applicationmap_handler(), apply_general_options(), apply_list_configuration(), apply_option_timeout(), apply_options_full(), apply_outgoing(), apply_peer(), apps_handler(), aqm_exec(), ari_channels_handle_originate_with_id(), ari_channels_handle_snoop_channel(), ari_originate_dial(), assign_and_insert(), ast_acl_output(), ast_add_extension2_lockopt(), ast_agi_register(), ast_aoc_s_add_rate_duration(), ast_aoc_s_add_rate_flat(), ast_aoc_s_add_rate_volume(), ast_aoc_set_association_number(), ast_aoc_set_currency_info(), ast_app_getdata(), ast_app_getdata_full(), ast_app_group_get_count(), ast_app_group_match_get_count(), ast_app_group_set_channel(), ast_app_group_split_group(), ast_app_run_macro(), ast_app_run_sub(), ast_append_acl(), ast_apply_acl_internal(), ast_ari_applications_subscribe(), ast_ari_asterisk_get_global_var(), ast_ari_asterisk_set_global_var(), ast_ari_bridges_add_channel(), ast_ari_bridges_create_with_id(), ast_ari_channels_continue_in_dialplan(), ast_ari_channels_create(), ast_ari_channels_dial(), ast_ari_channels_external_media(), ast_ari_channels_get_channel_var(), ast_ari_channels_hangup(), ast_ari_channels_mute(), ast_ari_channels_redirect(), ast_ari_channels_send_dtmf(), ast_ari_channels_set_channel_var(), ast_ari_channels_unmute(), ast_ari_config_validate_user(), ast_ari_events_user_event(), ast_audiosocket_connect(), ast_audiosocket_init(), ast_base64decode_string(), ast_base64encode_string(), ast_bridge_add_channel(), ast_bridge_channel_write_hold(), ast_bridge_features_enable(), ast_bridge_features_register(), ast_bridge_get_snapshot_by_uniqueid(), ast_bridge_read_after_goto(), ast_bridge_set_after_go_on(), ast_bridge_setup_after_goto(), ast_bridge_snapshot_to_json(), ast_bridge_timelimit(), ast_bridge_transfer_attended(), ast_bucket_alloc(), ast_bucket_file_alloc(), ast_bucket_file_retrieve(), ast_bucket_file_temporary_destroy(), ast_bucket_retrieve(), ast_build_timing(), ast_call_forward(), ast_cc_is_recall(), ast_cdr_format_var(), ast_cdr_getvar(), ast_cdr_serialize_variables(), ast_cel_backend_register(), ast_cel_fabricate_channel_from_event(), ast_channel_by_exten_cb(), ast_channel_by_name_cb(), ast_channel_by_uniqueid_cb(), ast_channel_connected_line_macro(), ast_channel_connected_line_sub(), ast_channel_get_by_name_prefix(), ast_channel_hash_cb(), ast_channel_internal_setup_topics(), ast_channel_publish_dial_forward(), ast_channel_publish_dial_internal(), ast_channel_redirecting_macro(), ast_channel_redirecting_sub(), ast_channel_snapshot_cep_equal(), ast_channel_snapshot_get_latest(), ast_channel_snapshot_get_latest_by_name(), ast_cli_complete(), ast_cli_perms_init(), ast_context_remove_extension_callerid2(), ast_control_tone(), ast_datastores_add(), ast_datastores_alloc_datastore(), ast_db_deltree(), ast_db_gettree(), ast_dns_resolve(), ast_dns_resolve_ipv6_and_ipv4(), ast_dns_resolve_recurring(), ast_dns_resolver_register(), ast_dns_resolver_set_result(), ast_dnsmgr_get_family(), ast_eivr_senddtmf(), ast_el_read_default_histfile(), ast_el_write_default_histfile(), ast_endpoint_add_channel(), ast_endpoint_create(), ast_endpoint_latest_snapshot(), ast_endpoint_set_max_channels(), ast_endpoint_set_state(), ast_endpoint_snapshot_create(), ast_escape(), ast_escape_c(), ast_explicit_goto(), ast_false(), ast_format_cache_set(), ast_format_cap_update_by_allow_disallow(), ast_frame_dump(), ast_get_chan_applicationmap(), ast_get_encoded_char(), ast_get_enum(), ast_get_group(), ast_get_indication_zone(), ast_get_namedgroups(), ast_get_time_t(), ast_get_timeval(), ast_http_create_response(), ast_http_get_json(), ast_http_get_post_vars(), ast_http_header_parse(), ast_http_send(), ast_iax2_new(), ast_include_new(), ast_is_valid_string(), ast_jb_read_conf(), ast_json_to_ast_variables(), ast_json_vpack(), ast_linear_stream(), ast_load_realtime_fields(), ast_logger_create_channel(), ast_makesocket(), ast_manager_build_bridge_state_string_prefix(), ast_manager_register2(), ast_media_cache_create_or_update(), ast_media_cache_delete(), ast_media_cache_exists(), ast_media_cache_retrieve(), ast_media_cache_retrieve_metadata(), ast_media_get_description(), ast_media_get_format_cap(), ast_media_index_update_for_file(), ast_module_check(), ast_moh_files_next(), ast_monitor_change_fname(), ast_monitor_start(), ast_monitor_stop(), ast_msg_send(), ast_multi_channel_blob_add_channel(), ast_multi_channel_blob_get_channel(), ast_multi_channel_blob_get_channels(), ast_multicast_rtp_create_options(), ast_multicast_rtp_options_get_format(), ast_mwi_mailbox_alloc(), ast_mwi_mailbox_delete(), ast_mwi_mailbox_get(), ast_parse_arg(), ast_parse_digest(), ast_pbx_hangup_handler_push(), ast_pbx_outgoing_app_predial(), ast_phoneprov_provider_register(), ast_pickup_call(), ast_playtones_start(), ast_privacy_set(), ast_publish_device_state_full(), ast_queue_hold(), ast_redirecting_reason_name(), ast_register_application2(), ast_register_indication(), ast_remotecontrol(), ast_rtp_dtls_cfg_parse(), ast_rtp_dtls_cfg_validate(), ast_rtp_engine_register2(), ast_rtp_glue_register2(), ast_rtp_instance_new(), ast_rtp_publish_rtcp_message(), ast_sendtext(), ast_sendtext_data(), ast_set_cc_agent_dialstring(), ast_set_cc_callback_macro(), ast_set_cc_callback_sub(), ast_set_hangupsource(), ast_set_indication_country(), ast_sip_auth_vector_init(), ast_sip_cli_traverse_objects(), ast_sip_create_ami_event(), ast_sip_create_dialog_uac(), ast_sip_create_rdata_with_contact(), ast_sip_create_subscription(), ast_sip_default_outbound_endpoint(), ast_sip_for_each_aor(), ast_sip_format_contact_ami(), ast_sip_get_host_ip(), ast_sip_get_transport_name(), ast_sip_location_create_contact(), ast_sip_location_retrieve_contact_and_aor_from_list_filtered(), ast_sip_message_apply_transport(), ast_sip_modify_id_header(), ast_sip_persistent_endpoint_add_to_regcontext(), ast_sip_persistent_endpoint_update_state(), ast_sip_publish_client_add_datastore(), ast_sip_publish_client_alloc_datastore(), ast_sip_register_endpoint_identifier_with_name(), ast_sip_register_event_publisher_handler(), ast_sip_register_publish_handler(), ast_sip_register_subscription_handler(), ast_sip_sched_is_task_running_by_name(), ast_sip_sched_task_cancel_by_name(), ast_sip_sched_task_get_next_run_by_name(), ast_sip_sched_task_get_times_by_name(), ast_sip_schedule_task(), ast_sip_session_add_datastore(), ast_sip_session_alloc_datastore(), ast_sip_session_create_outgoing(), ast_sip_session_media_get_transport(), ast_sip_set_tpselector_from_transport_name(), ast_sip_transport_state_set_preferred_identity(), ast_sip_transport_state_set_service_routes(), ast_sip_transport_state_set_transport(), ast_sorcery_alloc(), ast_sorcery_retrieve_by_id(), ast_speech_unregister(), ast_statsd_log_string(), ast_stir_shaken_verify(), ast_str_substitute_variables_full(), ast_stream_and_wait(), ast_strings_match(), ast_strsep(), ast_taskprocessor_get(), AST_TEST_DEFINE(), ast_true(), ast_tzset(), ast_unreal_new_channels(), ast_uri_is_secure(), ast_var_channels_table(), ast_variable_delete(), ast_variable_update(), ast_vector_string_split(), ast_websocket_uri_cb(), ast_xmldoc_build_arguments(), ast_xmldoc_build_final_response(), ast_xmldoc_build_list_responses(), ast_xmldoc_build_seealso(), ast_xmldoc_load_documentation(), asterisk_publication_devicestate(), asterisk_publication_devicestate_refresh(), asterisk_publication_mailboxstate(), asterisk_publication_mwi_refresh(), asterisk_start_devicestate_publishing(), asterisk_start_mwi_publishing(), astman_send_list_complete_start_common(), astman_send_response_full(), async_delete_name_rec(), async_play_sound_helper(), asyncgoto_exec(), attempt_thread(), attended_transfer_exec(), audiosocket_exec(), audiosocket_request(), auth_apply(), auth_exec(), auth_http_callback(), authenticate(), authenticate_reply(), authenticate_verify(), autopause2int(), background_detect_exec(), base64_helper(), base_process_party_a(), begin_dial_prerun(), blind_transfer_exec(), bridge_agent_hold_push(), bridge_base_init(), bridge_builtin_set_limits(), bridge_check_monitor(), bridge_exec(), bridge_features_duration_callback(), bridge_handle_trip(), bridge_parking_push(), bridge_personality_atxfer_push(), bridge_topics_init(), bridgeadd_exec(), bridgewait_exec(), bucket_file_update_path(), bucket_http_wizard_retrieve_id(), build_calendar(), build_contact(), build_device(), build_gateway(), build_mapping(), build_nonce(), build_peer(), build_profile(), build_reply_digest(), build_user(), builtin_features_helper(), cache_get_callno_locked(), caldav_add_event(), caldav_load_calendar(), caldav_request(), caldav_write_event(), calendar_busy_exec(), calendar_event_read(), calendar_query_exec(), calendar_query_result_exec(), calendar_write_exec(), calendarstate(), caller_id_handler(), callerid_feed(), callerid_genmsg(), cb_events(), cc_esc_publish_handler(), cc_handle_publish_error(), cc_unique_append(), cdr_format_var_internal(), cdr_object_create_public_records(), cdr_object_get_by_name(), cdr_prop_write_callback(), cdr_read(), cdr_read_callback(), cdr_retrieve_time(), cdr_write(), cdr_write_callback(), cel_channel_app_change(), cel_channel_linkedid_change(), cel_dial_cb(), cel_linkedid_ref(), celgenuserevent_exec(), chan_misdn_log(), chan_pjsip_new(), chanavail_exec(), change_monitor_action(), change_redirecting_information(), channel_admin_exec(), channel_dial_cb(), channel_dialplan(), channel_do_masquerade(), channel_fill_empty_accountcode(), channel_fill_empty_peeraccount(), channel_hold_cb(), channel_newexten(), channel_read_pjsip(), channel_read_rtcp(), channel_read_rtp(), channel_req_accountcodes(), channel_spy(), chanspy_exec(), chararray_handler_fn(), check_access(), check_auth(), check_blacklist(), check_bridge_play_sound(), check_day(), check_dow(), check_match(), check_month(), check_new_cdr_needed(), check_password(), check_peer_ok(), check_regcontext(), check_retire_linkedid(), check_sip_domain(), check_timerange(), check_user_full(), cleaned_basedn(), clear_stats(), cli_complete(), cli_complete_notify(), cli_console_dial(), cli_console_sendtext(), cli_contact_get_container(), cli_odbc_read(), cli_odbc_write(), cli_print_body(), cli_qualify(), cli_reload_qualify_endpoint(), cli_show_qualify_endpoint(), close_client(), commit_exec(), common_exec(), compare(), compile_script(), complete_agent(), complete_agent_logoff(), complete_ari_app(), complete_ari_user(), complete_bridge_live(), complete_number(), complete_parking_lot(), conf_ended(), conf_exec(), conf_find_bridge_profile(), conf_find_user_profile(), conf_run(), conf_set_menu_to_user(), confbridge_exec(), confbridge_handle_atxfer(), config_curl(), config_function_read(), config_ldap(), config_line(), config_module(), config_parse_variables(), config_text_file_load(), configuration_parse_unsigned_integer(), connection_dead(), console_dial(), console_new(), console_print(), console_sendtext(), contact_acl_to_str(), contact_apply_handler(), contactstatus_to_json(), control_list_create(), controlplayback_exec(), controlplayback_manager(), copy_all_header(), copy_header(), copy_message(), copy_rules(), copy_variables(), copy_via_headers(), count_exec(), create_addr(), create_addr_from_peer(), create_channel_name(), create_dynamic_lot_full(), create_local_sdp(), create_new_id_hdr(), create_out_of_dialog_request(), create_outgoing_sdp_stream(), create_queue_member(), create_rtp(), create_sound_blob(), create_transaction(), create_unsolicited_mwi_subscriptions(), create_vmaccount(), crement_function_read(), crypto_get_attrib(), csv_log(), csv_quote(), custom_prepare(), custom_presence_callback(), dahdi_cc_callback(), dahdi_handle_event(), dahdi_new(), dahdi_read(), dahdiscan_exec(), database_increment(), declined_handler(), delete_existing_cb(), deltree_exec(), destroy_all_channels(), destroy_endpoint(), destroy_mysql(), destroy_pgsql(), destroy_trans(), determine_actual_value(), determine_sip_publish_type(), determine_starting_point(), device_state_alloc(), device_state_cb(), device_state_subscription_create(), devstate_write(), dial_append_common(), dial_exec_full(), dial_handle_playtones(), dialgroup_read(), dialgroup_refreshdb(), dialgroup_write(), dialog_info_generate_body_content(), dialout(), dialplan_has_destination_cb(), dictate_exec(), digest_check_auth(), directory_exec(), disa_exec(), dns_query_alloc(), do_forward(), do_immediate_setup(), do_message(), do_monitor(), do_notify(), do_pause_or_unpause(), does_category_match(), does_id_conflict(), does_method_match(), domain_alias_apply(), dump_cause(), dump_consumer(), dump_hint(), dumpchan_exec(), dundi_exec(), dundi_flags2str(), dundi_helper(), dundi_hint2str(), dundi_lookup_local(), dundi_query_read(), dundi_query_thread(), dundi_result_read(), dundi_show_mappings(), dundi_show_peer(), dundifunc_read(), dynamic_dtmf_hook_add(), enable_jack_hook(), endpoint_acl_handler(), endpoint_internal_create(), enum_callback(), enum_query_read(), enum_result_read(), env_write(), event_session_alloc(), events_handler(), ewscal_load_calendar(), exchangecal_load_calendar(), exchangecal_write_event(), exec_exec(), execif_exec(), execute_state_callback(), expand_gosub_args(), export_ch(), exten_state_publisher_cb(), extension_match_core(), extension_presence_state_helper(), extenspy_exec(), extract_uri(), extstate_read(), fast_originate(), feature_automixmonitor(), feature_automonitor(), feature_blind_transfer(), festival_exec(), fetch_icalendar(), fileexists_core(), filename_parse(), filter_outgoing_message(), filter_session_outgoing_message(), find_account(), find_aor(), find_aor_for_resource(), find_aor_name(), find_app_by_name(), find_body_generator_accept(), find_channel_parking_lot_name(), find_cli(), find_conf_realtime(), find_endpoint(), find_engine(), find_header(), find_line_by_name(), find_or_create(), find_queue_by_name_rt(), find_realtime_gw(), find_registrar_aor(), find_request_serializer(), find_sdp(), find_sip_method(), find_table(), find_user(), findmeexec(), forkcdr_exec(), format_ami_endpoint_transport(), format_log_default(), forward_message(), forwards_create(), free_user_final(), free_zone(), func_channel_read(), func_channel_write_real(), func_channels_read(), func_check_sipdomain(), func_confbridge_helper(), func_confbridge_info(), func_get_parkingslot_channel(), func_header_read(), func_mixmonitor_read(), func_read_header(), func_write_header(), function_amiclient(), function_db_delete(), function_db_exists(), function_db_read(), function_db_write(), function_enum(), function_eval(), function_eval2(), function_fieldnum_helper(), function_realtime_read(), function_realtime_readdestroy(), function_realtime_store(), function_realtime_write(), function_txtcidname(), generate_parked_user(), generic_fax_exec(), generic_recall(), get_also_info(), get_attestation_from_payload(), get_buddy_status(), get_container(), get_destination(), get_domain(), get_in_brackets_const(), get_in_brackets_full(), get_interface_helper(), get_key(), get_name_and_number(), get_name_from_variable(), get_or_create_subscription(), get_outbound_endpoint(), get_pai(), get_path_to_public_key(), get_queue_member_status(), get_range(), get_rdnis(), get_realm(), get_refer_info(), get_rpid(), get_sip_pvt_from_replaces(), get_subscription(), get_timerange(), get_transfer_context(), get_transport_str2enum(), global_apply(), gosub_exec(), gosubif_exec(), goto_exten(), grab_transfer(), group_count_function_read(), group_function_read(), group_function_write(), group_list_function_read(), group_match_count_function_read(), group_show_channels(), h264_generate_sdp_fmtp(), h264_getjoint(), handle_aor(), handle_attended_transfer(), handle_blind_transfer(), handle_bridge_enter(), handle_cc_notify(), handle_cc_subscribe(), handle_chanlist(), handle_clear_alarms(), handle_cli_check_permissions(), handle_cli_confbridge_show_bridge_profile(), handle_cli_confbridge_show_user_profile(), handle_cli_confbridge_start_record(), handle_cli_config_reload(), handle_cli_database_show(), handle_cli_database_showkey(), handle_cli_devstate_change(), handle_cli_dialplan_save(), handle_cli_dynamic_level_test(), handle_cli_file_convert(), handle_cli_iax2_show_cache(), handle_cli_iax2_show_peer(), handle_cli_iax2_show_users(), handle_cli_presencestate_change(), handle_cli_realtime_mysql_status(), handle_cli_realtime_pgsql_status(), handle_command_response(), handle_controlstreamfile(), handle_debug(), handle_debug_dialplan(), handle_dial_message(), handle_dial_page(), handle_endpoint(), handle_export_primitives(), handle_getvariable(), handle_hangup(), handle_incoming(), handle_incoming_request(), handle_incoming_sdp(), handle_logger_remove_channel(), handle_manager_bridge_tech_suspend(), handle_options(), handle_orig(), handle_pjsip_list_ciphers(), handle_playtones(), handle_queue_add_member(), handle_queue_pause_member(), handle_queue_remove_member(), handle_queue_rule_show(), handle_registrations(), handle_request_bye(), handle_request_info(), handle_request_invite(), handle_request_invite_st(), handle_request_notify(), handle_request_options(), handle_request_publish(), handle_request_refer(), handle_request_subscribe(), handle_request_update(), handle_response(), handle_response_invite(), handle_response_notify(), handle_response_publish(), handle_response_refer(), handle_response_register(), handle_saydatetime(), handle_show_dialplan(), handle_soft_key_event_message(), handle_speechrecognize(), handle_stimulus_message(), handle_trace(), handle_updates(), handle_verbose(), handle_voicemail_show_aliases(), handle_voicemail_show_users(), has_voicemail(), hashtab_compare_extens(), header_identify_match_check(), hep_queue_cb(), hepv3_config_pre_apply(), hint_hash(), hint_read(), hold_intercept_fn_write(), hook_off(), hook_on(), hook_re_enable(), http_body_discard_chunk_trailer_headers(), http_callback(), http_request_headers_get(), iax2_call(), iax2_datetime(), iax2_devicestate(), iax2_prov_app(), iax2_request(), iax_firmware_append(), iax_firmware_get_version(), iax_provflags2str(), ical_load_calendar(), icalendar_add_event(), ices_exec(), iconv_read(), ident_handler(), iftime(), import_helper(), inboxcount2(), incoming_in_dialog_request(), init_acf_query(), init_jack_data(), initialize_cc_max_requests(), initreqprep(), insert_penaltychange(), inspect_module(), internal_aco_type_find(), internal_dnsmgr_lookup(), internal_process_ast_config(), ip_identify_apply(), ip_identify_match_handler(), is_argument(), is_new_rec_file(), is_prefix(), is_preload(), is_unsolicited_allowed(), is_valid_dialstatus(), is_valid_tone_zone(), is_video_dest(), isAnsweringMachine(), isexten_function_read(), jack_exec(), jb_choose_impl(), jb_framedata_init(), jb_helper(), jingle_action_hook(), jingle_alloc(), jingle_interpret_content(), jingle_interpret_description(), jingle_interpret_google_transport(), jingle_interpret_ice_udp_transport(), jingle_new(), jingle_outgoing_hook(), jingle_request(), jingle_send_error_response(), join_conference_bridge(), key_dial_page(), key_history(), key_main_page(), keypad_cfg_read(), kill_if_unfound(), launch_asyncagi(), launch_monitor_thread(), launch_netscript(), ldap_reconnect(), ldap_table_config_add_attribute(), leave_voicemail(), line_identify(), list_item_handler(), load_aliases(), load_asterisk_conf(), load_column_config(), load_config(), load_endpoint(), load_indications(), load_module(), load_moh_classes(), load_mysql_config(), load_odbc_config(), load_realtime_rules(), load_values_config(), local_ast_moh_start(), log_events(), log_exec(), logger_print_normal(), loopback_parse(), lua_get_variable(), lua_get_variable_value(), main(), make_components(), make_dir(), make_email_file(), make_filename(), make_fn(), make_logchannel(), man_do_variable_value(), manager_add_queue_member(), manager_bridge_destroy(), manager_bridge_info(), manager_bridge_kick(), manager_bridge_tech_list(), manager_bridges_list(), manager_change_priority_caller_on_queue(), manager_dbdel(), manager_dbdeltree(), manager_dbget(), manager_dbput(), manager_dialplan_extension_add(), manager_dialplan_extension_remove(), manager_fax_session(), manager_fax_sessions(), manager_fax_stats(), manager_iax2_show_peer_list(), manager_iax2_show_peers(), manager_iax2_show_registry(), manager_jabber_send(), manager_list_voicemail_users(), manager_match_mailbox(), manager_mixmonitor(), manager_modulecheck(), manager_moduleload(), manager_mute_mixmonitor(), manager_mutestream(), manager_notify(), manager_optimize_away(), manager_park(), manager_parking_lot_list(), manager_parking_status(), manager_pause_queue_member(), manager_play_dtmf(), manager_queue_log_custom(), manager_queue_member_penalty(), manager_queue_member_ringinuse(), manager_queue_rule_show(), manager_queues_status(), manager_queues_summary(), manager_remove_queue_member(), manager_show_dialplan(), manager_show_dialplan_helper(), manager_show_registry(), manager_sip_peer_status(), manager_sip_qualify_peer(), manager_sip_show_peer(), manager_sip_show_peers(), manager_sipnotify(), manager_skinny_show_device(), manager_skinny_show_line(), manager_status_voicemail_user(), manager_stop_mixmonitor(), mark_parsed_methods(), mark_unfound(), match_aor(), match_req_to_dialog(), matchcid(), math(), mb_poll_thread(), mbl_load_adapter(), mbl_load_device(), mbl_sendsms_exec(), mbl_status_exec(), md5(), media_cache_item_populate_from_astdb(), meetmemute(), message_playback_callback_fn(), message_range_and_existence_check(), message_received_handler(), message_template_find(), message_template_parse_filebody(), messagecount(), messaging_app_unsubscribe_endpoint(), metermaidstate(), mgcp_call(), mgcp_hangup(), mgcp_new(), mgcp_prune_realtime_gateway(), mgcp_request(), mgcp_ss(), mgcpsock_read(), milliwatt_exec(), minivm_accmess_exec(), minivm_account_func_read(), minivm_counter_func_read(), minivm_counter_func_write(), minivm_delete_exec(), minivm_greet_exec(), minivm_mwi_exec(), minivm_notify_exec(), minivm_record_exec(), misdn_answer(), misdn_call(), misdn_cfg_update_ptp(), misdn_check_l2l1(), misdn_facility_exec(), misdn_new(), misdn_overlap_dial_task(), misdn_request(), misdn_set_opt_exec(), mixmonitor_exec(), mixmonitor_save_prep(), mixmonitor_thread(), mkintf(), module_load_helper_on_file(), moh_parse_options(), monitor_dial(), morsecode_exec(), mp3_exec(), msg_send_exec(), msg_set_var_full(), msg_to_endpoint(), mssql_connect(), multicast_rtp_request(), mwi_contact_changed(), mwi_contact_deleted(), mwi_create_state(), mwi_folder_map(), mwi_generate_body_content(), mwi_mailbox_delete(), mwi_mailbox_get(), mwi_mailbox_update(), mwi_new_subscribe(), mwi_on_aor(), mwi_state_create_message(), mwi_subscription_alloc(), mwi_subscription_established(), mwi_to_event(), mwi_validate_for_aor(), my_connect_db(), mysql_log(), mysql_reconnect(), named_acl_find_realtime(), named_groups_handler(), nbs_alloc(), new_outgoing(), new_realtime_sqlite3_db(), newpvt(), notify_endpoint(), notify_message(), notify_new_message(), notify_uri(), odbc_log(), onedigit_goto(), onNewCallCreated(), onOutgoingCall(), ooh323_indicate(), ooh323_new(), ooh323_onReceivedSetup(), options_on_rx_request(), orig_app(), orig_exten(), originate_exec(), osp_auth(), osp_convert_inout(), osp_convert_outin(), osp_get_varfloat(), osp_get_varint(), osp_lookup(), osp_report_qos(), ospauth_exec(), ospfinished_exec(), osplookup_exec(), ospnext_exec(), oss_call(), oss_new(), page_exec(), park_and_announce_app_exec(), park_announce_update_cb(), park_app_exec(), park_app_parse_data(), park_common_setup(), parked_call_app_exec(), parking_blind_transfer_park(), parking_channel_set_roles(), parking_duration_callback(), parking_lot_cfg_create_extensions(), parking_lot_cfg_remove_extensions(), parse(), parse_allowed_methods(), parse_bookmark(), parse_config(), parse_cookies(), parse_data(), parse_dial_string(), parse_line(), parse_minse(), parse_moved_contact(), parse_oli(), parse_playtone(), parse_register_contact(), parse_request(), parse_session_expires(), parse_simple_message_summary(), parse_sip_options(), parse_tag(), parse_tone_uri(), parse_uri(), parse_uri_full(), parse_via(), participant_idle_mode_setup(), path_get_string(), path_outgoing_request(), payload_helper_app(), pbx_builtin_answer(), pbx_builtin_background(), pbx_builtin_execiftime(), pbx_builtin_gotoif(), pbx_builtin_gotoiftime(), pbx_builtin_hangup(), pbx_builtin_importvar(), pbx_builtin_incomplete(), pbx_builtin_saycharacters_case(), pbx_builtin_saynumber(), pbx_builtin_setamaflags(), pbx_builtin_setvar(), pbx_builtin_setvar_helper(), pbx_builtin_setvar_multiple(), pbx_builtin_waitexten(), pbx_checkcondition(), pbx_extension_helper(), pbx_find_extension(), pbx_load_config(), pbx_load_users(), pbx_outgoing_attempt(), pbx_outgoing_exec(), pbx_parseable_goto(), pbx_set_overrideswitch(), pbx_substitute_variables_helper_full(), peek_read(), peer_ipcmp_cb_full(), permanent_uri_handler(), pgsql_reconnect(), phone_call(), phone_new(), pickup_exec(), pickupchan_exec(), pidf_supplement_body(), pidf_validate_presence(), pjsip_acf_channel_read(), pjsip_acf_dial_contacts_read(), pjsip_acf_parse_uri_read(), pjsip_aor_function_read(), pjsip_contact_function_read(), pjsip_endpoint_function_read(), pjsip_log_test_addr(), play_file(), play_mailbox_owner(), play_message(), play_message_by_id_helper(), play_message_callerid(), play_message_category(), play_message_datetime(), play_moh_exec(), play_record_review(), play_sound_helper(), playback_common(), playback_create(), playback_exec(), populate_cache(), port_str2int(), post_cdr(), pp_each_extension_helper(), pqm_exec(), prep_email_sub_vars(), presence_read(), presence_state_cached(), presence_write(), print_event_instance(), print_ext(), print_frame(), privacy_exec(), proc_422_rsp(), process_category(), process_dahdi(), process_description_file(), process_echocancel(), process_extmap_attributes(), process_ice_attributes(), process_message(), process_message_callback(), process_my_load_module(), process_sdp(), process_sdp_a_ice(), process_sdp_o(), process_text_line(), process_token(), prometheus_callback_register(), prometheus_config_pre_apply(), prometheus_metric_full_to_string(), prometheus_show_status(), proxy_from_config(), public_key_is_expired(), publish_acl_change(), publish_device_state_to_stasis(), publish_load_message_type(), publish_mwi_to_stasis(), publish_qualify_peer_done(), publish_request_initial(), publisher_start(), pubsub_on_rx_mwi_notify_request(), ql_exec(), queue_exec(), queue_function_exists(), queue_function_mem_read(), queue_function_mem_write(), queue_function_memberpenalty_read(), queue_function_memberpenalty_write(), queue_function_qac_dep(), queue_function_queuegetchannel(), queue_function_queuememberlist(), queue_function_queuewaitingcount(), queue_function_var(), queue_mwi_event(), queue_reload_request(), quote(), qupd_exec(), rcv_mac_addr(), rcvfax_exec(), read_config(), read_dirs_cb(), read_exec(), readexten_exec(), realtime_common(), realtime_curl(), realtime_directory(), realtime_exec(), realtime_ldap_entry_to_var(), realtime_ldap_result_to_vars(), realtime_ldap_status(), realtime_multi_curl(), realtime_multi_mysql(), realtime_multi_odbc(), realtime_multi_pgsql(), realtime_mysql(), realtime_odbc(), realtime_peer_by_addr(), realtime_pgsql(), realtime_sqlite3_destroy(), realtime_sqlite3_helper(), realtime_sqlite3_load(), realtime_sqlite3_require(), realtime_sqlite3_store(), realtime_sqlite3_update(), realtime_sqlite3_update2(), realtime_update_peer(), realtimefield_read(), reason_code_to_str(), receive_ademco_event(), receive_message(), receivefax_exec(), record_exec(), record_serializer(), recording_publish(), recordthread(), refer_incoming_blind_request(), regex_filter_handler(), register_aor_core(), register_exten(), register_peer_exten(), register_verify(), registrar_on_rx_request(), registry_rerequest(), reload(), reload_config(), reload_followme(), reload_queue_members(), reload_queues(), reload_single_member(), remove_from_queue(), replace(), reply_digest(), report_receive_fax_status(), report_send_fax_status(), reqprep(), request(), requirecalltoken_mark_auto(), res_sdp_crypto_parse_offer(), resetcdr_exec(), resource_event_handler(), resource_list_apply_handler(), respprep(), restart_monitor(), retrydial_exec(), ring_entry(), rollback_exec(), rotate_file(), rqm_exec(), rt_handle_member_record(), rtcp_do_debug_ip(), rtcp_message_handler(), rtp_do_debug_ip(), run_externnotify(), save_dialstatus(), save_response_fields_to_transport(), saycountedadj_exec(), saycountednoun_exec(), sayunixtime_exec(), schedule_calendar_event(), sdp_fmtp_get(), sdp_requires_deferral(), search_directory(), search_directory_sub(), select_item_pause(), send_bridge_list_item_cb(), send_message(), send_refresh_cb(), send_unsolicited_mwi_notify(), send_unsolicited_mwi_notify_to_contact(), senddtmf_exec(), sendfax_exec(), sendimage_exec(), sendmail(), sendpage(), sendtext(), sendtext_exec(), sendurl_exec(), separate_mailbox(), session_outgoing_nat_hook(), set(), set_bridge_features_on_config(), set_callforwards(), set_config(), set_from_header(), set_id_from_hdr(), set_if(), set_insecure_flags(), set_local_info(), set_loop(), set_member_paused(), set_member_value(), set_outbound_authentication_credentials(), set_public_key_expiration(), set_queue_member_pause(), set_rec_filename(), set_remote_mslabel_and_stream_group(), set_sound(), set_touch_variable(), set_transport(), set_ttl(), set_var_handler(), set_voicemail_extension(), setsubstate(), setup_dahdi_int(), setup_mixmonitor(), setup_mixmonitor_ds(), setup_park_common_datastore(), setup_privacy_args(), setup_profile_caller(), setup_profile_paged(), setup_stunaddr(), sha1(), shared_read(), shared_write(), shell_helper(), shift_pop(), should_queue_connected_line_update(), show_main_page(), show_sound_info_cb(), sip_acf_channel_read(), sip_addheader(), sip_call(), sip_cc_agent_respond(), sip_cc_monitor_suspend(), sip_cc_monitor_unsuspend(), sip_dialog_create_contact(), sip_dialog_create_from(), sip_endpoint_apply_handler(), sip_get_cc_information(), sip_is_token(), sip_msg_send(), sip_new(), sip_options_qualify_contact(), sip_options_synchronize_endpoint(), sip_outbound_publisher_init(), sip_outbound_publisher_set_uri(), sip_outbound_publisher_set_uris(), sip_outbound_registration_apply(), sip_outbound_registration_regc_alloc(), sip_parse_host(), sip_parse_register_line(), sip_pidf_validate(), sip_poke_peer(), sip_prepare_socket(), sip_publisher_service_queue(), sip_reason_code_to_str(), sip_removeheader(), sip_report_chal_sent(), sip_report_failed_challenge_response(), sip_report_security_event(), sip_request_call(), sip_send_mwi_to_peer(), sip_show_channel(), sip_show_registry(), sip_show_settings(), sip_show_user(), sip_sipredirect(), sip_subscribe_mwi(), sip_uri_cmp(), sip_uri_headers_cmp(), sip_uri_params_cmp(), sipinfo_send(), skel_exec(), skinny_new(), skinny_register(), skinny_request(), sla_build_station(), sla_build_trunk(), sla_check_device(), sla_queue_event_conf(), sla_station_destructor(), sla_station_exec(), sla_trunk_destructor(), sla_trunk_exec(), smdi_md_q_cmp_fn(), smdi_msg_find(), smdi_msg_read(), smdi_msg_retrieve_read(), sms_exec(), sndfax_exec(), socket_process_helper(), softhangup_exec(), sorcery_astdb_open(), sorcery_config_open(), sorcery_config_retrieve_regex(), sorcery_function_read(), sorcery_is_configuration_met(), sorcery_is_explicit_name_met(), sorcery_memory_cache_ami_expire(), sorcery_memory_cache_ami_expire_object(), sorcery_memory_cache_ami_populate(), sorcery_memory_cache_ami_stale(), sorcery_memory_cache_ami_stale_object(), sorcery_memory_cache_close(), sorcery_memory_cache_load(), sorcery_memory_cache_open(), sorcery_memory_retrieve_regex(), sorcery_realtime_open(), sorcery_realtime_retrieve_regex(), spawn_mp3(), speech_background(), split_ext(), srv_query_read(), srv_result_read(), stackpeek_read(), start_automixmonitor(), start_automonitor(), start_mixmonitor_callback(), start_monitor_action(), start_monitor_exec(), stasis_app_control_moh_start(), stasis_app_control_record(), stasis_app_control_snoop(), stasis_app_device_state_delete(), stasis_app_device_state_update(), stasis_app_device_states_to_json(), stasis_app_recording_if_exists_parse(), stasis_app_recording_termination_parse(), static_callback(), stir_shaken_certificate_apply(), stir_shaken_incoming_request(), stir_shaken_outgoing_request(), stir_shaken_read(), stir_shaken_verify_json(), stop_automixmonitor(), stop_automonitor(), stop_mixmonitor_full(), stop_monitor_action(), store_config(), stream_echo_exec(), stringfield_handler_fn(), strings_to_mask(), strreplace(), sub_bridge_update_handler(), substituted(), subsystem_alert_decrement(), subsystem_alert_increment(), sysinfo_helper(), system_exec_helper(), system_registry_to_ami(), talk_detect_fn_write(), test_msg_has_destination_cb(), testclient_exec(), testserver_exec(), transfer(), transfer_exec(), transfer_refer(), transmit_cfwdstate(), transmit_fake_auth_response(), transmit_info_with_aoc(), transmit_invite(), transmit_modify_request(), transmit_modify_with_sdp(), transmit_notify_request(), transmit_notify_request_with_callerid(), transmit_register(), transmit_request_with_auth(), transport_apply(), transport_localnet_handler(), transport_tls_cipher_handler(), transport_tls_file_handler(), transport_tls_method_handler(), try_calling(), try_firmware(), try_suggested_sip_codec(), tryexec_exec(), unalloc_sub(), unbound_config_preapply(), unicast_rtp_request(), unistim_call(), unistim_new(), unistim_request(), unregister_exten(), unshift_push(), update_connectedline(), update_from(), update_odbc(), update_realtime_member_field(), update_realtime_members(), update_registry(), upqm_exec(), uri_parse_and_default(), uridecode(), uriencode(), user_event_hook_cb(), userevent_exec(), ustmtext(), valid_exit(), valid_priv_reply(), validate_metric(), validate_metric_type_counter(), validate_metric_type_gauge(), validate_metric_type_set(), validate_metric_type_timer(), validate_name(), validate_publish_config(), validate_user_cb(), verbose_exec(), vm_allocate_dh(), vm_authenticate(), vm_exec(), vm_execmain(), vm_mailbox_snapshot_create(), vm_msg_forward(), vm_msg_move(), vm_msg_play(), vm_msg_remove(), vm_newuser_setup(), vm_options(), vm_playmsgexec(), vm_sayname(), vmauthenticate(), vmsayname_exec(), vmu_tm(), volume_write(), wait_for_answer(), wait_for_hangup(), wait_for_winner(), waitfor_exec(), waituntil_exec(), websocket_client_handshake(), wizard_apply_handler(), word_match(), write_metadata(), xml_translate(), xmldoc_build_field(), xmldoc_get_node(), xmldoc_get_syntax_fun(), xmldoc_parse_specialtags(), xmldoc_update_config_type(), xmpp_client_authenticate_sasl(), xmpp_client_config_post_apply(), xmpp_client_reconnect(), xmpp_client_send_message(), xmpp_client_set_presence(), xmpp_config_prelink(), xmpp_join_exec(), xmpp_leave_exec(), xmpp_pak_message(), xmpp_pak_presence(), xmpp_pubsub_iq_create(), xmpp_send_cb(), xmpp_send_exec(), xmpp_sendgroup_exec(), and zapateller_exec().

Function Documentation

◆ add_channel()

static void add_channel ( char *  tech,
char *  location 
)
static

Definition at line 102 of file muted.c.

References channels, free(), channel::location, malloc(), channel::next, strdup, and channel::tech.

Referenced by load_config().

103 {
104  struct channel *chan;
105  chan = malloc(sizeof(struct channel));
106  if (chan) {
107  memset(chan, 0, sizeof(struct channel));
108  if (!(chan->tech = strdup(tech))) {
109  free(chan);
110  return;
111  }
112  if (!(chan->location = strdup(location))) {
113  free(chan->tech);
114  free(chan);
115  return;
116  }
117  chan->next = channels;
118  channels = chan;
119  }
120 
121 }
char * tech
Definition: muted.c:96
Definition: muted.c:95
char * malloc()
void free()
static struct channel * channels
#define strdup(a)
Definition: astmm.h:165
struct channel * next
Definition: muted.c:98
char * location
Definition: muted.c:97

◆ append_sub()

static void append_sub ( struct channel chan,
char *  name 
)
static

Definition at line 585 of file muted.c.

References free(), malloc(), subchannel::name, subchannel::next, strdup, sub, and channel::subs.

Referenced by offhook_chan().

586 {
587  struct subchannel *sub;
588  sub = chan->subs;
589  while(sub) {
590  if (!strcasecmp(sub->name, name))
591  return;
592  sub = sub->next;
593  }
594  sub = malloc(sizeof(struct subchannel));
595  if (sub) {
596  memset(sub, 0, sizeof(struct subchannel));
597  if (!(sub->name = strdup(name))) {
598  free(sub);
599  return;
600  }
601  sub->next = chan->subs;
602  chan->subs = sub;
603  }
604 }
char * malloc()
void free()
static const char name[]
Definition: cdr_mysql.c:74
struct subchannel * subs
Definition: muted.c:99
struct stasis_forward * sub
Definition: res_corosync.c:240
char * name
Definition: muted.c:91
#define strdup(a)
Definition: astmm.h:165
struct subchannel * next
Definition: muted.c:92

◆ check_mute()

static void check_mute ( void  )
static

Definition at line 547 of file muted.c.

References channels, mute(), muted, channel::next, channel::subs, and unmute().

Referenced by hangup_chan(), and offhook_chan().

548 {
549  int offhook = 0;
550  struct channel *chan;
551  chan = channels;
552  while(chan) {
553  if (chan->subs) {
554  offhook++;
555  break;
556  }
557  chan = chan->next;
558  }
559  if (offhook && !muted)
560  mute();
561  else if (!offhook && muted)
562  unmute();
563 }
static int muted
Definition: muted.c:82
Definition: muted.c:95
static void mute(void)
Definition: muted.c:468
static struct channel * channels
static void unmute(void)
Definition: muted.c:506
struct subchannel * subs
Definition: muted.c:99
struct channel * next
Definition: muted.c:98

◆ connect_asterisk()

static int connect_asterisk ( void  )
static

Connect to the asterisk manager interface

Definition at line 225 of file muted.c.

References astf, errno, gethostbyname, host, and hp.

Referenced by main().

226 {
227  int sock;
228  struct hostent *hp;
229  char *ports;
230  int port = 5038;
231  struct sockaddr_in sin;
232 
233  ports = strchr(host, ':');
234  if (ports) {
235  *ports = '\0';
236  ports++;
237  if ((sscanf(ports, "%5d", &port) != 1) || (port < 1) || (port > 65535)) {
238  fprintf(stderr, "'%s' is not a valid port number in the hostname\n", ports);
239  return -1;
240  }
241  }
242  hp = gethostbyname(host);
243  if (!hp) {
244  fprintf(stderr, "Can't find host '%s'\n", host);
245  return -1;
246  }
247  sock = socket(AF_INET, SOCK_STREAM, 0);
248  if (sock < 0) {
249  fprintf(stderr, "Failed to create socket: %s\n", strerror(errno));
250  return -1;
251  }
252  sin.sin_family = AF_INET;
253  sin.sin_port = htons(port);
254  memcpy(&sin.sin_addr, hp->h_addr, sizeof(sin.sin_addr));
255  if (connect(sock, (struct sockaddr *)&sin, sizeof(sin))) {
256  fprintf(stderr, "Failed to connect to '%s' port '%d': %s\n", host, port, strerror(errno));
257  close(sock);
258  return -1;
259  }
260  astf = fdopen(sock, "r+");
261  if (!astf) {
262  fprintf(stderr, "fdopen failed: %s\n", strerror(errno));
263  close(sock);
264  return -1;
265  }
266  return 0;
267 }
#define gethostbyname
Definition: lock.h:637
static FILE * astf
Definition: muted.c:209
static char host[256]
Definition: muted.c:77
int errno
static struct hostent * hp
Definition: chan_skinny.c:1236

◆ delete_sub()

static void delete_sub ( struct channel chan,
char *  name 
)
static

Definition at line 565 of file muted.c.

References free(), subchannel::name, subchannel::next, NULL, sub, and channel::subs.

Referenced by hangup_chan().

566 {
567  struct subchannel *sub, *prev;
568  prev = NULL;
569  sub = chan->subs;
570  while(sub) {
571  if (!strcasecmp(sub->name, name)) {
572  if (prev)
573  prev->next = sub->next;
574  else
575  chan->subs = sub->next;
576  free(sub->name);
577  free(sub);
578  return;
579  }
580  prev = sub;
581  sub = sub->next;
582  }
583 }
#define NULL
Definition: resample.c:96
void free()
static const char name[]
Definition: cdr_mysql.c:74
struct subchannel * subs
Definition: muted.c:99
struct stasis_forward * sub
Definition: res_corosync.c:240
char * name
Definition: muted.c:91
struct subchannel * next
Definition: muted.c:92

◆ find_channel()

static struct channel* find_channel ( char *  channel)
static

Definition at line 326 of file muted.c.

References channels, debug, channel::location, channel::next, NULL, channel::tech, and tmp().

Referenced by hangup_chan(), and offhook_chan().

327 {
328  char tmp[256] = "";
329  char *s, *t;
330  struct channel *chan;
331  strncpy(tmp, channel, sizeof(tmp) - 1);
332  s = strchr(tmp, '/');
333  if (s) {
334  *s = '\0';
335  s++;
336  t = strrchr(s, '-');
337  if (t) {
338  *t = '\0';
339  }
340  if (debug)
341  printf("Searching for '%s' tech, '%s' location\n", tmp, s);
342  chan = channels;
343  while(chan) {
344  if (!strcasecmp(chan->tech, tmp) && !strcasecmp(chan->location, s)) {
345  if (debug)
346  printf("Found '%s'/'%s'\n", chan->tech, chan->location);
347  break;
348  }
349  chan = chan->next;
350  }
351  } else
352  chan = NULL;
353  return chan;
354 }
static int tmp()
Definition: bt_open.c:389
char * tech
Definition: muted.c:96
Definition: muted.c:95
#define NULL
Definition: resample.c:96
static struct channel * channels
struct channel * next
Definition: muted.c:98
char * location
Definition: muted.c:97
static int debug
Definition: muted.c:84

◆ get_line()

static char* get_line ( void  )
static

Definition at line 269 of file muted.c.

References astf, buf, and NULL.

Referenced by login_asterisk(), and wait_event().

270 {
271  static char buf[1024];
272  if (fgets(buf, sizeof(buf), astf)) {
273  while(strlen(buf) && (buf[strlen(buf) - 1] < 33))
274  buf[strlen(buf) - 1] = '\0';
275  return buf;
276  } else
277  return NULL;
278 }
static FILE * astf
Definition: muted.c:209
char buf[BUFSIZE]
Definition: eagi_proxy.c:66
#define NULL
Definition: resample.c:96

◆ getvol()

static int getvol ( void  )
static

Definition at line 357 of file muted.c.

References channels, errno, mixchan, mixfd, and NULL.

Referenced by mute(), and unmute().

358 {
359  int vol;
360 
361  if (ioctl(mixfd, MIXER_READ(mixchan), &vol)) {
362 #else
363 static float getvol(void)
364 {
365  float volumeL, volumeR, vol;
366  OSStatus err;
367  AudioDeviceID device;
368  UInt32 size;
369  UInt32 channels[2];
370  AudioObjectPropertyAddress OutputAddr = { kAudioHardwarePropertyDefaultOutputDevice, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster };
371  AudioObjectPropertyAddress ChannelAddr = { kAudioDevicePropertyPreferredChannelsForStereo, kAudioDevicePropertyScopeOutput, kAudioObjectPropertyElementWildcard };
372  AudioObjectPropertyAddress VolumeAddr = { kAudioDevicePropertyVolumeScalar, kAudioDevicePropertyScopeOutput, };
373 
374  size = sizeof(device);
375  err = AudioObjectGetPropertyData(kAudioObjectSystemObject, &OutputAddr, 0, NULL, &size, &device);
376  size = sizeof(channels);
377  if (!err) {
378  err = AudioObjectGetPropertyData(device, &ChannelAddr, 0, NULL, &size, &channels);
379  }
380  size = sizeof(vol);
381  if (!err) {
382  VolumeAddr.mElement = channels[0];
383  err = AudioObjectGetPropertyData(device, &VolumeAddr, 0, NULL, &size, &volumeL);
384  }
385  if (!err) {
386  VolumeAddr.mElement = channels[1];
387  err = AudioObjectGetPropertyData(device, &VolumeAddr, 0, NULL, &size, &volumeR);
388  }
389  if (!err)
390  vol = (volumeL < volumeR) ? volumeR : volumeL;
391  else {
392 #endif
393  fprintf(stderr, "Unable to read mixer volume: %s\n", strerror(errno));
394  return -1;
395  }
396  return vol;
397 }
#define NULL
Definition: resample.c:96
static int mixchan
Definition: muted.c:87
static struct channel * channels
int errno
static int getvol(void)
Definition: muted.c:357
static int mixfd
Definition: muted.c:211

◆ hangup_chan()

static void hangup_chan ( char *  channel)
static

Definition at line 606 of file muted.c.

References check_mute(), debug, delete_sub(), and find_channel().

Referenced by wait_event().

607 {
608  struct channel *chan;
609  if (debug)
610  printf("Hangup '%s'\n", channel);
611  chan = find_channel(channel);
612  if (chan)
613  delete_sub(chan, channel);
614  check_mute();
615 }
static void check_mute(void)
Definition: muted.c:547
static void delete_sub(struct channel *chan, char *name)
Definition: muted.c:565
Definition: muted.c:95
static struct channel * find_channel(char *channel)
Definition: muted.c:326
static int debug
Definition: muted.c:84

◆ load_config()

static int load_config ( void  )
static

Definition at line 123 of file muted.c.

References add_channel(), buf, channels, config, errno, host, mutelevel, pass, and smoothfade.

Referenced by main().

124 {
125  FILE *f;
126  char buf[1024];
127  char *val;
128  char *val2;
129  int lineno=0;
130  int x;
131  f = fopen(config, "r");
132  if (!f) {
133  fprintf(stderr, "Unable to open config file '%s': %s\n", config, strerror(errno));
134  return -1;
135  }
136  while(!feof(f)) {
137  if (!fgets(buf, sizeof(buf), f)) {
138  continue;
139  }
140  if (!feof(f)) {
141  lineno++;
142  val = strchr(buf, '#');
143  if (val) *val = '\0';
144  while(strlen(buf) && (buf[strlen(buf) - 1] < 33))
145  buf[strlen(buf) - 1] = '\0';
146  if (!strlen(buf))
147  continue;
148  val = buf;
149  while(*val) {
150  if (*val < 33)
151  break;
152  val++;
153  }
154  if (*val) {
155  *val = '\0';
156  val++;
157  while(*val && (*val < 33)) val++;
158  }
159  if (!strcasecmp(buf, "host")) {
160  if (val && strlen(val))
161  strncpy(host, val, sizeof(host) - 1);
162  else
163  fprintf(stderr, "host needs an argument (the host) at line %d\n", lineno);
164  } else if (!strcasecmp(buf, "user")) {
165  if (val && strlen(val))
166  snprintf(user, sizeof(user), "%s", val);
167  else
168  fprintf(stderr, "user needs an argument (the user) at line %d\n", lineno);
169  } else if (!strcasecmp(buf, "pass")) {
170  if (val && strlen(val))
171  snprintf(pass, sizeof(pass), "%s", val);
172  else
173  fprintf(stderr, "pass needs an argument (the password) at line %d\n", lineno);
174  } else if (!strcasecmp(buf, "smoothfade")) {
175  smoothfade = 1;
176  } else if (!strcasecmp(buf, "mutelevel")) {
177  if (val && (sscanf(val, "%3d", &x) == 1) && (x > -1) && (x < 101)) {
178  mutelevel = x;
179  } else
180  fprintf(stderr, "mutelevel must be a number from 0 (most muted) to 100 (no mute) at line %d\n", lineno);
181  } else if (!strcasecmp(buf, "channel")) {
182  if (val && strlen(val)) {
183  val2 = strchr(val, '/');
184  if (val2) {
185  *val2 = '\0';
186  val2++;
187  add_channel(val, val2);
188  } else
189  fprintf(stderr, "channel needs to be of the format Tech/Location at line %d\n", lineno);
190  } else
191  fprintf(stderr, "channel needs an argument (the channel) at line %d\n", lineno);
192  } else {
193  fprintf(stderr, "ignoring unknown keyword '%s'\n", buf);
194  }
195  }
196  }
197  fclose(f);
198  if (!strlen(host))
199  fprintf(stderr, "no 'host' specification in config file\n");
200  else if (!strlen(user))
201  fprintf(stderr, "no 'user' specification in config file\n");
202  else if (!channels)
203  fprintf(stderr, "no 'channel' specifications in config file\n");
204  else
205  return 0;
206  return -1;
207 }
Definition: ast_expr2.c:325
char buf[BUFSIZE]
Definition: eagi_proxy.c:66
static int smoothfade
Definition: muted.c:80
static int mutelevel
Definition: muted.c:81
static char host[256]
Definition: muted.c:77
static struct channel * channels
static char * config
Definition: muted.c:75
int errno
structure to hold users read from users.conf
static void add_channel(char *tech, char *location)
Definition: muted.c:102
static char pass[256]
Definition: muted.c:79

◆ login_asterisk()

static int login_asterisk ( void  )
static

Login to the asterisk manager interface

Definition at line 281 of file muted.c.

References astf, get_line(), and pass.

Referenced by main().

282 {
283  char *welcome;
284  char *resp;
285  if (!(welcome = get_line())) {
286  fprintf(stderr, "disconnected (1)\n");
287  return -1;
288  }
289  fprintf(astf,
290  "Action: Login\r\n"
291  "Username: %s\r\n"
292  "Secret: %s\r\n\r\n", user, pass);
293  if (!(welcome = get_line())) {
294  fprintf(stderr, "disconnected (2)\n");
295  return -1;
296  }
297  if (strcasecmp(welcome, "Response: Success")) {
298  fprintf(stderr, "login failed ('%s')\n", welcome);
299  return -1;
300  }
301  /* Eat the rest of the event */
302  while((resp = get_line()) && strlen(resp));
303  if (!resp) {
304  fprintf(stderr, "disconnected (3)\n");
305  return -1;
306  }
307  fprintf(astf,
308  "Action: Status\r\n\r\n");
309  if (!(welcome = get_line())) {
310  fprintf(stderr, "disconnected (4)\n");
311  return -1;
312  }
313  if (strcasecmp(welcome, "Response: Success")) {
314  fprintf(stderr, "status failed ('%s')\n", welcome);
315  return -1;
316  }
317  /* Eat the rest of the event */
318  while((resp = get_line()) && strlen(resp));
319  if (!resp) {
320  fprintf(stderr, "disconnected (5)\n");
321  return -1;
322  }
323  return 0;
324 }
static FILE * astf
Definition: muted.c:209
static char * get_line(void)
Definition: muted.c:269
structure to hold users read from users.conf
static char pass[256]
Definition: muted.c:79

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 687 of file muted.c.

References astf, connect_asterisk(), debug, errno, load_config(), login_asterisk(), mixfd, needfork, NULL, open_mixer(), usage(), and wait_event().

688 {
689  int x;
690  while((x = getopt(argc, argv, "fhd")) > 0) {
691  switch(x) {
692  case 'd':
693  debug = 1;
694  needfork = 0;
695  break;
696  case 'f':
697  needfork = 0;
698  break;
699  case 'h':
700  /* Fall through */
701  default:
702  usage();
703  exit(1);
704  }
705  }
706  if (load_config())
707  exit(1);
708 #ifndef __Darwin__
709  if (open_mixer())
710  exit(1);
711 #endif
712  if (connect_asterisk()) {
713 #ifndef __Darwin__
714  close(mixfd);
715 #endif
716  exit(1);
717  }
718  if (login_asterisk()) {
719 #ifndef __Darwin__
720  close(mixfd);
721 #endif
722  fclose(astf);
723  exit(1);
724  }
725 #ifdef HAVE_WORKING_FORK
726  if (needfork) {
727 #ifndef HAVE_SBIN_LAUNCHD
728  if (daemon(0,0) < 0) {
729  fprintf(stderr, "daemon() failed: %s\n", strerror(errno));
730  exit(1);
731  }
732 #else
733  const char *found = NULL, *paths[] = {
734  "/Library/LaunchAgents/org.asterisk.muted.plist",
735  "/Library/LaunchDaemons/org.asterisk.muted.plist",
736  "contrib/init.d/org.asterisk.muted.plist",
737  "<path-to-asterisk-source>/contrib/init.d/org.asterisk.muted.plist" };
738  char userpath[256];
739  struct stat unused;
740  struct passwd *pwd = getpwuid(getuid());
741  int i;
742 
743  snprintf(userpath, sizeof(userpath), "%s%s", pwd->pw_dir, paths[0]);
744  if (!stat(userpath, &unused)) {
745  found = userpath;
746  }
747 
748  if (!found) {
749  for (i = 0; i < 3; i++) {
750  if (!stat(paths[i], &unused)) {
751  found = paths[i];
752  break;
753  }
754  }
755  }
756 
757  fprintf(stderr, "Mac OS X detected. Use 'launchctl load -w %s' to launch.\n", found ? found : paths[3]);
758  exit(1);
759 #endif /* !defined(HAVE_SBIN_LAUNCHD */
760  }
761 #endif
762  for(;;) {
763  if (wait_event()) {
764  fclose(astf);
765  while(connect_asterisk()) {
766  sleep(5);
767  }
768  if (login_asterisk()) {
769  fclose(astf);
770  exit(1);
771  }
772  }
773  }
774  exit(0);
775 }
static FILE * astf
Definition: muted.c:209
static int wait_event(void)
Definition: muted.c:628
#define NULL
Definition: resample.c:96
static int connect_asterisk(void)
Definition: muted.c:225
static int login_asterisk(void)
Definition: muted.c:281
static int open_mixer(void)
Definition: muted.c:213
static int load_config(void)
Definition: muted.c:123
int errno
static int mixfd
Definition: muted.c:211
static void usage(void)
Definition: muted.c:680
static int needfork
Definition: muted.c:83
static int debug
Definition: muted.c:84

◆ mute()

static void mute ( void  )
static

Definition at line 468 of file muted.c.

References debug, getvol(), muted, mutedlevel(), mutelevel, setvol(), smoothfade, and stepsize.

Referenced by check_mute().

469 {
470 #ifndef __Darwin__
471  int vol;
472  int start;
473  int x;
474 #else
475  float vol;
476  float start = 1.0;
477  float x;
478 #endif
479  vol = getvol();
480  oldvol = vol;
481  if (smoothfade)
482 #ifdef __Darwin__
483  start = mutelevel;
484 #else
485  start = 100;
486  else
487  start = mutelevel;
488 #endif
489  for (x=start;x>=mutelevel;x-=stepsize) {
490  mutevol = mutedlevel(vol, x);
491  setvol(mutevol);
492  /* Wait 0.01 sec */
493  usleep(10000);
494  }
495  mutevol = mutedlevel(vol, mutelevel);
496  setvol(mutevol);
497  if (debug)
498 #ifdef __Darwin__
499  printf("Mute from '%f' to '%f'!\n", oldvol, mutevol);
500 #else
501  printf("Mute from '%04x' to '%04x'!\n", oldvol, mutevol);
502 #endif
503  muted = 1;
504 }
static int mutevol
Definition: muted.c:443
static int muted
Definition: muted.c:82
static int mutedlevel(int orig, int level)
Definition: muted.c:450
static int smoothfade
Definition: muted.c:80
static int mutelevel
Definition: muted.c:81
static int stepsize
Definition: muted.c:85
static int getvol(void)
Definition: muted.c:357
static int setvol(int vol)
Definition: muted.c:400
static int oldvol
Definition: muted.c:442
static int debug
Definition: muted.c:84

◆ mutedlevel()

static int mutedlevel ( int  orig,
int  level 
)
static

Definition at line 450 of file muted.c.

Referenced by mute(), and unmute().

451 {
452  int l = orig >> 8;
453  int r = orig & 0xff;
454  l = (float)(level) * (float)(l) / 100.0;
455  r = (float)(level) * (float)(r) / 100.0;
456 
457  return (l << 8) | r;
458 #else
459 static float mutedlevel(float orig, float level)
460 {
461  float master = orig;
462  master = level * master / 100.0;
463  return master;
464 #endif
465 
466 }
static int mutedlevel(int orig, int level)
Definition: muted.c:450

◆ offhook_chan()

static void offhook_chan ( char *  channel)
static

Definition at line 617 of file muted.c.

References append_sub(), check_mute(), debug, and find_channel().

Referenced by wait_event().

618 {
619  struct channel *chan;
620  if (debug)
621  printf("Offhook '%s'\n", channel);
622  chan = find_channel(channel);
623  if (chan)
624  append_sub(chan, channel);
625  check_mute();
626 }
static void check_mute(void)
Definition: muted.c:547
Definition: muted.c:95
static void append_sub(struct channel *chan, char *name)
Definition: muted.c:585
static struct channel * find_channel(char *channel)
Definition: muted.c:326
static int debug
Definition: muted.c:84

◆ open_mixer()

static int open_mixer ( void  )
static

Definition at line 213 of file muted.c.

References errno, and mixfd.

Referenced by main().

214 {
215  mixfd = open("/dev/mixer", O_RDWR);
216  if (mixfd < 0) {
217  fprintf(stderr, "Unable to open /dev/mixer: %s\n", strerror(errno));
218  return -1;
219  }
220  return 0;
221 }
int errno
static int mixfd
Definition: muted.c:211

◆ setvol()

static int setvol ( int  vol)
static

Definition at line 400 of file muted.c.

References channels, errno, mixchan, mixfd, and NULL.

Referenced by mute(), and unmute().

404 {
405 #ifndef __Darwin__
406  if (ioctl(mixfd, MIXER_WRITE(mixchan), &vol)) {
407 #else
408  float volumeL = vol;
409  float volumeR = vol;
410  OSStatus err;
411  AudioDeviceID device;
412  UInt32 size;
413  UInt32 channels[2];
414  AudioObjectPropertyAddress OutputAddr = { kAudioHardwarePropertyDefaultOutputDevice, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster };
415  AudioObjectPropertyAddress ChannelAddr = { kAudioDevicePropertyPreferredChannelsForStereo, kAudioDevicePropertyScopeOutput, kAudioObjectPropertyElementWildcard };
416  AudioObjectPropertyAddress VolumeAddr = { kAudioDevicePropertyVolumeScalar, kAudioDevicePropertyScopeOutput, };
417 
418  size = sizeof(device);
419  err = AudioObjectGetPropertyData(kAudioObjectSystemObject, &OutputAddr, 0, NULL, &size, &device);
420  size = sizeof(channels);
421  err = AudioObjectGetPropertyData(device, &ChannelAddr, 0, NULL, &size, &channels);
422  size = sizeof(vol);
423  if (!err) {
424  VolumeAddr.mElement = channels[0];
425  err = AudioObjectSetPropertyData(device, &VolumeAddr, 0, NULL, size, &volumeL);
426  }
427  if (!err) {
428  VolumeAddr.mElement = channels[1];
429  err = AudioObjectSetPropertyData(device, &VolumeAddr, 0, NULL, size, &volumeR);
430  }
431  if (err) {
432 #endif
433 
434  fprintf(stderr, "Unable to write mixer volume: %s\n", strerror(errno));
435  return -1;
436 
437  }
438  return 0;
439 }
#define NULL
Definition: resample.c:96
static int mixchan
Definition: muted.c:87
static struct channel * channels
int errno
static int mixfd
Definition: muted.c:211

◆ unmute()

static void unmute ( void  )
static

Definition at line 506 of file muted.c.

References debug, getvol(), muted, mutedlevel(), mutelevel, setvol(), smoothfade, and stepsize.

Referenced by check_mute().

507 {
508 #ifdef __Darwin__
509  float vol;
510  float start;
511  float x;
512 #else
513  int vol;
514  int start;
515  int x;
516 #endif
517  vol = getvol();
518  if (debug)
519 #ifdef __Darwin__
520  printf("Unmute from '%f' (should be '%f') to '%f'!\n", vol, mutevol, oldvol);
521  mutevol = vol;
522  if (vol == mutevol) {
523 #else
524  printf("Unmute from '%04x' (should be '%04x') to '%04x'!\n", vol, mutevol, oldvol);
525  if ((int)vol == mutevol) {
526 #endif
527  if (smoothfade)
528  start = mutelevel;
529  else
530 #ifdef __Darwin__
531  start = 1.0;
532 #else
533  start = 100;
534 #endif
535  for (x=start;x<100;x+=stepsize) {
536  mutevol = mutedlevel(oldvol, x);
537  setvol(mutevol);
538  /* Wait 0.01 sec */
539  usleep(10000);
540  }
541  setvol(oldvol);
542  } else
543  printf("Whoops, it's already been changed!\n");
544  muted = 0;
545 }
static int mutevol
Definition: muted.c:443
static int muted
Definition: muted.c:82
static int mutedlevel(int orig, int level)
Definition: muted.c:450
static int smoothfade
Definition: muted.c:80
static int mutelevel
Definition: muted.c:81
static int stepsize
Definition: muted.c:85
static int getvol(void)
Definition: muted.c:357
static int setvol(int vol)
Definition: muted.c:400
static int oldvol
Definition: muted.c:442
static int debug
Definition: muted.c:84

◆ usage()

static void usage ( void  )
static

Definition at line 680 of file muted.c.

Referenced by main().

681 {
682  printf("Usage: muted [-f] [-d]\n"
683  " -f : Do not fork\n"
684  " -d : Debug (implies -f)\n");
685 }

◆ wait_event()

static int wait_event ( void  )
static

Definition at line 628 of file muted.c.

References get_line(), hangup_chan(), and offhook_chan().

Referenced by main().

629 {
630  char *resp;
631  char event[120]="";
632  char channel[120]="";
633  char oldname[120]="";
634  char newname[120]="";
635 
636  resp = get_line();
637  if (!resp) {
638  fprintf(stderr, "disconnected (6)\n");
639  return -1;
640  }
641  if (!strncasecmp(resp, "Event: ", strlen("Event: "))) {
642  int event_len = -1;
643  int channel_len = -1;
644  int newname_len = -1;
645  int oldname_len = -1;
646 
647  event_len = snprintf(event, sizeof(event), "%s", resp + strlen("Event: "));
648  /* Consume the rest of the non-event */
649  while((resp = get_line()) && strlen(resp)) {
650  if (!strncasecmp(resp, "Channel: ", strlen("Channel: ")))
651  channel_len = snprintf(channel, sizeof(channel), "%s", resp + strlen("Channel: "));
652  if (!strncasecmp(resp, "Newname: ", strlen("Newname: ")))
653  newname_len = snprintf(newname, sizeof(newname), "%s", resp + strlen("Newname: "));
654  if (!strncasecmp(resp, "Oldname: ", strlen("Oldname: ")))
655  oldname_len = snprintf(oldname, sizeof(oldname), "%s", resp + strlen("Oldname: "));
656  }
657  if (channel_len == strlen(channel)) {
658  if (event_len == strlen(event) && !strcasecmp(event, "Hangup"))
659  hangup_chan(channel);
660  else
661  offhook_chan(channel);
662  }
663  if (newname_len == strlen(newname) && oldname_len == strlen(oldname)) {
664  if (event_len == strlen(event) && !strcasecmp(event, "Rename")) {
665  hangup_chan(oldname);
666  offhook_chan(newname);
667  }
668  }
669  } else {
670  /* Consume the rest of the non-event */
671  while((resp = get_line()) && strlen(resp));
672  }
673  if (!resp) {
674  fprintf(stderr, "disconnected (7)\n");
675  return -1;
676  }
677  return 0;
678 }
static void offhook_chan(char *channel)
Definition: muted.c:617
Definition: astman.c:222
Definition: muted.c:95
static void hangup_chan(char *channel)
Definition: muted.c:606
static char * get_line(void)
Definition: muted.c:269

Variable Documentation

◆ astf

FILE* astf
static

Definition at line 209 of file muted.c.

Referenced by connect_asterisk(), get_line(), login_asterisk(), and main().

◆ channels

struct channel * channels
static

◆ config

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

Definition at line 75 of file muted.c.

Referenced by load_config().

◆ debug

int debug = 0
static

Definition at line 84 of file muted.c.

Referenced by find_channel(), hangup_chan(), main(), mute(), offhook_chan(), and unmute().

◆ host

char host[256] = ""
static

◆ mixchan

int mixchan = SOUND_MIXER_VOLUME
static

Definition at line 87 of file muted.c.

Referenced by getvol(), and setvol().

◆ mixfd

int mixfd
static

Definition at line 211 of file muted.c.

Referenced by getvol(), main(), open_mixer(), and setvol().

◆ muted

int muted = 0
static

◆ mutelevel

int mutelevel = 20
static

Definition at line 81 of file muted.c.

Referenced by load_config(), mute(), and unmute().

◆ mutevol

int mutevol = 0
static

Definition at line 443 of file muted.c.

◆ needfork

int needfork = 1
static

Definition at line 83 of file muted.c.

Referenced by main().

◆ oldvol

int oldvol = 0
static

Definition at line 442 of file muted.c.

◆ pass

char pass[256] = ""
static

Definition at line 79 of file muted.c.

Referenced by load_config(), and login_asterisk().

◆ smoothfade

int smoothfade = 0
static

Definition at line 80 of file muted.c.

Referenced by load_config(), mute(), and unmute().

◆ stepsize

int stepsize = 3
static

Definition at line 85 of file muted.c.

Referenced by mute(), and unmute().

◆ user

char user[256] = ""
static

Definition at line 78 of file muted.c.