Asterisk - The Open Source Telephony Project
18.5.0
|
Implementation of Session Initiation Protocol. More...
#include "asterisk.h"
#include <signal.h>
#include <regex.h>
#include <inttypes.h>
#include "asterisk/network.h"
#include "asterisk/paths.h"
#include "asterisk/lock.h"
#include "asterisk/config.h"
#include "asterisk/module.h"
#include "asterisk/pbx.h"
#include "asterisk/sched.h"
#include "asterisk/io.h"
#include "asterisk/rtp_engine.h"
#include "asterisk/udptl.h"
#include "asterisk/acl.h"
#include "asterisk/manager.h"
#include "asterisk/callerid.h"
#include "asterisk/cli.h"
#include "asterisk/musiconhold.h"
#include "asterisk/dsp.h"
#include "asterisk/pickup.h"
#include "asterisk/parking.h"
#include "asterisk/srv.h"
#include "asterisk/astdb.h"
#include "asterisk/causes.h"
#include "asterisk/utils.h"
#include "asterisk/file.h"
#include "asterisk/astobj2.h"
#include "asterisk/dnsmgr.h"
#include "asterisk/devicestate.h"
#include "asterisk/netsock2.h"
#include "asterisk/localtime.h"
#include "asterisk/abstract_jb.h"
#include "asterisk/threadstorage.h"
#include "asterisk/translate.h"
#include "asterisk/ast_version.h"
#include "asterisk/aoc.h"
#include "asterisk/message.h"
#include "sip/include/sip.h"
#include "sip/include/globals.h"
#include "sip/include/config_parser.h"
#include "sip/include/reqresp_parser.h"
#include "sip/include/sip_utils.h"
#include "asterisk/sdp_srtp.h"
#include "asterisk/ccss.h"
#include "asterisk/xml.h"
#include "sip/include/dialog.h"
#include "sip/include/dialplan_functions.h"
#include "sip/include/security_events.h"
#include "sip/include/route.h"
#include "asterisk/sip_api.h"
#include "asterisk/mwi.h"
#include "asterisk/bridge.h"
#include "asterisk/stasis.h"
#include "asterisk/stasis_endpoints.h"
#include "asterisk/stasis_system.h"
#include "asterisk/stasis_channels.h"
#include "asterisk/features_config.h"
#include "asterisk/http_websocket.h"
#include "asterisk/format_cache.h"
#include "asterisk/linkedlists.h"
Go to the source code of this file.
Data Structures | |
struct | blind_transfer_cb_data |
struct | cfalias |
Structure for conversion between compressed SIP and "normal" SIP headers. More... | |
struct | cfsip_methods |
The core structure to setup dialogs. We parse incoming messages by using structure and then route the messages according to the type. More... | |
struct | cfsubscription_types |
Subscription types that we support. We support. More... | |
struct | domain_list |
struct | epa_static_data_list |
struct | event_state_compositor |
The Event State Compositors. More... | |
struct | invstate2stringtable |
Readable descriptions of device states. More... | |
struct | match_req_args |
struct | mwi_subscription_data |
struct | reregister_data |
struct | show_peers_context |
Used in the sip_show_peers functions to pass parameters. More... | |
struct | sip_history_head |
struct | sip_reasons |
Diversion header reasons. More... | |
struct | sip_scheddestroy_data |
struct | state_notify_data |
Macros | |
#define | append_history(p, event, fmt, args...) append_history_full(p, "%-15s " fmt, event, ## args) |
Append to SIP dialog history. More... | |
#define | BOGUS_PEER_MD5SECRET "intentionally_invalid_md5_string" |
We can recognize the bogus peer by this invalid MD5 hash. More... | |
#define | check_request_transport(peer, tmpl) |
generic function for determining if a correct transport is being used to contact a peer More... | |
#define | CHECK_RESULTS(in, expected_res, expected_start, expected_len) |
#define | CONTAINER_UNLINK(container, obj, tag) |
Unlink the given object from the container and return TRUE if it was in the container. More... | |
#define | find_call(req, addr, intended_method) __find_call(req, addr, intended_method, __FILE__, __LINE__, __PRETTY_FUNCTION__) |
#define | FORMAT "%-25.25s %-15.15s %-15.15s \n" |
#define | FORMAT "%-47.47s %-9.9s %-6.6s\n" |
#define | FORMAT "%-25.25s %-15.15s %-15.15s %-15.15s %-5.5s%-10.10s\n" |
#define | FORMAT "%-40.40s %-20.20s %-16.16s\n" |
#define | FORMAT "%-39.39s %-6.6s %-12.12s %8d %-20.20s %-25.25s\n" |
#define | FORMAT "%-15.15s %-11.11s %-8.8s %-10.10u%-1.1s %-10.10u (%5.2f%%) %-6.4lf %-10.10u%-1.1s %-10.10u (%5.2f%%) %-6.4lf\n" |
#define | FORMAT "%-30.30s %-12.12s %-10.10s %-10.10s\n" |
#define | FORMAT "%-15.15s %-15.15s %-15.15s %-15.15s %-3.3s %-3.3s %-15.15s %-10.10s %-10.10s\n" |
#define | FORMAT2 "%-25.25s %-15.15s %-15.15s \n" |
#define | FORMAT2 "%-47.47s %9.9s %6.6s\n" |
#define | FORMAT2 "%-39.39s %-6.6s %-12.12s %8.8s %-20.20s %-25.25s\n" |
#define | FORMAT2 "%-15.15s %-11.11s %-8.8s %-10.10s %-10.10s ( %%) %-6.6s %-10.10s %-10.10s ( %%) %-6.6s\n" |
#define | FORMAT2 "%-15.15s %-15.15s %-15.15s %-15.15s %-7.7s %-15.15s %-10.10s %-10.10s\n" |
#define | FORMAT3 "%-15.15s %-15.15s %-15.15s %-15.15s %-13.13s %-15.15s %-10.10s %-6.6s\n" |
#define | FORMAT4 "%-15.15s %-15.15s %-15.15s %-15.15s %-13.13s %-15.15s %-10.10s %-6.6d\n" |
#define | peer_in_destruction(peer) (ao2_ref(peer, 0) == 0) |
#define | PEERS_FORMAT2 "%-25.25s %-39.39s %-3.3s %-10.10s %-10.10s %-3.3s %-8s %-11s %-32.32s %s\n" |
#define | REMOVE_MAILBOX_WITH_LOCKED_PEER(__peer) |
#define | sip_pvt_lock(x) ao2_lock(x) |
#define | sip_pvt_trylock(x) ao2_trylock(x) |
#define | sip_pvt_unlock(x) ao2_unlock(x) |
#define | SIP_TRANSPORT_STR_BUFSIZE 128 |
Size of the SIP transport buffer. More... | |
#define | SIPHEADER 256 |
#define | UNLINK(element, head, prev) |
Enumerations | |
enum | match_req_res { SIP_REQ_MATCH, SIP_REQ_NOT_MATCH, SIP_REQ_LOOP_DETECTED, SIP_REQ_FORKED } |
enum | message_integrity { MESSAGE_INVALID, MESSAGE_FRAGMENT, MESSAGE_FRAGMENT_COMPLETE, MESSAGE_COMPLETE } |
Indication of a TCP message's integrity. More... | |
enum | peer_unlink_flag_t { SIP_PEERS_MARKED, SIP_PEERS_ALL } |
enum | sip_media_fds { SIP_AUDIO_RTP_FD, SIP_AUDIO_RTCP_FD, SIP_VIDEO_RTP_FD, SIP_VIDEO_RTCP_FD, SIP_TEXT_RTP_FD, SIP_UDPTL_FD } |
Functions | |
static int | __cleanup_registration (const void *data) |
static int | __dialog_unlink_sched_items (const void *data) |
static struct sip_pvt * | __find_call (struct sip_request *req, struct ast_sockaddr *addr, const int intended_method, const char *file, int line, const char *func) |
find or create a dialog structure for an incoming SIP message. Connect incoming SIP message to current dialog or create new dialog structure Returns a reference to the sip_pvt object, remember to give it back once done. Called by handle_request_do More... | |
static const char * | __get_header (const struct sip_request *req, const char *name, int *start) |
static void | __init_sip_content_buf (void) |
static void | __init_sip_transport_str_buf (void) |
A per-thread buffer for transport to string conversion. More... | |
static void | __init_ts_temp_pvt (void) |
A per-thread temporary pvt structure. More... | |
static void | __reg_module (void) |
static int | __sched_check_pendings (const void *data) |
static int | __set_address_from_contact (const char *fullcontact, struct ast_sockaddr *addr, int tcp) |
static int | __shutdown_mwi_subscription (const void *data) |
int | __sip_ack (struct sip_pvt *p, uint32_t seqno, int resp, int sipmethod) |
Acknowledges receipt of a packet and stops retransmission called with p locked. More... | |
struct sip_pvt * | __sip_alloc (ast_string_field callid, struct ast_sockaddr *addr, int useglobal_nat, const int intended_method, struct sip_request *req, ast_callid logger_callid, const char *file, int line, const char *func) |
Allocate sip_pvt structure, set defaults and link in the container. Returns a reference to the object so whoever uses it later must remember to release the reference. More... | |
static int | __sip_autodestruct (const void *data) |
Kill a SIP dialog (called only by the scheduler) The scheduler has a reference to this dialog when p->autokillid != -1, and we are called using that reference. So if the event is not rescheduled, we need to call dialog_unref(). More... | |
static int | __sip_cancel_destroy (const void *data) |
static int | __sip_do_register (struct sip_registry *r) |
Register with SIP proxy. More... | |
void | __sip_pretend_ack (struct sip_pvt *p) |
Pretend to ack all packets called with p locked. More... | |
static int | __sip_reliable_xmit (struct sip_pvt *p, uint32_t seqno, int resp, struct ast_str *data, int fatal, int sipmethod) |
static int | __sip_scheddestroy (const void *data) |
int | __sip_semi_ack (struct sip_pvt *p, uint32_t seqno, int resp, int sipmethod) |
Acks receipt of packet, keep it around (used for provisional responses) More... | |
static int | __sip_subscribe_mwi_do (struct sip_subscription_mwi *mwi) |
Actually setup an MWI subscription or resubscribe. More... | |
static int | __sip_xmit (struct sip_pvt *p, struct ast_str *data) |
static int | __start_mwi_subscription (const void *data) |
static int | __start_register_timeout (const void *data) |
static int | __start_reregister_timeout (const void *data) |
static int | __start_session_timer (const void *data) |
static int | __start_t38_abort_timer (const void *data) |
static int | __stop_provisional_keepalive (const void *data) |
static int | __stop_register_timeout (const void *data) |
static int | __stop_reinvite_retry (const void *data) |
static int | __stop_reinviteid (const void *data) |
static int | __stop_retrans_pkt (const void *data) |
static int | __stop_session_timer (const void *data) |
static int | __stop_t38_abort_timer (const void *data) |
static int | __transmit_response (struct sip_pvt *p, const char *msg, const struct sip_request *req, enum xmittype reliable) |
Base transmit response function. More... | |
static void | __unreg_module (void) |
static int | __update_provisional_keepalive (const void *data) |
static int | __update_provisional_keepalive_full (struct sip_pvt *pvt, int with_sdp) |
static int | __update_provisional_keepalive_with_sdp (const void *data) |
static char * | _sip_qualify_peer (int type, int fd, struct mansession *s, const struct message *m, int argc, const char *argv[]) |
Send qualify message to peer from cli or manager. Mostly for debugging. More... | |
static char * | _sip_show_peer (int type, int fd, struct mansession *s, const struct message *m, int argc, const char *argv[]) |
Show one peer in detail (main function) More... | |
static char * | _sip_show_peers (int fd, int *total, struct mansession *s, const struct message *m, int argc, const char *argv[]) |
Execute sip show peers command. More... | |
static struct sip_peer * | _sip_show_peers_one (int fd, struct mansession *s, struct show_peers_context *cont, struct sip_peer *peer) |
Emit informations for one peer during sip show peers command. More... | |
static void * | _sip_tcp_helper_thread (struct ast_tcptls_session_instance *tcptls_session) |
SIP TCP thread management function This function reads from the socket, parses the packet into a request. More... | |
static void | acl_change_event_stasis_unsubscribe (void) |
static void | acl_change_stasis_cb (void *data, struct stasis_subscription *sub, struct stasis_message *message) |
static void | acl_change_stasis_subscribe (void) |
static void | add_blank (struct sip_request *req) |
add a blank line if no body More... | |
static void | add_cc_call_info_to_response (struct sip_pvt *p, struct sip_request *resp) |
static void | add_codec_to_sdp (const struct sip_pvt *p, struct ast_format *format, struct ast_str **m_buf, struct ast_str **a_buf, int debug, int *min_packet_size, int *max_packet_size) |
Add codec offer to SDP offer/answer body in INVITE or 200 OK. More... | |
static int | add_content (struct sip_request *req, const char *line) |
Add content (not header) to SIP message. More... | |
static void | add_date (struct sip_request *req) |
Add date header to SIP message. More... | |
static int | add_digit (struct sip_request *req, char digit, unsigned int duration, int mode) |
Add DTMF INFO tone to sip message Mode = 0 for application/dtmf-relay (Cisco) 1 for application/dtmf. More... | |
static void | add_diversion (struct sip_request *req, struct sip_pvt *pvt) |
Add "Diversion" header to outgoing message. More... | |
static void | add_dtls_to_sdp (struct ast_rtp_instance *instance, struct ast_str **a_buf) |
Add DTLS attributes to SDP. More... | |
static void | add_expires (struct sip_request *req, int expires) |
Add Expires header to SIP message. More... | |
static int | add_header (struct sip_request *req, const char *var, const char *value) |
Add header to SIP message. More... | |
static void | add_ice_to_sdp (struct ast_rtp_instance *instance, struct ast_str **a_buf) |
Add ICE attributes to SDP. More... | |
static int | add_max_forwards (struct sip_pvt *dialog, struct sip_request *req) |
Add 'Max-Forwards' header to SIP message. More... | |
static void | add_msg_header (struct sip_pvt *pvt, const char *hdr_name, const char *hdr_value) |
static void | add_noncodec_to_sdp (const struct sip_pvt *p, int format, struct ast_str **m_buf, struct ast_str **a_buf, int debug) |
Add RFC 2833 DTMF offer to SDP. More... | |
static void | add_peer_mailboxes (struct sip_peer *peer, const char *value) |
static void | add_peer_mwi_subs (struct sip_peer *peer) |
static void | add_realm_authentication (struct sip_auth_container **credentials, const char *configuration, int lineno) |
static void | add_required_respheader (struct sip_request *req) |
static void | add_route (struct sip_request *req, struct sip_route *route, int skip) |
Add route header into request per learned route. More... | |
static int | add_rpid (struct sip_request *req, struct sip_pvt *p) |
Add Remote-Party-ID header to SIP message. More... | |
static enum sip_result | add_sdp (struct sip_request *resp, struct sip_pvt *p, int oldsdp, int add_audio, int add_t38) |
Add Session Description Protocol message. More... | |
static int | add_sip_domain (const char *domain, const enum domain_mode mode, const char *context) |
Add SIP domain to list of domains we are responsible for. More... | |
static int | add_supported (struct sip_pvt *pvt, struct sip_request *req) |
Add "Supported" header to sip message. Since some options may be disabled in the config, the sip_pvt must be inspected to determine what is supported for this dialog. More... | |
static void | add_tcodec_to_sdp (const struct sip_pvt *p, struct ast_format *format, struct ast_str **m_buf, struct ast_str **a_buf, int debug, int *min_packet_size) |
Add text codec offer to SDP offer/answer body in INVITE or 200 OK. More... | |
static int | add_text (struct sip_request *req, struct sip_pvt *p) |
Add text body to SIP message. More... | |
static struct ast_variable * | add_var (const char *buf, struct ast_variable *list) |
implement the setvar config line More... | |
static void | add_vcodec_to_sdp (const struct sip_pvt *p, struct ast_format *format, struct ast_str **m_buf, struct ast_str **a_buf, int debug, int *min_packet_size) |
Add video codec offer to SDP offer/answer body in INVITE or 200 OK. More... | |
static int | add_vidupdate (struct sip_request *req) |
add XML encoded media control with update More... | |
static int | allow_notify_user_presence (struct sip_pvt *p) |
static const char * | allowoverlap2str (int mode) |
Convert AllowOverlap setting to printable string. More... | |
static | AO2_GLOBAL_OBJ_STATIC (g_bogus_peer) |
A bogus peer, to be used when authentication should fail. More... | |
static void | append_history_full (struct sip_pvt *p, const char *fmt,...) |
Append to SIP dialog history with arg list. More... | |
static void | append_history_va (struct sip_pvt *p, const char *fmt, va_list ap) |
Append to SIP dialog history with arg list. More... | |
struct ast_module * | AST_MODULE_SELF_SYM (void) |
static void | ast_sip_ouraddrfor (const struct ast_sockaddr *them, struct ast_sockaddr *us, struct sip_pvt *p) |
NAT fix - decide which IP address to use for Asterisk server? More... | |
static int | ast_sockaddr_resolve_first (struct ast_sockaddr *addr, const char *name, int flag) |
Return the first entry from ast_sockaddr_resolve filtered by family of binddaddr. More... | |
static int | ast_sockaddr_resolve_first_transport (struct ast_sockaddr *addr, const char *name, int flag, unsigned int transport) |
Return the first entry from ast_sockaddr_resolve filtered by family of binddaddr. More... | |
AST_TEST_DEFINE (test_sip_mwi_subscribe_parse) | |
AST_TEST_DEFINE (test_tcp_message_fragmentation) | |
AST_TEST_DEFINE (get_in_brackets_const_test) | |
static int | auto_congest (const void *arg) |
Scheduled congestion on a call. Only called by the scheduler, must return the reference when done. More... | |
static const char * | autocreatepeer2str (enum autocreatepeer_mode r) |
static void | blind_transfer_cb (struct ast_channel *chan, struct transfer_channel_data *user_data_wrapper, enum ast_transfer_type transfer_type) |
static int | block_msg_header (const char *header_name) |
static void | build_callid_pvt (struct sip_pvt *pvt) |
Build SIP Call-ID value for a non-REGISTER transaction. More... | |
static void | build_callid_registry (struct sip_registry *reg, const struct ast_sockaddr *ourip, const char *fromdomain) |
Build SIP Call-ID value for a REGISTER transaction. More... | |
static void | build_contact (struct sip_pvt *p, struct sip_request *req, int incoming) |
Build contact header. More... | |
static void | build_localtag_registry (struct sip_registry *reg) |
Build SIP From tag value for REGISTER. More... | |
static void | build_nonce (struct sip_pvt *p, int forceupdate) |
builds the sip_pvt's nonce field which is used for the authentication challenge. When forceupdate is not set, the nonce is only updated if the current one is stale. In this case, a stalenonce is one which has already received a response, if a nonce has not received a response it is not always necessary or beneficial to create a new one. More... | |
static int | build_path (struct sip_pvt *p, struct sip_peer *peer, struct sip_request *req, const char *pathbuf) |
Build route list from Path header RFC 3327 requires that the Path header contains SIP URIs with lr paramter. Thus, we do not care about strict routing SIP routers. More... | |
static struct sip_peer * | build_peer (const char *name, struct ast_variable *v_head, struct ast_variable *alt, int realtime, int devstate_only) |
Build peer from configuration (file or realtime static/dynamic) More... | |
static int | build_reply_digest (struct sip_pvt *p, int method, char *digest, int digest_len) |
Build reply digest. More... | |
static void | build_route (struct sip_pvt *p, struct sip_request *req, int backwards, int resp) |
Build route list from Record-Route header. More... | |
static void | build_via (struct sip_pvt *p) |
Build a Via header for a request. More... | |
static int | cb_extensionstate (const char *context, const char *exten, struct ast_state_cb_info *info, void *data) |
Callback for the devicestate notification (SUBSCRIBE) support subsystem. More... | |
static void | cb_extensionstate_destroy (int id, void *data) |
static void | cc_epa_destructor (void *data) |
static int | cc_esc_publish_handler (struct sip_pvt *pvt, struct sip_request *req, struct event_state_compositor *esc, struct sip_esc_entry *esc_entry) |
static void | cc_handle_publish_error (struct sip_pvt *pvt, const int resp, struct sip_request *req, struct sip_epa_entry *epa_entry) |
static void | change_callid_pvt (struct sip_pvt *pvt, const char *callid) |
static void | change_hold_state (struct sip_pvt *dialog, struct sip_request *req, int holdstate, int sendonly) |
Change hold state for a call. More... | |
static void | change_redirecting_information (struct sip_pvt *p, struct sip_request *req, struct ast_party_redirecting *redirecting, struct ast_set_party_redirecting *update_redirecting, int set_call_forward) |
update redirecting information for a channel based on headers More... | |
static void | change_t38_state (struct sip_pvt *p, int state) |
Change the T38 state on a SIP dialog. More... | |
static enum check_auth_result | check_auth (struct sip_pvt *p, struct sip_request *req, const char *username, const char *secret, const char *md5secret, int sipmethod, const char *uri, enum xmittype reliable) |
Check user authorization from peer definition Some actions, like REGISTER and INVITEs from peers require authentication (if peer have secret set) More... | |
static void | check_for_nat (const struct ast_sockaddr *addr, struct sip_pvt *p) |
Check and see if the requesting UA is likely to be behind a NAT. More... | |
static enum message_integrity | check_message_integrity (struct ast_str **request, struct ast_str **overflow) |
Check that a message received over TCP is a full message. More... | |
static enum check_auth_result | check_peer_ok (struct sip_pvt *p, char *of, struct sip_request *req, int sipmethod, struct ast_sockaddr *addr, struct sip_peer **authpeer, enum xmittype reliable, char *calleridname, char *uri2) |
Validate device authentication. More... | |
static void | check_pendings (struct sip_pvt *p) |
Check pending actions on SIP call. More... | |
static int | check_rtp_timeout (struct sip_pvt *dialog, time_t t) |
helper function for the monitoring thread – seems to be called with the assumption that the dialog is locked More... | |
static int | check_sip_domain (const char *domain, char *context, size_t len) |
check_sip_domain: Check if domain part of uri is local to our server More... | |
static int | check_user (struct sip_pvt *p, struct sip_request *req, int sipmethod, const char *uri, enum xmittype reliable, struct ast_sockaddr *addr) |
Find user If we get a match, this will add a reference pointer to the user object, that needs to be unreferenced. More... | |
static enum check_auth_result | check_user_full (struct sip_pvt *p, struct sip_request *req, int sipmethod, const char *uri, enum xmittype reliable, struct ast_sockaddr *addr, struct sip_peer **authpeer) |
Check if matching user or peer is defined Match user on From: user name and peer on IP/port This is used on first invite (not re-invites) and subscribe requests. More... | |
static void | check_via (struct sip_pvt *p, const struct sip_request *req) |
check Via: header for hostname, port and rport request/answer More... | |
static void | cleanup_all_regs (void) |
static int | cleanup_registration (void *obj, void *arg, int flags) |
static void | cleanup_stale_contexts (char *new, char *old) |
Destroy disused contexts between reloads Only used in reload_config so the code for regcontext doesn't get ugly. More... | |
static void | clear_peer_mailboxes (struct sip_peer *peer) |
static void | clear_sip_domains (void) |
Clear our domain list (at reload) More... | |
static char * | complete_sip_notify (const char *line, const char *word, int pos, int state) |
Support routine for 'sip notify' CLI. More... | |
static char * | complete_sip_peer (const char *word, int state, int flags2) |
Do completion on peer name. More... | |
static char * | complete_sip_registered_peer (const char *word, int state, int flags2) |
Do completion on registered peer name. More... | |
static char * | complete_sip_show_history (const char *line, const char *word, int pos, int state) |
Support routine for 'sip show history' CLI. More... | |
static char * | complete_sip_show_peer (const char *line, const char *word, int pos, int state) |
Support routine for 'sip show peer' CLI. More... | |
static char * | complete_sip_show_user (const char *line, const char *word, int pos, int state) |
Support routine for 'sip show user' CLI. More... | |
static char * | complete_sip_unregister (const char *line, const char *word, int pos, int state) |
Support routine for 'sip unregister' CLI. More... | |
static char * | complete_sip_user (const char *word, int state) |
Do completion on user name. More... | |
static char * | complete_sipch (const char *line, const char *word, int pos, int state) |
Support routine for 'sip show channel' and 'sip show history' CLI This is in charge of generating all strings that match a prefix in the given position. As many functions of this kind, each invokation has O(state) time complexity so be careful in using it. More... | |
static void | configure_rtcp (struct sip_pvt *p, struct ast_rtp_instance *instance, int which, int remote_rtcp_mux) |
static int | construct_pidf_body (enum sip_cc_publish_state state, char *pidf_body, size_t size, const char *presentity) |
static int | copy_all_header (struct sip_request *req, const struct sip_request *orig, const char *field) |
Copy all headers from one request to another. More... | |
static int | copy_header (struct sip_request *req, const struct sip_request *orig, const char *field) |
Copy one header field from one request to another. More... | |
static void | copy_request (struct sip_request *dst, const struct sip_request *src) |
copy SIP request (mostly used to save request for responses) More... | |
static void | copy_socket_data (struct sip_socket *to_sock, const struct sip_socket *from_sock) |
static struct ast_variable * | copy_vars (struct ast_variable *src) |
duplicate a list of channel variables, More... | |
static int | copy_via_headers (struct sip_pvt *p, struct sip_request *req, const struct sip_request *orig, const char *field) |
Copy SIP VIA Headers from the request to the response. More... | |
static int | create_addr (struct sip_pvt *dialog, const char *opeer, struct ast_sockaddr *addr, int newdialog) |
create address structure from device name Or, if peer not found, find it in the global DNS returns TRUE (-1) on failure, FALSE on success More... | |
static int | create_addr_from_peer (struct sip_pvt *dialog, struct sip_peer *peer) |
Create address structure from peer reference. This function copies data from peer to the dialog, so we don't have to look up the peer again from memory or database during the life time of the dialog. More... | |
static struct sip_epa_entry * | create_epa_entry (const char *const event_package, const char *const destination) |
static struct sip_esc_entry * | create_esc_entry (struct event_state_compositor *esc, struct sip_request *req, const int expires) |
static void | create_new_sip_etag (struct sip_esc_entry *esc_entry, int is_linked) |
static char * | crypto_get_attrib (struct ast_sdp_srtp *srtp, int dtls_enabled, int default_taglen_32) |
static int | default_sip_port (enum ast_transport type) |
The default sip port for the given transport. More... | |
static void | deinit_req (struct sip_request *req) |
Deinitialize SIP response/request. More... | |
static void | deprecation_notice (void) |
static void | destroy_association (struct sip_peer *peer) |
Remove registration data from realtime database or AST/DB when registration expires. More... | |
static void | destroy_escs (void) |
static void | destroy_mailbox (struct sip_mailbox *mailbox) |
static void | destroy_msg_headers (struct sip_pvt *pvt) |
static void | destroy_realm_authentication (void *obj) |
static int | determine_firstline_parts (struct sip_request *req) |
Parse first line of incoming SIP request. More... | |
static enum sip_publish_type | determine_sip_publish_type (struct sip_request *req, const char *const event, const char *const etag, const char *const expires, int *expires_int) |
static int | dialog_checkrtp_cb (void *dialogobj, void *arg, int flags) |
Check RTP Timeout on dialogs. More... | |
static void | dialog_clean_rtp (struct sip_pvt *p) |
static int | dialog_cmp_cb (void *obj, void *arg, int flags) |
static int | dialog_dump_func (void *userobj, void *arg, int flags) |
static int | dialog_find_multiple (void *obj, void *arg, int flags) |
static int | dialog_hash_cb (const void *obj, const int flags) |
static int | dialog_initialize_dtls_srtp (const struct sip_pvt *dialog, struct ast_rtp_instance *rtp, struct ast_sdp_srtp **srtp) |
Initialize DTLS-SRTP support on an RTP instance. More... | |
static int | dialog_initialize_rtp (struct sip_pvt *dialog) |
Initialize RTP portion of a dialog. More... | |
static int | dialog_needdestroy (void *dialogobj, void *arg, int flags) |
Match dialogs that need to be destroyed. More... | |
void | dialog_unlink_all (struct sip_pvt *dialog) |
Unlink a dialog from the dialogs container, as well as any other places that it may be currently stored. More... | |
static void | disable_dsp_detect (struct sip_pvt *p) |
static void | display_nat_warning (const char *cat, int reason, struct ast_flags *flags) |
static void | do_cancel_destroy (struct sip_pvt *pvt) |
static void | do_dialog_unlink_sched_items (struct sip_pvt *dialog) |
static int | do_magic_pickup (struct ast_channel *channel, const char *extension, const char *context) |
static int | do_message_auth (struct sip_pvt *p, int resp, const char *rest, struct sip_request *req, uint32_t seqno) |
static void * | do_monitor (void *data) |
The SIP monitoring thread. More... | |
static int | do_proxy_auth (struct sip_pvt *p, struct sip_request *req, enum sip_auth_type code, int sipmethod, int init) |
Add authentication on outbound SIP packet. More... | |
static int | do_register_auth (struct sip_pvt *p, struct sip_request *req, enum sip_auth_type code) |
Authenticate for outbound registration. More... | |
static void | do_setnat (struct sip_pvt *p) |
Set nat mode on the various data sockets. More... | |
static void | do_stop_session_timer (struct sip_pvt *pvt) |
static const char * | domain_mode_to_text (const enum domain_mode mode) |
Print domain mode to cli. More... | |
static const char * | dtmfmode2str (int mode) |
Convert DTMF mode to printable string. More... | |
static void | enable_dsp_detect (struct sip_pvt *p) |
static int | esc_cmp_fn (void *obj, void *arg, int flags) |
static void | esc_entry_destructor (void *obj) |
static int | esc_hash_fn (const void *obj, const int flags) |
static int | expire_register (const void *data) |
Expire registration of SIP peer. More... | |
static int | extensionstate_update (const char *context, const char *exten, struct state_notify_data *data, struct sip_pvt *p, int force) |
Callback for the devicestate notification (SUBSCRIBE) support subsystem. More... | |
static void | extract_host_from_hostport (char **hostport) |
Terminate a host:port at the ':'. More... | |
static void | extract_transferrer_headers (const char *prefix, struct ast_channel *peer, const struct sip_request *req) |
static void | extract_uri (struct sip_pvt *p, struct sip_request *req) |
Check Contact: URI of SIP message. More... | |
static const char * | faxec2str (int faxec) |
static int | finalize_content (struct sip_request *req) |
Add 'Content-Length' header and content to SIP message. More... | |
static const char * | find_alias (const char *name, const char *_default) |
Find compressed SIP alias. More... | |
static int | find_by_callid_helper (void *obj, void *arg, int flags) |
static int | find_by_name (void *obj, void *arg, void *data, int flags) |
static int | find_by_notify_uri_helper (void *obj, void *arg, int flags) |
static int | find_by_subscribe_uri_helper (void *obj, void *arg, int flags) |
const char * | find_closing_quote (const char *start, const char *lim) |
Locate closing quote in a string, skipping escaped quotes. optionally with a limit on the search. start must be past the first quote. More... | |
static const char * | find_full_alias (const char *name, const char *_default) |
Find full SIP alias. More... | |
static struct sip_auth * | find_realm_authentication (struct sip_auth_container *credentials, const char *realm) |
static struct ast_channel * | find_ringing_channel (struct ao2_container *device_state_info, struct sip_pvt *p) |
static int | find_sdp (struct sip_request *req) |
Determine whether a SIP message contains an SDP in its body. More... | |
static struct ast_cc_agent * | find_sip_cc_agent_by_notify_uri (const char *const uri) |
static struct ast_cc_agent * | find_sip_cc_agent_by_original_callid (struct sip_pvt *pvt) |
static struct ast_cc_agent * | find_sip_cc_agent_by_subscribe_uri (const char *const uri) |
static int | find_sip_method (const char *msg) |
find_sip_method: Find SIP method from header More... | |
static int | find_sip_monitor_instance_by_subscription_pvt (void *obj, void *arg, int flags) |
static int | find_sip_monitor_instance_by_suspension_entry (void *obj, void *arg, int flags) |
static const struct epa_static_data * | find_static_data (const char *const event_package) |
static const struct cfsubscription_types * | find_subscription_type (enum subscriptiontype subtype) |
Find subscription type in array. More... | |
static void | forked_invite_init (struct sip_request *req, const char *new_theirtag, struct sip_pvt *original, struct ast_sockaddr *addr) |
This function creates a dialog to handle a forked request. This dialog exists only to properly terminiate the forked request immediately. More... | |
static int | func_check_sipdomain (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len) |
Dial plan function to check if domain is local. More... | |
static int | func_header_read (struct ast_channel *chan, const char *function, char *data, char *buf, size_t len) |
Read SIP header (dialplan function) More... | |
static int | func_headers_read2 (struct ast_channel *chan, const char *function, char *data, struct ast_str **buf, ssize_t maxlen) |
Read unique list of SIP headers (dialplan function) More... | |
static int | function_sippeer (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len) |
${SIPPEER()} Dialplan function - reads peer data More... | |
static char * | generate_random_string (char *buf, size_t size) |
Generate 32 byte random string for callid's etc. More... | |
static char * | generate_uri (struct sip_pvt *pvt, char *buf, size_t size) |
static int | get_address_family_filter (unsigned int transport) |
Helper for dns resolution to filter by address family. More... | |
static int | get_also_info (struct sip_pvt *p, struct sip_request *oreq) |
Call transfer support (old way, deprecated by the IETF) More... | |
static int | get_cached_mwi (struct sip_peer *peer, int *new, int *old) |
Get cached MWI info. More... | |
static char * | get_content (struct sip_request *req) |
Get message body content. More... | |
static char * | get_content_line (struct sip_request *req, char *name, char delimiter) |
Get a specific line from the message content. More... | |
static enum sip_get_dest_result | get_destination (struct sip_pvt *p, struct sip_request *oreq, int *cc_recall_core_id) |
Find out who the call is for. More... | |
static int | get_domain (const char *str, char *domain, int len) |
Extract domain from SIP To/From header. More... | |
static struct event_state_compositor * | get_esc (const char *const event_package) |
static struct sip_esc_entry * | get_esc_entry (const char *entity_tag, struct event_state_compositor *esc) |
static struct ast_variable * | get_insecure_variable_from_config (struct ast_config *config) |
static struct ast_variable * | get_insecure_variable_from_sippeers (const char *column, const char *value) |
static struct ast_variable * | get_insecure_variable_from_sipregs (const char *column, const char *value, struct ast_variable **var) |
static const char * | get_name_from_variable (const struct ast_variable *var) |
static void | get_our_media_address (struct sip_pvt *p, int needvideo, int needtext, struct ast_sockaddr *addr, struct ast_sockaddr *vaddr, struct ast_sockaddr *taddr, struct ast_sockaddr *dest, struct ast_sockaddr *vdest, struct ast_sockaddr *tdest) |
Set all IP media addresses for this call. More... | |
static int | get_pai (struct sip_pvt *p, struct sip_request *req) |
Parse the parts of the P-Asserted-Identity header on an incoming packet. Returns 1 if a valid header is found and it is different from the current caller id. More... | |
static int | get_rdnis (struct sip_pvt *p, struct sip_request *oreq, char **name, char **number, int *reason_code, char **reason_str) |
Get referring dnis. More... | |
static void | get_realm (struct sip_pvt *p, const struct sip_request *req) |
Choose realm based on From header and then To header or use globaly configured realm. Realm from From/To header should be listed among served domains in config file: domain=... More... | |
static int | get_refer_info (struct sip_pvt *transferer, struct sip_request *outgoing_req) |
Call transfer support (the REFER method) Extracts Refer headers into pvt dialog structure. More... | |
static int | get_rpid (struct sip_pvt *p, struct sip_request *oreq) |
Get name, number and presentation from remote party id header, returns true if a valid header was found and it was different from the current caller id. More... | |
static const char * | get_sdp_iterate (int *start, struct sip_request *req, const char *name) |
Lookup 'name' in the SDP starting at the 'start' line. Returns the matching line, and 'start' is updated with the next line number. More... | |
static char | get_sdp_line (int *start, int stop, struct sip_request *req, const char **value) |
Fetches the next valid SDP line between the 'start' line (inclusive) and the 'stop' line (exclusive). Returns the type ('a', 'c', ...) and matching line in reference 'start' is updated with the next line number. More... | |
static int | get_sip_pvt_from_replaces (const char *callid, const char *totag, const char *fromtag, struct sip_pvt **out_pvt, struct ast_channel **out_chan) |
Find a companion dialog based on Replaces information. More... | |
static const char * | get_srv_protocol (enum ast_transport t) |
Return protocol string for srv dns query. More... | |
static const char * | get_srv_service (enum ast_transport t) |
Return service string for srv dns query. More... | |
static const char * | get_transport_list (unsigned int transports) |
Return configuration of transports for a device. More... | |
static const char * | get_transport_pvt (struct sip_pvt *p) |
Return transport of dialog. More... | |
static int | get_transport_str2enum (const char *transport) |
Return int representing a bit field of transport types found in const char *transport. More... | |
static const char * | gettag (const struct sip_request *req, const char *header, char *tagbuf, int tagbufsize) |
Get tag from packet. More... | |
static int | handle_cc_notify (struct sip_pvt *pvt, struct sip_request *req) |
static int | handle_cc_subscribe (struct sip_pvt *p, struct sip_request *req) |
static int | handle_common_options (struct ast_flags *flags, struct ast_flags *mask, struct ast_variable *v) |
Handle flag-type options common to configuration of devices - peers. More... | |
static int | handle_incoming (struct sip_pvt *p, struct sip_request *req, struct ast_sockaddr *addr, int *recount, int *nounlock) |
Handle incoming SIP requests (methods) More... | |
static int | handle_invite_replaces (struct sip_pvt *p, struct sip_request *req, int *nounlock, struct sip_pvt *replaces_pvt, struct ast_channel *replaces_chan) |
Handle the transfer part of INVITE with a replaces: header,. More... | |
static int | handle_request_bye (struct sip_pvt *p, struct sip_request *req) |
Handle incoming BYE request. More... | |
static int | handle_request_cancel (struct sip_pvt *p, struct sip_request *req) |
Handle incoming CANCEL request. More... | |
static int | handle_request_do (struct sip_request *req, struct ast_sockaddr *addr) |
Handle incoming SIP message - request or response. More... | |
static void | handle_request_info (struct sip_pvt *p, struct sip_request *req) |
Receive SIP INFO Message. More... | |
static int | handle_request_invite (struct sip_pvt *p, struct sip_request *req, struct ast_sockaddr *addr, uint32_t seqno, int *recount, const char *e, int *nounlock) |
Handle incoming INVITE request. More... | |
static int | handle_request_invite_st (struct sip_pvt *p, struct sip_request *req, int reinvite) |
static int | handle_request_message (struct sip_pvt *p, struct sip_request *req, struct ast_sockaddr *addr, const char *e) |
Handle incoming MESSAGE request. More... | |
static int | handle_request_notify (struct sip_pvt *p, struct sip_request *req, struct ast_sockaddr *addr, uint32_t seqno, const char *e) |
Handle incoming notifications. More... | |
static int | handle_request_options (struct sip_pvt *p, struct sip_request *req, struct ast_sockaddr *addr, const char *e) |
Handle incoming OPTIONS request An OPTIONS request should be answered like an INVITE from the same UA, including SDP. More... | |
static int | handle_request_publish (struct sip_pvt *p, struct sip_request *req, struct ast_sockaddr *addr, const uint32_t seqno, const char *uri) |
static int | handle_request_refer (struct sip_pvt *p, struct sip_request *req, uint32_t seqno, int *nounlock) |
static int | handle_request_register (struct sip_pvt *p, struct sip_request *req, struct ast_sockaddr *addr, const char *e) |
Handle incoming REGISTER request. More... | |
static int | handle_request_subscribe (struct sip_pvt *p, struct sip_request *req, struct ast_sockaddr *addr, uint32_t seqno, const char *e) |
Handle incoming SUBSCRIBE request. More... | |
static int | handle_request_update (struct sip_pvt *p, struct sip_request *req) |
bare-bones support for SIP UPDATE More... | |
static void | handle_response (struct sip_pvt *p, int resp, const char *rest, struct sip_request *req, uint32_t seqno) |
Handle SIP response in dialogue. More... | |
static void | handle_response_info (struct sip_pvt *p, int resp, const char *rest, struct sip_request *req, uint32_t seqno) |
static void | handle_response_invite (struct sip_pvt *p, int resp, const char *rest, struct sip_request *req, uint32_t seqno) |
Handle SIP response to INVITE dialogue. More... | |
static void | handle_response_message (struct sip_pvt *p, int resp, const char *rest, struct sip_request *req, uint32_t seqno) |
static void | handle_response_notify (struct sip_pvt *p, int resp, const char *rest, struct sip_request *req, uint32_t seqno) |
static void | handle_response_peerpoke (struct sip_pvt *p, int resp, struct sip_request *req) |
Handle qualification responses (OPTIONS) More... | |
static void | handle_response_publish (struct sip_pvt *p, int resp, const char *rest, struct sip_request *req, uint32_t seqno) |
static void | handle_response_refer (struct sip_pvt *p, int resp, const char *rest, struct sip_request *req, uint32_t seqno) |
static int | handle_response_register (struct sip_pvt *p, int resp, const char *rest, struct sip_request *req, uint32_t seqno) |
Handle responses on REGISTER to services. More... | |
static void | handle_response_subscribe (struct sip_pvt *p, int resp, const char *rest, struct sip_request *req, uint32_t seqno) |
static void | handle_response_update (struct sip_pvt *p, int resp, const char *rest, struct sip_request *req, uint32_t seqno) |
Handle authentication challenge for SIP UPDATE. More... | |
static int | handle_sip_publish_initial (struct sip_pvt *p, struct sip_request *req, struct event_state_compositor *esc, const int expires) |
static int | handle_sip_publish_modify (struct sip_pvt *p, struct sip_request *req, struct event_state_compositor *esc, const char *const etag, const int expires) |
static int | handle_sip_publish_refresh (struct sip_pvt *p, struct sip_request *req, struct event_state_compositor *esc, const char *const etag, const int expires) |
static int | handle_sip_publish_remove (struct sip_pvt *p, struct sip_request *req, struct event_state_compositor *esc, const char *const etag) |
static int | handle_t38_options (struct ast_flags *flags, struct ast_flags *mask, struct ast_variable *v, unsigned int *maxdatagram) |
Handle T.38 configuration options common to users and peers. More... | |
const char * | hangup_cause2sip (int cause) |
Convert Asterisk hangup causes to SIP codes. More... | |
int | hangup_sip2cause (int cause) |
Convert SIP hangup causes to Asterisk hangup causes. More... | |
static int | has_media_level_attribute (int start, struct sip_request *req, const char *attr) |
static int | has_media_stream (struct sip_pvt *p, enum media_type m) |
Check the media stream list to see if the given type already exists. More... | |
static int | init_req (struct sip_request *req, int sipmethod, const char *recip) |
Initialize SIP request. More... | |
static int | init_resp (struct sip_request *resp, const char *msg) |
Initialize SIP response, based on SIP request. More... | |
static int | initialize_escs (void) |
static void | initialize_initreq (struct sip_pvt *p, struct sip_request *req) |
Initialize the initital request packet in the pvt structure. This packet is used for creating replies and future requests in a dialog. More... | |
static int | initialize_udptl (struct sip_pvt *p) |
static void | initreqprep (struct sip_request *req, struct sip_pvt *p, int sipmethod, const char *const explicit_uri) |
Initiate new SIP request to peer/user. More... | |
static const char * | insecure2str (int mode) |
Convert Insecure setting to printable string. More... | |
static int | interpret_t38_parameters (struct sip_pvt *p, const struct ast_control_t38_parameters *parameters) |
Helper function which updates T.38 capability information and triggers a reinvite. More... | |
static int | is_method_allowed (unsigned int *allowed_methods, enum sipmethod method) |
Check if method is allowed for a device or a dialog. More... | |
static int | load_module (void) |
Load the module. More... | |
static int | local_attended_transfer (struct sip_pvt *transferer, struct ast_channel *transferer_chan, uint32_t seqno, int *nounlock) |
Find all call legs and bridge transferee with target called from handle_request_refer. More... | |
static void | lws2sws (struct ast_str *data) |
Parse multiline SIP headers into one header This is enabled if pedanticsipchecking is enabled. More... | |
static void | make_our_tag (struct sip_pvt *pvt) |
Make our SIP dialog tag. More... | |
static int | manager_show_registry (struct mansession *s, const struct message *m) |
Show SIP registrations in the manager API. More... | |
static int | manager_sip_peer_status (struct mansession *s, const struct message *m) |
Show SIP peers in the manager API. More... | |
static int | manager_sip_qualify_peer (struct mansession *s, const struct message *m) |
Qualify SIP peers in the manager API. More... | |
static int | manager_sip_show_peer (struct mansession *s, const struct message *m) |
Show SIP peers in the manager API. More... | |
static int | manager_sip_show_peers (struct mansession *s, const struct message *m) |
Show SIP peers in the manager API. More... | |
static int | manager_sipnotify (struct mansession *s, const struct message *m) |
static int | map_s_x (const struct _map_x_s *table, const char *s, int errorvalue) |
map from a string to an integer value, case insensitive. If no match is found, return errorvalue. More... | |
static const char * | map_x_s (const struct _map_x_s *table, int x, const char *errorstring) |
map from an integer value to a string. If no match is found, return errorstring More... | |
static void | mark_method_allowed (unsigned int *allowed_methods, enum sipmethod method) |
static void | mark_method_unallowed (unsigned int *allowed_methods, enum sipmethod method) |
static void | mark_parsed_methods (unsigned int *methods, char *methods_str) |
static int | match_and_cleanup_peer_sched (void *peerobj, void *arg, int flags) |
static enum match_req_res | match_req_to_dialog (struct sip_pvt *sip_pvt_ptr, struct match_req_args *arg) |
static int | method_match (enum sipmethod id, const char *name) |
returns true if 'name' (with optional trailing whitespace) matches the sip method 'id'. Strictly speaking, SIP methods are case SENSITIVE, but we do a case-insensitive comparison to be more tolerant. following Jon Postel's rule: Be gentle in what you accept, strict with what you send More... | |
static int | mock_tcp_loop (char *fragments[], size_t num_fragments, struct ast_str **overflow, char **messages, int *num_messages, struct ast_test *test) |
Imitation TCP reception loop. More... | |
static void | mwi_event_cb (void *userdata, struct stasis_subscription *sub, struct stasis_message *msg) |
Receive MWI events that we have subscribed to. More... | |
static int | network_change_sched_cb (const void *data) |
static void | network_change_stasis_cb (void *data, struct stasis_subscription *sub, struct stasis_message *message) |
static void | network_change_stasis_subscribe (void) |
static void | network_change_stasis_unsubscribe (void) |
static struct sip_proxy * | obproxy_get (struct sip_pvt *dialog, struct sip_peer *peer) |
Get default outbound proxy or global proxy. More... | |
static void | offered_media_list_destroy (struct sip_pvt *p) |
Destroy SDP media offer list. More... | |
static void | on_dns_update_mwi (struct ast_sockaddr *old, struct ast_sockaddr *new, void *data) |
static void | on_dns_update_peer (struct ast_sockaddr *old, struct ast_sockaddr *new, void *data) |
static void | on_dns_update_registry (struct ast_sockaddr *old, struct ast_sockaddr *new, void *data) |
static unsigned int | parse_allowed_methods (struct sip_request *req) |
parse the Allow header to see what methods the endpoint we are communicating with allows. More... | |
static void | parse_copy (struct sip_request *dst, const struct sip_request *src) |
Copy SIP request, parse it. More... | |
static int | parse_minse (const char *p_hdrval, int *const p_interval) |
Session-Timers: Function for parsing Min-SE header. More... | |
static void | parse_moved_contact (struct sip_pvt *p, struct sip_request *req, char **name, char **number, int set_call_forward) |
Parse 302 Moved temporalily response. More... | |
static int | parse_ok_contact (struct sip_pvt *pvt, struct sip_request *req) |
Save contact header for 200 OK on INVITE. More... | |
static void | parse_oli (struct sip_request *req, struct ast_channel *chan) |
Check for the presence of OLI tag(s) in the From header and set on the channel. More... | |
static enum parse_register_result | parse_register_contact (struct sip_pvt *pvt, struct sip_peer *peer, struct sip_request *req) |
Parse contact header and save registration (peer registration) More... | |
static int | parse_request (struct sip_request *req) |
Parse a SIP message. More... | |
static int | parse_session_expires (const char *p_hdrval, int *const p_interval, enum st_refresher_param *const p_ref) |
Session-Timers: Function for parsing Session-Expires header. More... | |
static int | parse_uri_legacy_check (char *uri, const char *scheme, char **user, char **pass, char **hostport, char **transport) |
parse uri in a way that allows semicolon stripping if legacy mode is enabled More... | |
static int | peer_cmp_cb (void *obj, void *arg, int flags) |
static int | peer_dump_func (void *userobj, void *arg, int flags) |
static int | peer_hash_cb (const void *obj, const int flags) |
static int | peer_ipcmp_cb_full (void *obj, void *arg, void *data, int flags) |
static int | peer_iphash_cb (const void *obj, const int flags) |
static void | peer_mailboxes_to_str (struct ast_str **mailbox_str, struct sip_peer *peer) |
list peer mailboxes to CLI More... | |
static int | peer_markall_autopeers_func (void *device, void *arg, int flags) |
static int | peer_markall_func (void *device, void *arg, int flags) |
static void | peer_sched_cleanup (struct sip_peer *peer) |
static int | peer_status (struct sip_peer *peer, char *status, int statuslen) |
int | peercomparefunc (const void *a, const void *b) |
static int | pidf_validate_presence (struct ast_xml_doc *doc) |
static int | pidf_validate_tuple (struct ast_xml_node *tuple_node) |
unsigned int | port_str2int (const char *pt, unsigned int standard) |
converts ascii port to int representation. If no pt buffer is provided or the pt has errors when being converted to an int value, the port provided as the standard is used. More... | |
static void | print_group (int fd, ast_group_t group, int crlf) |
Print call group and pickup group. More... | |
static void | print_named_groups (int fd, struct ast_namedgroups *group, int crlf) |
Print named call groups and pickup groups. More... | |
static void | proc_422_rsp (struct sip_pvt *p, struct sip_request *rsp) |
Handle 422 response to INVITE with session-timer requested. More... | |
static int | proc_session_timer (const void *vp) |
Session-Timers: Process session refresh timeout event. More... | |
static int | process_crypto (struct sip_pvt *p, struct ast_rtp_instance *rtp, struct ast_sdp_srtp **srtp, const char *a) |
static int | process_sdp (struct sip_pvt *p, struct sip_request *req, int t38action, int is_offer) |
Process SIP SDP offer, select formats and activate media channels If offer is rejected, we will not change any properties of the call Return 0 on success, a negative value on errors. Must be called after find_sdp(). More... | |
static int | process_sdp_a_audio (const char *a, struct sip_pvt *p, struct ast_rtp_codecs *newaudiortp, int *last_rtpmap_codec) |
static int | process_sdp_a_dtls (const char *a, struct sip_pvt *p, struct ast_rtp_instance *instance) |
static int | process_sdp_a_ice (const char *a, struct sip_pvt *p, struct ast_rtp_instance *instance, int rtcp_mux) |
static int | process_sdp_a_image (const char *a, struct sip_pvt *p) |
static int | process_sdp_a_rtcp_mux (const char *a, struct sip_pvt *p, int *requested) |
static int | process_sdp_a_sendonly (const char *a, int *sendonly) |
static int | process_sdp_a_text (const char *a, struct sip_pvt *p, struct ast_rtp_codecs *newtextrtp, char *red_fmtp, int *red_num_gen, int *red_data_pt, int *last_rtpmap_codec) |
static int | process_sdp_a_video (const char *a, struct sip_pvt *p, struct ast_rtp_codecs *newvideortp, int *last_rtpmap_codec) |
static int | process_sdp_c (const char *c, struct ast_sockaddr *addr) |
static int | process_sdp_o (const char *o, struct sip_pvt *p) |
static int | process_via (struct sip_pvt *p, const struct sip_request *req) |
Process the Via header according to RFC 3261 section 18.2.2. More... | |
static struct sip_proxy * | proxy_from_config (const char *proxy, int sipconf_lineno, struct sip_proxy *dest) |
Parse proxy string and return an ao2_alloc'd proxy. If dest is non-NULL, no allocation is performed and dest is used instead. On error NULL is returned. More... | |
static int | proxy_update (struct sip_proxy *proxy) |
static int | publish_expire (const void *data) |
static void | publish_qualify_peer_done (const char *id, const char *peer) |
static void | pvt_set_needdestroy (struct sip_pvt *pvt, const char *reason) |
static int | read_raw_content_length (const char *message) |
Get the content length from an unparsed SIP message. More... | |
static struct sip_peer * | realtime_peer (const char *newpeername, struct ast_sockaddr *addr, char *callbackexten, int devstate_only, int which_objects) |
realtime_peer: Get peer from realtime storage Checks the "sippeers" realtime family from extconfig.conf Checks the "sipregs" realtime family from extconfig.conf if it's configured. This returns a pointer to a peer and because we use build_peer, we can rest assured that the refcount is bumped. More... | |
static int | realtime_peer_by_addr (const char **name, struct ast_sockaddr *addr, const char *ipaddr, const char *callbackexten, struct ast_variable **var, struct ast_variable **varregs) |
static int | realtime_peer_by_name (const char *const *name, struct ast_sockaddr *addr, const char *ipaddr, struct ast_variable **var, struct ast_variable **varregs) |
static struct ast_variable * | realtime_peer_get_sippeer_helper (const char **name, struct ast_variable **varregs) |
static void | realtime_update_peer (const char *peername, struct ast_sockaddr *addr, const char *defaultuser, const char *fullcontact, const char *useragent, int expirey, unsigned short deprecated_username, int lastms, const char *path) |
Update peer object in realtime storage If the Asterisk system name is set in asterisk.conf, we will use that name and store that in the "regserver" field in the sippeers table to facilitate multi-server setups. More... | |
static void | receive_message (struct sip_pvt *p, struct sip_request *req, struct ast_sockaddr *addr, const char *e) |
Receive SIP MESSAGE method messages. More... | |
static void | ref_proxy (struct sip_pvt *pvt, struct sip_proxy *proxy) |
maintain proper refcounts for a sip_pvt's outboundproxy More... | |
static const char * | referstatus2str (enum referstatus rstatus) |
Convert transfer status to string. More... | |
static void | reg_source_db (struct sip_peer *peer) |
Get registration details from Asterisk DB. More... | |
static void | register_peer_exten (struct sip_peer *peer, int onoff) |
Automatically add peer extension to dial plan. More... | |
static int | register_realtime_peers_with_callbackextens (void) |
static enum check_auth_result | register_verify (struct sip_pvt *p, struct ast_sockaddr *addr, struct sip_request *req, const char *uri) |
Verify registration of user. More... | |
static int | registry_cmp_cb (void *obj, void *arg, int flags) |
static int | registry_hash_cb (const void *obj, const int flags) |
static const char * | regstate2str (enum sipregistrystate regstate) |
Convert registration state status to string. More... | |
static int | reinvite_timeout (const void *data) |
static int | reload (void) |
Part of Asterisk module interface. More... | |
static int | reload_config (enum channelreloadreason reason) |
Re-read SIP.conf config file. More... | |
static char * | remove_uri_parameters (char *uri) |
static int | reply_digest (struct sip_pvt *p, struct sip_request *req, char *header, int sipmethod, char *digest, int digest_len) |
reply to authentication for outbound registrations More... | |
static int | reqprep (struct sip_request *req, struct sip_pvt *p, int sipmethod, uint32_t seqno, int newbranch) |
Initialize a SIP request message (not the initial one in a dialog) More... | |
static int | resp_needs_contact (const char *msg, enum sipmethod method) |
Test if this response needs a contact header. More... | |
static int | respprep (struct sip_request *resp, struct sip_pvt *p, const char *msg, const struct sip_request *req) |
Prepare SIP response packet. More... | |
static int | restart_monitor (void) |
Start the channel monitor thread. More... | |
static void | restart_session_timer (struct sip_pvt *p) |
Session-Timers: Restart session timer. More... | |
static int | retrans_pkt (const void *data) |
Retransmit SIP message if no answer. More... | |
static void | sched_check_pendings (struct sip_pvt *pvt) |
static void | send_check_user_failure_response (struct sip_pvt *p, struct sip_request *req, int res, enum xmittype reliable) |
static void | send_manager_peer_status (struct mansession *s, struct sip_peer *peer, const char *idText) |
static int | send_provisional_keepalive (const void *data) |
static int | send_provisional_keepalive_full (struct sip_pvt *pvt, int with_sdp) |
static int | send_provisional_keepalive_with_sdp (const void *data) |
static int | send_request (struct sip_pvt *p, struct sip_request *req, enum xmittype reliable, uint32_t seqno) |
static int | send_response (struct sip_pvt *p, struct sip_request *req, enum xmittype reliable, uint32_t seqno) |
Transmit response on SIP request. More... | |
static void | send_session_timeout (struct ast_channel *chan, const char *source) |
Sends a session timeout channel blob used to produce SessionTimeout AMI messages. More... | |
static enum ast_cc_service_type | service_string_to_service_type (const char *const service_string) |
static struct ast_manager_event_blob * | session_timeout_to_ami (struct stasis_message *msg) |
static int | set_address_from_contact (struct sip_pvt *pvt) |
Change the other partys IP address based on given contact. More... | |
static void | set_destination (struct sip_pvt *p, const char *uri) |
Set destination from SIP URI. More... | |
static void | set_ice_components (struct sip_pvt *p, struct ast_rtp_instance *instance, int remote_rtcp_mux) |
static void | set_insecure_flags (struct ast_flags *flags, const char *value, int lineno) |
Parse insecure= setting in sip.conf and set flags according to setting. More... | |
static int | set_message_vars_from_req (struct ast_msg *msg, struct sip_request *req) |
static void | set_peer_defaults (struct sip_peer *peer) |
Set peer defaults before configuring specific configurations. More... | |
static void | set_peer_nat (const struct sip_pvt *p, struct sip_peer *peer) |
Set the peers nat flags if they are using auto_* settings. More... | |
static unsigned int | set_pvt_allowed_methods (struct sip_pvt *pvt, struct sip_request *req) |
static void | set_socket_transport (struct sip_socket *socket, int transport) |
static void | set_t38_capabilities (struct sip_pvt *p) |
Set the global T38 capabilities on a SIP dialog structure. More... | |
static int | show_channels_cb (struct sip_pvt *cur, struct __show_chan_arg *arg) |
callback for show channel|subscription More... | |
static int | show_chanstats_cb (struct sip_pvt *cur, struct __show_chan_arg *arg) |
Callback for show_chanstats. More... | |
static void | shutdown_mwi_subscription (struct sip_subscription_mwi *mwi) |
static int | sip_addheader (struct ast_channel *chan, const char *data) |
Add a SIP header to an outbound INVITE. More... | |
static int | sip_allow_anyrtp_remote (struct ast_channel *chan1, struct ast_rtp_instance *instance, const char *rtptype) |
static int | sip_allow_rtp_remote (struct ast_channel *chan1, struct ast_rtp_instance *instance) |
static int | sip_allow_vrtp_remote (struct ast_channel *chan1, struct ast_rtp_instance *instance) |
static void | sip_alreadygone (struct sip_pvt *dialog) |
Encapsulate setting of SIP_ALREADYGONE to be able to trace it with debugging. More... | |
static int | sip_answer (struct ast_channel *ast) |
sip_answer: Answer SIP call , send 200 OK on Invite Part of PBX interface More... | |
void | sip_auth_headers (enum sip_auth_type code, char **header, char **respheader) |
return the request and response header for a 401 or 407 code More... | |
static int | sip_call (struct ast_channel *ast, const char *dest, int timeout) |
Initiate SIP call from PBX used from the dial() application. More... | |
void | sip_cancel_destroy (struct sip_pvt *pvt) |
Cancel destruction of SIP dialog. More... | |
static void | sip_cc_agent_destructor (struct ast_cc_agent *agent) |
static int | sip_cc_agent_init (struct ast_cc_agent *agent, struct ast_channel *chan) |
static int | sip_cc_agent_recall (struct ast_cc_agent *agent) |
static void | sip_cc_agent_respond (struct ast_cc_agent *agent, enum ast_cc_agent_response_reason reason) |
static int | sip_cc_agent_start_monitoring (struct ast_cc_agent *agent) |
static int | sip_cc_agent_start_offer_timer (struct ast_cc_agent *agent) |
static int | sip_cc_agent_status_request (struct ast_cc_agent *agent) |
static int | sip_cc_agent_stop_offer_timer (struct ast_cc_agent *agent) |
static int | sip_cc_monitor_cancel_available_timer (struct ast_cc_monitor *monitor, int *sched_id) |
static void | sip_cc_monitor_destructor (void *private_data) |
static int | sip_cc_monitor_request_cc (struct ast_cc_monitor *monitor, int *available_timer_id) |
static int | sip_cc_monitor_suspend (struct ast_cc_monitor *monitor) |
static int | sip_cc_monitor_unsuspend (struct ast_cc_monitor *monitor) |
static int | sip_check_authtimeout (time_t start) |
Check if the authtimeout has expired. More... | |
static char * | sip_cli_notify (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
Cli command to send SIP notify to peer. More... | |
static int | sip_debug_test_addr (const struct ast_sockaddr *addr) |
See if we pass debug IP filter. More... | |
static int | sip_debug_test_pvt (struct sip_pvt *p) |
Test PVT for debugging output. More... | |
static void | sip_destroy_peer (struct sip_peer *peer) |
Destroy peer object from memory. More... | |
static void | sip_destroy_peer_fn (void *peer) |
static int | sip_devicestate (const char *data) |
Part of PBX channel interface. More... | |
void | sip_digest_parser (char *c, struct digestkeys *keys) |
Takes the digest response and parses it. More... | |
static char * | sip_do_debug (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
Turn on SIP debugging (CLI command) More... | |
static char * | sip_do_debug_ip (int fd, const char *arg) |
Enable SIP Debugging for a single IP. More... | |
static char * | sip_do_debug_peer (int fd, const char *arg) |
Turn on SIP debugging for a given peer. More... | |
static int | sip_do_reload (enum channelreloadreason reason) |
Reload module. More... | |
static int | sip_dtmfmode (struct ast_channel *chan, const char *data) |
Set the DTMFmode for an outbound SIP call (application) More... | |
static void | sip_dump_history (struct sip_pvt *dialog) |
Dump SIP history to debug log file at end of lifespan for SIP dialog. More... | |
static int | sip_epa_register (const struct epa_static_data *static_data) |
static void | sip_epa_unregister_all (void) |
struct sip_peer * | sip_find_peer (const char *peer, struct ast_sockaddr *addr, int realtime, int which_objects, int devstate_only, int transport) |
Locate device by name or ip address. More... | |
static struct sip_peer * | sip_find_peer_by_ip_and_exten (struct ast_sockaddr *addr, char *callbackexten, int transport) |
static struct sip_peer * | sip_find_peer_full (const char *peer, struct ast_sockaddr *addr, char *callbackexten, int realtime, int which_objects, int devstate_only, int transport) |
static int | sip_fixup (struct ast_channel *oldchan, struct ast_channel *newchan) |
sip_fixup: Fix up a channel: If a channel is consumed, this is called. Basically update any ->owner links More... | |
static const char * | sip_get_callid (struct ast_channel *chan) |
Deliver SIP call ID for the call. More... | |
static int | sip_get_cc_information (struct sip_request *req, char *subscribe_uri, size_t size, enum ast_cc_service_type *service) |
static void | sip_get_codec (struct ast_channel *chan, struct ast_format_cap *result) |
const char * | sip_get_header (const struct sip_request *req, const char *name) |
Get header from SIP request. More... | |
static enum ast_rtp_glue_result | sip_get_rtp_peer (struct ast_channel *chan, struct ast_rtp_instance **instance) |
const char * | sip_get_transport (enum ast_transport t) |
Return transport as string. More... | |
static enum ast_rtp_glue_result | sip_get_trtp_peer (struct ast_channel *chan, struct ast_rtp_instance **instance) |
static enum ast_rtp_glue_result | sip_get_vrtp_peer (struct ast_channel *chan, struct ast_rtp_instance **instance) |
static void | sip_handle_cc (struct sip_pvt *pvt, struct sip_request *req, enum ast_cc_service_type service) |
static int | sip_hangup (struct ast_channel *ast) |
sip_hangup: Hangup SIP call Part of PBX interface, called from ast_hangup More... | |
static int | sip_indicate (struct ast_channel *ast, int condition, const void *data, size_t datalen) |
Play indication to user With SIP a lot of indications is sent as messages, letting the device play the indication - busy signal, congestion etc. More... | |
static int | sip_is_token (const char *str) |
static int | sip_is_xml_parsable (void) |
static void | sip_keepalive_all_peers (void) |
Send a keepalive to all known peers. More... | |
static int | sip_monitor_instance_cmp_fn (void *obj, void *arg, int flags) |
static void | sip_monitor_instance_destructor (void *data) |
static int | sip_monitor_instance_hash_fn (const void *obj, const int flags) |
static struct sip_monitor_instance * | sip_monitor_instance_init (int core_id, const char *const subscribe_uri, const char *const peername, const char *const device_name) |
static int | sip_msg_send (const struct ast_msg *msg, const char *to, const char *from) |
static const char * | sip_nat_mode (const struct sip_pvt *p) |
Display SIP nat mode. More... | |
static struct ast_channel * | sip_new (struct sip_pvt *i, int state, const char *title, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, ast_callid callid) |
Initiate a call in the SIP channel. More... | |
static int | sip_notify_alloc (struct sip_pvt *p) |
Allocate SIP refer structure. More... | |
static int | sip_offer_timer_expire (const void *data) |
static void | sip_peer_hold (struct sip_pvt *p, int hold) |
Change onhold state of a peer using a pvt structure. More... | |
static int | sip_pickup (struct ast_channel *chan) |
Pickup a call using the subsystem in features.c This is executed in a separate thread. More... | |
static void * | sip_pickup_thread (void *stuff) |
SIP pickup support function Starts in a new thread, then pickup the call. More... | |
static int | sip_pidf_validate (struct sip_request *req, struct ast_xml_doc **pidf_doc) |
Makes sure that body is properly formatted PIDF. More... | |
static void | sip_pkt_dtor (void *vdoomed) |
static void | sip_poke_all_peers (void) |
Send a poke to all known peers. More... | |
static int | sip_poke_noanswer (const void *data) |
React to lack of answer to Qualify poke. More... | |
static int | sip_poke_peer (struct sip_peer *peer, int force) |
Check availability of peer, also keep NAT open. More... | |
static int | sip_poke_peer_now (const void *data) |
static int | sip_poke_peer_s (const void *data) |
Poke peer (send qualify to check if peer is alive and well) More... | |
static int | sip_prepare_socket (struct sip_pvt *p) |
static char * | sip_prune_realtime (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
Remove temporary realtime objects from memory (CLI) More... | |
static void | sip_publish_registry (const char *username, const char *domain, const char *status) |
static void | sip_pvt_callid_set (struct sip_pvt *pvt, ast_callid callid) |
static void | sip_pvt_dtor (void *vdoomed) |
ao2 destructor for SIP dialog structure More... | |
static struct ast_channel * | sip_pvt_lock_full (struct sip_pvt *pvt) |
static char * | sip_qualify_peer (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
Send an OPTIONS packet to a SIP peer. More... | |
static int | sip_queryoption (struct ast_channel *chan, int option, void *data, int *datalen) |
Query an option on a SIP dialog. More... | |
static void | sip_queue_hangup_cause (struct sip_pvt *p, int cause) |
static struct ast_frame * | sip_read (struct ast_channel *ast) |
Read SIP RTP from channel. More... | |
static const struct ast_sockaddr * | sip_real_dst (const struct sip_pvt *p) |
The real destination address for a write. More... | |
static const char * | sip_reason_code_to_str (struct ast_party_redirecting_reason *reason) |
static int | sip_refer_alloc (struct sip_pvt *p) |
Allocate SIP refer structure. More... | |
static void | sip_refer_destroy (struct sip_pvt *p) |
Destroy SIP refer structure. More... | |
static int | sip_reg_timeout (const void *data) |
Registration request timeout, register again. More... | |
static int | sip_register (const char *value, int lineno) |
create sip_registry object from register=> line in sip.conf and link into reg container More... | |
static void | sip_register_tests (void) |
SIP test registration. More... | |
static void | sip_registry_destroy (void *obj) |
Destroy registry object Objects created with the register= statement in static configuration. More... | |
static int | sip_reinvite_retry (const void *data) |
Reset the NEEDREINVITE flag after waiting when we get 491 on a Re-invite to avoid race conditions between asterisk servers. More... | |
static char * | sip_reload (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
Force reload of module from cli. More... | |
static int | sip_removeheader (struct ast_channel *chan, const char *data) |
Remove SIP headers added previously with SipAddHeader application. More... | |
static struct ast_channel * | sip_request_call (const char *type, struct ast_format_cap *cap, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *dest, int *cause) |
PBX interface function -build SIP pvt structure SIP calls initiated by the PBX arrive here. More... | |
static int | sip_reregister (const void *data) |
Update registration with SIP Proxy. More... | |
static struct ast_frame * | sip_rtp_read (struct ast_channel *ast, struct sip_pvt *p, int *faxdetect) |
Read RTP from network. More... | |
static const char * | sip_sanitized_host (const char *host) |
void | sip_scheddestroy (struct sip_pvt *p, int ms) |
Schedule destruction of SIP dialog. More... | |
void | sip_scheddestroy_final (struct sip_pvt *p, int ms) |
Schedule final destruction of SIP dialog. More... | |
static int | sip_scheddestroy_full (struct sip_pvt *p, int ms) |
static void | sip_send_all_mwi_subscriptions (void) |
Send all MWI subscriptions. More... | |
static void | sip_send_all_registers (void) |
Send all known registrations. More... | |
static int | sip_send_keepalive (const void *data) |
Send keep alive packet to peer. More... | |
static int | sip_send_mwi_to_peer (struct sip_peer *peer, int cache_only) |
Send message waiting indication to alert peer that they've got voicemail. More... | |
static int | sip_sendcustominfo (struct ast_channel *chan, const char *data) |
Send a custom INFO message via AST_CONTROL_CUSTOM indication. More... | |
static int | sip_senddigit_begin (struct ast_channel *ast, char digit) |
static int | sip_senddigit_end (struct ast_channel *ast, char digit, unsigned int duration) |
Send DTMF character on SIP channel within one call, we're able to transmit in many methods simultaneously. More... | |
static int | sip_sendhtml (struct ast_channel *chan, int subclass, const char *data, int datalen) |
Send message with Access-URL header, if this is an HTML URL only! More... | |
static int | sip_sendtext (struct ast_channel *ast, const char *text) |
static void | sip_set_default_format_capabilities (struct ast_format_cap *cap) |
static char * | sip_set_history (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
Enable/Disable SIP History logging (CLI) More... | |
static void | sip_set_owner (struct sip_pvt *p, struct ast_channel *chan) |
Set the owning channel on the sip_pvt object. More... | |
static void | sip_set_redirstr (struct sip_pvt *p, char *reason) |
Translate referring cause. More... | |
static int | sip_set_rtp_peer (struct ast_channel *chan, struct ast_rtp_instance *instance, struct ast_rtp_instance *vinstance, struct ast_rtp_instance *tinstance, const struct ast_format_cap *cap, int nat_active) |
static int | sip_setoption (struct ast_channel *chan, int option, void *data, int datalen) |
Set an option on a SIP dialog. More... | |
static char * | sip_show_channel (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
Show details of one active dialog. More... | |
static char * | sip_show_channels (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
CLI for show channels or subscriptions. This is a new-style CLI handler so a single function contains the prototype for the function, the 'generator' to produce multiple entries in case it is required, and the actual handler for the command. More... | |
static char * | sip_show_channelstats (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
SIP show channelstats CLI (main function) More... | |
static char * | sip_show_domains (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
CLI command to list local domains. More... | |
static char * | sip_show_history (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
Show history details of one dialog. More... | |
static char * | sip_show_inuse (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
CLI Command to show calls within limits set by call_limit. More... | |
static char * | sip_show_mwi (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | sip_show_objects (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
List all allocated SIP Objects (realtime or static) More... | |
static char * | sip_show_peer (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
Show one peer in detail. More... | |
static char * | sip_show_peers (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
CLI Show Peers command. More... | |
static char * | sip_show_registry (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
Show SIP Registry (registrations with other SIP proxies. More... | |
static char * | sip_show_sched (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | sip_show_settings (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
List global settings for the SIP channel. More... | |
static char * | sip_show_tcp (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
Show active TCP connections. More... | |
static char * | sip_show_user (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
Show one user in detail. More... | |
static char * | sip_show_users (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
CLI Command 'SIP Show Users'. More... | |
static int | sip_sipredirect (struct sip_pvt *p, const char *dest) |
Transfer call before connect with a 302 redirect. More... | |
static struct sip_st_dlg * | sip_st_alloc (struct sip_pvt *const p) |
Allocate Session-Timers struct w/in dialog. More... | |
static int | sip_standard_port (enum ast_transport type, int port) |
Returns the port to use for this socket. More... | |
static int | sip_subscribe_mwi (const char *value, int lineno) |
Parse mwi=> line in sip.conf and add to list. More... | |
static void | sip_subscribe_mwi_destroy (void *data) |
Destroy MWI subscription object. More... | |
static int | sip_subscribe_mwi_do (const void *data) |
Send a subscription or resubscription for MWI. More... | |
static int | sip_t38_abort (const void *data) |
Called to deny a T38 reinvite if the core does not respond to our request. More... | |
static struct ast_tcptls_session_instance * | sip_tcp_locate (struct ast_sockaddr *s) |
Find thread for TCP/TLS session (based on IP/Port. More... | |
static void * | sip_tcp_worker_fn (void *data) |
SIP TCP connection handler. More... | |
static void | sip_tcptls_client_args_destructor (void *obj) |
static int | sip_tcptls_read (struct sip_request *req, struct ast_tcptls_session_instance *tcptls_session, int authenticated, time_t start) |
Read SIP request or response from a TCP/TLS connection. More... | |
static int | sip_tcptls_write (struct ast_tcptls_session_instance *tcptls_session, const void *buf, size_t len) |
used to indicate to a tcptls thread that data is ready to be written More... | |
static struct sip_threadinfo * | sip_threadinfo_create (struct ast_tcptls_session_instance *tcptls_session, int transport) |
creates a sip_threadinfo object and links it into the threadt table. More... | |
static void | sip_threadinfo_destructor (void *obj) |
static int | sip_transfer (struct ast_channel *ast, const char *dest) |
Transfer SIP call. More... | |
static char * | sip_unregister (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
Unregister (force expiration) a SIP peer in the registry via CLI. More... | |
static void | sip_unregister_tests (void) |
SIP test registration. More... | |
static void | sip_websocket_callback (struct ast_websocket *session, struct ast_variable *parameters, struct ast_variable *headers) |
SIP WebSocket connection handler. More... | |
static int | sip_write (struct ast_channel *ast, struct ast_frame *frame) |
Send frame to media channel (rtp) More... | |
static int | sipinfo_send (struct ast_channel *chan, struct ast_variable *headers, const char *content_type, const char *content, const char *useragent_filter) |
static int | sipsock_read (int *id, int fd, short events, void *ignore) |
Read data from SIP UDP socket. More... | |
static int | sockaddr_is_null_or_any (const struct ast_sockaddr *addr) |
static enum st_mode | st_get_mode (struct sip_pvt *p, int no_cached) |
Get the session-timer mode. More... | |
static enum st_refresher | st_get_refresher (struct sip_pvt *p) |
Get the entity (UAC or UAS) that's acting as the session-timer refresher. More... | |
static int | st_get_se (struct sip_pvt *p, int max) |
Get Max or Min SE (session timer expiry) More... | |
static void | start_ice (struct ast_rtp_instance *instance, int offer) |
Start ICE negotiation on an RTP instance. More... | |
static void | start_mwi_subscription (struct sip_subscription_mwi *mwi, int ms) |
static void | start_register_timeout (struct sip_registry *reg) |
static void | start_reregister_timeout (struct sip_registry *reg, int ms) |
static void | start_session_timer (struct sip_pvt *pvt) |
Session-Timers: Start session timer. More... | |
static void | start_t38_abort_timer (struct sip_pvt *pvt) |
static void | startup_event_cb (void *data, struct stasis_subscription *sub, struct stasis_message *message) |
Event callback which indicates we're fully booted. More... | |
STASIS_MESSAGE_TYPE_DEFN_LOCAL (session_timeout_type,.to_ami=session_timeout_to_ami,) | |
static void | state_notify_build_xml (struct state_notify_data *data, int full, const char *exten, const char *context, struct ast_str **tmp, struct sip_pvt *p, int subscribed, const char *mfrom, const char *mto) |
Builds XML portion of NOTIFY messages for presence or dialog updates. More... | |
static const char * | stmode2str (enum st_mode m) |
static void | stop_media_flows (struct sip_pvt *p) |
Immediately stop RTP, VRTP and UDPTL as applicable. More... | |
static void | stop_provisional_keepalive (struct sip_pvt *pvt) |
static void | stop_register_timeout (struct sip_registry *reg) |
static void | stop_reinvite_retry (struct sip_pvt *pvt) |
static void | stop_reinviteid (struct sip_pvt *pvt) |
static void | stop_retrans_pkt (struct sip_pkt *pkt) |
static void | stop_session_timer (struct sip_pvt *pvt) |
Session-Timers: Stop session timer. More... | |
static void | stop_t38_abort_timer (struct sip_pvt *pvt) |
static int | str2dtmfmode (const char *str) |
maps a string to dtmfmode, returns -1 on error More... | |
static enum st_mode | str2stmode (const char *s) |
static enum st_refresher_param | str2strefresherparam (const char *s) |
static const char * | strefresher2str (enum st_refresher r) |
static const char * | strefresherparam2str (enum st_refresher_param r) |
static const char * | subscription_type2str (enum subscriptiontype subtype) |
Show subscription type in string format. More... | |
static unsigned int | t38_get_rate (enum ast_control_t38_rate rate) |
Get Max T.38 Transmission rate from T38 capabilities. More... | |
static void | tcptls_packet_destructor (void *obj) |
static struct sip_peer * | temp_peer (const char *name) |
Create temporary peer (used in autocreatepeer mode) More... | |
static void | temp_pvt_cleanup (void *) |
static int | temp_pvt_init (void *) |
static char * | terminate_uri (char *uri) |
static int | threadinfo_locate_cb (void *obj, void *arg, int flags) |
static int | threadt_cmp_cb (void *obj, void *arg, int flags) |
static int | threadt_hash_cb (const void *obj, const int flags) |
static char * | transfermode2str (enum transfermodes mode) |
Convert transfer mode to text string. More... | |
static int | transmit_cc_notify (struct ast_cc_agent *agent, struct sip_pvt *subscription, enum sip_cc_notify_state state) |
static void | transmit_fake_auth_response (struct sip_pvt *p, struct sip_request *req, enum xmittype reliable) |
Send a fake 401 Unauthorized response when the administrator wants to hide the names of local devices from fishers. More... | |
static int | transmit_info_with_aoc (struct sip_pvt *p, struct ast_aoc_decoded *decoded) |
Send SIP INFO advice of charge message. More... | |
static int | transmit_info_with_digit (struct sip_pvt *p, const char digit, unsigned int duration) |
Send SIP INFO dtmf message, see Cisco documentation on cisco.com. More... | |
static int | transmit_info_with_vidupdate (struct sip_pvt *p) |
Send SIP INFO with video update request. More... | |
static int | transmit_invite (struct sip_pvt *p, int sipmethod, int sdp, int init, const char *const explicit_uri) |
Build REFER/INVITE/OPTIONS/SUBSCRIBE message and transmit it. More... | |
static int | transmit_message (struct sip_pvt *p, int init, int auth) |
Transmit with SIP MESSAGE method. More... | |
static int | transmit_notify_with_mwi (struct sip_pvt *p, int newmsgs, int oldmsgs, const char *vmexten) |
Notify user of messages waiting in voicemail (RFC3842) More... | |
static int | transmit_notify_with_sipfrag (struct sip_pvt *p, int cseq, char *message, int terminate) |
Notify a transferring party of the status of transfer (RFC3515) More... | |
static int | transmit_provisional_response (struct sip_pvt *p, const char *msg, const struct sip_request *req, int with_sdp) |
static int | transmit_publish (struct sip_epa_entry *epa_entry, enum sip_publish_type publish_type, const char *const explicit_uri) |
static int | transmit_refer (struct sip_pvt *p, const char *dest) |
Transmit SIP REFER message (initiated by the transfer() dialplan application. More... | |
static int | transmit_register (struct sip_registry *r, int sipmethod, const char *auth, const char *authheader) |
Transmit register to SIP proxy or UA auth = NULL on the initial registration (from sip_reregister()) More... | |
static int | transmit_reinvite_with_sdp (struct sip_pvt *p, int t38version, int oldsdp) |
Transmit reinvite with SDP. More... | |
static int | transmit_request (struct sip_pvt *p, int sipmethod, uint32_t seqno, enum xmittype reliable, int newbranch) |
Transmit generic SIP request returns XMIT_ERROR if transmit failed with a critical error (don't retry) More... | |
static int | transmit_request_with_auth (struct sip_pvt *p, int sipmethod, uint32_t seqno, enum xmittype reliable, int newbranch) |
Transmit SIP request, auth added. More... | |
static int | transmit_response (struct sip_pvt *p, const char *msg, const struct sip_request *req) |
Transmit response, no retransmits. More... | |
static int | transmit_response_reliable (struct sip_pvt *p, const char *msg, const struct sip_request *req) |
Transmit response, Make sure you get an ACK This is only used for responses to INVITEs, where we need to make sure we get an ACK. More... | |
static int | transmit_response_using_temp (ast_string_field callid, struct ast_sockaddr *addr, int useglobal_nat, const int intended_method, const struct sip_request *req, const char *msg) |
Transmit response, no retransmits, using a temporary pvt structure. More... | |
static int | transmit_response_with_allow (struct sip_pvt *p, const char *msg, const struct sip_request *req, enum xmittype reliable) |
Append Accept header, content length before transmitting response. More... | |
static int | transmit_response_with_auth (struct sip_pvt *p, const char *msg, const struct sip_request *req, const char *nonce, enum xmittype reliable, const char *header, int stale) |
Respond with authorization request. More... | |
static int | transmit_response_with_date (struct sip_pvt *p, const char *msg, const struct sip_request *req) |
Add date before transmitting response. More... | |
static int | transmit_response_with_minexpires (struct sip_pvt *p, const char *msg, const struct sip_request *req, int minexpires) |
Append Min-Expires header, content length before transmitting response. More... | |
static int | transmit_response_with_minse (struct sip_pvt *p, const char *msg, const struct sip_request *req, int minse_int) |
Transmit 422 response with Min-SE header (Session-Timers) More... | |
static int | transmit_response_with_retry_after (struct sip_pvt *p, const char *msg, const struct sip_request *req, const char *seconds) |
Append Retry-After header field when transmitting response. More... | |
static int | transmit_response_with_sdp (struct sip_pvt *p, const char *msg, const struct sip_request *req, enum xmittype reliable, int oldsdp, int rpid) |
Used for 200 OK and 183 early media. More... | |
static int | transmit_response_with_sip_etag (struct sip_pvt *p, const char *msg, const struct sip_request *req, struct sip_esc_entry *esc_entry, int need_new_etag) |
static int | transmit_response_with_t38_sdp (struct sip_pvt *p, char *msg, struct sip_request *req, int retrans) |
Used for 200 OK and 183 early media. More... | |
static int | transmit_response_with_unsupported (struct sip_pvt *p, const char *msg, const struct sip_request *req, const char *unsupported) |
Transmit response, no retransmits. More... | |
static int | transmit_state_notify (struct sip_pvt *p, struct state_notify_data *data, int full, int timeout) |
Used in the SUBSCRIBE notification subsystem (RFC3265) More... | |
static const char * | trust_id_outbound2str (int mode) |
static void | try_suggested_sip_codec (struct sip_pvt *p) |
Try setting the codecs suggested by the SIP_CODEC channel variable. More... | |
static int | uac_sips_contact (struct sip_request *req) |
Determine if, as a UAC, we need to use a SIPS Contact. More... | |
static int | uas_sips_contact (struct sip_request *req) |
Determine if, as a UAS, we need to use a SIPS Contact. More... | |
static void | unlink_all_peers_from_tables (void) |
static void | unlink_marked_peers_from_tables (void) |
static void | unlink_peers_from_tables (peer_unlink_flag_t flag) |
static int | unload_module (void) |
PBX unload module API. More... | |
static int | update_call_counter (struct sip_pvt *fup, int event) |
update_call_counter: Handle call_limit for SIP devices Setting a call-limit will cause calls above the limit not to be accepted. More... | |
static void | update_connectedline (struct sip_pvt *p, const void *data, size_t datalen) |
Notify peer that the connected line has changed. More... | |
static void | update_peer (struct sip_peer *p, int expire) |
Update peer data in database (if used) More... | |
static void | update_peer_lastmsgssent (struct sip_peer *peer, int value, int locked) |
static void | update_provisional_keepalive (struct sip_pvt *pvt, int with_sdp) |
static void | update_redirecting (struct sip_pvt *p, const void *data, size_t datalen) |
Send a provisional response indicating that a call was redirected. More... | |
static int | use_reason_header (struct sip_pvt *pvt, struct sip_request *req) |
Parses SIP reason header according to RFC3326 and sets channel's hangupcause if configured so and header present. More... | |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Session Initiation Protocol (SIP)" , .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 = "30ef0c93b36035ec78c9cfd712d36d9b" , .support_level = AST_MODULE_SUPPORT_DEPRECATED, .load = load_module, .unload = unload_module, .reload = reload, .load_pri = AST_MODPRI_CHANNEL_DRIVER, .requires = "ccss,dnsmgr,udptl", .optional_modules = "res_crypto,res_http_websocket", } |
static struct stasis_subscription * | acl_change_sub |
static const struct cfalias | aliases [] |
static const struct _map_x_s | allowoverlapstr [] |
static char * | app_dtmfmode = "SIPDtmfMode" |
static char * | app_sipaddheader = "SIPAddHeader" |
static char * | app_sipremoveheader = "SIPRemoveHeader" |
static char * | app_sipsendcustominfo = "SIPSendCustomINFO" |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static struct sip_auth_container * | authl = NULL |
Authentication container for realm authentication. More... | |
static ast_mutex_t | authl_lock = { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP , NULL, {1, 0} } |
Global authentication container protection while adjusting the references. More... | |
static int | authlimit = DEFAULT_AUTHLIMIT |
static int | authtimeout = DEFAULT_AUTHTIMEOUT |
static struct _map_x_s | autopeermodes [] |
struct ast_sockaddr | bindaddr |
static int | can_parse_xml |
static const struct epa_static_data | cc_epa_static_data |
static const struct sip_esc_publish_callbacks | cc_esc_publish_callbacks |
static const struct ast_sip_api_tech | chan_sip_api_provider |
static struct ast_custom_function | checksipdomain_function |
static struct ast_cli_entry | cli_sip [] |
SIP Cli commands definition. More... | |
static const char | config [] = "sip.conf" |
static struct ast_sockaddr | debugaddr |
static struct ast_rtp_dtls_cfg | default_dtls_cfg |
Default DTLS connection configuration. More... | |
static int | default_expiry = DEFAULT_DEFAULT_EXPIRY |
static struct ast_jb_conf | default_jbconf |
Global jitterbuffer configuration - by default, jb is disabled. More... | |
static const int | DEFAULT_PUBLISH_EXPIRES = 3600 |
static struct ast_tls_config | default_tls_cfg |
Default TLS connection configuration. More... | |
static struct ao2_container * | dialogs |
struct ao2_container * | dialogs_needdestroy |
struct ao2_container * | dialogs_rtpcheck |
static struct domain_list | domain_list = { .first = NULL, .last = NULL, .lock = { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP , NULL, {1, 0} } , } |
static const struct _map_x_s | dtmfstr [] |
mapping between dtmf flags and strings More... | |
struct epa_static_data_list | epa_static_data_list = { .first = NULL, .last = NULL, .lock = { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP , NULL, {1, 0} } , } |
static int | esc_etag_counter |
static const int | ESC_MAX_BUCKETS = 37 |
static struct event_state_compositor | event_state_compositors [] |
static struct ast_sockaddr | externaddr |
our external IP address/port for SIP sessions. externaddr.sin_addr is only set when we know we might be behind a NAT, and this is done using a variety of (mutually exclusive) ways from the config file: More... | |
static time_t | externexpire |
static char | externhost [MAXHOSTNAMELEN] |
static int | externrefresh = 10 |
static uint16_t | externtcpport |
static uint16_t | externtlsport |
static struct _map_x_s | faxecmodes [] |
static struct ast_flags | global_flags [3] = {{0}} |
static struct ast_jb_conf | global_jbconf |
static unsigned int | global_t38_maxdatagram |
static const int | HASH_DIALOG_SIZE = 563 |
static const int | HASH_PEER_SIZE = 563 |
static const int | HASH_REGISTRY_SIZE = 563 |
static const struct _map_x_s | insecurestr [] |
static struct ast_sockaddr | internip |
our (internal) default address/port to put in SIP/SDP messages internip is initialized picking a suitable address from one of the interfaces, and the same port number we bind to. It is used as the default address/port in SIP messages, and as the default address (but not port) in SDP messages. More... | |
static const struct invstate2stringtable | invitestate2string [] |
static struct io_context * | io |
static struct ast_ha * | localaddr |
List of local networks We store "localnet" addresses from the config file into an access list, marked as 'DENY', so the call to ast_apply_ha() will return AST_SENSE_DENY for 'local' addresses, and AST_SENSE_ALLOW for 'non local' (i.e. presumably public) addresses. More... | |
static int | log_level = -1 |
static int | max_expiry = DEFAULT_MAX_EXPIRY |
static int | max_subexpiry = DEFAULT_MAX_EXPIRY |
static struct ast_sockaddr | media_address |
static int | min_expiry = DEFAULT_MIN_EXPIRY |
static int | min_subexpiry = DEFAULT_MIN_EXPIRY |
static pthread_t | monitor_thread = AST_PTHREADT_NULL |
This is the thread for the monitor which checks for input on the channels which are not currently in use. More... | |
static ast_mutex_t | monlock = { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP , NULL, {1, 0} } |
Protect the monitoring thread, so only one process can kill or start it, and not when it's doing something critical. More... | |
static int | mwi_expiry = DEFAULT_MWI_EXPIRY |
static ast_mutex_t | netlock = { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP , NULL, {1, 0} } |
static int | network_change_sched_id = -1 |
static struct stasis_subscription * | network_change_sub |
static const char | notify_config [] = "sip_notify.conf" |
static struct ast_config * | notify_types = NULL |
static int | ourport_tcp |
static int | ourport_tls |
static struct ao2_container * | peers |
The peer list: Users, Peers and Friends. More... | |
static struct ao2_container * | peers_by_ip |
static const struct _map_x_s | referstatusstrings [] |
static struct ao2_container * | registry_list |
The register list: Other SIP proxies we register with and receive calls from. More... | |
static const struct _map_x_s | regstatestrings [] |
static struct ast_sockaddr | rtpbindaddr |
struct ast_sched_context * | sched |
static struct ast_cc_agent_callbacks | sip_cc_agent_callbacks |
static struct ast_cc_monitor_callbacks | sip_cc_monitor_callbacks |
struct { | |
enum sip_cc_notify_state state | |
const char * state_string | |
} | sip_cc_notify_state_map [] |
struct { | |
enum ast_cc_service_type service | |
const char * service_string | |
} | sip_cc_service_map [] |
static struct ast_threadstorage | sip_content_buf = { .once = PTHREAD_ONCE_INIT , .key_init = __init_sip_content_buf , .custom_init = NULL , } |
static struct ast_custom_function | sip_header_function |
static struct ast_custom_function | sip_headers_function |
static const struct cfsip_methods | sip_methods [] |
struct ao2_container * | sip_monitor_instances |
static const struct ast_msg_tech | sip_msg_tech |
static const struct sip_reasons | sip_reason_table [] |
static ast_mutex_t | sip_reload_lock = { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP , NULL, {1, 0} } |
static int | sip_reloading = FALSE |
static enum channelreloadreason | sip_reloadreason |
static struct ast_rtp_glue | sip_rtp_glue |
static struct ast_tcptls_session_args | sip_tcp_desc |
The TCP server definition. More... | |
struct ast_channel_tech | sip_tech |
Definition of this channel for PBX channel registration. More... | |
struct ast_channel_tech | sip_tech_info |
This version of the sip channel tech has no send_digit_begin callback so that the core knows that the channel does not want DTMF BEGIN frames. The struct is initialized just before registering the channel driver, and is for use with channels using SIP INFO DTMF. More... | |
static struct ast_tls_config | sip_tls_cfg |
Working TLS connection configuration. More... | |
static struct ast_tcptls_session_args | sip_tls_desc |
The TCP/TLS server definition. More... | |
static struct ast_threadstorage | sip_transport_str_buf = { .once = PTHREAD_ONCE_INIT , .key_init = __init_sip_transport_str_buf , .custom_init = NULL , } |
static enum sip_debug_e | sipdebug |
static int | sipdebug_text |
extra debugging for 'text' related events. At the moment this is set together with sip_debug_console. More... | |
static struct ast_custom_function | sippeer_function |
Structure to declare a dialplan function: SIPPEER. More... | |
static int | sipsock = -1 |
Main socket for UDP SIP communication. More... | |
static int * | sipsock_read_id |
static const struct _map_x_s | stmodes [] |
Report Peer status in character string. More... | |
static const struct _map_x_s | strefresher_params [] |
static const struct _map_x_s | strefreshers [] |
static struct ao2_container * | subscription_mwi_list |
The MWI subscription list. More... | |
static const struct cfsubscription_types | subscription_types [] |
static struct ao2_container * | threadt |
The table of TCP threads. More... | |
static const struct _map_x_s | trust_id_outboundstr [] |
static struct ast_threadstorage | ts_temp_pvt = { .once = PTHREAD_ONCE_INIT , .key_init = __init_ts_temp_pvt , .custom_init = temp_pvt_init , } |
static int | unauth_sessions = 0 |
static char | used_context [AST_MAX_CONTEXT] |
Object counters @{ | |
| |
static int | speerobjs = 0 |
static int | rpeerobjs = 0 |
static int | apeerobjs = 0 |
Implementation of Session Initiation Protocol.
See Also:
Implementation of RFC 3261 - without S/MIME, and experimental TCP and TLS support Configuration file sip.conf
********** IMPORTANT *
******** General TODO:s
Better support of forking
VIA branch tag transaction checking
Transaction support
******** Wishlist: Improvements
In the SIP channel, there's a list of active SIP dialogs, which includes all of these when they are active. "sip show channels" in the CLI will show most of these, excluding subscriptions which are shown by "sip show subscriptions"
sipsock_read sends the packet to handle_incoming(), that parses a bit more. If it is a response to an outbound request, the packet is sent to handle_response(). If it is a request, handle_incoming() sends it to one of a list of functions depending on the request type - INVITE, OPTIONS, REFER, BYE, CANCEL etc sipsock_read locks the ast_channel if it exists (an active call) and unlocks it after we have processed the SIP message.
A new INVITE is sent to handle_request_invite(), that will end up starting a new channel in the PBX, the new channel after that executing in a separate channel thread. This is an incoming "call". When the call is answered, either by a bridged channel or the PBX itself the sip_answer() function is called.
The actual media - Video or Audio - is mostly handled by the RTP subsystem in rtp.c
Definition in file chan_sip.c.
#define append_history | ( | p, | |
event, | |||
fmt, | |||
args... | |||
) | append_history_full(p, "%-15s " fmt, event, ## args) |
Append to SIP dialog history.
Definition at line 2406 of file chan_sip.c.
Referenced by __sip_autodestruct(), __sip_reliable_xmit(), __sip_scheddestroy(), auto_congest(), build_reply_digest(), change_hold_state(), check_auth(), do_cancel_destroy(), do_message_auth(), do_register_auth(), extensionstate_update(), handle_invite_replaces(), handle_request_bye(), handle_request_do(), handle_request_invite(), handle_request_refer(), handle_request_register(), handle_request_subscribe(), handle_response(), handle_response_invite(), local_attended_transfer(), obproxy_get(), pvt_set_needdestroy(), retrans_pkt(), send_request(), send_response(), sip_fixup(), sip_hangup(), sip_new(), sip_reregister(), sip_set_rtp_peer(), transmit_register(), transmit_reinvite_with_sdp(), transmit_response_with_auth(), and update_connectedline().
#define BOGUS_PEER_MD5SECRET "intentionally_invalid_md5_string" |
We can recognize the bogus peer by this invalid MD5 hash.
Definition at line 1058 of file chan_sip.c.
Referenced by check_auth(), load_module(), and sip_reload().
#define check_request_transport | ( | peer, | |
tmpl | |||
) |
generic function for determining if a correct transport is being used to contact a peer
this is done as a macro so that the "tmpl" var can be passed either a sip_request or a sip_peer
Definition at line 2498 of file chan_sip.c.
Referenced by create_addr_from_peer(), and register_verify().
#define CHECK_RESULTS | ( | in, | |
expected_res, | |||
expected_start, | |||
expected_len | |||
) |
Referenced by AST_TEST_DEFINE().
#define CONTAINER_UNLINK | ( | container, | |
obj, | |||
tag | |||
) |
Unlink the given object from the container and return TRUE if it was in the container.
Definition at line 8838 of file chan_sip.c.
Referenced by change_callid_pvt().
#define find_call | ( | req, | |
addr, | |||
intended_method | |||
) | __find_call(req, addr, intended_method, __FILE__, __LINE__, __PRETTY_FUNCTION__) |
Definition at line 1240 of file chan_sip.c.
Referenced by handle_request_do().
#define FORMAT "%-25.25s %-15.15s %-15.15s \n" |
Definition at line 22152 of file chan_sip.c.
Referenced by show_channels_cb(), show_chanstats_cb(), sip_show_domains(), sip_show_inuse(), sip_show_mwi(), sip_show_registry(), sip_show_tcp(), and sip_show_users().
#define FORMAT "%-47.47s %-9.9s %-6.6s\n" |
Definition at line 22152 of file chan_sip.c.
#define FORMAT "%-25.25s %-15.15s %-15.15s %-15.15s %-5.5s%-10.10s\n" |
Definition at line 22152 of file chan_sip.c.
#define FORMAT "%-40.40s %-20.20s %-16.16s\n" |
Definition at line 22152 of file chan_sip.c.
#define FORMAT "%-39.39s %-6.6s %-12.12s %8d %-20.20s %-25.25s\n" |
Definition at line 22152 of file chan_sip.c.
#define FORMAT "%-15.15s %-11.11s %-8.8s %-10.10u%-1.1s %-10.10u (%5.2f%%) %-6.4lf %-10.10u%-1.1s %-10.10u (%5.2f%%) %-6.4lf\n" |
Definition at line 22152 of file chan_sip.c.
#define FORMAT "%-30.30s %-12.12s %-10.10s %-10.10s\n" |
Definition at line 22152 of file chan_sip.c.
#define FORMAT "%-15.15s %-15.15s %-15.15s %-15.15s %-3.3s %-3.3s %-15.15s %-10.10s %-10.10s\n" |
Definition at line 22152 of file chan_sip.c.
#define FORMAT2 "%-25.25s %-15.15s %-15.15s \n" |
Definition at line 22151 of file chan_sip.c.
Referenced by sip_show_channels(), sip_show_channelstats(), sip_show_inuse(), sip_show_registry(), and sip_show_tcp().
#define FORMAT2 "%-47.47s %9.9s %6.6s\n" |
Definition at line 22151 of file chan_sip.c.
#define FORMAT2 "%-39.39s %-6.6s %-12.12s %8.8s %-20.20s %-25.25s\n" |
Definition at line 22151 of file chan_sip.c.
#define FORMAT2 "%-15.15s %-11.11s %-8.8s %-10.10s %-10.10s ( %%) %-6.6s %-10.10s %-10.10s ( %%) %-6.6s\n" |
Definition at line 22151 of file chan_sip.c.
#define FORMAT2 "%-15.15s %-15.15s %-15.15s %-15.15s %-7.7s %-15.15s %-10.10s %-10.10s\n" |
Definition at line 22151 of file chan_sip.c.
#define FORMAT3 "%-15.15s %-15.15s %-15.15s %-15.15s %-13.13s %-15.15s %-10.10s %-6.6s\n" |
Definition at line 22150 of file chan_sip.c.
Referenced by sip_show_channels().
#define FORMAT4 "%-15.15s %-15.15s %-15.15s %-15.15s %-13.13s %-15.15s %-10.10s %-6.6d\n" |
Definition at line 22149 of file chan_sip.c.
Referenced by show_channels_cb().
#define peer_in_destruction | ( | peer | ) | (ao2_ref(peer, 0) == 0) |
Definition at line 1337 of file chan_sip.c.
Referenced by mwi_event_cb().
#define PEERS_FORMAT2 "%-25.25s %-39.39s %-3.3s %-10.10s %-10.10s %-3.3s %-8s %-11s %-32.32s %s\n" |
Definition at line 20280 of file chan_sip.c.
Referenced by _sip_show_peers(), and _sip_show_peers_one().
#define REMOVE_MAILBOX_WITH_LOCKED_PEER | ( | __peer | ) |
Definition at line 5283 of file chan_sip.c.
Referenced by clear_peer_mailboxes().
#define SIP_PEDANTIC_DECODE | ( | str | ) |
Definition at line 813 of file chan_sip.c.
Referenced by check_user_full(), get_also_info(), get_destination(), get_refer_info(), register_verify(), and sip_msg_send().
#define sip_pvt_lock | ( | x | ) | ao2_lock(x) |
Definition at line 1044 of file chan_sip.c.
Referenced by __find_call(), __sip_cancel_destroy(), __sip_scheddestroy(), __update_provisional_keepalive_full(), auto_congest(), complete_sipch(), do_dialog_unlink_sched_items(), extensionstate_update(), forked_invite_init(), get_sip_pvt_from_replaces(), handle_invite_replaces(), handle_request_bye(), handle_request_invite(), handle_request_refer(), handle_request_subscribe(), local_attended_transfer(), parse_register_contact(), register_verify(), retrans_pkt(), show_channels_cb(), show_chanstats_cb(), sip_allow_anyrtp_remote(), sip_answer(), sip_call(), sip_cc_agent_destructor(), sip_cc_agent_init(), sip_cc_agent_recall(), sip_cc_agent_respond(), sip_cc_monitor_request_cc(), sip_dtmfmode(), sip_fixup(), sip_get_rtp_peer(), sip_get_trtp_peer(), sip_get_vrtp_peer(), sip_hangup(), sip_indicate(), sip_monitor_instance_destructor(), sip_msg_send(), sip_new(), sip_pvt_lock_full(), sip_queryoption(), sip_read(), sip_reg_timeout(), sip_request_call(), sip_send_mwi_to_peer(), sip_senddigit_begin(), sip_senddigit_end(), sip_sendtext(), sip_set_rtp_peer(), sip_setoption(), sip_show_channel(), sip_show_history(), sip_transfer(), sip_write(), sipinfo_send(), transmit_publish(), and update_call_counter().
#define sip_pvt_trylock | ( | x | ) | ao2_trylock(x) |
Definition at line 1045 of file chan_sip.c.
Referenced by dialog_checkrtp_cb(), dialog_needdestroy(), and forked_invite_init().
#define sip_pvt_unlock | ( | x | ) | ao2_unlock(x) |
Definition at line 1046 of file chan_sip.c.
Referenced by __find_call(), __sched_check_pendings(), __sip_autodestruct(), __sip_cancel_destroy(), __sip_scheddestroy(), __update_provisional_keepalive_full(), auto_congest(), complete_sipch(), dialog_checkrtp_cb(), dialog_needdestroy(), dialog_unlink_all(), do_dialog_unlink_sched_items(), extensionstate_update(), forked_invite_init(), get_refer_info(), get_sip_pvt_from_replaces(), handle_invite_replaces(), handle_request_bye(), handle_request_do(), handle_request_invite(), handle_request_refer(), handle_request_subscribe(), local_attended_transfer(), parse_register_contact(), proc_session_timer(), register_verify(), reinvite_timeout(), retrans_pkt(), send_provisional_keepalive_full(), show_channels_cb(), show_chanstats_cb(), sip_allow_anyrtp_remote(), sip_answer(), sip_call(), sip_cc_agent_destructor(), sip_cc_agent_init(), sip_cc_agent_recall(), sip_cc_agent_respond(), sip_cc_monitor_request_cc(), sip_dtmfmode(), sip_fixup(), sip_get_rtp_peer(), sip_get_trtp_peer(), sip_get_vrtp_peer(), sip_hangup(), sip_indicate(), sip_monitor_instance_destructor(), sip_msg_send(), sip_new(), sip_pvt_lock_full(), sip_queryoption(), sip_queue_hangup_cause(), sip_read(), sip_reg_timeout(), sip_reinvite_retry(), sip_request_call(), sip_send_mwi_to_peer(), sip_senddigit_begin(), sip_senddigit_end(), sip_sendtext(), sip_set_rtp_peer(), sip_setoption(), sip_show_channel(), sip_show_history(), sip_t38_abort(), sip_transfer(), sip_write(), sipinfo_send(), transmit_publish(), and update_call_counter().
#define SIP_TRANSPORT_STR_BUFSIZE 128 |
Size of the SIP transport buffer.
Definition at line 1076 of file chan_sip.c.
Referenced by get_transport_list().
#define SIPHEADER 256 |
Referenced by initreqprep().
#define UNLINK | ( | element, | |
head, | |||
prev | |||
) |
some list management macros.
Definition at line 1157 of file chan_sip.c.
Referenced by __sip_ack(), handle_request_cancel(), and retrans_pkt().
enum match_req_res |
Enumerator | |
---|---|
SIP_REQ_MATCH | |
SIP_REQ_NOT_MATCH | |
SIP_REQ_LOOP_DETECTED | |
SIP_REQ_FORKED |
Definition at line 9165 of file chan_sip.c.
enum message_integrity |
Indication of a TCP message's integrity.
Definition at line 2761 of file chan_sip.c.
enum peer_unlink_flag_t |
Enumerator | |
---|---|
SIP_PEERS_MARKED | |
SIP_PEERS_ALL |
Definition at line 3225 of file chan_sip.c.
enum sip_media_fds |
Enumerator | |
---|---|
SIP_AUDIO_RTP_FD | |
SIP_AUDIO_RTCP_FD | |
SIP_VIDEO_RTP_FD | |
SIP_VIDEO_RTCP_FD | |
SIP_TEXT_RTP_FD | |
SIP_UDPTL_FD |
Definition at line 7841 of file chan_sip.c.
|
static |
Definition at line 32459 of file chan_sip.c.
References ao2_lock, ao2_t_ref, ao2_unlock, ast_debug, ast_dnsmgr_release(), AST_SCHED_DEL_UNREF, sip_registry::call, dialog_unlink_all(), dialog_unref, sip_registry::dnsmgr, sip_registry::expire, sip_registry::hostname, NULL, sip_registry::timeout, and sip_registry::username.
Referenced by cleanup_registration().
|
static |
Definition at line 3351 of file chan_sip.c.
References dialog_unref, and do_dialog_unlink_sched_items().
Referenced by dialog_unlink_all().
|
static |
find or create a dialog structure for an incoming SIP message. Connect incoming SIP message to current dialog or create new dialog structure Returns a reference to the sip_pvt object, remember to give it back once done. Called by handle_request_do
Definition at line 9469 of file chan_sip.c.
References __ao2_callback(), __ao2_find(), __ao2_ref(), ao2_iterator_destroy(), ao2_iterator_next, args, ast_create_callid(), ast_debug, ast_skip_blanks(), ast_string_field_set, ast_strlen_zero, match_req_args::authentication_present, sip_via::branch, sip_pvt::callid, match_req_args::callid, CAN_CREATE_DIALOG, CAN_CREATE_DIALOG_UNSUPPORTED_METHOD, dialog_find_multiple(), dialog_ref, dialog_unref, forked_invite_init(), free_via(), match_req_args::fromtag, gettag(), sip_request::has_to_tag, match_req_to_dialog(), sip_request::method, sip_pvt::method, match_req_args::method, NULL, OBJ_MULTIPLE, OBJ_POINTER, parse_via(), sip_settings::pedanticsipchecking, REQ_OFFSET_TO_STR, match_req_args::respid, match_req_args::ruri, sip_via::sent_by, match_req_args::seqno, SIP_ACK, sip_alloc, SIP_BYE, sip_cfg, sip_get_header(), SIP_INFO, SIP_INVITE, sip_methods, sip_pvt_lock, sip_pvt_unlock, SIP_REGISTER, SIP_REQ_FORKED, SIP_REQ_LOOP_DETECTED, SIP_REQ_MATCH, SIP_REQ_NOT_MATCH, SIP_RESPONSE, cfsip_methods::text, sip_pvt::theirtag, match_req_args::totag, transmit_response_using_temp(), match_req_args::viabranch, and match_req_args::viasentby.
|
static |
Definition at line 8562 of file chan_sip.c.
References ast_skip_blanks(), find_alias(), sip_request::headers, len(), match(), NULL, and REQ_OFFSET_TO_STR.
Referenced by build_path(), build_route(), copy_all_header(), copy_via_headers(), func_header_read(), handle_incoming(), handle_request_invite(), handle_request_subscribe(), handle_response_register(), parse_register_contact(), reply_digest(), and sip_get_header().
|
static |
Definition at line 8607 of file chan_sip.c.
|
static |
A per-thread buffer for transport to string conversion.
Definition at line 1073 of file chan_sip.c.
|
static |
|
static |
Definition at line 35928 of file chan_sip.c.
|
static |
Definition at line 23785 of file chan_sip.c.
References ast_channel_unlock, ast_channel_unref, check_pendings(), dialog_unref, sip_pvt_lock_full(), and sip_pvt_unlock.
Referenced by sched_check_pendings().
|
static |
Definition at line 16892 of file chan_sip.c.
References ast_copy_string(), ast_log, ast_sockaddr_port, ast_sockaddr_resolve_first_transport(), ast_sockaddr_set_port, ast_strlen_zero, AST_TRANSPORT_TLS, get_transport_str2enum(), LOG_WARNING, NULL, parse_uri_legacy_check(), STANDARD_SIP_PORT, and STANDARD_TLS_PORT.
Referenced by build_peer(), create_addr_from_peer(), dialog_initialize_rtp(), set_address_from_contact(), sip_poke_peer(), and sip_request_call().
|
static |
Definition at line 14935 of file chan_sip.c.
References ao2_t_ref, ast_dnsmgr_release(), AST_SCHED_DEL_UNREF, sip_subscription_mwi::dnsmgr, NULL, and sip_subscription_mwi::resub.
Referenced by shutdown_mwi_subscription().
int __sip_ack | ( | struct sip_pvt * | p, |
uint32_t | seqno, | ||
int | resp, | ||
int | sipmethod | ||
) |
Acknowledges receipt of a packet and stops retransmission called with p locked.
Definition at line 4570 of file chan_sip.c.
References ao2_t_ref, ast_debug, sip_pvt::callid, FALSE, sip_proxy::force, sip_pkt::is_resp, sip_pkt::method, sip_pkt::next, NULL, sip_pvt::outboundproxy, sip_pvt::packets, sip_pvt::pendinginvite, ref_proxy(), sip_pkt::retransid, sip_pkt::seqno, sipdebug, stop_retrans_pkt(), TRUE, and UNLINK.
Referenced by __sip_pretend_ack(), handle_incoming(), handle_request_invite(), handle_request_publish(), and handle_response().
struct sip_pvt* __sip_alloc | ( | ast_string_field | callid, |
struct ast_sockaddr * | addr, | ||
int | useglobal_nat, | ||
const int | intended_method, | ||
struct sip_request * | req, | ||
ast_callid | logger_callid, | ||
const char * | file, | ||
int | line, | ||
const char * | func | ||
) |
Allocate sip_pvt structure, set defaults and link in the container. Returns a reference to the object so whoever uses it later must remember to release the reference.
Definition at line 8942 of file chan_sip.c.
References __ao2_alloc(), sip_pvt::allowed_methods, sip_settings::allowtransfer, sip_pvt::allowtransfer, AO2_ALLOC_OPT_LOCK_MUTEX, ao2_cleanup, ao2_t_link, ao2_t_ref, ast_cc_config_params_init, ast_copy_flags, ast_copy_string(), ast_debug, ast_format_cap_alloc, ast_format_cap_append_from_cap(), AST_FORMAT_CAP_FLAG_DEFAULT, AST_LIST_HEAD_INIT_NOLOCK, AST_MEDIA_TYPE_UNKNOWN, ast_random(), AST_RTP_DTMF, ast_sip_ouraddrfor(), ast_sockaddr_copy(), ast_string_field_init, ast_string_field_set, ast_strlen_zero, ast_test_flag, AST_TRANSPORT_UDP, sip_pvt::autoframing, sip_pvt::autokillid, sip_via::branch, sip_pvt::branch, build_callid_pvt(), build_via(), sip_pvt::callid, sip_settings::caps, sip_pvt::caps, sip_pvt::cc_params, check_via(), context, sip_settings::default_context, default_engine, default_fromdomain, default_fromdomainport, sip_settings::default_max_forwards, default_maxcallbitrate, default_mohinterpret, default_mohsuggest, default_parkinglot, default_zone, sip_pvt::do_history, do_setnat(), sip_socket::fd, sip_pvt::flags, free_via(), sip_pvt::fromdomainport, global_autoframing, global_t1, global_timer_b, sip_pvt::init_icseq, INITIAL_CSEQ, sip_pvt::initid, internip, sip_pvt::jointcaps, make_our_tag(), sip_pvt::maxcallbitrate, sip_pvt::maxforwards, sip_pvt::method, mohinterpret, mohsuggest, sip_pvt::noncodeccapability, NONE, NULL, sip_pvt::ocseq, sip_pvt::offered_media, sip_pvt::ourip, parkinglot, parse_via(), sip_pvt::peercaps, sip_pvt::prefcaps, sip_pvt::provisional_keepalive_sched_id, recordhistory, sip_pvt::recv, sip_pvt::redircaps, sip_pvt::reinviteid, sip_pvt::request_queue, sip_pvt::request_queue_sched_id, sip_pvt::rtp, sip_pvt::sa, sip_via::sent_by, sip_pvt::session_modify, sip_pvt::sessionversion_remote, set_socket_transport(), sip_cfg, SIP_DTMF, SIP_DTMF_AUTO, SIP_DTMF_RFC2833, SIP_FLAGS_TO_COPY, sip_get_header(), sip_methods, SIP_OPTIONS, SIP_PAGE2_FLAGS_TO_COPY, SIP_PAGE3_FLAGS_TO_COPY, sip_pvt_callid_set(), sip_pvt_dtor(), SIP_REGISTER, sip_request::socket, sip_pvt::socket, sip_pvt::stateid, sip_pvt::stimer, sip_pvt::subscribed, sip_pvt::t38id, cfsip_methods::text, sip_pvt::timer_b, sip_pvt::timer_t1, TRUE, sip_socket::type, sip_pvt::waitid, and sip_pvt::zone.
|
static |
Kill a SIP dialog (called only by the scheduler) The scheduler has a reference to this dialog when p->autokillid != -1, and we are called using that reference. So if the event is not rescheduled, we need to call dialog_unref().
Definition at line 4369 of file chan_sip.c.
References __sip_pretend_ack(), sip_pvt::alreadygone, append_history, AST_CAUSE_PROTOCOL_ERROR, ast_channel_name(), ast_channel_unlock, ast_channel_unref, ast_debug, AST_EXTENSION_DEACTIVATED, ast_log, ast_queue_hangup_with_cause(), sip_pvt::autokillid, CALL_COMPLETION, sip_pvt::callid, DEFAULT_TRANS_TIMEOUT, dialog_unlink_all(), dialog_unref, sip_pvt::lastmsg, LOG_WARNING, sip_pvt::method, method_match(), MWI_NOTIFICATION, sip_pvt::needdestroy, NONE, sip_pvt::ongoing_reinvite, sip_pvt::packets, pvt_set_needdestroy(), sip_pvt::refer, SIP_BYE, SIP_CANCEL, sip_methods, sip_pvt_lock_full(), sip_pvt_unlock, sip_scheddestroy(), state_notify_data::state, stop_media_flows(), sip_pvt::subscribed, cfsip_methods::text, transmit_request_with_auth(), transmit_state_notify(), TRUE, and XMIT_RELIABLE.
Referenced by __sip_scheddestroy(), and sip_show_sched().
|
static |
Definition at line 4453 of file chan_sip.c.
References dialog_unref, do_cancel_destroy(), sip_pvt_lock, and sip_pvt_unlock.
Referenced by sip_cancel_destroy().
|
static |
Register with SIP proxy.
Definition at line 15909 of file chan_sip.c.
References NULL, SIP_REGISTER, and transmit_register().
Referenced by sip_reregister().
void __sip_pretend_ack | ( | struct sip_pvt * | p | ) |
Pretend to ack all packets called with p locked.
Definition at line 4615 of file chan_sip.c.
References __sip_ack(), ast_log, ast_str_buffer(), sip_pkt::data, find_sip_method(), sip_pkt::is_resp, LOG_WARNING, sip_pkt::method, method, NULL, sip_pvt::packets, sip_pkt::seqno, sip_methods, and cfsip_methods::text.
Referenced by __sip_autodestruct(), handle_request_bye(), handle_request_cancel(), and sip_reg_timeout().
|
static |
Definition at line 4275 of file chan_sip.c.
References __sip_xmit(), AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_alloc_options, ao2_t_ref, append_history, ast_debug, AST_FAILURE, ast_log, AST_PTHREADT_NULL, ast_sched_add_variable(), ast_str_buffer(), ast_str_create, ast_str_set(), ast_str_strlen(), AST_SUCCESS, AST_TRANSPORT_UDP, ast_tvnow(), sip_pkt::data, DEFAULT_RETRANS, DEFAULT_TIMER_T1, dialog_ref, sip_pkt::is_fatal, sip_pkt::is_resp, LOG_ERROR, sip_pkt::method, monitor_thread, sip_pkt::next, NULL, sip_pkt::owner, sip_pvt::packets, sip_pvt::pendinginvite, sip_pkt::response_code, retrans_pkt(), sip_pkt::retrans_stop, sip_pkt::retrans_stop_time, sip_pkt::retransid, sip_pkt::seqno, SIP_INVITE, sip_pkt_dtor(), sipdebug, sip_pvt::socket, stop_retrans_pkt(), sip_pkt::time_sent, sip_pvt::timer_t1, sip_pkt::timer_t1, sip_socket::type, and XMIT_ERROR.
Referenced by send_request(), and send_response().
|
static |
Definition at line 4484 of file chan_sip.c.
References __sip_autodestruct(), append_history, ast_free, ast_sched_add(), sip_pvt::autokillid, dialog_ref, dialog_unref, do_cancel_destroy(), sip_pvt::do_history, sip_scheddestroy_data::ms, sip_scheddestroy_data::pvt, sip_pvt_lock, sip_pvt_unlock, sip_pvt::stimer, and stop_session_timer().
Referenced by sip_scheddestroy_full().