Asterisk - The Open Source Telephony Project
GIT-master-a24979a
|
Implementation of Media Gateway Control Protocol. More...
#include "asterisk.h"
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <fcntl.h>
#include <netdb.h>
#include <signal.h>
#include <netinet/in.h>
#include <netinet/in_systm.h>
#include <netinet/ip.h>
#include <arpa/inet.h>
#include <ctype.h>
#include "asterisk/lock.h"
#include "asterisk/channel.h"
#include "asterisk/config.h"
#include "asterisk/module.h"
#include "asterisk/pickup.h"
#include "asterisk/pbx.h"
#include "asterisk/sched.h"
#include "asterisk/io.h"
#include "asterisk/rtp_engine.h"
#include "asterisk/acl.h"
#include "asterisk/callerid.h"
#include "asterisk/cli.h"
#include "asterisk/say.h"
#include "asterisk/astdb.h"
#include "asterisk/features.h"
#include "asterisk/app.h"
#include "asterisk/mwi.h"
#include "asterisk/musiconhold.h"
#include "asterisk/utils.h"
#include "asterisk/netsock2.h"
#include "asterisk/causes.h"
#include "asterisk/dsp.h"
#include "asterisk/devicestate.h"
#include "asterisk/stringfields.h"
#include "asterisk/abstract_jb.h"
#include "asterisk/chanvars.h"
#include "asterisk/pktccops.h"
#include "asterisk/stasis.h"
#include "asterisk/bridge.h"
#include "asterisk/features_config.h"
#include "asterisk/parking.h"
#include "asterisk/stasis_channels.h"
#include "asterisk/format_cache.h"
Go to the source code of this file.
Data Structures | |
struct | mgcp_endpoint |
struct | mgcp_gateway |
struct | mgcp_message |
mgcp_message: MGCP message for queuing up More... | |
struct | mgcp_request |
struct | mgcp_response |
struct | mgcp_subchannel |
Macros | |
#define | DEFAULT_EXPIRY 120 |
#define | DEFAULT_MGCP_CA_PORT 2727 |
#define | DEFAULT_MGCP_GW_PORT 2427 |
#define | DEFAULT_RETRANS 1000 |
#define | DIRECTMEDIA 1 |
#define | INADDR_NONE (in_addr_t)(-1) |
#define | MAX_EXPIRY 3600 |
#define | MAX_RETRANS 5 |
#define | MAX_SUBS 2 |
#define | MGCP_CX_CONF 3 |
#define | MGCP_CX_CONFERENCE 3 |
#define | MGCP_CX_INACTIVE 4 |
#define | MGCP_CX_MUTE 4 |
#define | MGCP_CX_RECVONLY 1 |
#define | MGCP_CX_SENDONLY 0 |
#define | MGCP_CX_SENDRECV 2 |
#define | MGCP_DTMF_HYBRID (1 << 2) |
#define | MGCP_DTMF_INBAND (1 << 1) |
#define | MGCP_DTMF_RFC2833 (1 << 0) |
#define | MGCP_MAX_HEADERS 64 |
#define | MGCP_MAX_LINES 64 |
#define | MGCP_MAX_PACKET 1500 |
#define | MGCP_OFFHOOK 2 |
#define | MGCP_ONHOOK 1 |
#define | MGCP_SUBCHANNEL_MAGIC "!978!" |
#define | MGCPDUMPER |
#define | RESPONSE_TIMEOUT 30 |
#define | SUB_ALT 1 |
#define | SUB_REAL 0 |
#define | TYPE_LINE 2 |
#define | TYPE_TRUNK 1 |
Enumerations | |
enum | { MGCP_CMD_EPCF , MGCP_CMD_CRCX , MGCP_CMD_MDCX , MGCP_CMD_DLCX , MGCP_CMD_RQNT , MGCP_CMD_NTFY , MGCP_CMD_AUEP , MGCP_CMD_AUCX , MGCP_CMD_RSIP } |
Functions | |
static char * | __get_header (struct mgcp_request *req, char *name, int *start, char *def) |
static int | __mgcp_xmit (struct mgcp_gateway *gw, char *data, int len) |
static void | __reg_module (void) |
static void | __unreg_module (void) |
static int | acf_channel_read (struct ast_channel *chan, const char *funcname, char *preparse, char *buf, size_t buflen) |
static int | add_header (struct mgcp_request *req, const char *var, const char *value) |
static void | add_header_offhook (struct mgcp_subchannel *sub, struct mgcp_request *resp, char *tone) |
static int | add_line (struct mgcp_request *req, char *line) |
static int | add_sdp (struct mgcp_request *resp, struct mgcp_subchannel *sub, struct ast_rtp_instance *rtp) |
static struct ast_variable * | add_var (const char *buf, struct ast_variable *list) |
struct ast_module * | AST_MODULE_SELF_SYM (void) |
static int | attempt_transfer (struct mgcp_endpoint *p, struct mgcp_subchannel *sub) |
Complete an attended transfer. More... | |
static struct mgcp_gateway * | build_gateway (char *cat, struct ast_variable *v) |
build_gateway: parse mgcp.conf and create gateway/endpoint structures More... | |
static char * | control2str (int ind) |
static struct ast_variable * | copy_vars (struct ast_variable *src) |
duplicate a list of channel variables, More... | |
static void | destroy_endpoint (struct mgcp_endpoint *e) |
static void | destroy_gateway (struct mgcp_gateway *g) |
static void * | do_monitor (void *data) |
static void | dump_cmd_queues (struct mgcp_endpoint *p, struct mgcp_subchannel *sub) |
dump_cmd_queues: (SC:) cleanup pending commands More... | |
static void | dump_queue (struct mgcp_gateway *gw, struct mgcp_endpoint *p) |
static int | find_and_retrans (struct mgcp_subchannel *sub, struct mgcp_request *req) |
static struct mgcp_request * | find_command (struct mgcp_endpoint *p, struct mgcp_subchannel *sub, struct mgcp_request **queue, ast_mutex_t *l, int ident) |
find_command: (SC:) remove command transaction from queue More... | |
static struct mgcp_gateway * | find_realtime_gw (char *name, char *at, struct sockaddr_in *sin) |
static struct mgcp_subchannel * | find_subchannel_and_lock (char *name, int msgid, struct sockaddr_in *sin) |
static char * | get_csv (char *c, int *len, char **next) |
get_csv: (SC:) get comma separated value More... | |
static char * | get_header (struct mgcp_request *req, char *name) |
static char * | get_sdp (struct mgcp_request *req, char *name) |
static char * | get_sdp_by_line (char *line, char *name, int nameLen) |
static char * | get_sdp_iterate (int *iterator, struct mgcp_request *req, char *name) |
static void | handle_hd_hf (struct mgcp_subchannel *sub, char *ev) |
static char * | handle_mgcp_audit_endpoint (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_mgcp_show_endpoints (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static int | handle_request (struct mgcp_subchannel *sub, struct mgcp_request *req, struct sockaddr_in *sin) |
static void | handle_response (struct mgcp_endpoint *p, struct mgcp_subchannel *sub, int result, unsigned int ident, struct mgcp_request *resp) |
static int | has_voicemail (struct mgcp_endpoint *p) |
static int | init_req (struct mgcp_endpoint *p, struct mgcp_request *req, char *verb, unsigned int oseq) |
static int | init_resp (struct mgcp_request *req, char *resp, struct mgcp_request *orig, char *resprest) |
static int | load_module (void) |
Load the module. More... | |
static int | mgcp_alloc_pktcgate (struct mgcp_subchannel *sub) |
static int | mgcp_answer (struct ast_channel *ast) |
static int | mgcp_call (struct ast_channel *ast, const char *dest, int timeout) |
static int | mgcp_devicestate (const char *data) |
mgcp_devicestate: channel callback for device status monitoring More... | |
static int | mgcp_fixup (struct ast_channel *oldchan, struct ast_channel *newchan) |
static void | mgcp_get_codec (struct ast_channel *chan, struct ast_format_cap *result) |
static enum ast_rtp_glue_result | mgcp_get_rtp_peer (struct ast_channel *chan, struct ast_rtp_instance **instance) |
static int | mgcp_hangup (struct ast_channel *ast) |
static int | mgcp_indicate (struct ast_channel *ast, int ind, const void *data, size_t datalen) |
static struct ast_channel * | mgcp_new (struct mgcp_subchannel *sub, int state, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor) |
static int | mgcp_pktcgate_open (struct cops_gate *gate) |
static int | mgcp_pktcgate_remove (struct cops_gate *gate) |
static int | mgcp_postrequest (struct mgcp_endpoint *p, struct mgcp_subchannel *sub, char *data, int len, unsigned int seqno) |
static int | mgcp_prune_realtime_gateway (struct mgcp_gateway *g) |
static void | mgcp_queue_control (struct mgcp_subchannel *sub, int control) |
static void | mgcp_queue_frame (struct mgcp_subchannel *sub, struct ast_frame *f) |
static void | mgcp_queue_hangup (struct mgcp_subchannel *sub) |
static struct ast_frame * | mgcp_read (struct ast_channel *ast) |
static char * | mgcp_reload (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static struct ast_channel * | mgcp_request (const char *type, struct ast_format_cap *cap, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *dest, int *cause) |
static struct ast_frame * | mgcp_rtp_read (struct mgcp_subchannel *sub) |
static int | mgcp_senddigit_begin (struct ast_channel *ast, char digit) |
static int | mgcp_senddigit_end (struct ast_channel *ast, char digit, unsigned int duration) |
static void | mgcp_set_owner (struct mgcp_subchannel *sub, struct ast_channel *chan) |
static int | mgcp_set_rtp_peer (struct ast_channel *chan, struct ast_rtp_instance *rtp, struct ast_rtp_instance *vrtp, struct ast_rtp_instance *trtp, const struct ast_format_cap *cap, int nat_active) |
static void * | mgcp_ss (void *data) |
static int | mgcp_write (struct ast_channel *ast, struct ast_frame *frame) |
static int | mgcpsock_read (int *id, int fd, short events, void *ignore) |
static void | parse (struct mgcp_request *req) |
static int | process_sdp (struct mgcp_subchannel *sub, struct mgcp_request *req) |
static void | prune_gateways (void) |
static int | reload (void) |
static int | reload_config (int reload) |
static int | reqprep (struct mgcp_request *req, struct mgcp_endpoint *p, char *verb) |
static int | resend_response (struct mgcp_subchannel *sub, struct mgcp_response *resp) |
static int | resolve_first_addr (const char *hostname, struct in_addr *sin_addr) |
Resolve the given hostname and save its IPv4 address. More... | |
static int | respprep (struct mgcp_request *resp, struct mgcp_endpoint *p, char *msg, struct mgcp_request *req, char *msgrest) |
static int | restart_monitor (void) |
static int | retrans_pkt (const void *data) |
static void | sdpLineNum_iterator_init (int *iterator) |
static int | send_request (struct mgcp_endpoint *p, struct mgcp_subchannel *sub, struct mgcp_request *req, unsigned int seqno) |
static int | send_response (struct mgcp_subchannel *sub, struct mgcp_request *req) |
static void | start_rtp (struct mgcp_subchannel *sub) |
static int | transmit_audit_endpoint (struct mgcp_endpoint *p) |
static int | transmit_connect (struct mgcp_subchannel *sub) |
static int | transmit_connect_with_sdp (struct mgcp_subchannel *sub, struct ast_rtp_instance *rtp) |
static int | transmit_connection_del (struct mgcp_subchannel *sub) |
static int | transmit_connection_del_w_params (struct mgcp_endpoint *p, char *callid, char *cxident) |
static int | transmit_modify_request (struct mgcp_subchannel *sub) |
static int | transmit_modify_with_sdp (struct mgcp_subchannel *sub, struct ast_rtp_instance *rtp, const struct ast_format_cap *codecs) |
static int | transmit_notify_request (struct mgcp_subchannel *sub, char *tone) |
static int | transmit_notify_request_with_callerid (struct mgcp_subchannel *sub, char *tone, char *callernum, char *callername) |
static int | transmit_response (struct mgcp_subchannel *sub, char *msg, struct mgcp_request *req, char *msgrest) |
static int | unalloc_sub (struct mgcp_subchannel *sub) |
static int | unload_module (void) |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Media Gateway Control Protocol (MGCP)" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = AST_BUILDOPT_SUM, .support_level = AST_MODULE_SUPPORT_DEPRECATED, .load = load_module, .unload = unload_module, .reload = reload, .load_pri = AST_MODPRI_CHANNEL_DRIVER, .optional_modules = "res_pktccops", } |
static struct in_addr | __ourip |
static char | accountcode [AST_MAX_ACCOUNT_CODE] = "" |
static int | adsi = 0 |
static int | amaflags = 0 |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static struct sockaddr_in | bindaddr |
static int | callreturn = 0 |
static int | callwaiting = 0 |
static int | cancallforward = 0 |
static char | cid_name [AST_MAX_EXTENSION] = "" |
static char | cid_num [AST_MAX_EXTENSION] = "" |
static struct ast_cli_entry | cli_mgcp [] |
static const char | config [] = "mgcp.conf" |
static char | context [AST_MAX_EXTENSION] = "default" |
static ast_group_t | cur_callergroup = 0 |
static ast_group_t | cur_pickupgroup = 0 |
static struct ast_jb_conf | default_jbconf |
static int | directmedia = DIRECTMEDIA |
static int | dtmfmode = 0 |
static int | firstdigittimeout = 16000 |
static ast_mutex_t | gatelock = { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP , NULL, {1, 0} } |
gatelock: mutex for gateway/endpoint lists More... | |
static struct mgcp_gateway * | gateways = NULL |
static int | gendigittimeout = 8000 |
static struct ast_format_cap * | global_capability |
static struct ast_jb_conf | global_jbconf |
static int | hangupongateremove = 0 |
static int | immediate = 0 |
static struct io_context * | io |
static char | language [MAX_LANGUAGE] = "" |
static char | mailbox [AST_MAX_MAILBOX_UNIQUEID] |
static int | matchdigittimeout = 3000 |
static const char *const | mgcp_cxmodes [] |
static ast_mutex_t | mgcp_reload_lock = { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP , NULL, {1, 0} } |
static int | mgcp_reloading = 0 |
static struct ast_rtp_glue | mgcp_rtp_glue |
static struct ast_channel_tech | mgcp_tech |
static int | mgcpsock = -1 |
static int * | mgcpsock_read_id = NULL |
static pthread_t | monitor_thread = AST_PTHREADT_NULL |
static ast_mutex_t | monlock = { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP , NULL, {1, 0} } |
static char | musicclass [MAX_MUSICCLASS] = "" |
static int | nat = 0 |
static int | ncs = 0 |
static ast_mutex_t | netlock = { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP , NULL, {1, 0} } |
static int | nonCodecCapability = AST_RTP_DTMF |
static unsigned int | oseq_global = 0 |
static ast_mutex_t | oseq_lock = { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP , NULL, {1, 0} } |
static char | ourhost [MAXHOSTNAMELEN] |
static int | ourport |
static char | parkinglot [AST_MAX_CONTEXT] |
static int | pktcgatealloc = 0 |
struct { | |
unsigned int cos | |
unsigned int cos_audio | |
unsigned int tos | |
unsigned int tos_audio | |
} | qos = { 0, 0, 0, 0 } |
static struct ast_sched_context * | sched |
static int | singlepath = 0 |
static int | slowsequence = 0 |
static const char | tdesc [] = "Media Gateway Control Protocol (MGCP)" |
static int | threewaycalling = 0 |
static int | transfer = 0 |
Implementation of Media Gateway Control Protocol.
Definition in file chan_mgcp.c.
#define DEFAULT_EXPIRY 120 |
Definition at line 99 of file chan_mgcp.c.
#define DEFAULT_MGCP_CA_PORT 2727 |
From RFC 2705
Definition at line 127 of file chan_mgcp.c.
#define DEFAULT_MGCP_GW_PORT 2427 |
From RFC 2705
Definition at line 126 of file chan_mgcp.c.
#define DEFAULT_RETRANS 1000 |
How frequently to retransmit
Definition at line 129 of file chan_mgcp.c.
#define DIRECTMEDIA 1 |
Definition at line 101 of file chan_mgcp.c.
#define INADDR_NONE (in_addr_t)(-1) |
Definition at line 104 of file chan_mgcp.c.
#define MAX_EXPIRY 3600 |
Definition at line 100 of file chan_mgcp.c.
#define MAX_RETRANS 5 |
Try only 5 times for retransmissions
Definition at line 130 of file chan_mgcp.c.
#define MAX_SUBS 2 |
Definition at line 292 of file chan_mgcp.c.
#define MGCP_CX_CONF 3 |
Definition at line 136 of file chan_mgcp.c.
#define MGCP_CX_CONFERENCE 3 |
Definition at line 137 of file chan_mgcp.c.
#define MGCP_CX_INACTIVE 4 |
Definition at line 139 of file chan_mgcp.c.
#define MGCP_CX_MUTE 4 |
Definition at line 138 of file chan_mgcp.c.
#define MGCP_CX_RECVONLY 1 |
Definition at line 134 of file chan_mgcp.c.
#define MGCP_CX_SENDONLY 0 |
MGCP rtp stream modes {
Definition at line 133 of file chan_mgcp.c.
#define MGCP_CX_SENDRECV 2 |
Definition at line 135 of file chan_mgcp.c.
#define MGCP_DTMF_HYBRID (1 << 2) |
Definition at line 124 of file chan_mgcp.c.
#define MGCP_DTMF_INBAND (1 << 1) |
Definition at line 123 of file chan_mgcp.c.
#define MGCP_DTMF_RFC2833 (1 << 0) |
Definition at line 122 of file chan_mgcp.c.
#define MGCP_MAX_HEADERS 64 |
The private structures of the mgcp channels are linked for selecting outgoing channels
Definition at line 251 of file chan_mgcp.c.
#define MGCP_MAX_LINES 64 |
Definition at line 252 of file chan_mgcp.c.
#define MGCP_MAX_PACKET 1500 |
Also from RFC 2543, should sub headers tho
Definition at line 128 of file chan_mgcp.c.
#define MGCP_OFFHOOK 2 |
Definition at line 328 of file chan_mgcp.c.
#define MGCP_ONHOOK 1 |
Definition at line 327 of file chan_mgcp.c.
#define MGCP_SUBCHANNEL_MAGIC "!978!" |
subchannel magic string. Needed to prove that any subchannel pointer passed by asterisk really points to a valid subchannel memory area. Ugly.. But serves the purpose for the time being.
Definition at line 303 of file chan_mgcp.c.
#define MGCPDUMPER |
Definition at line 98 of file chan_mgcp.c.
#define RESPONSE_TIMEOUT 30 |
in seconds
Definition at line 282 of file chan_mgcp.c.
#define SUB_ALT 1 |
Definition at line 295 of file chan_mgcp.c.
#define SUB_REAL 0 |
Definition at line 294 of file chan_mgcp.c.
#define TYPE_LINE 2 |
Definition at line 331 of file chan_mgcp.c.
#define TYPE_TRUNK 1 |
Definition at line 330 of file chan_mgcp.c.
anonymous enum |
Enumerator | |
---|---|
MGCP_CMD_EPCF | |
MGCP_CMD_CRCX | |
MGCP_CMD_MDCX | |
MGCP_CMD_DLCX | |
MGCP_CMD_RQNT | |
MGCP_CMD_NTFY | |
MGCP_CMD_AUEP | |
MGCP_CMD_AUCX | |
MGCP_CMD_RSIP |
Definition at line 150 of file chan_mgcp.c.
|
static |
Definition at line 1607 of file chan_mgcp.c.
References mgcp_request::header, mgcp_request::headers, len(), and name.
Referenced by get_header().
|
static |
Definition at line 535 of file chan_mgcp.c.
References mgcp_gateway::addr, ast_log, mgcp_gateway::defaddr, errno, len(), LOG_WARNING, and mgcpsock.
Referenced by mgcp_postrequest(), resend_response(), retrans_pkt(), and send_response().
|
static |
Definition at line 5009 of file chan_mgcp.c.
|
static |
Definition at line 5009 of file chan_mgcp.c.
|
static |
Definition at line 4485 of file chan_mgcp.c.
References args, ast_channel_tech(), ast_channel_tech_pvt(), ast_log, buf, LOG_ERROR, mgcp_tech, and sub.
|
static |
Definition at line 2031 of file chan_mgcp.c.
References ast_log, mgcp_request::data, mgcp_request::header, mgcp_request::headers, mgcp_request::len, mgcp_request::lines, LOG_WARNING, MGCP_MAX_HEADERS, value, and var.
Referenced by add_header_offhook(), transmit_audit_endpoint(), transmit_connect(), transmit_connect_with_sdp(), transmit_connection_del(), transmit_connection_del_w_params(), transmit_modify_request(), transmit_modify_with_sdp(), transmit_notify_request(), and transmit_notify_request_with_callerid().
|
static |
Definition at line 2614 of file chan_mgcp.c.
References add_header(), ast_debug, AST_STATE_RINGING, mgcp_endpoint::dtmfmode, MGCP_DTMF_HYBRID, MGCP_DTMF_INBAND, mgcp_endpoint::ncs, mgcp_subchannel::owner, mgcp_endpoint::sub, and sub.
Referenced by transmit_modify_request(), transmit_notify_request(), and transmit_notify_request_with_callerid().
|
static |
Definition at line 2053 of file chan_mgcp.c.
References ast_copy_string(), ast_log, mgcp_request::data, mgcp_request::len, mgcp_request::line, mgcp_request::lines, LOG_WARNING, and MGCP_MAX_LINES.
Referenced by add_sdp().
|
static |
Definition at line 2167 of file chan_mgcp.c.
References a, add_line(), ao2_ref, ast_copy_string(), ast_debug, ast_format_cap_count(), ast_format_cap_get_format(), ast_format_get_name(), ast_format_get_type(), ast_inet_ntoa(), ast_log, AST_MEDIA_TYPE_AUDIO, ast_rtp_codecs_payload_code(), AST_RTP_DTMF, ast_rtp_instance_get_codecs(), ast_rtp_instance_get_local_address(), ast_rtp_instance_get_remote_address, ast_rtp_lookup_mime_subtype2(), AST_RTP_MAX, ast_sockaddr_to_sin, c, mgcp_endpoint::cap, ast_format::codec, format, len(), LOG_WARNING, mgcp_endpoint::nonCodecCapability, NULL, mgcp_gateway::ourip, mgcp_endpoint::parent, and sub.
Referenced by transmit_connect_with_sdp(), transmit_modify_request(), and transmit_modify_with_sdp().
|
static |
Definition at line 4617 of file chan_mgcp.c.
References ast_strdupa, ast_variable_new, buf, ast_variable::next, and NULL.
Referenced by build_gateway().
struct ast_module* AST_MODULE_SELF_SYM | ( | void | ) |
Definition at line 5009 of file chan_mgcp.c.
|
static |
Complete an attended transfer.
p | The endpoint performing the attended transfer |
sub | The sub-channel completing the attended transfer |
0 | when channel should be hung up |
1 | when channel should not be hung up |
Definition at line 3247 of file chan_mgcp.c.
References ast_bridge_transfer_attended(), AST_BRIDGE_TRANSFER_SUCCESS, ast_channel_softhangup_internal_flag_add(), AST_CONTROL_RINGING, ast_mutex_lock, ast_mutex_unlock, ast_queue_control(), ast_queue_unhold(), AST_SOFTHANGUP_DEV, AST_STATE_RINGING, mgcp_subchannel::lock, mgcp_queue_hangup(), mgcp_subchannel::next, mgcp_endpoint::sub, sub, and unalloc_sub().
Referenced by handle_request().
|
static |
build_gateway: parse mgcp.conf and create gateway/endpoint structures
Definition at line 3982 of file chan_mgcp.c.
References __ourip, accountcode, mgcp_endpoint::accountcode, add_var(), mgcp_gateway::addr, adsi, mgcp_endpoint::adsi, amaflags, mgcp_endpoint::amaflags, ast_append_ha(), ast_callerid_split(), ast_calloc, ast_channel_string2amaflag(), ast_copy_string(), ast_format_cap_alloc, ast_format_cap_append_from_cap(), AST_FORMAT_CAP_FLAG_DEFAULT, ast_free, ast_get_group(), ast_get_ip(), ast_log, AST_MEDIA_TYPE_UNKNOWN, ast_mutex_destroy, ast_mutex_init, ast_mwi_subscribe_pool(), ast_ouraddrfor(), ast_random(), AST_SCHED_DEL, ast_sockaddr_from_sin, ast_sockaddr_to_sin, ast_strlen_zero(), ast_true(), ast_variables_destroy(), ast_verb, mgcp_endpoint::callgroup, callreturn, mgcp_endpoint::callreturn, callwaiting, mgcp_endpoint::callwaiting, cancallforward, mgcp_endpoint::cancallforward, mgcp_endpoint::cap, mgcp_endpoint::chanvars, cid_name, mgcp_endpoint::cid_name, cid_num, mgcp_endpoint::cid_num, mgcp_endpoint::cmd_queue_lock, context, mgcp_endpoint::context, copy_vars(), cur_callergroup, cur_pickupgroup, mgcp_gateway::defaddr, DEFAULT_MGCP_GW_PORT, mgcp_endpoint::delme, mgcp_gateway::delme, DIRECTMEDIA, directmedia, mgcp_endpoint::directmedia, dtmfmode, mgcp_endpoint::dtmfmode, mgcp_gateway::dynamic, mgcp_gateway::endpoints, mgcp_gateway::expire, gateways, global_capability, mgcp_gateway::ha, hangupongateremove, mgcp_endpoint::hangupongateremove, mgcp_endpoint::hascallwaiting, mgcp_endpoint::hookstate, immediate, mgcp_endpoint::immediate, INADDR_NONE, mgcp_gateway::isnamedottedip, language, mgcp_endpoint::language, ast_variable::lineno, mgcp_endpoint::lock, LOG_ERROR, LOG_WARNING, mgcp_endpoint::mailbox, mailbox, MAX_SUBS, MGCP_CX_INACTIVE, MGCP_DTMF_HYBRID, MGCP_DTMF_INBAND, MGCP_DTMF_RFC2833, MGCP_ONHOOK, MGCP_SUBCHANNEL_MAGIC, mgcp_gateway::msgs_lock, mgcp_endpoint::msgstate, musicclass, mgcp_endpoint::musicclass, mgcp_endpoint::mwi_event_sub, mgcp_endpoint::name, mgcp_gateway::name, ast_variable::name, nat, ncs, mgcp_endpoint::ncs, mgcp_endpoint::needaudit, mgcp_endpoint::next, mgcp_gateway::next, ast_variable::next, NULL, mgcp_endpoint::onhooktime, mgcp_gateway::ourip, mgcp_endpoint::parent, parkinglot, mgcp_endpoint::parkinglot, mgcp_endpoint::pickupgroup, pktcgatealloc, mgcp_endpoint::pktcgatealloc, mgcp_gateway::realtime, mgcp_gateway::retransid, mgcp_endpoint::rqnt_ident, mgcp_endpoint::rqnt_queue_lock, mgcp_subchannel::rtp, singlepath, mgcp_endpoint::singlepath, slowsequence, mgcp_endpoint::slowsequence, stasis_subscription_cb_noop(), mgcp_endpoint::sub, sub, threewaycalling, mgcp_endpoint::threewaycalling, tmp(), transfer, mgcp_endpoint::transfer, mgcp_endpoint::type, TYPE_LINE, TYPE_TRUNK, ast_variable::value, and mgcp_gateway::wcardep.
Referenced by find_realtime_gw(), and reload_config().
|
static |
Definition at line 1378 of file chan_mgcp.c.
References AST_CONTROL_ANSWER, AST_CONTROL_BUSY, AST_CONTROL_CONGESTION, AST_CONTROL_FLASH, AST_CONTROL_HANGUP, AST_CONTROL_OFFHOOK, AST_CONTROL_OPTION, AST_CONTROL_RADIO_KEY, AST_CONTROL_RADIO_UNKEY, AST_CONTROL_RING, AST_CONTROL_RINGING, AST_CONTROL_TAKEOFFHOOK, and AST_CONTROL_WINK.
Referenced by mgcp_indicate().
|
static |
duplicate a list of channel variables,
Definition at line 4635 of file chan_mgcp.c.
References ast_variable_new, ast_variable::next, NULL, and tmp().
Referenced by build_gateway().
|
static |
Definition at line 4505 of file chan_mgcp.c.
References ao2_ref, ast_dsp_free(), ast_free, ast_mutex_destroy, ast_mutex_lock, ast_mutex_unlock, ast_mwi_unsubscribe(), ast_rtp_instance_destroy(), ast_strlen_zero(), ast_variables_destroy(), mgcp_endpoint::cap, mgcp_endpoint::chanvars, mgcp_endpoint::cmd_queue_lock, mgcp_endpoint::dsp, dump_cmd_queues(), dump_queue(), mgcp_endpoint::lock, MAX_SUBS, mgcp_queue_hangup(), mgcp_endpoint::mwi_event_sub, mgcp_subchannel::next, NULL, mgcp_endpoint::parent, mgcp_endpoint::rqnt_queue_lock, mgcp_endpoint::sub, sub, and transmit_connection_del().
Referenced by prune_gateways().
|
static |
Definition at line 4564 of file chan_mgcp.c.
References ast_free, ast_free_ha(), dump_queue(), mgcp_gateway::ha, and NULL.
Referenced by prune_gateways().
|
static |
Definition at line 3784 of file chan_mgcp.c.
References ast_free, ast_io_add(), AST_IO_IN, ast_io_wait(), ast_mutex_destroy, ast_mutex_lock, ast_mutex_unlock, ast_sched_runq(), ast_sched_wait(), ast_verb, mgcp_gateway::endpoints, gatelock, gateways, has_voicemail(), io, MGCP_ONHOOK, mgcp_prune_realtime_gateway(), mgcp_reload_lock, mgcp_reloading, mgcpsock, mgcpsock_read(), mgcpsock_read_id, monlock, mgcp_gateway::msgs_lock, netlock, mgcp_gateway::next, NULL, mgcp_gateway::realtime, reload_config(), transmit_notify_request(), and TYPE_LINE.
Referenced by restart_monitor().
|
static |
dump_cmd_queues: (SC:) cleanup pending commands
Definition at line 2700 of file chan_mgcp.c.
References ast_free, ast_mutex_lock, ast_mutex_unlock, mgcp_endpoint::cmd_queue, mgcp_endpoint::cmd_queue_lock, mgcp_subchannel::cx_queue, mgcp_subchannel::cx_queue_lock, mgcp_request::next, mgcp_subchannel::next, NULL, mgcp_endpoint::rqnt_queue, mgcp_endpoint::rqnt_queue_lock, mgcp_endpoint::sub, and sub.
Referenced by destroy_endpoint(), handle_request(), handle_response(), and unalloc_sub().
|
static |
Definition at line 571 of file chan_mgcp.c.
References ast_free, ast_log, ast_mutex_lock, ast_mutex_unlock, LOG_NOTICE, mgcp_gateway::msgs, mgcp_gateway::msgs_lock, mgcp_gateway::name, mgcp_message::next, NULL, mgcp_message::owner_ep, and mgcp_message::seqno.
Referenced by destroy_endpoint(), destroy_gateway(), and handle_request().
|
static |
Definition at line 3605 of file chan_mgcp.c.
References answer(), ast_free, mgcp_request::identifier, mgcp_response::next, NULL, resend_response(), RESPONSE_TIMEOUT, mgcp_response::seqno, and sub.
Referenced by mgcpsock_read().
|
static |
find_command: (SC:) remove command transaction from queue
Definition at line 2734 of file chan_mgcp.c.
References mgcp_gateway::addr, ast_debug, ast_inet_ntoa(), ast_mutex_lock, ast_mutex_unlock, mgcp_postrequest(), mgcp_request::next, NULL, mgcp_endpoint::parent, sub, and mgcp_request::trid.
Referenced by handle_response().
|
static |
Definition at line 1658 of file chan_mgcp.c.
References args, AST_APP_ARG, ast_check_realtime(), ast_copy_string(), ast_debug, AST_DECLARE_APP_ARGS, ast_load_realtime(), AST_STANDARD_APP_ARGS, ast_strlen_zero(), ast_variables_destroy(), build_gateway(), mgcp_gateway::endpoints, gateways, ast_variable::name, mgcp_endpoint::needaudit, mgcp_endpoint::next, mgcp_gateway::next, ast_variable::next, NULL, mgcp_gateway::realtime, transmit_audit_endpoint(), and ast_variable::value.
Referenced by find_subchannel_and_lock().
|
static |
Definition at line 1749 of file chan_mgcp.c.
References __ourip, mgcp_gateway::addr, ast_copy_string(), ast_debug, ast_inet_ntoa(), ast_log, ast_mutex_lock, ast_mutex_unlock, ast_ouraddrfor(), ast_sockaddr_from_sin, ast_sockaddr_to_sin, ast_verb, c, mgcp_gateway::defaddr, mgcp_gateway::dynamic, mgcp_gateway::endpoints, find_realtime_gw(), gatelock, gateways, mgcp_subchannel::id, LOG_NOTICE, mgcp_endpoint::name, mgcp_gateway::name, name, mgcp_endpoint::next, mgcp_gateway::next, NULL, mgcp_gateway::ourip, mgcp_endpoint::sub, sub, and tmp().
Referenced by mgcp_request(), and mgcpsock_read().
|
static |
get_csv: (SC:) get comma separated value
Definition at line 1634 of file chan_mgcp.c.
References c, len(), and NULL.
Referenced by handle_response().
|
static |
Definition at line 1627 of file chan_mgcp.c.
References __get_header(), and name.
Referenced by handle_request(), and handle_response().
|
static |
Definition at line 1578 of file chan_mgcp.c.
References get_sdp_by_line(), len(), mgcp_request::line, mgcp_request::lines, and name.
Referenced by process_sdp().
|
static |
Definition at line 1568 of file chan_mgcp.c.
References name.
Referenced by get_sdp(), and get_sdp_iterate().
|
static |
Definition at line 1596 of file chan_mgcp.c.
References get_sdp_by_line(), len(), mgcp_request::line, and name.
Referenced by process_sdp().
|
static |
Definition at line 3288 of file chan_mgcp.c.
References AST_CONTROL_ANSWER, ast_hangup(), ast_log, ast_pthread_create_detached, ast_queue_unhold(), AST_STATE_DOWN, AST_STATE_RING, c, errno, has_voicemail(), mgcp_endpoint::hookstate, mgcp_endpoint::immediate, LOG_WARNING, MGCP_CX_SENDRECV, mgcp_new(), MGCP_OFFHOOK, mgcp_queue_control(), mgcp_ss(), mgcp_endpoint::name, mgcp_gateway::name, mgcp_endpoint::ncs, NULL, mgcp_endpoint::parent, start_rtp(), sub, transmit_modify_request(), and transmit_notify_request().
Referenced by handle_request().
|
static |
Definition at line 1061 of file chan_mgcp.c.
|
static |
Definition at line 1019 of file chan_mgcp.c.
References a, mgcp_gateway::addr, ast_cli(), ast_inet_ntoa(), ast_mutex_lock, ast_mutex_unlock, mgcp_endpoint::chanvars, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, mgcp_endpoint::context, mgcp_gateway::defaddr, mgcp_gateway::dynamic, mgcp_gateway::endpoints, gatelock, gateways, mgcp_endpoint::name, mgcp_gateway::name, ast_variable::name, mgcp_endpoint::next, mgcp_gateway::next, ast_variable::next, NULL, mgcp_subchannel::owner, mgcp_gateway::realtime, mgcp_endpoint::sub, ast_cli_entry::usage, and ast_variable::value.
|
static |
Definition at line 3368 of file chan_mgcp.c.
References ast_debug, AST_FRAME_DTMF, ast_inet_ntoa(), ast_log, ast_mutex_lock, ast_mutex_unlock, ast_queue_hold(), ast_queue_unhold(), AST_STATE_DOWN, AST_STATE_UP, ast_verb, attempt_transfer(), mgcp_endpoint::callwaiting, mgcp_endpoint::curtone, mgcp_subchannel::cxmode, mgcp_endpoint::dtmf_buf, dump_cmd_queues(), dump_queue(), mgcp_gateway::endpoints, ast_frame::frametype, get_header(), handle_hd_hf(), has_voicemail(), mgcp_endpoint::hascallwaiting, mgcp_endpoint::hidecallerid, mgcp_endpoint::hookstate, mgcp_subchannel::id, ast_frame_subclass::integer, mgcp_subchannel::lock, LOG_NOTICE, LOG_WARNING, MGCP_CX_CONF, MGCP_CX_MUTE, MGCP_CX_RECVONLY, MGCP_CX_SENDRECV, MGCP_OFFHOOK, MGCP_ONHOOK, mgcp_queue_frame(), mgcp_queue_hangup(), mgcp_endpoint::name, mgcp_gateway::name, mgcp_endpoint::ncs, mgcp_subchannel::next, mgcp_endpoint::next, NULL, mgcp_subchannel::owner, mgcp_endpoint::parent, ast_frame::src, mgcp_endpoint::sub, sub, ast_frame::subclass, mgcp_endpoint::threewaycalling, mgcp_endpoint::transfer, transmit_audit_endpoint(), transmit_connection_del(), transmit_modify_request(), transmit_notify_request(), transmit_response(), mgcp_request::verb, and mgcp_gateway::wcardep.
Referenced by mgcpsock_read().
|
static |
Definition at line 2763 of file chan_mgcp.c.
References AST_CONTROL_RINGING, ast_copy_string(), ast_free, ast_log, ast_queue_control(), AST_STATE_RINGING, ast_strlen_zero(), ast_verb, c, mgcp_request::cmd, mgcp_endpoint::cmd_queue, mgcp_endpoint::cmd_queue_lock, mgcp_subchannel::cxident, dump_cmd_queues(), find_command(), get_csv(), get_header(), mgcp_endpoint::hookstate, len(), mgcp_request::lines, LOG_NOTICE, LOG_WARNING, MGCP_CMD_AUEP, MGCP_CMD_CRCX, MGCP_CMD_MDCX, MGCP_OFFHOOK, MGCP_ONHOOK, mgcp_queue_hangup(), mgcp_endpoint::name, mgcp_gateway::name, mgcp_subchannel::next, NULL, mgcp_subchannel::owner, mgcp_endpoint::parent, process_sdp(), result, mgcp_endpoint::rqnt_queue, mgcp_endpoint::rqnt_queue_lock, mgcp_endpoint::slowsequence, start_rtp(), mgcp_endpoint::sub, sub, transmit_connection_del(), transmit_connection_del_w_params(), transmit_modify_with_sdp(), transmit_notify_request(), and transmit_response().
Referenced by mgcpsock_read(), and retrans_pkt().
|
static |
Definition at line 491 of file chan_mgcp.c.
References ao2_cleanup, ast_app_has_voicemail(), ast_mwi_state_cache(), ast_mwi_state_type(), mgcp_endpoint::mailbox, ast_mwi_state::new_msgs, NULL, RAII_VAR, stasis_cache_get(), and stasis_message_data().
Referenced by do_monitor(), handle_hd_hf(), handle_request(), mgcp_hangup(), and mgcp_request().
|
static |
Definition at line 2094 of file chan_mgcp.c.
References ast_log, mgcp_request::data, mgcp_request::header, mgcp_request::headers, mgcp_gateway::isnamedottedip, mgcp_request::len, LOG_WARNING, MGCP_MAX_HEADERS, mgcp_endpoint::name, mgcp_gateway::name, mgcp_endpoint::ncs, and mgcp_endpoint::parent.
Referenced by reqprep().
|
static |
Definition at line 2076 of file chan_mgcp.c.
References ast_log, mgcp_request::data, mgcp_request::header, mgcp_request::headers, mgcp_request::identifier, mgcp_request::len, LOG_WARNING, and MGCP_MAX_HEADERS.
Referenced by respprep().
|
static |
Load the module.
Module loading including tests for configuration or dependencies. This function can return AST_MODULE_LOAD_FAILURE, AST_MODULE_LOAD_DECLINE, or AST_MODULE_LOAD_SUCCESS. If a dependency or environment variable fails tests return AST_MODULE_LOAD_FAILURE. If the module can not load the configuration file or other non-critical problem return AST_MODULE_LOAD_DECLINE. On success return AST_MODULE_LOAD_SUCCESS.
Definition at line 4840 of file chan_mgcp.c.
References ao2_ref, ast_channel_register(), ast_cli_register_multiple, ast_format_alaw, ast_format_cap_alloc, ast_format_cap_append, AST_FORMAT_CAP_FLAG_DEFAULT, ast_format_ulaw, ast_log, AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_SUCCESS, ast_rtp_glue_register, ast_sched_context_create(), ast_sched_context_destroy(), ast_channel_tech::capabilities, cli_mgcp, global_capability, io, io_context_create(), io_context_destroy(), LOG_ERROR, LOG_WARNING, mgcp_rtp_glue, mgcp_tech, reload_config(), and restart_monitor().
|
static |
Definition at line 2414 of file chan_mgcp.c.
References mgcp_gateway::addr, ast_pktccops_gate_alloc(), GATE_SET, mgcp_pktcgate_open(), mgcp_pktcgate_remove(), NULL, mgcp_endpoint::parent, and sub.
Referenced by start_rtp().
|
static |
Definition at line 1128 of file chan_mgcp.c.
References ast_channel_name(), ast_channel_tech_pvt(), ast_debug, ast_mutex_lock, ast_mutex_unlock, ast_setstate(), AST_STATE_UP, ast_verb, MGCP_CX_SENDRECV, mgcp_endpoint::name, mgcp_gateway::name, mgcp_endpoint::parent, start_rtp(), sub, transmit_modify_request(), and transmit_notify_request().
|
static |
Definition at line 827 of file chan_mgcp.c.
References ast_channel_connected(), ast_channel_name(), ast_channel_tech_pvt(), ast_copy_string(), ast_debug, ast_log, ast_mutex_lock, ast_mutex_unlock, ast_setstate(), AST_STATE_DOWN, AST_STATE_RESERVED, AST_STATE_RINGING, ast_strlen_zero(), mgcp_endpoint::hookstate, LOG_NOTICE, LOG_WARNING, MGCP_CX_RECVONLY, MGCP_CX_SENDRECV, MGCP_OFFHOOK, MGCP_ONHOOK, name, mgcp_endpoint::ncs, pbx_builtin_getvar_helper(), S_COR, start_rtp(), sub, transmit_modify_request(), transmit_notify_request_with_callerid(), mgcp_endpoint::type, and TYPE_LINE.
|
static |
mgcp_devicestate: channel callback for device status monitoring
data | tech/resource name of MGCP device to query |
Callback for device state management in channel subsystem to obtain device status (up/down) of a specific MGCP endpoint
Definition at line 1332 of file chan_mgcp.c.
References AST_DEVICE_INVALID, AST_DEVICE_UNKNOWN, ast_mutex_lock, ast_mutex_unlock, ast_strdupa, mgcp_gateway::endpoints, error(), gatelock, gateways, mgcp_endpoint::name, mgcp_gateway::name, mgcp_endpoint::next, mgcp_gateway::next, NULL, and tmp().
|
static |
Definition at line 1254 of file chan_mgcp.c.
References ast_channel_name(), ast_channel_tech_pvt(), ast_log, ast_mutex_lock, ast_mutex_unlock, LOG_NOTICE, LOG_WARNING, mgcp_set_owner(), and sub.
|
static |
Definition at line 4469 of file chan_mgcp.c.
References ast_channel_tech_pvt(), ast_format_cap_append_from_cap(), AST_MEDIA_TYPE_UNKNOWN, mgcp_endpoint::cap, result, and sub.
|
static |
Definition at line 3982 of file chan_mgcp.c.
|
static |
Definition at line 903 of file chan_mgcp.c.
References ast_channel_bridge_peer(), ast_channel_caller(), ast_channel_cleanup, ast_channel_name(), ast_channel_tech_pvt(), ast_channel_tech_pvt_set(), ast_debug, ast_dsp_free(), ast_module_unref, ast_mutex_lock, ast_mutex_unlock, ast_pktccops_gate_alloc(), ast_rtp_instance_destroy(), ast_strlen_zero(), ast_verb, mgcp_endpoint::callwaiting, mgcp_subchannel::cxmode, mgcp_endpoint::dsp, mgcp_endpoint::dtmf_buf, mgcp_endpoint::dtmfmode, GATE_ALLOC_PROGRESS, GATE_ALLOCATED, GATE_DEL, has_voicemail(), mgcp_endpoint::hascallwaiting, mgcp_endpoint::hidecallerid, mgcp_endpoint::hookstate, MGCP_CX_INACTIVE, MGCP_CX_RECVONLY, MGCP_DTMF_HYBRID, MGCP_DTMF_INBAND, MGCP_OFFHOOK, MGCP_ONHOOK, mgcp_set_owner(), MGCP_SUBCHANNEL_MAGIC, mgcp_endpoint::name, mgcp_gateway::name, name, mgcp_endpoint::ncs, mgcp_subchannel::next, NULL, mgcp_endpoint::parent, mgcp_endpoint::pktcgatealloc, RAII_VAR, S_COR, ast_module_info::self, mgcp_endpoint::sub, sub, transmit_connection_del(), transmit_modify_request(), transmit_notify_request(), and transmit_notify_request_with_callerid().
|
static |
Definition at line 1410 of file chan_mgcp.c.
References ast_channel_name(), ast_channel_tech_pvt(), AST_CONTROL_BUSY, AST_CONTROL_CONGESTION, AST_CONTROL_HOLD, AST_CONTROL_INCOMPLETE, AST_CONTROL_PROCEEDING, AST_CONTROL_PROGRESS, AST_CONTROL_PVT_CAUSE_CODE, AST_CONTROL_RINGING, AST_CONTROL_SRCCHANGE, AST_CONTROL_SRCUPDATE, AST_CONTROL_UNHOLD, ast_debug, ast_log, ast_moh_start(), ast_moh_stop(), ast_mutex_lock, ast_mutex_unlock, ast_rtp_instance_change_source(), ast_rtp_instance_update_source(), control2str(), LOG_WARNING, NULL, sub, transmit_modify_request(), and transmit_notify_request().
|