76#define UNIQUEID_BUFSIZE 256
111 .description =
"PJSIP Channel Driver",
186 if (!channel || !channel->
session) {
195 if (!media || !media->
rtp) {
207 *instance = media->
rtp;
229 if (!channel || !channel->
session) {
234 if (!media || !media->
rtp) {
240 *instance = media->
rtp;
270 .
type =
"chan_pjsip_transport_info",
280 if (
session->endpoint->media.direct_media.glare_mitigation ==
293 if ((
session->endpoint->media.direct_media.glare_mitigation ==
295 session->inv_session->role == PJSIP_ROLE_UAC) ||
296 (
session->endpoint->media.direct_media.glare_mitigation ==
298 session->inv_session->role == PJSIP_ROLE_UAS)) {
330 int changed = 0, position = -1;
339 if (position != -1) {
349 if (position != -1) {
440 cdata->session->endpoint->media.direct_media.method, 1,
NULL);
467 if (nat_active &&
session->endpoint->media.direct_media.disable_on_nat) {
495 const char *channel_id)
503 if (!session_media || !session_media->
rtp) {
557 .tenantid =
session->endpoint->tenantid,
568 session->endpoint->accountcode,
569 exten,
session->endpoint->context,
570 assignedids, requestor, 0,
571 session->endpoint->persistent, &initializers,
"PJSIP/%s-%08x",
603 if (!topology || !caps) {
657 ast_channel_language_set(chan,
session->endpoint->language);
663 ast_log(
LOG_ERROR,
"Unknown country code '%s' for tonezone. Check indications.conf for available country codes.\n",
session->endpoint->zone);
690 pj_status_t
status = PJ_SUCCESS;
691 pjsip_tx_data *packet =
NULL;
695 if (
session->inv_session->state == PJSIP_INV_STATE_DISCONNECTED) {
698 pjsip_get_status_text(
session->inv_session->cause)->ptr);
702 pjsip_dlg_inc_lock(
session->inv_session->dlg);
703 if (
session->inv_session->invite_tsx) {
706 ast_log(
LOG_ERROR,
"Cannot answer '%s' because there is no associated SIP transaction\n",
709 pjsip_dlg_dec_lock(
session->inv_session->dlg);
711 if (
status == PJ_SUCCESS && packet) {
715 if (
status != PJ_SUCCESS) {
716 char err[PJ_ERR_MSG_SIZE];
718 pj_strerror(
status, err,
sizeof(err));
756 ast_log(
LOG_ERROR,
"Cannot answer '%s': Unable to push answer task to the threadpool.\n",
773 const char *target_context;
778 dsp_features &= ~DSP_FEATURE_FAX_DETECT;
807 ast_verb(2,
"Redirecting '%s' to fax extension due to CNG detection\n",
811 ast_log(
LOG_ERROR,
"Failed to async goto '%s' into fax extension in '%s'\n",
880 if (!
session->endpoint->asymmetric_rtp_codec &&
886 ast_debug(1,
"Oooh, got a frame with format of %s on channel '%s' when we're sending '%s', switching to match\n",
909 ast_debug(1,
"Oooh, got a frame with format of %s on channel '%s' when it has not been negotiated\n",
920 &&
session->endpoint->faxdetect_timeout
922 dsp_features &= ~DSP_FEATURE_FAX_DETECT;
929 ast_debug(3,
"Channel driver fax CNG detection timeout on %s\n",
937 ast_debug(3,
"Channel driver fax CNG detected on %s\n",
974 ast_debug(3,
"Channel %s stream %d is of type '%s', not audio!\n",
984 "Channel %s asked to send %s frame when native formats are %s (rd:%s->%s;%s wr:%s->%s;%s)\n",
1004 ast_debug(3,
"Channel %s stream %d is of type '%s', not video!\n",
1015 ast_debug(3,
"Channel %s stream %d is of type '%s', not image!\n",
1029 ast_debug(3,
"Channel %s stream %d is of type '%s', not video! Unable to write RTCP feedback.\n",
1073 const char *key = obj;
1091 const char *left = obj_left;
1092 const char *right = obj_right;
1098 cmp = strcmp(left, right);
1101 cmp = strncmp(left, right, strlen(right));
1194 if (!endpoint_snapshot) {
1204 if (!endpoint_snapshot->num_channels) {
1210 for (num = 0; num < endpoint_snapshot->num_channels; num++) {
1232 if (endpoint->devicestate_busy_at && (inuse == endpoint->devicestate_busy_at)) {
1288 if (!channel || !uniqueid) {
1340 pjsip_tx_data *packet =
NULL;
1345 if ((
session->inv_session->state != PJSIP_INV_STATE_DISCONNECTED) &&
1346 (pjsip_inv_answer(
session->inv_session, response_code,
NULL,
NULL, &packet) == PJ_SUCCESS)) {
1359 "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n"
1360 " <media_control>\r\n"
1361 " <vc_primitive>\r\n"
1363 " <picture_fast_update/>\r\n"
1364 " </to_encoder>\r\n"
1365 " </vc_primitive>\r\n"
1366 " </media_control>\r\n";
1369 .
type =
"application",
1370 .subtype =
"media_control+xml",
1375 struct pjsip_tx_data *tdata;
1377 if (
session->inv_session->state == PJSIP_INV_STATE_DISCONNECTED) {
1380 pjsip_get_status_text(
session->inv_session->cause)->ptr);
1389 ast_log(
LOG_ERROR,
"Could not add body to text video update INFO request\n");
1410 int update_allowed = 0;
1412 if (!
session->endpoint->id.send_connected_line
1413 || (!
session->endpoint->id.send_pai && !
session->endpoint->id.send_rpid)) {
1424 && (
session->endpoint->id.trust_outbound
1430 return update_allowed;
1438 if (
session->inv_session->state == PJSIP_INV_STATE_DISCONNECTED) {
1441 pjsip_get_status_text(
session->inv_session->cause)->ptr);
1447 ||
session->inv_session->role == PJSIP_ROLE_UAC) {
1450 int generate_new_sdp;
1453 if (
session->inv_session->options & PJSIP_INV_SUPPORT_UPDATE) {
1462 }
else if (
session->endpoint->id.rpid_immediate
1463 &&
session->inv_session->state != PJSIP_INV_STATE_DISCONNECTED
1465 int response_code = 0;
1468 response_code = !
session->endpoint->inband_progress ? 180 : 183;
1470 response_code = 183;
1473 if (response_code) {
1474 struct pjsip_tx_data *packet =
NULL;
1476 if (pjsip_inv_answer(
session->inv_session, response_code,
NULL,
NULL, &packet) == PJ_SUCCESS) {
1490 if (session_media) {
1552 rdata->msg_info.msg->line.status.code,
1557 if (PJSIP_IS_STATUS_IN_CLASS(rdata->msg_info.msg->line.status.code, 200)) {
1566 }
else if (300 <= rdata->msg_info.msg->line.status.code) {
1629 int response_code = 0;
1632 size_t device_buf_size;
1638 .integer = condition
1641 .data.ptr = (
void *)
data,
1643 char condition_name[256];
1644 unsigned int duration;
1651 switch (condition) {
1656 pjmedia_sdp_neg_get_state(channel->
session->
inv_session->neg) == PJMEDIA_SDP_NEG_STATE_DONE)) {
1659 response_code = 180;
1661 response_code = 183;
1664 response_code = 180;
1673 response_code = 486;
1680 response_code = 503;
1687 response_code = 484;
1694 response_code = 100;
1701 response_code = 183;
1773 if (*(
int *)
data) {
1792 device_buf = alloca(device_buf_size);
1799 ast_log(
LOG_WARNING,
"Could not queue task to remotely put session '%s' on hold with endpoint '%s'\n",
1808 device_buf = alloca(device_buf_size);
1815 ast_log(
LOG_WARNING,
"Could not queue task to remotely take session '%s' off hold with endpoint '%s'\n",
1827 response_code = 181;
1863 if (response_code) {
1871 ast_log(
LOG_ERROR,
"%s: Cannot send response code %d to endpoint %s. Could not queue task properly\n",
1915 pjsip_tx_data *packet;
1917 pjsip_contact_hdr *contact;
1920 if (pjsip_inv_end_session(
session->inv_session, 302,
NULL, &packet) != PJ_SUCCESS
1930 if (!(contact = pjsip_msg_find_hdr(packet->msg, PJSIP_H_CONTACT,
NULL))) {
1931 contact = pjsip_contact_hdr_create(packet->pool);
1934 pj_strdup2_with_null(packet->pool, &
tmp,
target);
1935 if (!(contact->uri = pjsip_parse_uri(packet->pool,
tmp.ptr,
tmp.slen, PJSIP_PARSE_URI_AS_NAMEADDR))) {
1940 pjsip_tx_data_dec_ref(packet);
1944 pjsip_msg_add_hdr(packet->msg, (pjsip_hdr *) contact);
1952 .name = {
"REFER Callback", 14 },
1978 if (pjsip_evsub_get_state(
sub) == PJSIP_EVSUB_STATE_ACCEPTED) {
1980 pjsip_rx_data *rdata;
1981 pjsip_generic_string_hdr *refer_sub;
1982 const pj_str_t REFER_SUB = {
"Refer-Sub", 9 };
1987 if (
event->type == PJSIP_EVENT_TSX_STATE &&
event->body.tsx_state.type == PJSIP_EVENT_RX_MSG) {
1988 rdata =
event->body.tsx_state.src.rdata;
1991 refer_sub = pjsip_msg_find_hdr_by_name(rdata->msg_info.msg, &REFER_SUB,
NULL);
1997 if (refer_sub && !pj_stricmp2(&refer_sub->hvalue,
"false")) {
2002 pjsip_evsub_terminate(
sub, PJ_TRUE);
2006 }
else if (pjsip_evsub_get_state(
sub) == PJSIP_EVSUB_STATE_ACTIVE ||
2007 pjsip_evsub_get_state(
sub) == PJSIP_EVSUB_STATE_TERMINATED) {
2010 pjsip_msg_body *body;
2011 pjsip_status_line status_line = { .code = 0 };
2015 if (
event->type == PJSIP_EVENT_TSX_STATE &&
event->body.tsx_state.type == PJSIP_EVENT_RX_MSG) {
2016 pjsip_rx_data *rdata;
2018 rdata =
event->body.tsx_state.src.rdata;
2019 msg = rdata->msg_info.msg;
2021 if (msg->type == PJSIP_REQUEST_MSG) {
2022 if (!pjsip_method_cmp(&msg->line.req.method, pjsip_get_notify_method())) {
2024 if (body && !pj_stricmp2(&body->content_type.type,
"message")
2025 && !pj_stricmp2(&body->content_type.subtype,
"sipfrag")) {
2026 pjsip_parse_status_line((
char *)body->data, body->len, &status_line);
2030 status_line.code = msg->line.status.code;
2031 status_line.reason = msg->line.status.reason;
2034 status_line.code = 500;
2035 status_line.reason = *pjsip_get_status_text(500);
2038 is_last = (pjsip_evsub_get_state(
sub) == PJSIP_EVSUB_STATE_TERMINATED);
2040 if (status_line.code >= 200 || is_last) {
2048 if (status_line.code < 200) {
2050 }
else if (status_line.code >= 300) {
2057 pjsip_tx_data *tdata;
2059 status = pjsip_evsub_initiate(
sub, pjsip_get_subscribe_method(), 0, &tdata);
2060 if (
status == PJ_SUCCESS) {
2061 pjsip_evsub_send_request(
sub, tdata);
2066 ast_debug(3,
"Transfer channel %s completed: %d %.*s (%s)\n",
2069 (
int)status_line.reason.slen, status_line.reason.ptr,
2085 pjsip_tx_data *packet;
2086 const char *ref_by_val;
2087 char local_info[pj_strlen(&
session->inv_session->dlg->local.info_str) + 1];
2088 struct pjsip_evsub_user xfer_cb;
2091 pj_bzero(&xfer_cb,
sizeof(xfer_cb));
2094 if (pjsip_xfer_create_uac(
session->inv_session->dlg, &xfer_cb, &
sub) != PJ_SUCCESS) {
2107 if (pjsip_xfer_initiate(
sub, pj_cstr(&
tmp, target), &packet) != PJ_SUCCESS) {
2119 if (pjsip_xfer_send_request(
sub, packet) == PJ_SUCCESS) {
2127 pjsip_evsub_terminate(
sub, PJ_FALSE);
2137 const char *target = trnf_data->
target;
2149 target = contact->
uri;
2195 if (!media || !media->
rtp) {
2202 if (!media || !media->
rtp) {
2259 struct pjsip_tx_data *tdata;
2264 .
type =
"application",
2265 .subtype =
"dtmf-relay",
2268 if (
session->inv_session->state == PJSIP_INV_STATE_DISCONNECTED) {
2271 pjsip_get_status_text(
session->inv_session->cause)->ptr);
2279 ast_str_set(&
body_text, 0,
"Signal=%c\r\nDuration=%u\r\n", dtmf_data->digit, dtmf_data->duration);
2289 pjsip_tx_data_dec_ref(tdata);
2303 if (!channel || !channel->
session) {
2314 if (!media || !media->
rtp) {
2319 ast_debug(3,
"Told to send end of digit on Auto-Info channel %s RFC4733 negotiated so using it.\n",
ast_channel_name(ast));
2324 ast_debug(3,
"Told to send end of digit on Auto-Info channel %s RFC4733 NOT negotiated using INFO instead.\n",
ast_channel_name(ast));
2343 if (!media || !media->
rtp) {
2350 if (!media || !media->
rtp) {
2398 pjsip_tx_data *tdata;
2477 ast_debug(1,
"AST hangup cause %d (no match found in PJSIP)\n", cause);
2534 int cause = h_data->
cause;
2536 if (
channel->session->active_media_state &&
2568 if (!channel || !channel->
session) {
2580 ast_log(
LOG_WARNING,
"Unable to push hangup task to the threadpool. Expect bad things\n");
2618 ast_log(
LOG_ERROR,
"Unable to create PJSIP channel with empty destination\n");
2627 if ((endpoint_name = strchr(
args.endpoint,
'@'))) {
2628 request_user =
args.endpoint;
2629 *endpoint_name++ =
'\0';
2631 endpoint_name =
args.endpoint;
2636 ast_log(
LOG_ERROR,
"Unable to create PJSIP channel with empty endpoint name: %s@<endpoint-name>\n",
2639 ast_log(
LOG_ERROR,
"Unable to create PJSIP channel with empty endpoint name\n");
2647 ast_log(
LOG_ERROR,
"Unable to create PJSIP channel - endpoint '%s' was not found\n", endpoint_name);
2653 endpoint_name =
args.endpoint;
2655 ast_log(
LOG_ERROR,
"Unable to create PJSIP channel with empty endpoint name\n");
2666 endpoint_name = strchr(
args.endpoint,
'@');
2667 if (!endpoint_name) {
2672 ast_log(
LOG_ERROR,
"Unable to create PJSIP channel - endpoint '%s' was not found\n",
2677 request_user =
args.endpoint;
2678 *endpoint_name++ =
'\0';
2681 ast_log(
LOG_ERROR,
"Unable to create PJSIP channel with empty endpoint name: %s@<endpoint-name>\n",
2690 ast_log(
LOG_ERROR,
"Unable to create PJSIP channel - endpoint '%s' was not found\n", endpoint_name);
2701 ast_log(
LOG_ERROR,
"Failed to create outgoing session to endpoint '%s'\n", endpoint_name);
2720 req_data.
dest = data;
2792 pjsip_tx_data *tdata;
2803 sep = strchr(content_type,
'/');
2806 body.
type = content_type;
2816 pjsip_from_hdr *hdr;
2817 pjsip_name_addr *name_addr;
2820 int invalidate_tdata = 0;
2830 hdr = PJSIP_MSG_FROM_HDR(tdata->msg);
2831 name_addr = (pjsip_name_addr *) hdr->uri;
2832 pj_strdup2(tdata->pool, &name_addr->display, from);
2833 invalidate_tdata = 1;
2841 hdr = PJSIP_MSG_TO_HDR(tdata->msg);
2842 name_addr = (pjsip_name_addr *) hdr->uri;
2843 pj_strdup2(tdata->pool, &name_addr->display, to);
2844 invalidate_tdata = 1;
2847 if (invalidate_tdata) {
2848 pjsip_tx_data_invalidate_msg(tdata);
2865 ast_debug(1,
"Sending MESSAGE from '%s' to '%s:%s': %s\n",
2890 .value = (
char *)
text,
2909 if (
session->endpoint->media.direct_media.glare_mitigation ==
2915 "direct_media_glare_mitigation");
2935 if (
session->active_media_state &&
2961 size_t size = pj_strlen(host) + 1;
2975 pjsip_tx_data *packet =
NULL;
2983 if (rdata->msg_info.to->tag.slen) {
3003 transport_data =
ast_calloc(1,
sizeof(*transport_data));
3004 if (!transport_data) {
3007 pj_sockaddr_cp(&transport_data->
local_addr, &rdata->tp_info.transport->local_addr);
3008 pj_sockaddr_cp(&transport_data->
remote_addr, &rdata->pkt_info.src_addr);
3009 datastore->data = transport_data;
3013 if (pjsip_inv_end_session(
session->inv_session, 503,
NULL, &packet) == PJ_SUCCESS
3035 if (rdata->msg_info.to->tag.slen) {
3042 ast_log(
LOG_ERROR,
"Unable to retrieve pickup configuration options. Unable to detect call pickup extension.\n");
3085 if (rdata->msg_info.to->tag.slen) {
3122 struct pjsip_status_line
status = rdata->msg_info.msg->line.status;
3124 int data_size =
sizeof(*cause_code);
3133 data_size += 4 + 4 + pj_strlen(&
status.reason);
3135 memset(cause_code, 0, data_size);
3139 snprintf(cause_code->
code, data_size -
sizeof(*cause_code) + 1,
"SIP %d %.*s",
status.code,
3140 (
int) pj_strlen(&
status.reason), pj_strbuf(&
status.reason));
3152 struct pjsip_status_line
status = rdata->msg_info.msg->line.status;
3161 pjsip_rdata_sdp_info *sdp = pjsip_rdata_get_sdp_info(rdata);
3162 if (sdp && sdp->body.ptr) {
3164 session->early_confirmed = pjsip_100rel_is_reliable(rdata) == PJ_TRUE;
3179 if (
session->endpoint->ignore_183_without_sdp) {
3180 pjsip_rdata_sdp_info *sdp = pjsip_rdata_get_sdp_info(rdata);
3181 if (sdp && sdp->body.ptr) {
3184 (
int)rdata->msg_info.cseq->method.name.slen, rdata->msg_info.cseq->method.name.ptr,
status.code);
3185 session->early_confirmed = pjsip_100rel_is_reliable(rdata) == PJ_TRUE;
3191 (
int)rdata->msg_info.cseq->method.name.slen, rdata->msg_info.cseq->method.name.ptr,
status.code);
3211 if (rdata->msg_info.msg->line.req.method.id == PJSIP_ACK_METHOD) {
3212 if (
session->endpoint->media.direct_media.enabled &&
session->channel) {
3224 if (pj_strcmp2(&rdata->msg_info.msg->line.req.method.name,
"PRACK") == 0 &&
3225 pjmedia_sdp_neg_get_state(
session->inv_session->neg) == PJMEDIA_SDP_NEG_STATE_DONE) {
3240 .
name =
"PJSIP_DIAL_CONTACTS",
3245 .
name =
"PJSIP_PARSE_URI",
3250 .
name =
"PJSIP_PARSE_URI_FROM",
3255 .
name =
"PJSIP_MEDIA_OFFER",
3261 .
name =
"PJSIP_DTMF_MODE",
3267 .
name =
"PJSIP_MOH_PASSTHROUGH",
3273 .
name =
"PJSIP_SEND_SESSION_REFRESH",
3307 ast_log(
LOG_ERROR,
"Unable to register PJSIP_DIAL_CONTACTS dialplan function\n");
3312 ast_log(
LOG_ERROR,
"Unable to register PJSIP_PARSE_URI dialplan function\n");
3317 ast_log(
LOG_ERROR,
"Unable to register PJSIP_PARSE_URI_FROM dialplan function\n");
3332 ast_log(
LOG_WARNING,
"Unable to register PJSIP_MOH_PASSTHROUGH dialplan function\n");
3337 ast_log(
LOG_WARNING,
"Unable to register PJSIP_SEND_SESSION_REFRESH dialplan function\n");
3444 .
requires =
"res_pjsip,res_pjsip_session,res_pjsip_pubsub",
Access Control of various sorts.
Asterisk main include file. File version handling, generic pbx functions.
static struct ast_mansession session
#define ast_alloca(size)
call __builtin_alloca to ensure we get gcc builtin semantics
#define ast_strdup(str)
A wrapper for strdup()
#define ast_strdupa(s)
duplicate a string in memory from the stack
void ast_free_ptr(void *ptr)
free() wrapper
#define ast_calloc(num, len)
A wrapper for calloc()
#define ast_malloc(len)
A wrapper for malloc()
#define ao2_link(container, obj)
Add an object to a container.
@ AO2_ALLOC_OPT_LOCK_NOLOCK
@ AO2_ALLOC_OPT_LOCK_RWLOCK
#define ao2_callback(c, flags, cb_fn, arg)
ao2_callback() is a generic function that applies cb_fn() to all objects in a container,...
#define ao2_find(container, arg, flags)
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
#define ao2_alloc_options(data_size, destructor_fn, options)
#define ao2_bump(obj)
Bump refcount on an AO2 object by one, returning the object.
@ OBJ_SEARCH_PARTIAL_KEY
The arg parameter is a partial search key similar to OBJ_SEARCH_KEY.
@ OBJ_SEARCH_OBJECT
The arg parameter is an object of the same type.
@ OBJ_SEARCH_MASK
Search option field mask.
@ OBJ_SEARCH_KEY
The arg parameter is a search key, but is not an object.
#define ao2_alloc(data_size, destructor_fn)
#define ao2_container_alloc_hash(ao2_options, container_options, n_buckets, hash_fn, sort_fn, cmp_fn)
Allocate and initialize a hash container with the desired number of buckets.
@ AO2_CONTAINER_ALLOC_OPT_DUPS_REJECT
Reject objects with duplicate keys in container.
CallerID (and other GR30) management and generation Includes code and algorithms from the Zapata libr...
@ AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER
#define AST_PRES_RESTRICTION
Internal Asterisk hangup causes.
#define AST_CAUSE_SWITCH_CONGESTION
#define AST_CAUSE_CONGESTION
#define AST_CAUSE_UNALLOCATED
#define AST_CAUSE_INTERWORKING
#define AST_CAUSE_NUMBER_CHANGED
#define AST_CAUSE_BEARERCAPABILITY_NOTAVAIL
#define AST_CAUSE_INVALID_NUMBER_FORMAT
#define AST_CAUSE_CHAN_NOT_IMPLEMENTED
#define AST_CAUSE_FAILURE
#define AST_CAUSE_DESTINATION_OUT_OF_ORDER
#define AST_CAUSE_NO_USER_RESPONSE
#define AST_CAUSE_CHANNEL_UNACCEPTABLE
#define AST_CAUSE_NOTDEFINED
#define AST_CAUSE_CALL_REJECTED
#define AST_CAUSE_FACILITY_REJECTED
#define AST_CAUSE_NORMAL_UNSPECIFIED
#define AST_CAUSE_NO_ROUTE_TRANSIT_NET
#define AST_CAUSE_NO_ROUTE_DESTINATION
#define AST_CAUSE_UNREGISTERED
#define AST_CAUSE_NO_ANSWER
#define AST_CAUSE_NORMAL_CLEARING
#define AST_CAUSE_USER_BUSY
static void transfer_data_destroy(void *obj)
static int chan_pjsip_incoming_ack(struct ast_sip_session *session, struct pjsip_rx_data *rdata)
static struct ast_datastore_info direct_media_mitigation_info
static void chan_pjsip_get_codec(struct ast_channel *chan, struct ast_format_cap *result)
Function called by RTP engine to get peer capabilities.
static struct ast_datastore_info transport_info
Datastore used to store local/remote addresses for the INVITE request that created the PJSIP channel.
static void xfer_client_on_evsub_state(pjsip_evsub *sub, pjsip_event *event)
Callback function to report status of implicit REFER-NOTIFY subscription.
static int hangup_cause2sip(int cause)
Internal function which translates from Asterisk cause codes to SIP response codes.
static int remote_send_hold_refresh(struct ast_sip_session *session, unsigned int held)
Update local hold state and send a re-INVITE with the new SDP.
static int check_for_rtp_changes(struct ast_channel *chan, struct ast_rtp_instance *rtp, struct ast_sip_session_media *media, struct ast_sip_session *session)
static int chan_pjsip_devicestate(const char *data)
Function called to get the device state of an endpoint.
static int uid_hold_sort_fn(const void *obj_left, const void *obj_right, const int flags)
static int chan_pjsip_transfer(struct ast_channel *ast, const char *target)
Function called by core for Asterisk initiated transfer.
static int update_connected_line_information(void *data)
Update connected line information.
static void transfer_redirect(struct ast_sip_session *session, const char *target)
static void clear_session_and_channel(struct ast_sip_session *session, struct ast_channel *ast)
Clear a channel from a session along with its PVT.
static char * app_pjsip_hangup
static void chan_pjsip_session_end(struct ast_sip_session *session)
Function called when the session ends.
static int sendtext(void *obj)
static void update_initial_connected_line(struct ast_sip_session *session)
static int update_devstate(void *obj, void *arg, int flags)
static struct ast_sip_session_supplement chan_pjsip_supplement
SIP session supplement structure.
static int remote_send_unhold(void *data)
Update local hold state to be unheld.
static void rtp_direct_media_data_destroy(void *data)
static int chan_pjsip_call(struct ast_channel *ast, const char *dest, int timeout)
Function called by core to actually start calling a remote party.
static int direct_media_mitigate_glare(struct ast_sip_session *session)
static int chan_pjsip_set_rtp_peer(struct ast_channel *chan, struct ast_rtp_instance *rtp, struct ast_rtp_instance *vrtp, struct ast_rtp_instance *tpeer, const struct ast_format_cap *cap, int nat_active)
Function called by RTP engine to change where the remote party should send media.
static int request(void *obj)
static int chan_pjsip_indicate(struct ast_channel *ast, int condition, const void *data, size_t datalen)
Function called by core to ask the channel to indicate some sort of condition.
static int chan_pjsip_hangup(struct ast_channel *ast)
Function called by core to hang up a PJSIP session.
static void chan_pjsip_pvt_dtor(void *obj)
static struct topology_change_refresh_data * topology_change_refresh_data_alloc(struct ast_sip_session *session, const struct ast_stream_topology *topology)
static int handle_topology_request_change(struct ast_sip_session *session, const struct ast_stream_topology *proposed)
static enum ast_rtp_glue_result chan_pjsip_get_rtp_peer(struct ast_channel *chan, struct ast_rtp_instance **instance)
Function called by RTP engine to get local audio RTP peer.
static struct ast_channel * chan_pjsip_request(const char *type, struct ast_format_cap *cap, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *data, int *cause)
Asterisk core interaction functions.
static struct ast_custom_function chan_pjsip_dial_contacts_function
static int send_topology_change_refresh(void *data)
static int indicate(void *data)
static int remote_send_hold(void *data)
Update local hold state to be held.
static int on_topology_change_response(struct ast_sip_session *session, pjsip_rx_data *rdata)
static struct ao2_container * pjsip_uids_onhold
static int chan_pjsip_queryoption(struct ast_channel *ast, int option, void *data, int *datalen)
Function called to query options on a channel.
static int chan_pjsip_incoming_request(struct ast_sip_session *session, struct pjsip_rx_data *rdata)
Function called when a request is received on the session.
struct ast_channel_tech chan_pjsip_tech
PBX interface structure for channel registration.
static void set_channel_on_rtp_instance(const struct ast_sip_session *session, const char *channel_id)
static int chan_pjsip_incoming_prack(struct ast_sip_session *session, struct pjsip_rx_data *rdata)
static struct ast_channel * chan_pjsip_request_with_stream_topology(const char *type, struct ast_stream_topology *topology, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *data, int *cause)
Function called by core to create a new outgoing PJSIP session.
static int uid_hold_hash_fn(const void *obj, const int flags)
static struct ast_sip_session_supplement pbx_start_supplement
static int chan_pjsip_digit_begin(struct ast_channel *ast, char digit)
Function called by core to start a DTMF digit.
static struct ast_custom_function chan_pjsip_parse_uri_from_function
static struct ast_sip_session_supplement chan_pjsip_prack_supplement
static void chan_pjsip_session_begin(struct ast_sip_session *session)
SIP session interaction functions.
static void topology_change_refresh_data_free(struct topology_change_refresh_data *refresh_data)
static struct indicate_data * indicate_data_alloc(struct ast_sip_session *session, int condition, int response_code, const void *frame_data, size_t datalen)
static struct rtp_direct_media_data * rtp_direct_media_data_create(struct ast_channel *chan, struct ast_rtp_instance *rtp, struct ast_rtp_instance *vrtp, const struct ast_format_cap *cap, struct ast_sip_session *session)
static struct sendtext_data * sendtext_data_create(struct ast_channel *chan, struct ast_msg_data *msg)
static void transport_info_destroy(void *obj)
Destructor function for transport_info_data.
static int send_direct_media_request(void *data)
static int chan_pjsip_sendtext_data(struct ast_channel *ast, struct ast_msg_data *msg)
Function called by core to send text on PJSIP session.
static struct ast_rtp_glue chan_pjsip_rtp_glue
Local glue for interacting with the RTP engine core.
static pjsip_module refer_callback_module
REFER Callback module, used to attach session data structure to subscription.
static int call_pickup_incoming_request(struct ast_sip_session *session, pjsip_rx_data *rdata)
static enum ast_rtp_glue_result chan_pjsip_get_vrtp_peer(struct ast_channel *chan, struct ast_rtp_instance **instance)
Function called by RTP engine to get local video RTP peer.
static int rtp_find_rtcp_fd_position(struct ast_sip_session *session, struct ast_rtp_instance *rtp)
Helper function to find the position for RTCP.
static int transfer(void *data)
static const char channel_type[]
static void chan_pjsip_remove_hold(const char *chan_uid)
Remove a channel ID from the list of PJSIP channels on hold.
static int hangup(void *data)
static int transmit_info_with_vidupdate(void *data)
Send SIP INFO with video update request.
static void sendtext_data_destroy(void *obj)
static struct ast_custom_function moh_passthrough_function
static void chan_pjsip_incoming_response_update_cause(struct ast_sip_session *session, struct pjsip_rx_data *rdata)
Function called when a response is received on the session.
static struct hangup_data * hangup_data_alloc(int cause, struct ast_channel *chan)
static int chan_pjsip_write_stream(struct ast_channel *ast, int stream_num, struct ast_frame *f)
static int answer(void *data)
static int transmit_info_dtmf(void *data)
static struct ast_custom_function media_offer_function
static int chan_pjsip_write(struct ast_channel *ast, struct ast_frame *f)
static int compatible_formats_exist(struct ast_stream_topology *top, struct ast_format_cap *cap)
Determine if a topology is compatible with format capabilities.
static void hangup_data_destroy(void *obj)
static int load_module(void)
Load the module.
static struct ast_sip_session_supplement chan_pjsip_ack_supplement
static int chan_pjsip_get_hold(const char *chan_uid)
Determine whether a channel ID is in the list of PJSIP channels on hold.
static int call(void *data)
static int chan_pjsip_sendtext(struct ast_channel *ast, const char *text)
static struct ast_custom_function chan_pjsip_parse_uri_function
static void transfer_refer(struct ast_sip_session *session, const char *target)
static struct ast_threadstorage uniqueid_threadbuf
static int unload_module(void)
Unload the PJSIP channel from Asterisk.
static int pbx_start_incoming_request(struct ast_sip_session *session, pjsip_rx_data *rdata)
static int is_compatible_format(struct ast_sip_session *session, struct ast_frame *f)
Determine if the given frame is in a format we've negotiated.
static unsigned int chan_idx
static void indicate_data_destroy(void *obj)
static struct ast_custom_function session_refresh_function
static struct ast_frame * chan_pjsip_cng_tone_detected(struct ast_channel *ast, struct ast_sip_session *session, struct ast_frame *f)
Internal helper function called when CNG tone is detected.
static const char * chan_pjsip_get_uniqueid(struct ast_channel *ast)
static struct transfer_data * transfer_data_alloc(struct ast_sip_session *session, const char *target)
static int chan_pjsip_answer(struct ast_channel *ast)
Function called by core when we should answer a PJSIP session.
static void info_dtmf_data_destroy(void *obj)
static int chan_pjsip_add_hold(const char *chan_uid)
Add a channel ID to the list of PJSIP channels on hold.
static struct info_dtmf_data * info_dtmf_data_alloc(struct ast_sip_session *session, char digit, unsigned int duration)
static int is_colp_update_allowed(struct ast_sip_session *session)
static int chan_pjsip_digit_end(struct ast_channel *ast, char digit, unsigned int duration)
Function called by core to stop a DTMF digit.
static struct ast_sip_session_supplement chan_pjsip_supplement_response
SIP session supplement structure just for responses.
static struct ast_frame * chan_pjsip_read_stream(struct ast_channel *ast)
Function called by core to read any waiting frames.
static void set_sipdomain_variable(struct ast_sip_session *session)
static int chan_pjsip_fixup(struct ast_channel *oldchan, struct ast_channel *newchan)
Function called by core to change the underlying owner channel.
static struct ast_channel * chan_pjsip_new(struct ast_sip_session *session, int state, const char *exten, const char *title, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *cid_name)
Function called to create a new PJSIP Asterisk channel.
static struct ast_sip_session_supplement call_pickup_supplement
static void chan_pjsip_incoming_response(struct ast_sip_session *session, struct pjsip_rx_data *rdata)
Function called when a response is received on the session.
static struct ast_custom_function dtmf_mode_function
PJSIP Channel Driver shared data structures.
General Asterisk PBX channel definitions.
const char * ast_channel_name(const struct ast_channel *chan)
void ast_channel_rings_set(struct ast_channel *chan, int value)
void ast_channel_named_pickupgroups_set(struct ast_channel *chan, struct ast_namedgroups *value)
int ast_channel_get_device_name(struct ast_channel *chan, char *device_name, size_t name_buffer_length)
Get a device name given its channel structure.
struct ast_stream_topology * ast_channel_set_stream_topology(struct ast_channel *chan, struct ast_stream_topology *topology)
Set the topology of streams on a channel.
void ast_channel_set_unbridged_nolock(struct ast_channel *chan, int value)
Variant of ast_channel_set_unbridged. Use this if the channel is already locked prior to calling.
@ AST_CHAN_TP_SEND_TEXT_DATA
Channels have this property if they implement send_text_data.
@ AST_CHAN_TP_WANTSJITTER
Channels have this property if they can accept input with jitter; i.e. most VoIP channels.
@ AST_CHAN_TP_CREATESJITTER
Channels have this property if they can create jitter; i.e. most VoIP channels.
void * ast_channel_tech_pvt(const struct ast_channel *chan)
struct ast_format * ast_channel_rawreadformat(struct ast_channel *chan)
int ast_set_read_format_path(struct ast_channel *chan, struct ast_format *raw_format, struct ast_format *core_format)
Set specific read path on channel.
void ast_hangup(struct ast_channel *chan)
Hang up a channel.
int ast_queue_hangup(struct ast_channel *chan)
Queue a hangup frame.
int ast_party_id_presentation(const struct ast_party_id *id)
Determine the overall presentation value for the given party.
void ast_channel_nativeformats_set(struct ast_channel *chan, struct ast_format_cap *value)
int ast_channel_fdno(const struct ast_channel *chan)
#define ast_channel_lock(chan)
struct ast_trans_pvt * ast_channel_readtrans(const struct ast_channel *chan)
struct ast_format_cap * ast_channel_nativeformats(const struct ast_channel *chan)
ast_t38_state
Possible T38 states on channels.
void ast_channel_unregister(const struct ast_channel_tech *tech)
Unregister a channel technology.
struct ast_trans_pvt * ast_channel_writetrans(const struct ast_channel *chan)
int ast_queue_control(struct ast_channel *chan, enum ast_control_frame_type control)
Queue a control frame without payload.
#define ast_channel_ref(c)
Increase channel reference count.
const char * ast_channel_uniqueid(const struct ast_channel *chan)
const char * ast_channel_context(const struct ast_channel *chan)
int ast_queue_control_data(struct ast_channel *chan, enum ast_control_frame_type control, const void *data, size_t datalen)
Queue a control frame with payload.
#define AST_CHANNEL_INITIALIZERS_VERSION
struct ABI version
int ast_queue_hangup_with_cause(struct ast_channel *chan, int cause)
Queue a hangup frame with hangupcause set.
void ast_channel_set_rawreadformat(struct ast_channel *chan, struct ast_format *format)
void ast_channel_tech_pvt_set(struct ast_channel *chan, void *value)
void ast_channel_callgroup_set(struct ast_channel *chan, ast_group_t value)
struct ast_format * ast_channel_rawwriteformat(struct ast_channel *chan)
int ast_channel_hangupcause(const struct ast_channel *chan)
int ast_channel_is_bridged(const struct ast_channel *chan)
Determine if a channel is in a bridge.
void ast_channel_set_rawwriteformat(struct ast_channel *chan, struct ast_format *format)
struct ast_party_dialed * ast_channel_dialed(struct ast_channel *chan)
#define ast_channel_alloc_with_initializers(needqueue, state, cid_num, cid_name, acctcode, exten, context, assignedids, requestor, amaflag, endpoint, initializers,...)
void ast_set_hangupsource(struct ast_channel *chan, const char *source, int force)
Set the source of the hangup in this channel and it's bridge.
void ast_channel_named_callgroups_set(struct ast_channel *chan, struct ast_namedgroups *value)
void ast_channel_hangupcause_hash_set(struct ast_channel *chan, const struct ast_control_pvt_cause_code *cause_code, int datalen)
Sets the HANGUPCAUSE hash and optionally the SIP_CAUSE hash on the given channel.
void ast_channel_set_readformat(struct ast_channel *chan, struct ast_format *format)
int ast_channel_register(const struct ast_channel_tech *tech)
Register a channel technology (a new channel driver) Called by a channel module to register the kind ...
#define ast_channel_unref(c)
Decrease channel reference count.
struct ast_format * ast_channel_writeformat(struct ast_channel *chan)
void ast_party_id_copy(struct ast_party_id *dest, const struct ast_party_id *src)
Copy the source party id information to the destination party id.
struct ast_party_id ast_channel_connected_effective_id(struct ast_channel *chan)
void ast_party_connected_line_init(struct ast_party_connected_line *init)
Initialize the given connected line structure.
int ast_channel_get_up_time(struct ast_channel *chan)
Obtain how long it has been since the channel was answered.
void ast_channel_set_fd(struct ast_channel *chan, int which, int fd)
int ast_set_write_format_path(struct ast_channel *chan, struct ast_format *core_format, struct ast_format *raw_format)
Set specific write path on channel.
void ast_channel_zone_set(struct ast_channel *chan, struct ast_tone_zone *value)
struct ast_party_caller * ast_channel_caller(struct ast_channel *chan)
void ast_channel_queue_connected_line_update(struct ast_channel *chan, const struct ast_party_connected_line *connected, const struct ast_set_party_connected_line *update)
Queue a connected line update frame on a channel.
void ast_channel_priority_set(struct ast_channel *chan, int value)
void ast_channel_hangupcause_set(struct ast_channel *chan, int value)
void ast_channel_pickupgroup_set(struct ast_channel *chan, ast_group_t value)
void ast_channel_adsicpe_set(struct ast_channel *chan, enum ast_channel_adsicpe value)
void ast_channel_tech_set(struct ast_channel *chan, const struct ast_channel_tech *value)
const char * ast_channel_exten(const struct ast_channel *chan)
#define ast_channel_unlock(chan)
void ast_channel_set_writeformat(struct ast_channel *chan, struct ast_format *format)
struct ast_format * ast_channel_readformat(struct ast_channel *chan)
ast_channel_state
ast_channel states
int ast_setstate(struct ast_channel *chan, enum ast_channel_state)
Change the state of a channel.
Standard Command Line Interface.
int pjsip_channel_cli_register(void)
Registers the channel cli commands.
void pjsip_channel_cli_unregister(void)
Unregisters the channel cli commands.
PJSIP CLI functions header file.
const char * ast_codec_media_type2str(enum ast_media_type type)
Conversion function to take a media type and turn it into a string.
void ast_devstate_aggregate_add(struct ast_devstate_aggregate *agg, enum ast_device_state state)
Add a device state to the aggregate device state.
int ast_devstate_changed(enum ast_device_state state, enum ast_devstate_cache cachable, const char *fmt,...)
Tells Asterisk the State for Device is changed.
void ast_devstate_aggregate_init(struct ast_devstate_aggregate *agg)
Initialize aggregate device state.
enum ast_device_state ast_devstate_aggregate_result(struct ast_devstate_aggregate *agg)
Get the aggregate device state result.
enum ast_device_state ast_state_chan2dev(enum ast_channel_state chanstate)
Convert channel state to devicestate.
int ast_devstate_changed_literal(enum ast_device_state state, enum ast_devstate_cache cachable, const char *device)
Tells Asterisk the State for Device is changed.
ast_device_state
Device States.
int pjsip_acf_moh_passthrough_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
PJSIP_MOH_PASSTHROUGH function read callback.
int pjsip_acf_media_offer_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
PJSIP_MEDIA_OFFER function read callback.
int pjsip_acf_media_offer_write(struct ast_channel *chan, const char *cmd, char *data, const char *value)
PJSIP_MEDIA_OFFER function write callback.
int pjsip_acf_dtmf_mode_write(struct ast_channel *chan, const char *cmd, char *data, const char *value)
PJSIP_DTMF_MODE function write callback.
int pjsip_acf_session_refresh_write(struct ast_channel *chan, const char *cmd, char *data, const char *value)
PJSIP_SEND_SESSION_REFRESH function write callback.
int pjsip_app_hangup(struct ast_channel *chan, const char *data)
PJSIPHangup Dialplan App.
int pjsip_acf_moh_passthrough_write(struct ast_channel *chan, const char *cmd, char *data, const char *value)
PJSIP_MOH_PASSTHROUGH function write callback.
int pjsip_action_hangup(struct mansession *s, const struct message *m)
PJSIPHangup Manager Action.
int pjsip_acf_channel_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
CHANNEL function read callback.
int pjsip_acf_dtmf_mode_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
PJSIP_DTMF_MODE function read callback.
int pjsip_acf_dial_contacts_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
PJSIP_DIAL_CONTACTS function read callback.
int pjsip_acf_parse_uri_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
PJSIP_PARSE_URI function read callback.
PJSIP dialplan functions header file.
Convenient Signal Processing routines.
void ast_dsp_free(struct ast_dsp *dsp)
struct ast_frame * ast_dsp_process(struct ast_channel *chan, struct ast_dsp *dsp, struct ast_frame *inf)
Return AST_FRAME_NULL frames when there is silence, AST_FRAME_BUSY on busies, and call progress,...
#define DSP_FEATURE_FAX_DETECT
int ast_dsp_get_features(struct ast_dsp *dsp)
Get features.
void ast_dsp_set_features(struct ast_dsp *dsp, int features)
Select feature set.
const char * ast_endpoint_get_tech(const struct ast_endpoint *endpoint)
Gets the technology of the given endpoint.
const char * ast_endpoint_get_resource(const struct ast_endpoint *endpoint)
Gets the resource name of the given endpoint.
Generic File Format Support. Should be included by clients of the file handling routines....
static int exists(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
int ast_manager_unregister(const char *action)
Unregister a registered manager command.
#define SCOPE_EXIT_RTN(...)
#define SCOPE_EXIT_RTN_VALUE(__return_value,...)
#define SCOPE_EXIT_LOG_RTN_VALUE(__value, __log_level,...)
#define SCOPE_ENTER(level,...)
#define SCOPE_ENTER_TASK(level, indent,...)
#define ast_trace(level,...)
#define ast_trace_get_indent()
struct ast_channel_snapshot * ast_channel_snapshot_get_latest(const char *uniqueid)
Obtain the latest ast_channel_snapshot from the Stasis Message Bus API cache. This is an ao2 object,...
void ast_channel_stage_snapshot_done(struct ast_channel *chan)
Clear flag to indicate channel snapshot is being staged, and publish snapshot.
struct ast_endpoint_snapshot * ast_endpoint_latest_snapshot(const char *tech, const char *resource)
Retrieve the most recent snapshot for the endpoint with the given name.
void ast_channel_stage_snapshot(struct ast_channel *chan)
Set flag to indicate channel snapshot is being staged.
const char * ast_msg_data_get_attribute(struct ast_msg_data *msg, enum ast_msg_data_attribute_type attribute_type)
Get attribute from ast_msg_data.
struct ast_msg_data * ast_msg_data_alloc(enum ast_msg_data_source_type source, struct ast_msg_data_attribute attributes[], size_t count)
Allocates an ast_msg_data structure.
struct ast_msg_data * ast_msg_data_dup(struct ast_msg_data *msg)
Clone an ast_msg_data structure.
@ AST_MSG_DATA_ATTR_CONTENT_TYPE
@ AST_MSG_DATA_SOURCE_TYPE_UNKNOWN
int ast_sip_push_task(struct ast_taskprocessor *serializer, int(*sip_task)(void *), void *task_data)
Pushes a task to SIP servants.
int ast_sip_push_task_wait_servant(struct ast_taskprocessor *serializer, int(*sip_task)(void *), void *task_data)
Push a task to SIP servants and wait for it to complete.
int ast_sip_push_task_wait_serializer(struct ast_taskprocessor *serializer, int(*sip_task)(void *), void *task_data)
Push a task to the serializer and wait for it to complete.
Application convenience functions, designed to give consistent look and feel to Asterisk apps.
#define AST_APP_ARG(name)
Define an application argument.
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
char * ast_get_encoded_str(const char *stream, char *result, size_t result_len)
Decode a stream of encoded control or extended ASCII characters.
#define AST_NONSTANDARD_APP_ARGS(args, parse, sep)
Performs the 'nonstandard' argument separation process for an application.
struct ast_features_pickup_config * ast_get_chan_features_pickup_config(struct ast_channel *chan)
Get the pickup configuration options for a channel.
char * ast_frame_subclass2str(struct ast_frame *f, char *subclass, size_t slen, char *moreinfo, size_t mlen)
Copy the discription of a frame's subclass into the provided string.
#define AST_OPTION_T38_STATE
@ AST_CONTROL_STREAM_TOPOLOGY_SOURCE_CHANGED
@ AST_CONTROL_STREAM_TOPOLOGY_REQUEST_CHANGE
@ AST_CONTROL_REDIRECTING
@ AST_CONTROL_T38_PARAMETERS
@ AST_CONTROL_STREAM_TOPOLOGY_CHANGED
@ AST_CONTROL_CONNECTED_LINE
@ AST_CONTROL_MASQUERADE_NOTIFY
@ AST_CONTROL_PVT_CAUSE_CODE
@ AST_CONTROL_UPDATE_RTP_PEER
struct ast_frame ast_null_frame
#define ast_debug(level,...)
Log a DEBUG message.
#define ast_verb(level,...)
struct ast_tone_zone * ast_get_indication_zone(const char *country)
locate ast_tone_zone
#define AST_LIST_NEXT(elm, field)
Returns the next entry in the list after the given entry.
Asterisk locking-related definitions:
int ast_atomic_fetchadd_int(volatile int *p, int v)
Atomically add v to *p and return the previous value of *p.
static struct ao2_container * endpoints
#define EVENT_FLAG_SYSTEM
#define ast_manager_register_xml(action, authority, func)
Register a manager callback using XML documentation to describe the manager.
Out-of-call text message support.
Asterisk module definitions.
#define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...)
@ AST_MODPRI_CHANNEL_DRIVER
@ AST_MODULE_SUPPORT_CORE
#define ASTERISK_GPL_KEY
The text the key() function should return.
int ast_unregister_application(const char *app)
Unregister an application.
@ AST_MODULE_LOAD_DECLINE
Module has failed to load, may be in an inconsistent state.
#define ast_register_application_xml(app, execute)
Register an application using XML documentation.
int ast_moh_start(struct ast_channel *chan, const char *mclass, const char *interpclass)
Turn on music on hold on a given channel.
void ast_moh_stop(struct ast_channel *chan)
Turn off music on hold on a given channel.
static int ast_sockaddr_isnull(const struct ast_sockaddr *addr)
Checks if the ast_sockaddr is null. "null" in this sense essentially means uninitialized,...
static void ast_sockaddr_setnull(struct ast_sockaddr *addr)
Sets address addr to null.
Core PBX routines and definitions.
const char * pbx_builtin_getvar_helper(struct ast_channel *chan, const char *name)
Return a pointer to the value of the corresponding channel variable.
int ast_exists_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid)
Determine whether an extension exists.
int pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const char *value)
Add a variable to the channel variable stack, removing the most recently set value for the same name.
#define ast_custom_function_register(acf)
Register a custom function.
int ast_custom_function_unregister(struct ast_custom_function *acf)
Unregister a custom function.
enum ast_pbx_result ast_pbx_start(struct ast_channel *c)
Create a new thread and start the PBX.
int ast_async_goto(struct ast_channel *chan, const char *context, const char *exten, int priority)
Set the channel to next execute the specified dialplan location.
int ast_pickup_call(struct ast_channel *chan)
Pickup a call.
static int cdata(void *userdata, int state, const char *cdata, size_t len)
struct stasis_forward * sub
void ast_sip_unregister_service(pjsip_module *module)
unsigned int ast_sip_get_allow_sending_180_after_183(void)
Retrieve the global setting 'allow_sending_180_after_183'.
struct ast_sip_contact * ast_sip_location_retrieve_contact_from_aor_list(const char *aor_list)
Retrieve the first bound contact from a list of AORs.
struct ao2_container * ast_sip_get_endpoints(void)
Retrieve any endpoints available to sorcery.
int ast_sip_register_service(pjsip_module *module)
Register a SIP service in Asterisk.
const int ast_sip_hangup_sip2cause(int cause)
Convert SIP hangup causes to Asterisk hangup causes.
@ AST_SIP_MEDIA_ENCRYPT_NONE
@ AST_SIP_SUPPLEMENT_PRIORITY_CHANNEL
@ AST_SIP_SUPPLEMENT_PRIORITY_LAST
void ast_copy_pj_str(char *dest, const pj_str_t *src, size_t size)
Copy a pj_str_t into a standard character buffer.
int ast_sip_send_request(pjsip_tx_data *tdata, struct pjsip_dialog *dlg, struct ast_sip_endpoint *endpoint, void *token, void(*callback)(void *token, pjsip_event *e))
General purpose method for sending a SIP request.
int ast_sip_add_body(pjsip_tx_data *tdata, const struct ast_sip_body *body)
Add a body to an outbound SIP message.
unsigned int ast_sip_get_disable_multi_domain(void)
Retrieve the system setting 'disable multi domain'.
int ast_sip_create_request(const char *method, struct pjsip_dialog *dlg, struct ast_sip_endpoint *endpoint, const char *uri, struct ast_sip_contact *contact, pjsip_tx_data **tdata)
General purpose method for creating a SIP request.
int ast_sip_add_header(pjsip_tx_data *tdata, const char *name, const char *value)
Add a header to an outbound SIP message.
struct ast_sorcery * ast_sip_get_sorcery(void)
Get a pointer to the SIP sorcery structure.
const pj_str_t * ast_sip_pjsip_uri_get_hostname(pjsip_uri *uri)
Get the host portion of the pjsip_uri.
@ AST_SIP_DIRECT_MEDIA_GLARE_MITIGATION_NONE
@ AST_SIP_DIRECT_MEDIA_GLARE_MITIGATION_INCOMING
@ AST_SIP_DIRECT_MEDIA_GLARE_MITIGATION_OUTGOING
ast_sip_session_refresh_method
@ AST_SIP_SESSION_REFRESH_METHOD_UPDATE
@ AST_SIP_SESSION_REFRESH_METHOD_INVITE
void ast_sip_session_send_request(struct ast_sip_session *session, pjsip_tx_data *tdata)
Send a SIP request.
struct ast_datastore * ast_sip_session_get_datastore(struct ast_sip_session *session, const char *name)
Retrieve a session datastore.
struct ast_sip_session_media_state * ast_sip_session_media_state_alloc(void)
Allocate a session media state structure.
int ast_sip_session_add_datastore(struct ast_sip_session *session, struct ast_datastore *datastore)
Add a datastore to a SIP session.
@ AST_SIP_SESSION_AFTER_MEDIA
@ AST_SIP_SESSION_BEFORE_MEDIA
void ast_sip_session_remove_datastore(struct ast_sip_session *session, const char *name)
Remove a session datastore from the session.
void ast_sip_session_media_state_free(struct ast_sip_session_media_state *media_state)
Free a session media state structure.
#define ast_sip_session_register_supplement(supplement)
struct ast_datastore * ast_sip_session_alloc_datastore(const struct ast_datastore_info *info, const char *uid)
Alternative for ast_datastore_alloc()
int ast_sip_session_create_invite(struct ast_sip_session *session, pjsip_tx_data **tdata)
Creates an INVITE request.
void ast_sip_session_unregister_supplement(struct ast_sip_session_supplement *supplement)
Unregister a an supplement to SIP session processing.
struct ast_sip_channel_pvt * ast_sip_channel_pvt_alloc(void *pvt, struct ast_sip_session *session)
Allocate a new SIP channel pvt structure.
void ast_sip_session_unsuspend(struct ast_sip_session *session)
Request the session serializer be unsuspended.
void ast_sip_session_terminate(struct ast_sip_session *session, int response)
Terminate a session and, if possible, send the provided response code.
void ast_sip_session_media_state_reset(struct ast_sip_session_media_state *media_state)
Reset a media state to a clean state.
int ast_sip_session_refresh(struct ast_sip_session *session, ast_sip_session_request_creation_cb on_request_creation, ast_sip_session_sdp_creation_cb on_sdp_creation, ast_sip_session_response_cb on_response, enum ast_sip_session_refresh_method method, int generate_new_sdp, struct ast_sip_session_media_state *media_state)
Send a reinvite or UPDATE on a session.
struct ast_sip_session * ast_sip_session_create_outgoing(struct ast_sip_endpoint *endpoint, struct ast_sip_contact *contact, const char *location, const char *request_user, struct ast_stream_topology *req_topology)
Create a new outgoing SIP session.
const char * ast_sip_session_get_name(const struct ast_sip_session *session)
Get the channel or endpoint name associated with the session.
void ast_sip_session_send_response(struct ast_sip_session *session, pjsip_tx_data *tdata)
Send a SIP response.
void ast_sip_session_suspend(struct ast_sip_session *session)
Request and wait for the session serializer to be suspended.
Pluggable RTP Architecture.
#define AST_RTP_RTCP_PSFB
void ast_rtp_instance_set_stats_vars(struct ast_channel *chan, struct ast_rtp_instance *instance)
Set standard statistics from an RTP instance on a channel.
enum ast_rtp_dtmf_mode ast_rtp_instance_dtmf_mode_get(struct ast_rtp_instance *instance)
Get the DTMF mode of an RTP instance.
@ AST_RTP_DTMF_MODE_INBAND
@ AST_RTP_GLUE_RESULT_LOCAL
@ AST_RTP_GLUE_RESULT_REMOTE
@ AST_RTP_GLUE_RESULT_FORBID
#define ast_rtp_instance_get_and_cmp_remote_address(instance, address)
Get the address of the remote endpoint that we are sending RTP to, comparing its address to another.
int ast_rtp_instance_dtmf_begin(struct ast_rtp_instance *instance, char digit)
Begin sending a DTMF digit.
void ast_rtp_instance_set_prop(struct ast_rtp_instance *instance, enum ast_rtp_property property, int value)
Set the value of an RTP instance property.
int ast_rtp_instance_dtmf_end_with_duration(struct ast_rtp_instance *instance, char digit, unsigned int duration)
int ast_rtp_instance_write(struct ast_rtp_instance *instance, struct ast_frame *frame)
Send a frame out over RTP.
void ast_rtp_instance_set_channel_id(struct ast_rtp_instance *instance, const char *uniqueid)
Set the channel that owns this RTP instance.
#define ast_rtp_glue_register(glue)
int ast_rtp_instance_fd(struct ast_rtp_instance *instance, int rtcp)
Get the file descriptor for an RTP session (or RTCP)
int ast_rtp_glue_unregister(struct ast_rtp_glue *glue)
Unregister RTP glue.
const char * ast_sorcery_object_get_id(const void *object)
Get the unique identifier of a sorcery object.
void * ast_sorcery_retrieve_by_id(const struct ast_sorcery *sorcery, const char *type, const char *id)
Retrieve an object using its unique identifier.
const char * ast_stream_topology_to_str(const struct ast_stream_topology *topology, struct ast_str **buf)
Get a string representing the topology for debugging/display purposes.
struct ast_stream * ast_stream_topology_get_stream(const struct ast_stream_topology *topology, unsigned int position)
Get a specific stream from the topology.
int ast_stream_topology_get_count(const struct ast_stream_topology *topology)
Get the number of streams in a topology.
void ast_stream_topology_free(struct ast_stream_topology *topology)
Unreference and destroy a stream topology.
struct ast_stream_topology * ast_stream_topology_create_from_format_cap(struct ast_format_cap *cap)
A helper function that, given a format capabilities structure, creates a topology and separates the m...
struct ast_format_cap * ast_stream_topology_get_formats(struct ast_stream_topology *topology)
Create a format capabilities structure representing the topology.
const struct ast_format_cap * ast_stream_get_formats(const struct ast_stream *stream)
Get the current negotiated formats of a stream.
struct ast_stream_topology * ast_stream_topology_clone(const struct ast_stream_topology *topology)
Create a deep clone of an existing stream topology.
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
static force_inline int attribute_pure ast_str_hash(const char *str)
Compute a hash value on a string.
#define S_COR(a, b, c)
returns the equivalent of logic or for strings, with an additional boolean check: second one if not e...
static force_inline int attribute_pure ast_strlen_zero(const char *s)
#define ast_str_tmp(init_len, __expr)
Provides a temporary ast_str and returns a copy of its buffer.
#define ast_str_alloca(init_len)
#define ast_str_create(init_len)
Create a malloc'ed dynamic length string.
int ast_str_set(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Set a dynamic string using variable arguments.
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
struct ast_sip_session * session
Structure to pass both assignedid values to channel drivers.
Helper struct for initializing additional channel information on channel creation.
uint32_t version
struct ABI version
const ast_string_field uniqueid
Structure representing a snapshot of channel state.
struct ast_channel_snapshot_base * base
enum ast_channel_state state
Structure to describe a channel "technology", ie a channel driver See for examples:
struct ast_format_cap * capabilities
Main Channel structure associated with a channel.
char exten[AST_MAX_EXTENSION]
char chan_name[AST_CHANNEL_NAME]
enum ast_control_t38 request_response
Data structure associated with a custom dialplan function.
Structure for a data store type.
Structure for a data store object.
You shouldn't care about the contents of this struct.
A snapshot of an endpoint's state.
Configuration relating to call pickup.
const ast_string_field pickupexten
struct ast_format * format
Data structure associated with a single frame of data.
struct ast_frame_subclass subclass
union ast_frame::@226 data
enum ast_frame_type frametype
enum ast_msg_data_attribute_type type
Structure used to transport a message through the frame core.
struct ast_party_id id
Caller party ID.
int ani2
Automatic Number Identification 2 (Info Digits)
Connected Line/Party information.
struct ast_party_dialed::@208 number
Dialed/Called number.
char * str
Subscriber phone number (Malloced)
Information needed to identify an endpoint in a call.
struct ast_party_number number
Subscriber phone number.
unsigned char valid
TRUE if the number information is valid/present.
A structure which contains a channel implementation and session.
struct ast_sip_session * session
Pointer to session.
An entity with which Asterisk communicates.
const ast_string_field aors
struct ast_sip_endpoint_media_configuration media
unsigned int inband_progress
A supplement to SIP message processing.
A structure describing a SIP session.
struct ast_sip_endpoint * endpoint
enum ast_sip_session_t38state t38state
struct ast_channel * channel
unsigned int moh_passthrough
struct ast_sip_session_media_state * active_media_state
struct ast_sip_session_media_state * pending_media_state
struct pjsip_inv_session * inv_session
enum ast_sip_dtmf_mode dtmf
struct ast_taskprocessor * serializer
Support for dynamic strings.
A set of tones for a given locale.
Structure for variables, used for configurations and for channel variables.
The PJSIP channel driver pvt, stored in the ast_sip_channel_pvt data structure.
struct ast_channel * chan
struct ast_sip_session * session
struct ast_sip_session * session
struct ast_sip_session * session
struct ast_stream_topology * topology
struct ast_sip_session * session
struct ast_msg_data * msg
struct ast_sip_session * session
struct ast_sip_session * session
struct ast_sip_session_media_state * media_state
struct ast_sip_session * session
Transport information stored in transport_info datastore.
pj_sockaddr local_addr
Our address that received the request.
pj_sockaddr remote_addr
The address that sent the request.
An API for managing task processing threads that can be shared across modules.
#define ast_test_suite_event_notify(s, f,...)
Definitions to aid in the use of thread local storage.
void * ast_threadstorage_get(struct ast_threadstorage *ts, size_t init_size)
Retrieve thread storage.
#define AST_THREADSTORAGE(name)
Define a thread storage variable.
Support for translation of data formats. translate.c.
const char * ast_translate_path_to_str(struct ast_trans_pvt *t, struct ast_str **str)
Puts a string representation of the translation path into outbuf.
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
#define AST_VECTOR_SIZE(vec)
Get the number of elements in a vector.
#define AST_VECTOR_GET(vec, idx)
Get an element from a vector.
#define AST_VECTOR_GET_ADDR(vec, idx)
Get an address of element in a vector.