53 char *configured_aors, *aor_name;
54 const pj_str_t *uri_username;
55 const pj_str_t *uri_hostname;
65 domain_name =
ast_alloca(uri_hostname->slen + 1);
88 if (!strcmp(username, aor_name)) {
92 if (!
id && !(
id =
ast_str_create(strlen(username) + uri_hostname->slen + 2))) {
122 char contact_buf[512];
136 contact_buf_len = pjsip_uri_print(PJSIP_URI_IN_CONTACT_HDR,
uri, contact_buf, 512);
137 contact_buf[contact_buf_len] =
'\0';
141 if (!strcmp(contact_buf, contact->
uri)) {
170 *path_str = pj_strdup3(pool, contact->
path);
176 pjsip_supported_hdr *hdr;
179 hdr = pjsip_msg_find_hdr(tdata->msg, PJSIP_H_SUPPORTED,
NULL);
182 hdr = pjsip_supported_hdr_create(tdata->pool);
187 pjsip_msg_add_hdr(tdata->msg, (pjsip_hdr *)hdr);
191 for (i = 0; i < hdr->count; ++i) {
197 if (hdr->count >= PJSIP_GENERIC_ARRAY_MAX_COUNT) {
228 if (!
aor || !
aor->support_path) {
267 struct pjsip_status_line
status = tdata->msg->line.status;
269 pjsip_generic_string_hdr *path_hdr;
271 pjsip_cseq_hdr *cseq = pjsip_msg_find_hdr(tdata->msg, PJSIP_H_CSEQ,
NULL);
272 const pj_str_t REGISTER_METHOD = {
"REGISTER", 8};
275 || !pj_stristr(®ISTER_METHOD, &cseq->method.name)
276 || !PJSIP_IS_STATUS_IN_CLASS(
status.code, 200)) {
286 path_hdr = pjsip_generic_string_hdr_create(tdata->pool, &
PATH_NAME, &path_dup);
291 pjsip_msg_add_hdr(tdata->msg, (pjsip_hdr*)path_hdr);
331 .
requires =
"res_pjsip,res_pjsip_session",
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_strdupa(s)
duplicate a string in memory from the stack
#define ao2_iterator_next(iter)
int ao2_container_count(struct ao2_container *c)
Returns the number of elements in a container.
struct ao2_iterator ao2_iterator_init(struct ao2_container *c, int flags) attribute_warn_unused_result
Create an iterator for a container.
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
void ao2_iterator_destroy(struct ao2_iterator *iter)
Destroy a container iterator.
char * strsep(char **str, const char *delims)
Asterisk module definitions.
#define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...)
@ AST_MODULE_SUPPORT_CORE
#define ASTERISK_GPL_KEY
The text the key() function should return.
@ AST_MODULE_LOAD_SUCCESS
void ast_sip_unregister_supplement(struct ast_sip_supplement *supplement)
Unregister a an supplement to SIP out of dialog processing.
const pj_str_t * ast_sip_pjsip_uri_get_username(pjsip_uri *uri)
Get the user portion of the pjsip_uri.
struct ast_sip_aor * ast_sip_location_retrieve_aor(const char *aor_name)
Retrieve a named AOR.
void ast_sip_register_supplement(struct ast_sip_supplement *supplement)
Register a supplement to SIP out of dialog processing.
#define AST_SIP_USER_OPTIONS_TRUNCATE_CHECK(str)
Truncate the URI user field options string if enabled.
@ AST_SIP_SUPPLEMENT_PRIORITY_CHANNEL
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_set_outbound_proxy(pjsip_tx_data *tdata, const char *proxy)
Set the outbound proxy for an outbound SIP message.
struct ast_sorcery * ast_sip_get_sorcery(void)
Get a pointer to the SIP sorcery structure.
const pj_str_t * ast_sip_pjsip_uri_get_hostname(pjsip_uri *uri)
Get the host portion of the pjsip_uri.
struct ao2_container * ast_sip_location_retrieve_aor_contacts(const struct ast_sip_aor *aor)
Retrieve all contacts currently available for an AOR.
static void path_outgoing_response(struct ast_sip_endpoint *endpoint, struct ast_sip_contact *contact, pjsip_tx_data *tdata)
static void path_session_outgoing_response(struct ast_sip_session *session, pjsip_tx_data *tdata)
static struct ast_sip_aor * find_aor(struct ast_sip_contact *contact)
static struct ast_sip_contact * find_contact(struct ast_sip_aor *aor, pjsip_uri *uri)
static struct ast_sip_supplement path_supplement
static int path_get_string(pj_pool_t *pool, struct ast_sip_contact *contact, pj_str_t *path_str)
Get the path string associated with this contact and tdata.
static int add_supported(pjsip_tx_data *tdata)
static void path_session_outgoing_request(struct ast_sip_session *session, pjsip_tx_data *tdata)
static void path_outgoing_request(struct ast_sip_endpoint *endpoint, struct ast_sip_contact *contact, pjsip_tx_data *tdata)
static const pj_str_t PATH_NAME
static struct ast_sip_aor * find_aor2(struct ast_sip_endpoint *endpoint, pjsip_uri *uri)
static pj_str_t PATH_SUPPORTED_NAME
static struct ast_sip_session_supplement path_session_supplement
static int load_module(void)
static int unload_module(void)
#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.
void * ast_sorcery_retrieve_by_id(const struct ast_sorcery *sorcery, const char *type, const char *id)
Retrieve an object using its unique identifier.
String manipulation functions.
int ast_str_append(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Append to a thread local dynamic string.
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
static force_inline int attribute_pure ast_strlen_zero(const char *s)
#define ast_str_create(init_len)
Create a malloc'ed dynamic length string.
int ast_str_set(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Set a dynamic string using variable arguments.
char * ast_strip(char *s)
Strip leading/trailing whitespace from a string.
When we need to walk through a container, we use an ao2_iterator to keep track of the current positio...
const ast_string_field domain
An entity with which Asterisk communicates.
const ast_string_field aors
A supplement to SIP message processing.
enum ast_sip_supplement_priority priority
A structure describing a SIP session.
A supplement to SIP message processing.
enum ast_sip_supplement_priority priority
Support for dynamic strings.
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.