76 #define UNIQUEID_BUFSIZE 256
111 .description =
"PJSIP Channel Driver",
178 if (!channel || !channel->
session) {
187 if (!media || !media->
rtp) {
199 *instance = media->
rtp;
221 if (!channel || !channel->
session) {
226 if (!media || !media->
rtp) {
232 *instance = media->
rtp;
262 .
type =
"chan_pjsip_transport_info",
272 if (
session->endpoint->media.direct_media.glare_mitigation ==
285 if ((
session->endpoint->media.direct_media.glare_mitigation ==
287 session->inv_session->role == PJSIP_ROLE_UAC) ||
288 (
session->endpoint->media.direct_media.glare_mitigation ==
290 session->inv_session->role == PJSIP_ROLE_UAS)) {
322 int changed = 0, position = -1;
331 if (position != -1) {
341 if (position != -1) {
432 cdata->session->endpoint->media.direct_media.method, 1,
NULL);
459 if (nat_active &&
session->endpoint->media.direct_media.disable_on_nat) {
487 const char *channel_id)
495 if (!session_media || !session_media->
rtp) {
556 session->endpoint->accountcode,
558 assignedids, requestor, 0,
559 session->endpoint->persistent,
"PJSIP/%s-%08x",
591 if (!topology || !caps) {
645 ast_channel_language_set(chan,
session->endpoint->language);
651 ast_log(
LOG_ERROR,
"Unknown country code '%s' for tonezone. Check indications.conf for available country codes.\n",
session->endpoint->zone);
678 pj_status_t
status = PJ_SUCCESS;
679 pjsip_tx_data *packet =
NULL;
683 if (
session->inv_session->state == PJSIP_INV_STATE_DISCONNECTED) {
686 pjsip_get_status_text(
session->inv_session->cause)->ptr);
690 pjsip_dlg_inc_lock(
session->inv_session->dlg);
691 if (
session->inv_session->invite_tsx) {
694 ast_log(
LOG_ERROR,
"Cannot answer '%s' because there is no associated SIP transaction\n",
697 pjsip_dlg_dec_lock(
session->inv_session->dlg);
699 if (
status == PJ_SUCCESS && packet) {
703 if (
status != PJ_SUCCESS) {
704 char err[PJ_ERR_MSG_SIZE];
706 pj_strerror(
status, err,
sizeof(err));
744 ast_log(
LOG_ERROR,
"Cannot answer '%s': Unable to push answer task to the threadpool.\n",
761 const char *target_context;
795 ast_verb(2,
"Redirecting '%s' to fax extension due to CNG detection\n",
799 ast_log(
LOG_ERROR,
"Failed to async goto '%s' into fax extension in '%s'\n",
868 if (!
session->endpoint->asymmetric_rtp_codec &&
874 ast_debug(1,
"Oooh, got a frame with format of %s on channel '%s' when we're sending '%s', switching to match\n",
897 ast_debug(1,
"Oooh, got a frame with format of %s on channel '%s' when it has not been negotiated\n",
908 &&
session->endpoint->faxdetect_timeout
917 ast_debug(3,
"Channel driver fax CNG detection timeout on %s\n",
925 ast_debug(3,
"Channel driver fax CNG detected on %s\n",
962 ast_debug(3,
"Channel %s stream %d is of type '%s', not audio!\n",
972 "Channel %s asked to send %s frame when native formats are %s (rd:%s->%s;%s wr:%s->%s;%s)\n",
992 ast_debug(3,
"Channel %s stream %d is of type '%s', not video!\n",
1003 ast_debug(3,
"Channel %s stream %d is of type '%s', not image!\n",
1017 ast_debug(3,
"Channel %s stream %d is of type '%s', not video! Unable to write RTCP feedback.\n",
1061 const char *key = obj;
1079 const char *left = obj_left;
1080 const char *right = obj_right;
1086 cmp = strcmp(left, right);
1089 cmp = strncmp(left, right, strlen(right));
1182 if (!endpoint_snapshot) {
1192 if (!endpoint_snapshot->num_channels) {
1198 for (num = 0; num < endpoint_snapshot->num_channels; num++) {
1328 pjsip_tx_data *packet =
NULL;
1333 if ((
session->inv_session->state != PJSIP_INV_STATE_DISCONNECTED) &&
1334 (pjsip_inv_answer(
session->inv_session, response_code,
NULL,
NULL, &packet) == PJ_SUCCESS)) {
1347 "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n"
1348 " <media_control>\r\n"
1349 " <vc_primitive>\r\n"
1351 " <picture_fast_update/>\r\n"
1352 " </to_encoder>\r\n"
1353 " </vc_primitive>\r\n"
1354 " </media_control>\r\n";
1357 .
type =
"application",
1358 .subtype =
"media_control+xml",
1363 struct pjsip_tx_data *tdata;
1365 if (
session->inv_session->state == PJSIP_INV_STATE_DISCONNECTED) {
1368 pjsip_get_status_text(
session->inv_session->cause)->ptr);
1377 ast_log(
LOG_ERROR,
"Could not add body to text video update INFO request\n");
1398 int update_allowed = 0;
1400 if (!
session->endpoint->id.send_connected_line
1401 || (!
session->endpoint->id.send_pai && !
session->endpoint->id.send_rpid)) {
1412 && (
session->endpoint->id.trust_outbound
1418 return update_allowed;
1426 if (
session->inv_session->state == PJSIP_INV_STATE_DISCONNECTED) {
1429 pjsip_get_status_text(
session->inv_session->cause)->ptr);
1435 ||
session->inv_session->role == PJSIP_ROLE_UAC) {
1438 int generate_new_sdp;
1441 if (
session->inv_session->options & PJSIP_INV_SUPPORT_UPDATE) {
1450 }
else if (
session->endpoint->id.rpid_immediate
1451 &&
session->inv_session->state != PJSIP_INV_STATE_DISCONNECTED
1453 int response_code = 0;
1456 response_code = !
session->endpoint->inband_progress ? 180 : 183;
1458 response_code = 183;
1461 if (response_code) {
1462 struct pjsip_tx_data *packet =
NULL;
1464 if (pjsip_inv_answer(
session->inv_session, response_code,
NULL,
NULL, &packet) == PJ_SUCCESS) {
1477 if (session_media) {
1545 rdata->msg_info.msg->line.status.code,
1550 if (PJSIP_IS_STATUS_IN_CLASS(rdata->msg_info.msg->line.status.code, 200)) {
1559 }
else if (300 <= rdata->msg_info.msg->line.status.code) {
1613 int response_code = 0;
1616 size_t device_buf_size;
1622 .integer = condition
1625 .data.ptr = (
void *)
data,
1627 char condition_name[256];
1628 unsigned int duration;
1635 switch (condition) {
1640 pjmedia_sdp_neg_get_state(channel->
session->
inv_session->neg) == PJMEDIA_SDP_NEG_STATE_DONE)) {
1643 response_code = 180;
1645 response_code = 183;
1648 response_code = 180;
1657 response_code = 486;
1664 response_code = 503;
1671 response_code = 484;
1678 response_code = 100;
1685 response_code = 183;
1758 if (*(
int *)
data) {
1777 device_buf = alloca(device_buf_size);
1784 ast_log(
LOG_WARNING,
"Could not queue task to remotely put session '%s' on hold with endpoint '%s'\n",
1793 device_buf = alloca(device_buf_size);
1800 ast_log(
LOG_WARNING,
"Could not queue task to remotely take session '%s' off hold with endpoint '%s'\n",
1812 response_code = 181;
1848 if (response_code) {
1856 ast_log(
LOG_ERROR,
"%s: Cannot send response code %d to endpoint %s. Could not queue task properly\n",
1900 pjsip_tx_data *packet;
1905 if (pjsip_inv_end_session(
session->inv_session, 302,
NULL, &packet) != PJ_SUCCESS
1915 if (!(
contact = pjsip_msg_find_hdr(packet->msg, PJSIP_H_CONTACT,
NULL))) {
1916 contact = pjsip_contact_hdr_create(packet->pool);
1919 pj_strdup2_with_null(packet->pool, &
tmp,
target);
1920 if (!(
contact->uri = pjsip_parse_uri(packet->pool,
tmp.ptr,
tmp.slen, PJSIP_PARSE_URI_AS_NAMEADDR))) {
1925 pjsip_tx_data_dec_ref(packet);
1929 pjsip_msg_add_hdr(packet->msg, (pjsip_hdr *)
contact);
1937 .name = {
"REFER Callback", 14 },
1963 if (pjsip_evsub_get_state(
sub) == PJSIP_EVSUB_STATE_ACCEPTED) {
1965 pjsip_rx_data *rdata;
1966 pjsip_generic_string_hdr *refer_sub;
1967 const pj_str_t REFER_SUB = {
"Refer-Sub", 9 };
1972 if (
event->type == PJSIP_EVENT_TSX_STATE &&
event->body.tsx_state.type == PJSIP_EVENT_RX_MSG) {
1973 rdata =
event->body.tsx_state.src.rdata;
1976 refer_sub = pjsip_msg_find_hdr_by_name(rdata->msg_info.msg, &REFER_SUB,
NULL);
1982 if (refer_sub && !pj_stricmp2(&refer_sub->hvalue,
"false")) {
1987 pjsip_evsub_terminate(
sub, PJ_TRUE);
1991 }
else if (pjsip_evsub_get_state(
sub) == PJSIP_EVSUB_STATE_ACTIVE ||
1992 pjsip_evsub_get_state(
sub) == PJSIP_EVSUB_STATE_TERMINATED) {
1995 pjsip_msg_body *body;
1996 pjsip_status_line status_line = { .code = 0 };
2000 if (
event->type == PJSIP_EVENT_TSX_STATE &&
event->body.tsx_state.type == PJSIP_EVENT_RX_MSG) {
2001 pjsip_rx_data *rdata;
2003 rdata =
event->body.tsx_state.src.rdata;
2004 msg = rdata->msg_info.msg;
2006 if (msg->type == PJSIP_REQUEST_MSG) {
2007 if (!pjsip_method_cmp(&msg->line.req.method, pjsip_get_notify_method())) {
2009 if (body && !pj_stricmp2(&body->content_type.type,
"message")
2010 && !pj_stricmp2(&body->content_type.subtype,
"sipfrag")) {
2011 pjsip_parse_status_line((
char *)body->data, body->len, &status_line);
2015 status_line.code = msg->line.status.code;
2016 status_line.reason = msg->line.status.reason;
2019 status_line.code = 500;
2020 status_line.reason = *pjsip_get_status_text(500);
2023 is_last = (pjsip_evsub_get_state(
sub) == PJSIP_EVSUB_STATE_TERMINATED);
2025 if (status_line.code >= 200 || is_last) {
2033 if (status_line.code < 200) {
2035 }
else if (status_line.code >= 300) {
2042 pjsip_tx_data *tdata;
2044 status = pjsip_evsub_initiate(
sub, pjsip_get_subscribe_method(), 0, &tdata);
2045 if (
status == PJ_SUCCESS) {
2046 pjsip_evsub_send_request(
sub, tdata);
2051 ast_debug(3,
"Transfer channel %s completed: %d %.*s (%s)\n",
2054 (
int)status_line.reason.slen, status_line.reason.ptr,
2070 pjsip_tx_data *packet;
2071 const char *ref_by_val;
2072 char local_info[pj_strlen(&
session->inv_session->dlg->local.info_str) + 1];
2073 struct pjsip_evsub_user xfer_cb;
2076 pj_bzero(&xfer_cb,
sizeof(xfer_cb));
2079 if (pjsip_xfer_create_uac(
session->inv_session->dlg, &xfer_cb, &
sub) != PJ_SUCCESS) {
2092 if (pjsip_xfer_initiate(
sub, pj_cstr(&
tmp, target), &packet) != PJ_SUCCESS) {
2104 if (pjsip_xfer_send_request(
sub, packet) == PJ_SUCCESS) {
2112 pjsip_evsub_terminate(
sub, PJ_FALSE);
2122 const char *target = trnf_data->
target;
2180 if (!media || !media->
rtp) {
2187 if (!media || !media->
rtp) {
2244 struct pjsip_tx_data *tdata;
2249 .
type =
"application",
2250 .subtype =
"dtmf-relay",
2253 if (
session->inv_session->state == PJSIP_INV_STATE_DISCONNECTED) {
2256 pjsip_get_status_text(
session->inv_session->cause)->ptr);
2264 ast_str_set(&
body_text, 0,
"Signal=%c\r\nDuration=%u\r\n", dtmf_data->digit, dtmf_data->duration);
2274 pjsip_tx_data_dec_ref(tdata);
2288 if (!channel || !channel->
session) {
2299 if (!media || !media->
rtp) {
2304 ast_debug(3,
"Told to send end of digit on Auto-Info channel %s RFC4733 negotiated so using it.\n",
ast_channel_name(ast));
2309 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));
2328 if (!media || !media->
rtp) {
2335 if (!media || !media->
rtp) {
2383 pjsip_tx_data *tdata;
2462 ast_debug(1,
"AST hangup cause %d (no match found in PJSIP)\n", cause);
2519 int cause = h_data->
cause;
2544 if (!channel || !channel->
session) {
2556 ast_log(
LOG_WARNING,
"Unable to push hangup task to the threadpool. Expect bad things\n");
2594 ast_log(
LOG_ERROR,
"Unable to create PJSIP channel with empty destination\n");
2603 if ((endpoint_name = strchr(
args.endpoint,
'@'))) {
2604 request_user =
args.endpoint;
2605 *endpoint_name++ =
'\0';
2607 endpoint_name =
args.endpoint;
2612 ast_log(
LOG_ERROR,
"Unable to create PJSIP channel with empty endpoint name: %s@<endpoint-name>\n",
2615 ast_log(
LOG_ERROR,
"Unable to create PJSIP channel with empty endpoint name\n");
2623 ast_log(
LOG_ERROR,
"Unable to create PJSIP channel - endpoint '%s' was not found\n", endpoint_name);
2629 endpoint_name =
args.endpoint;
2631 ast_log(
LOG_ERROR,
"Unable to create PJSIP channel with empty endpoint name\n");
2642 endpoint_name = strchr(
args.endpoint,
'@');
2643 if (!endpoint_name) {
2648 ast_log(
LOG_ERROR,
"Unable to create PJSIP channel - endpoint '%s' was not found\n",
2653 request_user =
args.endpoint;
2654 *endpoint_name++ =
'\0';
2657 ast_log(
LOG_ERROR,
"Unable to create PJSIP channel with empty endpoint name: %s@<endpoint-name>\n",
2666 ast_log(
LOG_ERROR,
"Unable to create PJSIP channel - endpoint '%s' was not found\n", endpoint_name);
2677 ast_log(
LOG_ERROR,
"Failed to create outgoing session to endpoint '%s'\n", endpoint_name);
2696 req_data.
dest = data;
2768 pjsip_tx_data *tdata;
2779 sep = strchr(content_type,
'/');
2782 body.
type = content_type;
2792 pjsip_from_hdr *hdr;
2793 pjsip_name_addr *name_addr;
2796 int invalidate_tdata = 0;
2806 hdr = PJSIP_MSG_FROM_HDR(tdata->msg);
2807 name_addr = (pjsip_name_addr *) hdr->uri;
2808 pj_strdup2(tdata->pool, &name_addr->display, from);
2809 invalidate_tdata = 1;
2817 hdr = PJSIP_MSG_TO_HDR(tdata->msg);
2818 name_addr = (pjsip_name_addr *) hdr->uri;
2819 pj_strdup2(tdata->pool, &name_addr->display, to);
2820 invalidate_tdata = 1;
2823 if (invalidate_tdata) {
2824 pjsip_tx_data_invalidate_msg(tdata);
2841 ast_debug(1,
"Sending MESSAGE from '%s' to '%s:%s': %s\n",
2866 .value = (
char *)
text,
2955 if (cause < 500 && cause >= 400) {
2958 }
else if (cause < 600 && cause >= 500) {
2961 }
else if (cause < 700 && cause >= 600) {
2976 if (
session->endpoint->media.direct_media.glare_mitigation ==
2982 "direct_media_glare_mitigation");
3017 pjsip_sip_uri *sip_ruri = pjsip_uri_get_uri(
session->request_uri);
3018 size_t size = pj_strlen(&sip_ruri->host) + 1;
3032 pjsip_tx_data *packet =
NULL;
3040 if (rdata->msg_info.to->tag.slen) {
3060 transport_data =
ast_calloc(1,
sizeof(*transport_data));
3061 if (!transport_data) {
3064 pj_sockaddr_cp(&transport_data->
local_addr, &rdata->tp_info.transport->local_addr);
3065 pj_sockaddr_cp(&transport_data->
remote_addr, &rdata->pkt_info.src_addr);
3066 datastore->
data = transport_data;
3070 if (pjsip_inv_end_session(
session->inv_session, 503,
NULL, &packet) == PJ_SUCCESS
3092 if (rdata->msg_info.to->tag.slen) {
3099 ast_log(
LOG_ERROR,
"Unable to retrieve pickup configuration options. Unable to detect call pickup extension.\n");
3142 if (rdata->msg_info.to->tag.slen) {
3179 struct pjsip_status_line
status = rdata->msg_info.msg->line.status;
3181 int data_size =
sizeof(*cause_code);
3190 data_size += 4 + 4 + pj_strlen(&
status.reason);
3192 memset(cause_code, 0, data_size);
3196 snprintf(cause_code->
code, data_size -
sizeof(*cause_code) + 1,
"SIP %d %.*s",
status.code,
3197 (
int) pj_strlen(&
status.reason), pj_strbuf(&
status.reason));
3209 struct pjsip_status_line
status = rdata->msg_info.msg->line.status;
3218 pjsip_rdata_sdp_info *sdp = pjsip_rdata_get_sdp_info(rdata);
3219 if (sdp && sdp->body.ptr) {
3235 if (
session->endpoint->ignore_183_without_sdp) {
3236 pjsip_rdata_sdp_info *sdp = pjsip_rdata_get_sdp_info(rdata);
3237 if (sdp && sdp->body.ptr) {
3240 (
int)rdata->msg_info.cseq->method.name.slen, rdata->msg_info.cseq->method.name.ptr,
status.code);
3246 (
int)rdata->msg_info.cseq->method.name.slen, rdata->msg_info.cseq->method.name.ptr,
status.code);
3266 if (rdata->msg_info.msg->line.req.method.id == PJSIP_ACK_METHOD) {
3267 if (
session->endpoint->media.direct_media.enabled &&
session->channel) {
3283 .
name =
"PJSIP_DIAL_CONTACTS",
3288 .
name =
"PJSIP_PARSE_URI",
3293 .
name =
"PJSIP_MEDIA_OFFER",
3299 .
name =
"PJSIP_DTMF_MODE",
3305 .
name =
"PJSIP_MOH_PASSTHROUGH",
3311 .
name =
"PJSIP_SEND_SESSION_REFRESH",
3343 ast_log(
LOG_ERROR,
"Unable to register PJSIP_DIAL_CONTACTS dialplan function\n");
3348 ast_log(
LOG_ERROR,
"Unable to register PJSIP_PARSE_URI dialplan function\n");
3363 ast_log(
LOG_WARNING,
"Unable to register PJSIP_MOH_PASSTHROUGH dialplan function\n");
3368 ast_log(
LOG_WARNING,
"Unable to register PJSIP_SEND_SESSION_REFRESH dialplan function\n");
3458 .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_NORMAL_TEMPORARY_FAILURE
#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_RECOVERY_ON_TIMER_EXPIRE
#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 char exten[AST_MAX_EXTENSION]
static char cid_name[AST_MAX_EXTENSION]
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 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 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 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 struct topology_change_refresh_data * topology_change_refresh_data_alloc(struct ast_sip_session *session, const struct ast_stream_topology *topology)
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 struct sendtext_data * sendtext_data_create(struct ast_channel *chan, struct ast_msg_data *msg)
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 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 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 transfer_data * transfer_data_alloc(struct ast_sip_session *session, const char *target)
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 int hangup_sip2cause(int cause)
Convert SIP hangup causes to Asterisk hangup causes.
static void transport_info_destroy(void *obj)
Destructor function for transport_info_data.
static int send_direct_media_request(void *data)
static struct hangup_data * hangup_data_alloc(int cause, struct ast_channel *chan)
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 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 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 indicate_data * indicate_data_alloc(struct ast_sip_session *session, int condition, int response_code, const void *frame_data, size_t datalen)
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 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 const char * chan_pjsip_get_uniqueid(struct ast_channel *ast)
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_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 void local_hold_set_state(struct ast_sip_session_media *session_media, unsigned int held)
Callback which changes the value of locally held on the media stream.
static struct ast_custom_function dtmf_mode_function
PJSIP Channel Driver shared data structures.
enum sip_cc_notify_state state
General Asterisk PBX channel definitions.
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_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.
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.
#define ast_channel_alloc_with_endpoint(needqueue, state, cid_num, cid_name, acctcode, exten, context, assignedids, requestor, amaflag, endpoint,...)
struct ast_format * ast_channel_writeformat(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.
const char * ast_channel_uniqueid(const struct ast_channel *chan)
void ast_channel_nativeformats_set(struct ast_channel *chan, struct ast_format_cap *value)
void * ast_channel_tech_pvt(const struct ast_channel *chan)
int ast_channel_fdno(const struct ast_channel *chan)
#define ast_channel_lock(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.
const char * ast_channel_context(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.
struct ast_party_dialed * ast_channel_dialed(struct ast_channel *chan)
#define ast_channel_ref(c)
Increase channel reference count.
struct ast_trans_pvt * ast_channel_readtrans(const struct ast_channel *chan)
const char * ast_channel_name(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.
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)
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_format * ast_channel_rawreadformat(struct ast_channel *chan)
const char * ast_channel_exten(const struct ast_channel *chan)
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.
struct ast_format * ast_channel_readformat(struct ast_channel *chan)
@ 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_set_readformat(struct ast_channel *chan, struct ast_format *format)
struct ast_trans_pvt * ast_channel_writetrans(const struct ast_channel *chan)
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.
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.
struct ast_party_caller * ast_channel_caller(struct ast_channel *chan)
void ast_channel_set_fd(struct ast_channel *chan, int which, int fd)
struct ast_format * ast_channel_rawwriteformat(struct ast_channel *chan)
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)
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.
const char * ast_channel_macrocontext(const struct ast_channel *chan)
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)
#define ast_channel_unlock(chan)
void ast_channel_set_writeformat(struct ast_channel *chan, struct ast_format *format)
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.
Convenient Signal Processing routines.
void ast_dsp_free(struct ast_dsp *dsp)
#define DSP_FEATURE_FAX_DETECT
int ast_dsp_get_features(struct ast_dsp *dsp)
Get features.
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,...
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)
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,...
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_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.
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.
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_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.
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_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
#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.
#define AST_OPTION_T38_STATE
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.
@ 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 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_verb(level,...)
#define ast_trace_get_indent()
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
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.
@ AST_MODULE_LOAD_DECLINE
Module has failed to load, may be in an inconsistent state.
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.
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.
const char * pbx_builtin_getvar_helper(struct ast_channel *chan, const char *name)
Return a pointer to the value of the corresponding channel variable.
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.
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_acf_moh_passthrough_write(struct ast_channel *chan, const char *cmd, char *data, const char *value)
PJSIP_MOH_PASSTHROUGH function write callback.
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.
static int cdata(void *userdata, int state, const char *cdata, size_t len)
struct stasis_forward * sub
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.
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 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.
@ AST_SIP_MEDIA_ENCRYPT_NONE
struct ast_sorcery * ast_sip_get_sorcery(void)
Get a pointer to the SIP sorcery structure.
@ 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.
@ 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_media_state * ast_sip_session_media_state_alloc(void)
Allocate a session media state structure.
struct ast_datastore * ast_sip_session_get_datastore(struct ast_sip_session *session, const char *name)
Retrieve a session datastore.
struct ast_datastore * ast_sip_session_alloc_datastore(const struct ast_datastore_info *info, const char *uid)
Alternative for ast_datastore_alloc()
void ast_sip_session_send_request(struct ast_sip_session *session, pjsip_tx_data *tdata)
Send a SIP request.
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.
const char * ast_sip_session_get_name(const struct ast_sip_session *session)
Get the channel or endpoint name associated with the session.
struct ast_sip_channel_pvt * ast_sip_channel_pvt_alloc(void *pvt, struct ast_sip_session *session)
Allocate a new SIP channel pvt structure.
#define ast_sip_session_register_supplement(supplement)
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.
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.
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.
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.
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
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.
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_sorcery_object_get_id(const void *object)
Get the unique identifier of a sorcery object.
struct ast_stream_topology * ast_stream_topology_clone(const struct ast_stream_topology *topology)
Create a deep clone of an existing stream topology.
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.
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 * ast_stream_topology_get_stream(const struct ast_stream_topology *topology, unsigned int position)
Get a specific stream from the 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.
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
#define S_OR(a, b)
returns the equivalent of logic or for strings: first one if not empty, otherwise second one.
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