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",
322 int changed = 0, position = -1;
331 if (position != -1) {
349 if (position != -1) {
495 const char *channel_id)
503 if (!session_media || !session_media->
rtp) {
566 assignedids, requestor, 0,
599 if (!topology || !caps) {
658 ast_log(
LOG_ERROR,
"Unknown country code '%s' for tonezone. Check indications.conf for available country codes.\n", session->
endpoint->
zone);
666 var->
value, buf,
sizeof(buf)));
685 pj_status_t
status = PJ_SUCCESS;
686 pjsip_tx_data *packet =
NULL;
690 if (session->
inv_session->state == PJSIP_INV_STATE_DISCONNECTED) {
693 pjsip_get_status_text(session->
inv_session->cause)->ptr);
701 ast_log(
LOG_ERROR,
"Cannot answer '%s' because there is no associated SIP transaction\n",
706 if (status == PJ_SUCCESS && packet) {
710 if (status != PJ_SUCCESS) {
711 char err[PJ_ERR_MSG_SIZE];
713 pj_strerror(status, err,
sizeof(err));
751 ast_log(
LOG_ERROR,
"Cannot answer '%s': Unable to push answer task to the threadpool.\n",
768 const char *target_context;
802 ast_verb(2,
"Redirecting '%s' to fax extension due to CNG detection\n",
806 ast_log(
LOG_ERROR,
"Failed to async goto '%s' into fax extension in '%s'\n",
881 ast_debug(1,
"Oooh, got a frame with format of %s on channel '%s' when we're sending '%s', switching to match\n",
904 ast_debug(1,
"Oooh, got a frame with format of %s on channel '%s' when it has not been negotiated\n",
917 dsp_features &= ~DSP_FEATURE_FAX_DETECT;
924 ast_debug(3,
"Channel driver fax CNG detection timeout on %s\n",
932 ast_debug(3,
"Channel driver fax CNG detected on %s\n",
957 if (stream_num >= 0) {
969 ast_debug(3,
"Channel %s stream %d is of type '%s', not audio!\n",
979 "Channel %s asked to send %s frame when native formats are %s (rd:%s->%s;%s wr:%s->%s;%s)\n",
999 ast_debug(3,
"Channel %s stream %d is of type '%s', not video!\n",
1010 ast_debug(3,
"Channel %s stream %d is of type '%s', not image!\n",
1024 ast_debug(3,
"Channel %s stream %d is of type '%s', not video! Unable to write RTCP feedback.\n",
1068 const char *key = obj;
1086 const char *left = obj_left;
1087 const char *right = obj_right;
1093 cmp = strcmp(left, right);
1096 cmp = strncmp(left, right, strlen(right));
1136 if (
ao2_link(pjsip_uids_onhold, hold_uid) == 0) {
1189 if (!endpoint_snapshot) {
1199 if (!endpoint_snapshot->num_channels) {
1205 for (num = 0; num < endpoint_snapshot->num_channels; num++) {
1227 if (endpoint->devicestate_busy_at && (inuse == endpoint->devicestate_busy_at)) {
1323 memcpy(ind_data->
frame_data, frame_data, datalen);
1335 pjsip_tx_data *packet =
NULL;
1340 if ((session->
inv_session->state != PJSIP_INV_STATE_DISCONNECTED) &&
1341 (pjsip_inv_answer(session->
inv_session, response_code,
NULL,
NULL, &packet) == PJ_SUCCESS)) {
1354 "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n" 1355 " <media_control>\r\n" 1356 " <vc_primitive>\r\n" 1358 " <picture_fast_update/>\r\n" 1359 " </to_encoder>\r\n" 1360 " </vc_primitive>\r\n" 1361 " </media_control>\r\n";
1364 .
type =
"application",
1365 .subtype =
"media_control+xml",
1370 struct pjsip_tx_data *tdata;
1372 if (session->
inv_session->state == PJSIP_INV_STATE_DISCONNECTED) {
1375 pjsip_get_status_text(session->
inv_session->cause)->ptr);
1384 ast_log(
LOG_ERROR,
"Could not add body to text video update INFO request\n");
1405 int update_allowed = 0;
1425 return update_allowed;
1433 if (session->
inv_session->state == PJSIP_INV_STATE_DISCONNECTED) {
1436 pjsip_get_status_text(session->
inv_session->cause)->ptr);
1442 || session->
inv_session->role == PJSIP_ROLE_UAC) {
1445 int generate_new_sdp;
1448 if (session->
inv_session->options & PJSIP_INV_SUPPORT_UPDATE) {
1458 && session->
inv_session->state != PJSIP_INV_STATE_DISCONNECTED
1460 int response_code = 0;
1465 response_code = 183;
1468 if (response_code) {
1469 struct pjsip_tx_data *packet =
NULL;
1471 if (pjsip_inv_answer(session->
inv_session, response_code,
NULL,
NULL, &packet) == PJ_SUCCESS) {
1484 if (session_media) {
1529 refresh_data =
ast_calloc(1,
sizeof(*refresh_data));
1530 if (!refresh_data) {
1546 return refresh_data;
1552 rdata->msg_info.msg->line.status.code,
1557 if (PJSIP_IS_STATUS_IN_CLASS(rdata->msg_info.msg->line.status.code, 200)) {
1566 }
else if (300 <= rdata->msg_info.msg->line.status.code) {
1600 if (!refresh_data) {
1616 int response_code = 0;
1619 size_t device_buf_size;
1625 .integer = condition
1628 .data.ptr = (
void *)data,
1630 char condition_name[256];
1634 switch (condition) {
1639 pjmedia_sdp_neg_get_state(channel->
session->
inv_session->neg) == PJMEDIA_SDP_NEG_STATE_DONE)) {
1640 response_code = 183;
1643 response_code = 180;
1652 response_code = 486;
1659 response_code = 503;
1666 response_code = 484;
1673 response_code = 100;
1680 response_code = 183;
1737 if (*(
int *) data) {
1756 device_buf = alloca(device_buf_size);
1763 ast_log(
LOG_WARNING,
"Could not queue task to remotely put session '%s' on hold with endpoint '%s'\n",
1772 device_buf = alloca(device_buf_size);
1779 ast_log(
LOG_WARNING,
"Could not queue task to remotely take session '%s' off hold with endpoint '%s'\n",
1791 response_code = 181;
1827 if (response_code) {
1835 ast_log(
LOG_ERROR,
"%s: Cannot send response code %d to endpoint %s. Could not queue task properly\n",
1879 pjsip_tx_data *packet;
1884 if (pjsip_inv_end_session(session->
inv_session, 302,
NULL, &packet) != PJ_SUCCESS
1894 if (!(contact = pjsip_msg_find_hdr(packet->msg, PJSIP_H_CONTACT,
NULL))) {
1895 contact = pjsip_contact_hdr_create(packet->pool);
1898 pj_strdup2_with_null(packet->pool, &tmp, target);
1899 if (!(contact->uri = pjsip_parse_uri(packet->pool, tmp.ptr, tmp.slen, PJSIP_PARSE_URI_AS_NAMEADDR))) {
1904 pjsip_tx_data_dec_ref(packet);
1908 pjsip_msg_add_hdr(packet->msg, (pjsip_hdr *) contact);
1916 .name = {
"REFER Callback", 14 },
1942 if (pjsip_evsub_get_state(sub) == PJSIP_EVSUB_STATE_ACCEPTED) {
1944 pjsip_rx_data *rdata;
1945 pjsip_generic_string_hdr *refer_sub;
1946 const pj_str_t REFER_SUB = {
"Refer-Sub", 9 };
1951 if (event->type == PJSIP_EVENT_TSX_STATE && event->body.tsx_state.type == PJSIP_EVENT_RX_MSG) {
1952 rdata =
event->body.tsx_state.src.rdata;
1955 refer_sub = pjsip_msg_find_hdr_by_name(rdata->msg_info.msg, &REFER_SUB,
NULL);
1961 if (refer_sub && !pj_stricmp2(&refer_sub->hvalue,
"false")) {
1966 pjsip_evsub_terminate(sub, PJ_TRUE);
1970 }
else if (pjsip_evsub_get_state(sub) == PJSIP_EVSUB_STATE_ACTIVE ||
1971 pjsip_evsub_get_state(sub) == PJSIP_EVSUB_STATE_TERMINATED) {
1974 pjsip_msg_body *body;
1975 pjsip_status_line status_line = { .code = 0 };
1979 if (event->type == PJSIP_EVENT_TSX_STATE && event->body.tsx_state.type == PJSIP_EVENT_RX_MSG) {
1980 pjsip_rx_data *rdata;
1982 rdata =
event->body.tsx_state.src.rdata;
1983 msg = rdata->msg_info.msg;
1985 if (msg->type == PJSIP_REQUEST_MSG) {
1986 if (!pjsip_method_cmp(&msg->line.req.method, pjsip_get_notify_method())) {
1988 if (body && !pj_stricmp2(&body->content_type.type,
"message")
1989 && !pj_stricmp2(&body->content_type.subtype,
"sipfrag")) {
1990 pjsip_parse_status_line((
char *)body->data, body->len, &status_line);
1994 status_line.code = msg->line.status.code;
1995 status_line.reason = msg->line.status.reason;
1998 status_line.code = 500;
1999 status_line.reason = *pjsip_get_status_text(500);
2002 is_last = (pjsip_evsub_get_state(sub) == PJSIP_EVSUB_STATE_TERMINATED);
2004 if (status_line.code >= 200 || is_last) {
2012 if (status_line.code < 200) {
2014 }
else if (status_line.code >= 300) {
2015 message = status_line.code;
2021 pjsip_tx_data *tdata;
2023 status = pjsip_evsub_initiate(sub, pjsip_get_subscribe_method(), 0, &tdata);
2024 if (status == PJ_SUCCESS) {
2025 pjsip_evsub_send_request(sub, tdata);
2030 ast_debug(3,
"Transfer channel %s completed: %d %.*s (%s)\n",
2033 (
int)status_line.reason.slen, status_line.reason.ptr,
2049 pjsip_tx_data *packet;
2050 const char *ref_by_val;
2051 char local_info[pj_strlen(&session->
inv_session->dlg->local.info_str) + 1];
2052 struct pjsip_evsub_user xfer_cb;
2055 pj_bzero(&xfer_cb,
sizeof(xfer_cb));
2058 if (pjsip_xfer_create_uac(session->
inv_session->dlg, &xfer_cb, &sub) != PJ_SUCCESS) {
2071 if (pjsip_xfer_initiate(sub, pj_cstr(&tmp, target), &packet) != PJ_SUCCESS) {
2083 if (pjsip_xfer_send_request(sub, packet) == PJ_SUCCESS) {
2091 pjsip_evsub_terminate(sub, PJ_FALSE);
2101 const char *target = trnf_data->
target;
2113 target = contact->
uri;
2159 if (!media || !media->
rtp) {
2166 if (!media || !media->
rtp) {
2223 struct pjsip_tx_data *tdata;
2228 .
type =
"application",
2229 .subtype =
"dtmf-relay",
2232 if (session->
inv_session->state == PJSIP_INV_STATE_DISCONNECTED) {
2235 pjsip_get_status_text(session->
inv_session->cause)->ptr);
2243 ast_str_set(&
body_text, 0,
"Signal=%c\r\nDuration=%u\r\n", dtmf_data->digit, dtmf_data->duration);
2253 pjsip_tx_data_dec_ref(tdata);
2267 if (!channel || !channel->
session) {
2278 if (!media || !media->
rtp) {
2283 ast_debug(3,
"Told to send end of digit on Auto-Info channel %s RFC4733 negotiated so using it.\n",
ast_channel_name(ast));
2288 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));
2307 if (!media || !media->
rtp) {
2314 if (!media || !media->
rtp) {
2352 connected.
id = session->
id;
2362 pjsip_tx_data *tdata;
2441 ast_debug(1,
"AST hangup cause %d (no match found in PJSIP)\n", cause);
2498 int cause = h_data->
cause;
2523 if (!channel || !channel->
session) {
2535 ast_log(
LOG_WARNING,
"Unable to push hangup task to the threadpool. Expect bad things\n");
2573 ast_log(
LOG_ERROR,
"Unable to create PJSIP channel with empty destination\n");
2582 if ((endpoint_name = strchr(
args.endpoint,
'@'))) {
2583 request_user =
args.endpoint;
2584 *endpoint_name++ =
'\0';
2586 endpoint_name =
args.endpoint;
2591 ast_log(
LOG_ERROR,
"Unable to create PJSIP channel with empty endpoint name: %s@<endpoint-name>\n",
2594 ast_log(
LOG_ERROR,
"Unable to create PJSIP channel with empty endpoint name\n");
2602 ast_log(
LOG_ERROR,
"Unable to create PJSIP channel - endpoint '%s' was not found\n", endpoint_name);
2608 endpoint_name =
args.endpoint;
2610 ast_log(
LOG_ERROR,
"Unable to create PJSIP channel with empty endpoint name\n");
2621 endpoint_name = strchr(
args.endpoint,
'@');
2622 if (!endpoint_name) {
2627 ast_log(
LOG_ERROR,
"Unable to create PJSIP channel - endpoint '%s' was not found\n",
2632 request_user =
args.endpoint;
2633 *endpoint_name++ =
'\0';
2636 ast_log(
LOG_ERROR,
"Unable to create PJSIP channel with empty endpoint name: %s@<endpoint-name>\n",
2645 ast_log(
LOG_ERROR,
"Unable to create PJSIP channel - endpoint '%s' was not found\n", endpoint_name);
2656 ast_log(
LOG_ERROR,
"Failed to create outgoing session to endpoint '%s'\n", endpoint_name);
2675 req_data.
dest = data;
2680 *cause = req_data.
cause;
2747 pjsip_tx_data *tdata;
2758 sep = strchr(content_type,
'/');
2761 body.
type = content_type;
2771 pjsip_from_hdr *hdr;
2772 pjsip_name_addr *name_addr;
2775 int invalidate_tdata = 0;
2785 hdr = PJSIP_MSG_FROM_HDR(tdata->msg);
2786 name_addr = (pjsip_name_addr *) hdr->uri;
2787 pj_strdup2(tdata->pool, &name_addr->display, from);
2788 invalidate_tdata = 1;
2796 hdr = PJSIP_MSG_TO_HDR(tdata->msg);
2797 name_addr = (pjsip_name_addr *) hdr->uri;
2798 pj_strdup2(tdata->pool, &name_addr->display, to);
2799 invalidate_tdata = 1;
2802 if (invalidate_tdata) {
2803 pjsip_tx_data_invalidate_msg(tdata);
2820 ast_debug(1,
"Sending MESSAGE from '%s' to '%s:%s': %s\n",
2845 .value = (
char *)text,
2934 if (cause < 500 && cause >= 400) {
2937 }
else if (cause < 600 && cause >= 500) {
2940 }
else if (cause < 700 && cause >= 600) {
2961 "direct_media_glare_mitigation");
2996 pjsip_sip_uri *sip_ruri = pjsip_uri_get_uri(session->
request_uri);
2997 size_t size = pj_strlen(&sip_ruri->host) + 1;
3011 pjsip_tx_data *packet =
NULL;
3019 if (rdata->msg_info.to->tag.slen) {
3039 transport_data =
ast_calloc(1,
sizeof(*transport_data));
3040 if (!transport_data) {
3043 pj_sockaddr_cp(&transport_data->
local_addr, &rdata->tp_info.transport->local_addr);
3044 pj_sockaddr_cp(&transport_data->
remote_addr, &rdata->pkt_info.src_addr);
3045 datastore->data = transport_data;
3049 if (pjsip_inv_end_session(session->
inv_session, 503,
NULL, &packet) == PJ_SUCCESS
3071 if (rdata->msg_info.to->tag.slen) {
3078 ast_log(
LOG_ERROR,
"Unable to retrieve pickup configuration options. Unable to detect call pickup extension.\n");
3121 if (rdata->msg_info.to->tag.slen) {
3158 struct pjsip_status_line status = rdata->msg_info.msg->line.status;
3160 int data_size =
sizeof(*cause_code);
3169 data_size += 4 + 4 + pj_strlen(&status.reason);
3171 memset(cause_code, 0, data_size);
3175 snprintf(cause_code->
code, data_size -
sizeof(*cause_code) + 1,
"SIP %d %.*s", status.code,
3176 (
int) pj_strlen(&status.reason), pj_strbuf(&status.reason));
3188 struct pjsip_status_line status = rdata->msg_info.msg->line.status;
3195 switch (status.code) {
3197 pjsip_rdata_sdp_info *sdp = pjsip_rdata_get_sdp_info(rdata);
3198 if (sdp && sdp->body.ptr) {
3215 pjsip_rdata_sdp_info *sdp = pjsip_rdata_get_sdp_info(rdata);
3216 if (sdp && sdp->body.ptr) {
3219 (
int)rdata->msg_info.cseq->method.name.slen, rdata->msg_info.cseq->method.name.ptr, status.code);
3225 (
int)rdata->msg_info.cseq->method.name.slen, rdata->msg_info.cseq->method.name.ptr, status.code);
3245 if (rdata->msg_info.msg->line.req.method.id == PJSIP_ACK_METHOD) {
3262 .
name =
"PJSIP_DIAL_CONTACTS",
3267 .
name =
"PJSIP_PARSE_URI",
3272 .
name =
"PJSIP_MEDIA_OFFER",
3278 .
name =
"PJSIP_DTMF_MODE",
3284 .
name =
"PJSIP_MOH_PASSTHROUGH",
3290 .
name =
"PJSIP_SEND_SESSION_REFRESH",
3322 ast_log(
LOG_ERROR,
"Unable to register PJSIP_DIAL_CONTACTS dialplan function\n");
3327 ast_log(
LOG_ERROR,
"Unable to register PJSIP_PARSE_URI dialplan function\n");
3342 ast_log(
LOG_WARNING,
"Unable to register PJSIP_MOH_PASSTHROUGH dialplan function\n");
3347 ast_log(
LOG_WARNING,
"Unable to register PJSIP_SEND_SESSION_REFRESH dialplan function\n");
3383 pjsip_uids_onhold =
NULL;
3406 pjsip_uids_onhold =
NULL;
3437 .requires =
"res_pjsip,res_pjsip_session,res_pjsip_pubsub",
static int remote_send_hold(void *data)
Update local hold state to be held.
struct ast_party_caller * ast_channel_caller(struct ast_channel *chan)
struct ast_sip_endpoint_pickup_configuration pickup
struct ast_variable * next
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.
#define AST_THREADSTORAGE(name)
Define a thread storage variable.
static int direct_media_mitigate_glare(struct ast_sip_session *session)
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 ast_queue_hangup(struct ast_channel *chan)
Queue a hangup frame.
static struct sendtext_data * sendtext_data_create(struct ast_channel *chan, struct ast_msg_data *msg)
#define SCOPE_EXIT_LOG_RTN_VALUE(__value, __log_level,...)
struct ast_sip_session * session
static struct ast_custom_function session_refresh_function
void ast_sip_session_send_request(struct ast_sip_session *session, pjsip_tx_data *tdata)
Send a SIP request.
Information needed to identify an endpoint in a call.
enum sip_cc_notify_state state
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.
void ast_party_connected_line_init(struct ast_party_connected_line *init)
Initialize the given connected line structure.
static unsigned int chan_idx
void ast_channel_pickupgroup_set(struct ast_channel *chan, ast_group_t value)
enum ast_sip_session_t38state t38state
#define ast_channel_lock(chan)
static int indicate(void *data)
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...
static char exten[AST_MAX_EXTENSION]
Main Channel structure associated with a channel.
struct ast_sip_endpoint * endpoint
struct ast_party_dialed::@246 number
Dialed/Called number.
pj_sockaddr local_addr
Our address that received the request.
struct ast_sip_session_media_state * ast_sip_session_media_state_alloc(void)
Allocate a session media state structure.
ast_device_state
Device States.
static int chan_pjsip_queryoption(struct ast_channel *ast, int option, void *data, int *datalen)
Function called to query options on a channel.
char * str
Subscriber phone number (Malloced)
void ast_sip_session_media_state_free(struct ast_sip_session_media_state *media_state)
Free a session media state structure.
struct ast_channel_snapshot_base * base
Asterisk locking-related definitions:
Asterisk main include file. File version handling, generic pbx functions.
static int is_colp_update_allowed(struct ast_sip_session *session)
struct ast_features_pickup_config * ast_get_chan_features_pickup_config(struct ast_channel *chan)
Get the pickup configuration options for a channel.
char * str
Subscriber phone number (Malloced)
char chan_name[AST_CHANNEL_NAME]
int ast_queue_control(struct ast_channel *chan, enum ast_control_frame_type control)
Queue a control frame without payload.
Channels have this property if they implement send_text_data.
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.
void * ast_threadstorage_get(struct ast_threadstorage *ts, size_t init_size)
Retrieve thread storage.
static int transfer(void *data)
static void chan_pjsip_pvt_dtor(void *obj)
void ast_rtp_instance_set_channel_id(struct ast_rtp_instance *instance, const char *uniqueid)
Set the channel that owns this RTP instance.
struct ast_sip_session_media_state * pending_media_state
#define ast_channel_alloc_with_endpoint(needqueue, state, cid_num, cid_name, acctcode, exten, context, assignedids, requestor, amaflag, endpoint,...)
#define SCOPE_ENTER_TASK(level, indent,...)
char * ast_get_encoded_str(const char *stream, char *result, size_t result_len)
Decode a stream of encoded control or extended ASCII characters.
static struct ast_custom_function media_offer_function
enum ast_msg_data_attribute_type type
Channels have this property if they can accept input with jitter; i.e. most VoIP channels.
static int transmit_info_with_vidupdate(void *data)
Send SIP INFO with video update request.
CallerID (and other GR30) management and generation Includes code and algorithms from the Zapata libr...
void ast_channel_set_writeformat(struct ast_channel *chan, struct ast_format *format)
struct ast_msg_data * ast_msg_data_dup(struct ast_msg_data *msg)
Clone an ast_msg_data structure.
void ast_sip_session_unsuspend(struct ast_sip_session *session)
Request the session serializer be unsuspended.
static int remote_send_unhold(void *data)
Update local hold state to be unheld.
struct ast_party_id id
Connected party ID.
struct ast_format_cap * ast_stream_topology_get_formats(struct ast_stream_topology *topology)
Create a format capabilities structure representing the topology.
void * ast_channel_tech_pvt(const struct ast_channel *chan)
#define AST_CAUSE_NORMAL_TEMPORARY_FAILURE
#define ast_channel_unref(c)
Decrease channel reference count.
The arg parameter is a search key, but is not an object.
static struct topology_change_refresh_data * topology_change_refresh_data_alloc(struct ast_sip_session *session, const struct ast_stream_topology *topology)
int ast_sip_session_create_invite(struct ast_sip_session *session, pjsip_tx_data **tdata)
Creates an INVITE request.
#define AST_CAUSE_SWITCH_CONGESTION
static int exists(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
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.
Support for translation of data formats. translate.c.
void ast_sip_session_terminate(struct ast_sip_session *session, int response)
Terminate a session and, if possible, send the provided response code.
static void hangup_data_destroy(void *obj)
struct ast_party_name name
Subscriber name.
void ast_channel_unregister(const struct ast_channel_tech *tech)
Unregister a channel technology.
void ast_dsp_free(struct ast_dsp *dsp)
#define AST_CAUSE_UNALLOCATED
void ast_channel_hangupcause_set(struct ast_channel *chan, int value)
void ast_sip_session_suspend(struct ast_sip_session *session)
Request and wait for the session serializer to be suspended.
static struct ast_custom_function dtmf_mode_function
unsigned int defer_terminate
static struct ast_sip_session_supplement chan_pjsip_supplement_response
SIP session supplement structure just for responses.
Convenient Signal Processing routines.
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.
const char * ast_endpoint_get_tech(const struct ast_endpoint *endpoint)
Gets the technology of the given endpoint.
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.
void ast_channel_set_rawwriteformat(struct ast_channel *chan, struct ast_format *format)
static int chan_pjsip_write(struct ast_channel *ast, struct ast_frame *f)
enum ast_pbx_result ast_pbx_start(struct ast_channel *c)
Create a new thread and start the PBX.
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
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_party_id_presentation(const struct ast_party_id *id)
Determine the overall presentation value for the given party.
#define ao2_callback(c, flags, cb_fn, arg)
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.
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.
struct ast_sip_session * session
static int unload_module(void)
Unload the PJSIP channel from Asterisk.
static int chan_pjsip_add_hold(const char *chan_uid)
Add a channel ID to the list of PJSIP channels on hold.
#define AST_CAUSE_FACILITY_REJECTED
const char * ast_codec_media_type2str(enum ast_media_type type)
Conversion function to take a media type and turn it into a string.
#define AST_CAUSE_RECOVERY_ON_TIMER_EXPIRE
static struct transfer_data * transfer_data_alloc(struct ast_sip_session *session, const char *target)
unsigned int ignore_183_without_sdp
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.
Structure for variables, used for configurations and for channel variables.
Structure representing a snapshot of channel state.
int ast_rtp_instance_write(struct ast_rtp_instance *instance, struct ast_frame *frame)
Send a frame out over RTP.
static int hangup_cause2sip(int cause)
Internal function which translates from Asterisk cause codes to SIP response codes.
#define ast_rtp_glue_register(glue)
unsigned int asymmetric_rtp_codec
#define AST_LIST_NEXT(elm, field)
Returns the next entry in the list after the given entry.
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 pjsip_module refer_callback_module
REFER Callback module, used to attach session data structure to subscription.
const ast_string_field context
enum ast_control_t38 request_response
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)
static int chan_pjsip_write_stream(struct ast_channel *ast, int stream_num, struct ast_frame *f)
Structure to pass both assignedid values to channel drivers.
int pjsip_acf_moh_passthrough_write(struct ast_channel *chan, const char *cmd, char *data, const char *value)
PJSIP_MOH_PASSTHROUGH function write callback.
Structure for a data store type.
void ast_channel_callgroup_set(struct ast_channel *chan, ast_group_t value)
Structure used to transport a message through the frame core.
#define ast_trace(level,...)
Print a basic trace message.
ast_channel_state
ast_channel states
char * str
Subscriber name (Malloced)
A structure which contains a channel implementation and session.
struct ast_sip_session * session
Pointer to session.
static struct ast_datastore_info transport_info
Datastore used to store local/remote addresses for the INVITE request that created the PJSIP channel...
ast_t38_state
Possible T38 states on channels.
static int chan_pjsip_digit_begin(struct ast_channel *ast, char digit)
Function called by core to start a DTMF digit.
const ast_string_field uniqueid
struct ast_sip_session * session
void ast_channel_named_pickupgroups_set(struct ast_channel *chan, struct ast_namedgroups *value)
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 void indicate_data_destroy(void *obj)
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...
int ast_channel_get_up_time(struct ast_channel *chan)
Obtain how long it has been since the channel was answered.
#define ao2_alloc_options(data_size, destructor_fn, options)
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.
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_str_alloca(init_len)
#define ast_strdup(str)
A wrapper for strdup()
static int call(void *data)
Structure for a data store object.
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.
static int hangup(void *data)
Generic File Format Support. Should be included by clients of the file handling routines. File service providers should instead include mod_format.h.
static int pbx_start_incoming_request(struct ast_sip_session *session, pjsip_rx_data *rdata)
void ast_sip_session_unregister_supplement(struct ast_sip_session_supplement *supplement)
Unregister a an supplement to SIP session processing.
char exten[AST_MAX_EXTENSION]
int pjsip_acf_channel_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
CHANNEL function read callback.
struct ast_stream * ast_stream_topology_get_stream(const struct ast_stream_topology *topology, unsigned int position)
Get a specific stream from the topology.
#define AST_CAUSE_NO_USER_RESPONSE
Definitions to aid in the use of thread local storage.
static struct ast_datastore_info direct_media_mitigation_info
Out-of-call text message support.
void ast_channel_zone_set(struct ast_channel *chan, struct ast_tone_zone *value)
struct pjsip_inv_session * inv_session
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.
Transport information stored in transport_info datastore.
static void transfer_data_destroy(void *obj)
#define AST_CAUSE_INVALID_NUMBER_FORMAT
static struct ast_custom_function chan_pjsip_dial_contacts_function
void ast_moh_stop(struct ast_channel *chan)
Turn off music on hold on a given channel.
void ast_free_ptr(void *ptr)
free() wrapper
static int uid_hold_hash_fn(const void *obj, const int flags)
static struct ast_sip_session_supplement chan_pjsip_ack_supplement
#define ast_verb(level,...)
#define ast_trace_get_indent()
A structure describing a SIP session.
struct ast_trans_pvt * ast_channel_readtrans(const struct ast_channel *chan)
const char * ast_endpoint_get_resource(const struct ast_endpoint *endpoint)
Gets the resource name of the given endpoint.
static void chan_pjsip_session_end(struct ast_sip_session *session)
Function called when the session ends.
int ast_atomic_fetchadd_int(volatile int *p, int v)
Atomically add v to *p and return the previous value of *p.
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_custom_function_unregister(struct ast_custom_function *acf)
Unregister a custom function.
int ast_sip_add_header(pjsip_tx_data *tdata, const char *name, const char *value)
Add a header to an outbound SIP message.
static int chan_pjsip_incoming_ack(struct ast_sip_session *session, struct pjsip_rx_data *rdata)
const char * pbx_builtin_getvar_helper(struct ast_channel *chan, const char *name)
Return a pointer to the value of the corresponding channel variable.
struct ast_format_cap * direct_media_cap
struct ast_frame_subclass subclass
enum ast_device_state ast_devstate_aggregate_result(struct ast_devstate_aggregate *agg)
Get the aggregate device state result.
unsigned int inband_progress
static void chan_pjsip_remove_hold(const char *chan_uid)
Remove a channel ID from the list of PJSIP channels on hold.
static void ast_sockaddr_setnull(struct ast_sockaddr *addr)
Sets address addr to null.
int ast_queue_hangup_with_cause(struct ast_channel *chan, int cause)
Queue a hangup frame with hangupcause set.
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 update_connected_line_information(void *data)
Update connected line information.
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.
#define ast_strlen_zero(foo)
struct ast_sip_session_media_state * active_media_state
void * ast_sorcery_retrieve_by_id(const struct ast_sorcery *sorcery, const char *type, const char *id)
Retrieve an object using its unique identifier.
static int hangup_sip2cause(int cause)
Convert SIP hangup causes to Asterisk hangup causes.
struct ast_format * ast_channel_readformat(struct ast_channel *chan)
static void sendtext_data_destroy(void *obj)
static int on_topology_change_response(struct ast_sip_session *session, pjsip_rx_data *rdata)
void ast_channel_tech_set(struct ast_channel *chan, const struct ast_channel_tech *value)
struct ast_sip_endpoint_media_configuration media
static int ast_sockaddr_isnull(const struct ast_sockaddr *addr)
Checks if the ast_sockaddr is null. "null" in this sense essentially means uninitialized, or having a 0 length.
void ast_sip_session_remove_datastore(struct ast_sip_session *session, const char *name)
Remove a session datastore from the session.
int ast_str_set(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Set a dynamic string using variable arguments.
struct ast_party_id id
Caller party ID.
static int chan_pjsip_transfer(struct ast_channel *ast, const char *target)
Function called by core for Asterisk initiated transfer.
#define ast_str_tmp(init_len, __expr)
#define ast_debug(level,...)
Log a DEBUG message.
void ast_channel_set_rawreadformat(struct ast_channel *chan, struct ast_format *format)
#define AST_CAUSE_NO_ROUTE_TRANSIT_NET
static void set_channel_on_rtp_instance(const struct ast_sip_session *session, const char *channel_id)
int ast_dsp_get_features(struct ast_dsp *dsp)
Get features.
The arg parameter is a partial search key similar to OBJ_SEARCH_KEY.
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_devstate_changed(enum ast_device_state state, enum ast_devstate_cache cachable, const char *fmt,...)
Tells Asterisk the State for Device is changed.
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.
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.
struct ast_msg_data * msg
struct ast_namedgroups * named_pickupgroups
General Asterisk PBX channel definitions.
static void transfer_refer(struct ast_sip_session *session, const char *target)
#define AST_VECTOR_GET_ADDR(vec, idx)
Get an address of element in a vector.
void ast_channel_rings_set(struct ast_channel *chan, int value)
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 int chan_pjsip_hangup(struct ast_channel *ast)
Function called by core to hang up a PJSIP session.
struct ast_datastore * ast_sip_session_alloc_datastore(const struct ast_datastore_info *info, const char *uid)
Alternative for ast_datastore_alloc()
static int compatible_formats_exist(struct ast_stream_topology *top, struct ast_format_cap *cap)
Determine if a topology is compatible with format capabilities.
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.
struct ast_datastore * ast_sip_session_get_datastore(struct ast_sip_session *session, const char *name)
Retrieve a session datastore.
int ast_sip_add_body(pjsip_tx_data *tdata, const struct ast_sip_body *body)
Add a body to an outbound SIP message.
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
A set of tones for a given locale.
void ast_channel_nativeformats_set(struct ast_channel *chan, struct ast_format_cap *value)
struct ast_trans_pvt * ast_channel_writetrans(const struct ast_channel *chan)
void ast_channel_stage_snapshot_done(struct ast_channel *chan)
Clear flag to indicate channel snapshot is being staged, and publish snapshot.
static int update_devstate(void *obj, void *arg, int flags)
PJSIP dialplan functions header file.
static struct ast_mansession session
const ast_string_field language
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.
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.
Data structure associated with a custom dialplan function.
Access Control of various sorts.
struct ast_sip_channel_pvt * ast_sip_channel_pvt_alloc(void *pvt, struct ast_sip_session *session)
Allocate a new SIP channel pvt structure.
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 pjsip_channel_cli_unregister(void)
Unregisters the channel cli commands.
#define AST_CAUSE_NORMAL_CLEARING
#define AST_CAUSE_CHAN_NOT_IMPLEMENTED
static void chan_pjsip_session_begin(struct ast_sip_session *session)
SIP session interaction functions.
struct ast_sip_session * session
static struct ao2_container * endpoints
#define ao2_ref(o, delta)
void ast_channel_set_readformat(struct ast_channel *chan, struct ast_format *format)
#define S_COR(a, b, c)
returns the equivalent of logic or for strings, with an additional boolean check: second one if not e...
const ast_string_field accountcode
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 DSP_FEATURE_FAX_DETECT
unsigned int rpid_immediate
static struct ast_custom_function moh_passthrough_function
#define ast_strdupa(s)
duplicate a string in memory from the stack
const char * ast_sorcery_object_get_id(const void *object)
Get the unique identifier of a sorcery object.
struct ast_channel * channel
struct ast_namedgroups * named_callgroups
static int call_pickup_incoming_request(struct ast_sip_session *session, pjsip_rx_data *rdata)
#define ast_malloc(len)
A wrapper for malloc()
enum ast_device_state ast_state_chan2dev(enum ast_channel_state chanstate)
Convert channel state to devicestate.
static int transmit_info_dtmf(void *data)
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_CAUSE_NO_ANSWER
static int send_direct_media_request(void *data)
const struct ast_format_cap * ast_stream_get_formats(const struct ast_stream *stream)
Get the current negotiated formats of a stream.
unsigned int ast_sip_get_disable_multi_domain(void)
Retrieve the system setting 'disable multi domain'.
An entity with which Asterisk communicates.
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 ast_exists_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid)
Determine whether an extension exists.
static int answer(void *data)
enum ast_sip_session_refresh_method refresh_method
void ast_sip_session_send_response(struct ast_sip_session *session, pjsip_tx_data *tdata)
Send a SIP response.
int ast_sip_register_service(pjsip_module *module)
Register a SIP service in Asterisk.
static int send_topology_change_refresh(void *data)
#define AST_CAUSE_NOTDEFINED
Structure to describe a channel "technology", ie a channel driver See for examples: ...
void ast_channel_adsicpe_set(struct ast_channel *chan, enum ast_channel_adsicpe value)
const char * ast_channel_exten(const struct ast_channel *chan)
Core PBX routines and definitions.
static int chan_pjsip_sendtext(struct ast_channel *ast, const char *text)
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.
unsigned int trust_outbound
unsigned int send_connected_line
A snapshot of an endpoint's state.
struct ast_taskprocessor * serializer
#define AST_CAUSE_DESTINATION_OUT_OF_ORDER
const ast_string_field zone
#define ast_test_suite_event_notify(s, f,...)
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.
#define ast_alloca(size)
call __builtin_alloca to ensure we get gcc builtin semantics
int ast_channel_fdno(const struct ast_channel *chan)
const char * ast_channel_uniqueid(const struct ast_channel *chan)
struct ast_sip_endpoint_id_configuration id
void ast_devstate_aggregate_add(struct ast_devstate_aggregate *agg, enum ast_device_state state)
Add a device state to the aggregate device state.
static int chan_pjsip_digit_end(struct ast_channel *ast, char digit, unsigned int duration)
Function called by core to stop a DTMF digit.
#define AST_CAUSE_FAILURE
void ast_channel_stage_snapshot(struct ast_channel *chan)
Set flag to indicate channel snapshot is being staged.
pj_sockaddr remote_addr
The address that sent the request.
static void transport_info_destroy(void *obj)
Destructor function for transport_info_data.
struct ast_format * ast_channel_rawreadformat(struct ast_channel *chan)
static int chan_pjsip_get_hold(const char *chan_uid)
Determine whether a channel ID is in the list of PJSIP channels on hold.
#define ao2_container_alloc_hash(ao2_options, container_options, n_buckets, hash_fn, sort_fn, cmp_fn)
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.
int ast_pickup_call(struct ast_channel *chan)
Pickup a call.
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_channel * chan
The descriptor of a dynamic string XXX storage will be optimized later if needed We use the ts field ...
static int chan_pjsip_devicestate(const char *data)
Function called to get the device state of an endpoint.
static struct ast_sip_session_supplement chan_pjsip_supplement
SIP session supplement structure.
struct ast_party_id ast_channel_connected_effective_id(struct ast_channel *chan)
static int chan_pjsip_answer(struct ast_channel *ast)
Function called by core when we should answer a PJSIP session.
int ast_sip_push_task(struct ast_taskprocessor *serializer, int(*sip_task)(void *), void *task_data)
Pushes a task to SIP servants.
#define AST_CAUSE_NORMAL_UNSPECIFIED
void ast_channel_named_callgroups_set(struct ast_channel *chan, struct ast_namedgroups *value)
static const char channel_type[]
#define AST_CAUSE_CHANNEL_UNACCEPTABLE
int pjsip_acf_dtmf_mode_write(struct ast_channel *chan, const char *cmd, char *data, const char *value)
PJSIP_DTMF_MODE function write callback.
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.
#define AST_NONSTANDARD_APP_ARGS(args, parse, sep)
Performs the 'nonstandard' argument separation process for an application.
struct ast_tone_zone * ast_get_indication_zone(const char *country)
locate ast_tone_zone
static void rtp_direct_media_data_destroy(void *data)
static void info_dtmf_data_destroy(void *obj)
static void xfer_client_on_evsub_state(pjsip_evsub *sub, pjsip_event *event)
Callback function to report status of implicit REFER-NOTIFY subscription.
enum ast_sip_dtmf_mode dtmf
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.
The PJSIP channel driver pvt, stored in the ast_sip_channel_pvt data structure.
Connected Line/Party information.
int ast_rtp_instance_dtmf_begin(struct ast_rtp_instance *instance, char digit)
Begin sending a DTMF digit.
struct ast_party_dialed * ast_channel_dialed(struct ast_channel *chan)
int ast_moh_start(struct ast_channel *chan, const char *mclass, const char *interpclass)
Turn on music on hold on a given channel.
static struct info_dtmf_data * info_dtmf_data_alloc(struct ast_sip_session *session, char digit, unsigned int duration)
ast_sip_session_refresh_method
static struct hangup_data * hangup_data_alloc(int cause, struct ast_channel *chan)
#define ao2_alloc(data_size, destructor_fn)
unsigned int faxdetect_timeout
struct ast_format_cap * capabilities
#define SCOPE_EXIT_RTN(...)
Scope Exit with return.
int ast_channel_is_bridged(const struct ast_channel *chan)
Determine if a channel is in a bridge.
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.
struct ast_stream_topology * topology
#define ast_channel_unlock(chan)
static int chan_pjsip_fixup(struct ast_channel *oldchan, struct ast_channel *newchan)
Function called by core to change the underlying owner channel.
void ast_dsp_set_features(struct ast_dsp *dsp, int features)
Select feature set.
#define AST_CAUSE_UNREGISTERED
int source
Information about the source of an update.
PJSIP Channel Driver shared data structures.
#define ast_calloc(num, len)
A wrapper for calloc()
void ast_devstate_aggregate_init(struct ast_devstate_aggregate *agg)
Initialize aggregate device state.
void ast_hangup(struct ast_channel *chan)
Hang up a channel.
#define AST_CAUSE_NUMBER_CHANGED
#define SCOPE_ENTER(level,...)
Non RAII_VAR Scope Trace macros The advantage of these macros is that the EXITs will have the actual ...
static struct ao2_container * pjsip_uids_onhold
int ast_rtp_instance_fd(struct ast_rtp_instance *instance, int rtcp)
Get the file descriptor for an RTP session (or RTCP)
static void chan_pjsip_get_codec(struct ast_channel *chan, struct ast_format_cap *result)
Function called by RTP engine to get peer capabilities.
Module has failed to load, may be in an inconsistent state.
enum ast_channel_state state
#define ao2_find(container, arg, flags)
An API for managing task processing threads that can be shared across modules.
static int request(void *obj)
#define AST_CAUSE_INTERWORKING
int ast_stream_topology_get_count(const struct ast_stream_topology *topology)
Get the number of streams in a topology.
void ast_channel_set_fd(struct ast_channel *chan, int which, int fd)
static int cdata(void *userdata, int state, const char *cdata, size_t len)
static struct ast_frame * chan_pjsip_read_stream(struct ast_channel *ast)
Function called by core to read any waiting frames.
static char cid_name[AST_MAX_EXTENSION]
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS|AST_MODFLAG_LOAD_ORDER, "HTTP Phone Provisioning",.support_level=AST_MODULE_SUPPORT_EXTENDED,.load=load_module,.unload=unload_module,.reload=reload,.load_pri=AST_MODPRI_CHANNEL_DEPEND,.requires="http",)
struct ast_format_cap * ast_channel_nativeformats(const struct ast_channel *chan)
A supplement to SIP message processing.
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...
struct ast_stream_topology * ast_stream_topology_clone(const struct ast_stream_topology *topology)
Create a deep clone of an existing stream topology.
#define AST_PRES_RESTRICTION
struct ast_frame ast_null_frame
#define SCOPE_EXIT_RTN_VALUE(__return_value,...)
Scope Exit with return value.
int pjsip_channel_cli_register(void)
Registers the channel cli commands.
struct ast_endpoint * persistent
struct ast_sip_session_media_state * media_state
The arg parameter is an object of the same type.
#define AST_VECTOR_GET(vec, idx)
Get an element from a vector.
struct ast_sip_session * session
static struct ast_custom_function chan_pjsip_parse_uri_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)
#define AST_CAUSE_NO_ROUTE_DESTINATION
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 ast_channel_ref(c)
Increase channel reference count.
static int load_module(void)
Load the module.
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_sorcery * ast_sip_get_sorcery(void)
Get a pointer to the SIP sorcery structure.
Standard Command Line Interface.
static struct ast_sip_session_supplement call_pickup_supplement
int ast_channel_hangupcause(const struct ast_channel *chan)
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
static struct ast_threadstorage uniqueid_threadbuf
#define S_OR(a, b)
returns the equivalent of logic or for strings: first one if not empty, otherwise second one...
const char * ast_channel_name(const struct ast_channel *chan)
#define AST_CAUSE_USER_BUSY
void ast_sip_unregister_service(pjsip_module *module)
int ast_setstate(struct ast_channel *chan, enum ast_channel_state)
Change the state of a channel.
int ast_rtp_glue_unregister(struct ast_rtp_glue *glue)
Unregister RTP glue.
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_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.
static int handle_topology_request_change(struct ast_sip_session *session, const struct ast_stream_topology *proposed)
enum ast_rtp_dtmf_mode ast_rtp_instance_dtmf_mode_get(struct ast_rtp_instance *instance)
Get the DTMF mode of an RTP instance.
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 stasis_forward * sub
Data structure associated with a single frame of data.
Internal Asterisk hangup causes.
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.
#define AST_RTP_RTCP_PSFB
You shouldn't care about the contents of this struct.
static int sendtext(void *obj)
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.
const char * ast_channel_context(const struct ast_channel *chan)
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.
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.
struct ao2_container * ast_sip_get_endpoints(void)
Retrieve any endpoints available to sorcery.
union ast_frame::@263 data
Reject objects with duplicate keys in container.
enum ast_frame_type frametype
static void topology_change_refresh_data_free(struct topology_change_refresh_data *refresh_data)
unsigned char valid
TRUE if the name information is valid/present.
Search option field mask.
struct ast_variable * channel_vars
int ast_rtp_instance_dtmf_end_with_duration(struct ast_rtp_instance *instance, char digit, unsigned int duration)
struct ast_format * format
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.
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.
void ast_stream_topology_free(struct ast_stream_topology *topology)
Unreference and destroy a stream topology.
const char * ast_channel_macrocontext(const struct ast_channel *chan)
void ast_sip_session_media_state_reset(struct ast_sip_session_media_state *media_state)
Reset a media state to a clean state.
const ast_string_field aors
static struct ast_sip_session_supplement pbx_start_supplement
static void update_initial_connected_line(struct ast_sip_session *session)
struct ast_sip_session * session
#define ASTERISK_GPL_KEY
The text the key() function should return.
#define AST_CAUSE_CALL_REJECTED
static int uid_hold_sort_fn(const void *obj_left, const void *obj_right, const int flags)
void ast_channel_priority_set(struct ast_channel *chan, int value)
Pluggable RTP Architecture.
#define AST_CAUSE_BEARERCAPABILITY_NOTAVAIL
Asterisk module definitions.
struct ast_format * ast_channel_writeformat(struct ast_channel *chan)
static const char * chan_pjsip_get_uniqueid(struct ast_channel *ast)
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.
static void set_sipdomain_variable(struct ast_sip_session *session)
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.
void ast_channel_tech_pvt_set(struct ast_channel *chan, void *value)
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
Application convenience functions, designed to give consistent look and feel to Asterisk apps...
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. ...
struct ast_format * ast_channel_rawwriteformat(struct ast_channel *chan)
unsigned char valid
TRUE if the number information is valid/present.
#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...
struct ast_channel_tech chan_pjsip_tech
PBX interface structure for channel registration.
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. ...
#define ast_custom_function_register(acf)
Register a custom function.
static void transfer_redirect(struct ast_sip_session *session, const char *target)
#define AST_CAUSE_CONGESTION
#define AST_VECTOR_SIZE(vec)
Get the number of elements in a vector.
PJSIP CLI functions header file.
struct ast_sip_session * session
void ast_rtp_instance_set_last_rx(struct ast_rtp_instance *rtp, time_t time)
Set the last RTP reception time.
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.
#define AST_OPTION_T38_STATE
#define AST_VECTOR_CALLBACK_VOID(vec, callback,...)
Execute a callback on every element in a vector disregarding callback return.
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.
int ast_sip_session_add_datastore(struct ast_sip_session *session, struct ast_datastore *datastore)
Add a datastore to a SIP session.
#define ast_str_create(init_len)
Create a malloc'ed dynamic length string.
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.
unsigned int moh_passthrough
const ast_string_field pickupexten
Configuration relating to call pickup.
#define AST_APP_ARG(name)
Define an application argument.
static force_inline int attribute_pure ast_str_hash(const char *str)
Compute a hash value on a string.
#define ast_sip_session_register_supplement(supplement)
static struct ast_rtp_glue chan_pjsip_rtp_glue
Local glue for interacting with the RTP engine core.
Channels have this property if they can create jitter; i.e. most VoIP channels.
struct ast_party_number number
Subscriber phone number.
#define ao2_link(container, obj)