84 .
type =
"chan_pjsip_channel_info",
94 return datastore ? datastore->
data :
NULL;
99 const void *uri,
const char *
type)
101 char value[PJSIP_MAX_URL_SIZE] =
"";
106 length = pjsip_uri_print(context, uri,
value,
sizeof(
value));
107 if (length < 0 || length >=
sizeof(
value)) {
113 value[length] =
'\0';
130 const pj_str_t *tag = &dlg->remote.info->tag;
132 target_changed =
copy_uri(&info->target_uri, PJSIP_URI_IN_REQ_URI,
133 dlg->target,
"target_uri");
134 copy_uri(&info->local_uri, PJSIP_URI_IN_FROMTO_HDR,
135 dlg->local.info->uri,
"local_uri");
136 copy_uri(&info->remote_uri, PJSIP_URI_IN_FROMTO_HDR,
137 dlg->remote.info->uri,
"remote_uri");
139 if (!info->remote_tag || strlen(info->remote_tag) != tag->slen
140 || (tag->slen && memcmp(info->remote_tag, tag->ptr, tag->slen))) {
144 info->remote_tag =
copy;
146#ifdef HAVE_PJSIP_GET_DEST_INFO
147 if (target_changed || info->target_uri.length < 0 || info->secure < 0) {
148 pjsip_host_info dest;
150 "channel-info", 128, 128);
154 if (pjsip_get_dest_info(dlg->target,
NULL, pool, &dest) == PJ_SUCCESS) {
155 info->secure = !!(dest.flag & PJSIP_TRANSPORT_SECURE);
161 ast_log(
LOG_WARNING,
"Asterisk has been built against a version of pjproject which does not have the required functionality to support the 'secure' argument. Please upgrade to version 2.3 or later.\n");
162 (void) target_changed;
165 copy_uri(&info->target_uri, PJSIP_URI_IN_REQ_URI,
NULL,
"target_uri");
166 copy_uri(&info->local_uri, PJSIP_URI_IN_FROMTO_HDR,
NULL,
"local_uri");
167 copy_uri(&info->remote_uri, PJSIP_URI_IN_FROMTO_HDR,
NULL,
"remote_uri");
169 info->remote_tag =
NULL;
173 media =
session->active_media_state
176 info->audio_secure = media && media->
srtp
179 media =
session->active_media_state
182 info->video_secure = media && media->
srtp
253 struct pjsip_rx_data *rdata)
261 struct pjsip_rx_data *rdata)
268 struct pjsip_tx_data *tdata)
274 struct pjsip_tx_data *tdata)
static int copy(char *infile, char *outfile)
Utility function to copy a file.
Asterisk main include file. File version handling, generic pbx functions.
static struct ast_mansession session
#define ast_strndup(str, len)
A wrapper for strndup()
#define ast_calloc(num, len)
A wrapper for calloc()
#define ao2_replace(dst, src)
Replace one object reference with another cleaning up the original.
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
#define ao2_bump(obj)
Bump refcount on an AO2 object by one, returning the object.
General Asterisk PBX channel definitions.
int ast_channel_datastore_add(struct ast_channel *chan, struct ast_datastore *datastore)
Add a datastore to a channel.
int ast_channel_datastore_remove(struct ast_channel *chan, struct ast_datastore *datastore)
Remove a datastore from a channel.
#define ast_channel_lock(chan)
#define ast_channel_unlock(chan)
struct ast_datastore * ast_channel_datastore_find(struct ast_channel *chan, const struct ast_datastore_info *info, const char *uid)
Find a datastore on a channel.
static const struct ast_datastore_info channel_info_datastore
static void channel_info_outgoing_response(struct ast_sip_session *session, struct pjsip_tx_data *tdata)
void pjsip_channel_info_schedule_update(struct ast_sip_session *session)
Schedule a refresh from any thread without waiting for the serializer.
static void channel_info_update_locked(struct pjsip_channel_info *info, struct ast_sip_session *session)
void pjsip_channel_info_register(void)
Register the channel information session supplement.
static void channel_info_incoming_response(struct ast_sip_session *session, struct pjsip_rx_data *rdata)
static void channel_info_breakdown(void *data, struct ast_channel *old_chan, struct ast_channel *new_chan)
static int channel_info_update_task(void *data)
struct pjsip_channel_info * pjsip_channel_info_get(struct ast_channel *chan)
Find the channel's information, or NULL if it has none.
static void channel_info_destroy(void *data)
static int channel_info_incoming_request(struct ast_sip_session *session, struct pjsip_rx_data *rdata)
void pjsip_channel_info_unregister(void)
Unregister the channel information session supplement.
void pjsip_channel_info_update(struct ast_sip_session *session)
Refresh channel information under the channel lock.
static void channel_info_outgoing_request(struct ast_sip_session *session, struct pjsip_tx_data *tdata)
static int copy_uri(struct pjsip_channel_uri *dest, pjsip_uri_context_e context, const void *uri, const char *type)
static struct ast_sip_session_supplement channel_info_supplement
int pjsip_channel_info_create(struct ast_channel *chan, struct ast_sip_session *session)
Create channel-owned PJSIP information before channel publication.
Channel-locked PJSIP information interface.
Asterisk datastore objects.
#define ast_datastore_alloc(info, uid)
int ast_datastore_free(struct ast_datastore *datastore)
Free a data store object.
#define ast_sip_push_task(serializer, sip_task, task_data)
pjsip_endpoint * ast_sip_get_pjsip_endpoint(void)
Get a pointer to the PJSIP endpoint.
@ AST_SIP_SUPPLEMENT_PRIORITY_CHANNEL
@ AST_SIP_SESSION_AFTER_MEDIA
#define ast_sip_session_register_supplement(supplement)
void ast_sip_session_unregister_supplement(struct ast_sip_session_supplement *supplement)
Unregister a an supplement to SIP session processing.
const char * ast_sip_session_get_name(const struct ast_sip_session *session)
Get the channel or endpoint name associated with the session.
Pluggable RTP Architecture.
#define AST_SRTP_CRYPTO_OFFER_OK
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
Main Channel structure associated with a channel.
Structure for a data store type.
Structure for a data store object.
const struct ast_datastore_info * info
A supplement to SIP message processing.
enum ast_sip_supplement_priority priority
A structure describing a SIP session.
struct ast_datastore * datastore
char value[PJSIP_MAX_URL_SIZE]
#define ast_test_flag(p, flag)