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",
285 if (!(tdata->tp_info.transport->flag & PJSIP_TRANSPORT_RELIABLE)) {
286 pjsip_tpmgr_fla2_param prm;
288 pjsip_tpmgr_fla2_param_default(&prm);
289 prm.tp_type = tdata->tp_info.transport->key.type;
290 pj_strset2(&prm.dst_host, tdata->tp_info.dst_name);
291 prm.local_if = PJ_TRUE;
294 tdata->pool, &prm) == PJ_SUCCESS) {
295 int af = prm.tp_type & PJSIP_TRANSPORT_IPV6 ? pj_AF_INET6() : pj_AF_INET();
297 if (prm.tp_type == PJSIP_TRANSPORT_UDP || prm.tp_type == PJSIP_TRANSPORT_UDP6) {
298 prm.ret_port = tdata->tp_info.transport->local_name.port;
301 if (pj_sockaddr_init(af, local_addr, &prm.ret_addr, prm.ret_port) == PJ_SUCCESS) {
307 pj_sockaddr_cp(local_addr, &tdata->tp_info.transport->local_addr);
308 return pj_sockaddr_has_addr(local_addr) ? 0 : -1;
326 if (!tdata->tp_info.transport
327 || !pj_sockaddr_has_addr(&tdata->tp_info.dst_addr)) {
331 dlg = pjsip_tdata_get_dlg(tdata);
339 ||
session->inv_session->role != PJSIP_ROLE_UAC) {
353 transport_data =
ast_calloc(1,
sizeof(*transport_data));
354 if (!transport_data) {
362 pj_sockaddr_cp(&transport_data->
remote_addr, &tdata->tp_info.dst_addr);
364 datastore->data = transport_data;
376 if (
session->endpoint->media.direct_media.glare_mitigation ==
389 if ((
session->endpoint->media.direct_media.glare_mitigation ==
391 session->inv_session->role == PJSIP_ROLE_UAC) ||
392 (
session->endpoint->media.direct_media.glare_mitigation ==
394 session->inv_session->role == PJSIP_ROLE_UAS)) {
426 int changed = 0, position = -1;
435 if (position != -1) {
445 if (position != -1) {
536 cdata->session->endpoint->media.direct_media.method, 1,
NULL);
563 if (nat_active &&
session->endpoint->media.direct_media.disable_on_nat) {
591 const char *channel_id)
599 if (!session_media || !session_media->
rtp) {
653 .tenantid =
session->endpoint->tenantid,
664 session->endpoint->accountcode,
665 exten,
session->endpoint->context,
666 assignedids, requestor, 0,
667 session->endpoint->persistent, &initializers,
"PJSIP/%s-%08x",
699 if (!topology || !caps) {
753 ast_channel_language_set(chan,
session->endpoint->language);
759 ast_log(
LOG_ERROR,
"Unknown country code '%s' for tonezone. Check indications.conf for available country codes.\n",
session->endpoint->zone);
786 pj_status_t
status = PJ_SUCCESS;
787 pjsip_tx_data *packet =
NULL;
791 if (
session->inv_session->state == PJSIP_INV_STATE_DISCONNECTED) {
794 pjsip_get_status_text(
session->inv_session->cause)->ptr);
798 pjsip_dlg_inc_lock(
session->inv_session->dlg);
799 if (
session->inv_session->invite_tsx) {
802 ast_log(
LOG_ERROR,
"Cannot answer '%s' because there is no associated SIP transaction\n",
805 pjsip_dlg_dec_lock(
session->inv_session->dlg);
807 if (
status == PJ_SUCCESS && packet) {
811 if (
status != PJ_SUCCESS) {
812 char err[PJ_ERR_MSG_SIZE];
814 pj_strerror(
status, err,
sizeof(err));
852 ast_log(
LOG_ERROR,
"Cannot answer '%s': Unable to push answer task to the taskpool.\n",
869 const char *target_context;
874 dsp_features &= ~DSP_FEATURE_FAX_DETECT;
903 ast_verb(2,
"Redirecting '%s' to fax extension due to CNG detection\n",
907 ast_log(
LOG_ERROR,
"Failed to async goto '%s' into fax extension in '%s'\n",
976 if (!
session->endpoint->asymmetric_rtp_codec &&
982 ast_debug(1,
"Oooh, got a frame with format of %s on channel '%s' when we're sending '%s', switching to match\n",
1005 ast_debug(1,
"Oooh, got a frame with format of %s on channel '%s' when it has not been negotiated\n",
1016 &&
session->endpoint->faxdetect_timeout
1018 dsp_features &= ~DSP_FEATURE_FAX_DETECT;
1025 ast_debug(3,
"Channel driver fax CNG detection timeout on %s\n",
1033 ast_debug(3,
"Channel driver fax CNG detected on %s\n",
1070 ast_debug(3,
"Channel %s stream %d is of type '%s', not audio!\n",
1080 "Channel %s asked to send %s frame when native formats are %s (rd:%s->%s;%s wr:%s->%s;%s)\n",
1100 ast_debug(3,
"Channel %s stream %d is of type '%s', not video!\n",
1111 ast_debug(3,
"Channel %s stream %d is of type '%s', not image!\n",
1125 ast_debug(3,
"Channel %s stream %d is of type '%s', not video! Unable to write RTCP feedback.\n",
1169 const char *key = obj;
1187 const char *left = obj_left;
1188 const char *right = obj_right;
1194 cmp = strcmp(left, right);
1197 cmp = strncmp(left, right, strlen(right));
1288 if (!endpoint_snapshot) {
1298 if (!endpoint_snapshot->num_channels) {
1304 for (num = 0; num < endpoint_snapshot->num_channels; num++) {
1325 if (endpoint->devicestate_busy_at && (inuse >= endpoint->devicestate_busy_at)) {
1381 if (!channel || !uniqueid) {
1433 pjsip_tx_data *packet =
NULL;
1438 if ((
session->inv_session->state != PJSIP_INV_STATE_DISCONNECTED) &&
1439 (pjsip_inv_answer(
session->inv_session, response_code,
NULL,
NULL, &packet) == PJ_SUCCESS)) {
1452 "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n"
1453 " <media_control>\r\n"
1454 " <vc_primitive>\r\n"
1456 " <picture_fast_update/>\r\n"
1457 " </to_encoder>\r\n"
1458 " </vc_primitive>\r\n"
1459 " </media_control>\r\n";
1462 .
type =
"application",
1463 .subtype =
"media_control+xml",
1468 struct pjsip_tx_data *tdata;
1470 if (
session->inv_session->state == PJSIP_INV_STATE_DISCONNECTED) {
1473 pjsip_get_status_text(
session->inv_session->cause)->ptr);
1482 ast_log(
LOG_ERROR,
"Could not add body to text video update INFO request\n");
1503 int update_allowed = 0;
1505 if (!
session->endpoint->id.send_connected_line
1506 || (!
session->endpoint->id.send_pai && !
session->endpoint->id.send_rpid)) {
1517 && (
session->endpoint->id.trust_outbound
1523 return update_allowed;
1531 if (
session->inv_session->state == PJSIP_INV_STATE_DISCONNECTED) {
1534 pjsip_get_status_text(
session->inv_session->cause)->ptr);
1540 ||
session->inv_session->role == PJSIP_ROLE_UAC) {
1543 int generate_new_sdp;
1546 if (
session->inv_session->options & PJSIP_INV_SUPPORT_UPDATE) {
1555 }
else if (
session->endpoint->id.rpid_immediate
1556 &&
session->inv_session->state != PJSIP_INV_STATE_DISCONNECTED
1558 int response_code = 0;
1561 response_code = !
session->endpoint->inband_progress ? 180 : 183;
1563 response_code = 183;
1566 if (response_code) {
1567 struct pjsip_tx_data *packet =
NULL;
1569 if (pjsip_inv_answer(
session->inv_session, response_code,
NULL,
NULL, &packet) == PJ_SUCCESS) {
1583 if (session_media) {
1645 rdata->msg_info.msg->line.status.code,
1650 if (PJSIP_IS_STATUS_IN_CLASS(rdata->msg_info.msg->line.status.code, 200)) {
1659 }
else if (300 <= rdata->msg_info.msg->line.status.code) {
1722 int response_code = 0;
1725 size_t device_buf_size;
1731 .integer = condition
1734 .data.ptr = (
void *)
data,
1736 char condition_name[256];
1737 unsigned int duration;
1744 switch (condition) {
1749 pjmedia_sdp_neg_get_state(channel->
session->
inv_session->neg) == PJMEDIA_SDP_NEG_STATE_DONE)) {
1752 response_code = 180;
1754 response_code = 183;
1757 response_code = 180;
1766 response_code = 486;
1773 response_code = 503;
1780 response_code = 484;
1787 response_code = 100;
1794 response_code = 183;
1866 if (*(
int *)
data) {
1885 device_buf = alloca(device_buf_size);
1892 ast_log(
LOG_WARNING,
"Could not queue task to remotely put session '%s' on hold with endpoint '%s'\n",
1901 device_buf = alloca(device_buf_size);
1908 ast_log(
LOG_WARNING,
"Could not queue task to remotely take session '%s' off hold with endpoint '%s'\n",
1922 if (media && media->
rtp) {
1930 response_code = 181;
1968 if (response_code) {
1976 ast_log(
LOG_ERROR,
"%s: Cannot send response code %d to endpoint %s. Could not queue task properly\n",
2020 pjsip_tx_data *packet;
2022 pjsip_contact_hdr *contact;
2025 if (pjsip_inv_end_session(
session->inv_session, 302,
NULL, &packet) != PJ_SUCCESS
2035 if (!(contact = pjsip_msg_find_hdr(packet->msg, PJSIP_H_CONTACT,
NULL))) {
2036 contact = pjsip_contact_hdr_create(packet->pool);
2039 pj_strdup2_with_null(packet->pool, &tmp,
target);
2040 if (!(contact->uri = pjsip_parse_uri(packet->pool, tmp.ptr, tmp.slen, PJSIP_PARSE_URI_AS_NAMEADDR))) {
2045 pjsip_tx_data_dec_ref(packet);
2049 pjsip_msg_add_hdr(packet->msg, (pjsip_hdr *) contact);
2057 .name = {
"chan_pjsip", 10 },
2084 if (pjsip_evsub_get_state(
sub) == PJSIP_EVSUB_STATE_ACCEPTED) {
2086 pjsip_rx_data *rdata;
2087 pjsip_generic_string_hdr *refer_sub;
2088 const pj_str_t REFER_SUB = {
"Refer-Sub", 9 };
2093 if (
event->type == PJSIP_EVENT_TSX_STATE &&
event->body.tsx_state.type == PJSIP_EVENT_RX_MSG) {
2094 rdata =
event->body.tsx_state.src.rdata;
2097 refer_sub = pjsip_msg_find_hdr_by_name(rdata->msg_info.msg, &REFER_SUB,
NULL);
2103 if (refer_sub && !pj_stricmp2(&refer_sub->hvalue,
"false")) {
2108 pjsip_evsub_terminate(
sub, PJ_TRUE);
2112 }
else if (pjsip_evsub_get_state(
sub) == PJSIP_EVSUB_STATE_ACTIVE ||
2113 pjsip_evsub_get_state(
sub) == PJSIP_EVSUB_STATE_TERMINATED) {
2116 pjsip_msg_body *body;
2117 pjsip_status_line status_line = { .code = 0 };
2121 if (
event->type == PJSIP_EVENT_TSX_STATE &&
event->body.tsx_state.type == PJSIP_EVENT_RX_MSG) {
2122 pjsip_rx_data *rdata;
2124 rdata =
event->body.tsx_state.src.rdata;
2125 msg = rdata->msg_info.msg;
2127 if (msg->type == PJSIP_REQUEST_MSG) {
2128 if (!pjsip_method_cmp(&msg->line.req.method, pjsip_get_notify_method())) {
2130 if (body && !pj_stricmp2(&body->content_type.type,
"message")
2131 && !pj_stricmp2(&body->content_type.subtype,
"sipfrag")) {
2132 pjsip_parse_status_line((
char *)body->data, body->len, &status_line);
2136 status_line.code = msg->line.status.code;
2137 status_line.reason = msg->line.status.reason;
2140 status_line.code = 500;
2141 status_line.reason = *pjsip_get_status_text(500);
2144 is_last = (pjsip_evsub_get_state(
sub) == PJSIP_EVSUB_STATE_TERMINATED);
2146 if (status_line.code >= 200 || is_last) {
2154 if (status_line.code < 200) {
2156 }
else if (status_line.code >= 300) {
2163 pjsip_tx_data *tdata;
2165 status = pjsip_evsub_initiate(
sub, pjsip_get_subscribe_method(), 0, &tdata);
2166 if (
status == PJ_SUCCESS) {
2167 pjsip_evsub_send_request(
sub, tdata);
2172 ast_debug(3,
"Transfer channel %s completed: %d %.*s (%s)\n",
2175 (
int)status_line.reason.slen, status_line.reason.ptr,
2191 pjsip_tx_data *packet;
2192 const char *ref_by_val;
2193 char local_info[pj_strlen(&
session->inv_session->dlg->local.info_str) + 1];
2194 struct pjsip_evsub_user xfer_cb;
2197 pj_bzero(&xfer_cb,
sizeof(xfer_cb));
2200 if (pjsip_xfer_create_uac(
session->inv_session->dlg, &xfer_cb, &
sub) != PJ_SUCCESS) {
2213 if (pjsip_xfer_initiate(
sub, pj_cstr(&tmp, target), &packet) != PJ_SUCCESS) {
2225 if (pjsip_xfer_send_request(
sub, packet) == PJ_SUCCESS) {
2233 pjsip_evsub_terminate(
sub, PJ_FALSE);
2243 const char *target = trnf_data->
target;
2255 target = contact->
uri;
2301 if (!media || !media->
rtp) {
2308 if (!media || !media->
rtp) {
2365 struct pjsip_tx_data *tdata;
2370 .
type =
"application",
2371 .subtype =
"dtmf-relay",
2374 if (
session->inv_session->state == PJSIP_INV_STATE_DISCONNECTED) {
2377 pjsip_get_status_text(
session->inv_session->cause)->ptr);
2385 ast_str_set(&
body_text, 0,
"Signal=%c\r\nDuration=%u\r\n", dtmf_data->digit, dtmf_data->duration);
2395 pjsip_tx_data_dec_ref(tdata);
2409 if (!channel || !channel->
session) {
2420 if (!media || !media->
rtp) {
2425 ast_debug(3,
"Told to send end of digit on Auto-Info channel %s RFC4733 negotiated so using it.\n",
ast_channel_name(ast));
2430 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));
2449 if (!media || !media->
rtp) {
2456 if (!media || !media->
rtp) {
2503 pjsip_tx_data *tdata;
2591 ast_debug(1,
"AST hangup cause %d (no match found in PJSIP)\n", cause);
2648 int cause = h_data->
cause;
2650 if (
channel->session->active_media_state &&
2680 int original_tech_cause;
2684 if (!channel || !channel->
session) {
2691 if (!original_tech_cause) {
2701 ast_log(
LOG_WARNING,
"Unable to push hangup task to the taskpool. Expect bad things\n");
2740 ast_log(
LOG_ERROR,
"Unable to create PJSIP channel with empty destination\n");
2749 if ((endpoint_name = strchr(
args.endpoint,
'@'))) {
2750 request_user =
args.endpoint;
2751 *endpoint_name++ =
'\0';
2753 endpoint_name =
args.endpoint;
2758 ast_log(
LOG_ERROR,
"Unable to create PJSIP channel with empty endpoint name: %s@<endpoint-name>\n",
2761 ast_log(
LOG_ERROR,
"Unable to create PJSIP channel with empty endpoint name\n");
2769 ast_log(
LOG_ERROR,
"Unable to create PJSIP channel - endpoint '%s' was not found\n", endpoint_name);
2775 endpoint_name =
args.endpoint;
2777 ast_log(
LOG_ERROR,
"Unable to create PJSIP channel with empty endpoint name\n");
2788 endpoint_name = strchr(
args.endpoint,
'@');
2789 if (!endpoint_name) {
2794 ast_log(
LOG_ERROR,
"Unable to create PJSIP channel - endpoint '%s' was not found\n",
2799 request_user =
args.endpoint;
2800 *endpoint_name++ =
'\0';
2803 ast_log(
LOG_ERROR,
"Unable to create PJSIP channel with empty endpoint name: %s@<endpoint-name>\n",
2812 ast_log(
LOG_ERROR,
"Unable to create PJSIP channel - endpoint '%s' was not found\n", endpoint_name);
2823 ast_log(
LOG_ERROR,
"Failed to create outgoing session to endpoint '%s'\n", endpoint_name);
2842 req_data.
dest = data;
2914 pjsip_tx_data *tdata;
2925 char *content_type_copy =
ast_strdupa(content_type);
2926 sep = strchr(content_type_copy,
'/');
2929 body.
type = content_type_copy;
2939 pjsip_from_hdr *hdr;
2940 pjsip_name_addr *name_addr;
2943 int invalidate_tdata = 0;
2953 hdr = PJSIP_MSG_FROM_HDR(tdata->msg);
2954 name_addr = (pjsip_name_addr *) hdr->uri;
2955 pj_strdup2(tdata->pool, &name_addr->display, from);
2956 invalidate_tdata = 1;
2964 hdr = PJSIP_MSG_TO_HDR(tdata->msg);
2965 name_addr = (pjsip_name_addr *) hdr->uri;
2966 pj_strdup2(tdata->pool, &name_addr->display, to);
2967 invalidate_tdata = 1;
2970 if (invalidate_tdata) {
2971 pjsip_tx_data_invalidate_msg(tdata);
2988 ast_debug(1,
"Sending MESSAGE from '%s' to '%s:%s': %s\n",
3013 .value = (
char *)
text,
3032 if (
session->endpoint->media.direct_media.glare_mitigation ==
3038 "direct_media_glare_mitigation");
3051 int existing_cause = 0;
3052 int existing_tech_cause = 0;
3054 int new_tech_cause = 0;
3066 if (
session->active_media_state &&
3079 new_cause = existing_cause;
3081 new_tech_cause = existing_tech_cause;
3084 existing_cause, existing_tech_cause);
3116 int count = sscanf(pvt_cause->
code,
"SIP %d ", &tech_cause);
3118 ast_trace(-1,
"%s: Unable to parse tech_cause from code '%s'\n",
3123 if (tech_cause / 100 > 2) {
3124 new_tech_cause = tech_cause;
3127 pvt_cause->
chan_name, new_cause, new_tech_cause);
3129 ast_trace(-1,
"%s: %s dialed ast_cause: %d tech_cause: %s. Skipped 2XX code.\n",
3134 ast_trace(-1,
"%s: %s dialed ast_cause: %d tech_cause: %s. Skipped other channel.\n",
3148 if (new_tech_cause == 0 &&
session->inv_session->cause / 100 > 2) {
3149 new_tech_cause =
session->inv_session->cause;
3150 ast_trace(-1,
"%s: Using tech_cause %d from invite session\n",
3154 if (new_cause == 0 && new_tech_cause > 0) {
3156 ast_trace(-1,
"%s: Using ast_cause %d derived from tech_cause %d\n",
3160 if (new_cause != existing_cause) {
3161 ast_trace(-1,
"%s: Setting ast_cause %d\n",
3166 if (new_tech_cause == 0) {
3168 ast_trace(-1,
"%s: Using tech_cause cause %d derived from ast_cause %d\n",
3172 if (new_tech_cause != existing_tech_cause && new_tech_cause / 100 > 2) {
3173 ast_trace(-1,
"%s: Setting tech_cause %d\n",
3182 new_cause, new_tech_cause);
3188 size_t size = pj_strlen(host) + 1;
3202 pjsip_tx_data *packet =
NULL;
3210 if (rdata->msg_info.to->tag.slen) {
3230 transport_data =
ast_calloc(1,
sizeof(*transport_data));
3231 if (!transport_data) {
3234 pj_sockaddr_cp(&transport_data->
local_addr, &rdata->tp_info.transport->local_addr);
3235 pj_sockaddr_cp(&transport_data->
remote_addr, &rdata->pkt_info.src_addr);
3236 datastore->data = transport_data;
3240 if (pjsip_inv_end_session(
session->inv_session, 503,
NULL, &packet) == PJ_SUCCESS
3262 if (rdata->msg_info.to->tag.slen) {
3269 ast_log(
LOG_ERROR,
"Unable to retrieve pickup configuration options. Unable to detect call pickup extension.\n");
3312 if (rdata->msg_info.to->tag.slen) {
3349 struct pjsip_status_line
status = rdata->msg_info.msg->line.status;
3351 int data_size =
sizeof(*cause_code);
3360 data_size += 4 + 4 + pj_strlen(&
status.reason);
3362 memset(cause_code, 0, data_size);
3373 snprintf(cause_code->
code, data_size -
sizeof(*cause_code) + 1,
"SIP %d %.*s",
status.code,
3374 (
int) pj_strlen(&
status.reason), pj_strbuf(&
status.reason));
3387 struct pjsip_status_line
status = rdata->msg_info.msg->line.status;
3396 pjsip_rdata_sdp_info *sdp = pjsip_rdata_get_sdp_info(rdata);
3397 if (sdp && sdp->body.ptr) {
3399 session->early_confirmed = pjsip_100rel_is_reliable(rdata) == PJ_TRUE;
3414 if (
session->endpoint->ignore_183_without_sdp) {
3415 pjsip_rdata_sdp_info *sdp = pjsip_rdata_get_sdp_info(rdata);
3416 if (sdp && sdp->body.ptr) {
3419 (
int)rdata->msg_info.cseq->method.name.slen, rdata->msg_info.cseq->method.name.ptr,
status.code);
3420 session->early_confirmed = pjsip_100rel_is_reliable(rdata) == PJ_TRUE;
3426 (
int)rdata->msg_info.cseq->method.name.slen, rdata->msg_info.cseq->method.name.ptr,
status.code);
3446 if (rdata->msg_info.msg->line.req.method.id == PJSIP_ACK_METHOD) {
3447 if (
session->endpoint->media.direct_media.enabled &&
session->channel) {
3459 if (pj_strcmp2(&rdata->msg_info.msg->line.req.method.name,
"PRACK") == 0 &&
3460 pjmedia_sdp_neg_get_state(
session->inv_session->neg) == PJMEDIA_SDP_NEG_STATE_DONE) {
3475 .
name =
"PJSIP_DIAL_CONTACTS",
3480 .
name =
"PJSIP_PARSE_URI",
3485 .
name =
"PJSIP_PARSE_URI_FROM",
3490 .
name =
"PJSIP_MEDIA_OFFER",
3496 .
name =
"PJSIP_DTMF_MODE",
3502 .
name =
"PJSIP_MOH_PASSTHROUGH",
3508 .
name =
"PJSIP_SEND_SESSION_REFRESH",
3513 .
name =
"PJSIP_TRANSFER_HANDLING",
3547 ast_log(
LOG_ERROR,
"Unable to register PJSIP_DIAL_CONTACTS dialplan function\n");
3552 ast_log(
LOG_ERROR,
"Unable to register PJSIP_PARSE_URI dialplan function\n");
3557 ast_log(
LOG_ERROR,
"Unable to register PJSIP_PARSE_URI_FROM dialplan function\n");
3572 ast_log(
LOG_WARNING,
"Unable to register PJSIP_MOH_PASSTHROUGH dialplan function\n");
3577 ast_log(
LOG_WARNING,
"Unable to register PJSIP_SEND_SESSION_REFRESH dialplan function\n");
3582 ast_log(
LOG_WARNING,
"Unable to register PJSIP_TRANSFER_HANDLING dialplan function\n");
3691 .
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_iterator_next(iter)
#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.
void ao2_iterator_destroy(struct ao2_iterator *iter)
Destroy a container iterator.
@ 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_REDIRECTED_TO_NEW_DESTINATION
#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 int set_transport_info_local_addr(struct pjsip_tx_data *tdata, pj_sockaddr *local_addr)
Determine the local signaling address used for an outgoing request.
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 pjsip_module chan_pjsip_module
General PJSIP module for chan_pjsip, currently used for REFER subscription data and outgoing request ...
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 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 pj_status_t transport_info_on_tx_request(pjsip_tx_data *tdata)
Store transport information for outgoing PJSIP session requests.
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 struct ast_custom_function transfer_handling_function
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 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.
struct ao2_iterator ast_channel_dialed_causes_iterator(const struct ast_channel *chan)
Retrieve an iterator for dialed cause information.
const char * ast_channel_name(const struct ast_channel *chan)
int ast_channel_tech_hangupcause(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.
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_channel_tech_hangupcause_set(struct ast_channel *chan, int value)
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
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)
@ 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.
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_transfer_handling_write(struct ast_channel *chan, const char *cmd, char *data, const char *value)
PJSIP_TRANSFER_HANDLING 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.
struct ast_endpoint_snapshot * ast_endpoint_get_snapshot(struct ast_endpoint *endpoint)
Gets the latest snapshot 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.
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
#define ast_sip_push_task(serializer, sip_task, task_data)
#define ast_sip_push_task_wait_serializer(serializer, sip_task, task_data)
#define ast_sip_push_task_wait_servant(serializer, sip_task, task_data)
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)
static struct stasis_subscription * sub
Statsd channel stats. Exmaple of how to subscribe to Stasis events.
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
pjsip_endpoint * ast_sip_get_pjsip_endpoint(void)
Get a pointer to the PJSIP endpoint.
@ 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
struct ast_sip_session * ast_sip_dialog_get_session(pjsip_dialog *dlg)
Retrieves a session from a dialog.
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)
void ast_rtp_instance_change_source(struct ast_rtp_instance *instance)
Indicate a new source of audio has dropped in and the ssrc should change.
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.
int ast_strings_equal(const char *str1, const char *str2)
Compare strings for equality checking for NULL.
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.
char *attribute_pure ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
struct ast_sip_session * session
When we need to walk through a container, we use an ao2_iterator to keep track of the current positio...
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.
enum ast_device_state state
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
enum ast_frame_type frametype
union ast_frame::@237 data
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::@218 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.
struct ast_module *const char * method
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 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.