41 char *configured_aors, *aor_name;
42 pjsip_sip_uri *sip_uri;
51 sip_uri = pjsip_uri_get_uri(uri);
52 domain_name =
ast_alloca(sip_uri->host.slen + 1);
73 if (!strcmp(username, aor_name)) {
77 if (!
id && !(
id =
ast_str_create(strlen(username) + sip_uri->host.slen + 2))) {
119 *path_str = pj_strdup3(pool, contact->
path);
125 pjsip_supported_hdr *hdr;
128 hdr = pjsip_msg_find_hdr(tdata->msg, PJSIP_H_SUPPORTED,
NULL);
131 hdr = pjsip_supported_hdr_create(tdata->pool);
136 pjsip_msg_add_hdr(tdata->msg, (pjsip_hdr *)hdr);
140 for (i = 0; i < hdr->count; ++i) {
146 if (hdr->count >= PJSIP_GENERIC_ARRAY_MAX_COUNT) {
173 aor =
find_aor(endpoint, tdata->msg->line.req.uri);
174 if (!aor || !aor->support_path) {
202 struct pjsip_status_line status = tdata->msg->line.status;
204 pjsip_generic_string_hdr *path_hdr;
205 pjsip_contact_hdr *contact_hdr;
207 pjsip_cseq_hdr *cseq = pjsip_msg_find_hdr(tdata->msg, PJSIP_H_CSEQ,
NULL);
208 const pj_str_t REGISTER_METHOD = {
"REGISTER", 8};
211 || !pj_stristr(®ISTER_METHOD, &cseq->method.name)
212 || !PJSIP_IS_STATUS_IN_CLASS(status.code, 200)) {
216 contact_hdr = pjsip_msg_find_hdr(tdata->msg, PJSIP_H_CONTACT,
NULL);
221 aor =
find_aor(endpoint, contact_hdr->uri);
227 path_hdr = pjsip_generic_string_hdr_create(tdata->pool, &
PATH_NAME, &path_dup);
232 pjsip_msg_add_hdr(tdata->msg, (pjsip_hdr*)path_hdr);
272 .requires =
"res_pjsip,res_pjsip_session",
struct ast_sip_endpoint * endpoint
#define AST_SIP_USER_OPTIONS_TRUNCATE_CHECK(str)
Truncate the URI user field options string if enabled.
static struct ast_sip_aor * find_aor(struct ast_sip_endpoint *endpoint, pjsip_uri *uri)
Asterisk main include file. File version handling, generic pbx functions.
static int add_supported(pjsip_tx_data *tdata)
String manipulation functions.
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.
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
int ast_sip_set_outbound_proxy(pjsip_tx_data *tdata, const char *proxy)
Set the outbound proxy for an outbound SIP message.
static pj_pool_t * pool
Global memory pool for configuration and timers.
int ast_str_append(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Append to a thread local dynamic string.
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.
void ast_sip_session_unregister_supplement(struct ast_sip_session_supplement *supplement)
Unregister a an supplement to SIP session processing.
A structure describing a SIP session.
#define ast_strlen_zero(foo)
void * ast_sorcery_retrieve_by_id(const struct ast_sorcery *sorcery, const char *type, const char *id)
Retrieve an object using its unique identifier.
int ast_str_set(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Set a dynamic string using variable arguments.
static void path_session_outgoing_request(struct ast_sip_session *session, pjsip_tx_data *tdata)
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
static struct ast_mansession session
char * ast_strip(char *s)
Strip leading/trailing whitespace from a string.
#define ast_strdupa(s)
duplicate a string in memory from the stack
static int load_module(void)
An entity with which Asterisk communicates.
static void path_outgoing_request(struct ast_sip_endpoint *endpoint, struct ast_sip_contact *contact, pjsip_tx_data *tdata)
struct ast_sip_aor * ast_sip_location_retrieve_aor(const char *aor_name)
Retrieve a named AOR.
#define ast_alloca(size)
call __builtin_alloca to ensure we get gcc builtin semantics
void ast_sip_register_supplement(struct ast_sip_supplement *supplement)
Register a supplement to SIP out of dialog processing.
The descriptor of a dynamic string XXX storage will be optimized later if needed We use the ts field ...
void ast_sip_unregister_supplement(struct ast_sip_supplement *supplement)
Unregister a an supplement to SIP out of dialog processing.
enum ast_sip_supplement_priority priority
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",)
A supplement to SIP message processing.
static struct ast_sip_session_supplement path_session_supplement
char * strsep(char **str, const char *delims)
const ast_string_field domain
struct ast_sorcery * ast_sip_get_sorcery(void)
Get a pointer to the SIP sorcery structure.
A supplement to SIP message processing.
static const pj_str_t PATH_NAME
static void path_outgoing_response(struct ast_sip_endpoint *endpoint, struct ast_sip_contact *contact, pjsip_tx_data *tdata)
static int unload_module(void)
const ast_string_field aors
static void path_session_outgoing_response(struct ast_sip_session *session, pjsip_tx_data *tdata)
#define ASTERISK_GPL_KEY
The text the key() function should return.
struct ast_sip_contact * contact
Asterisk module definitions.
#define ast_str_create(init_len)
Create a malloc'ed dynamic length string.
static pj_str_t PATH_SUPPORTED_NAME
#define ast_sip_session_register_supplement(supplement)
static struct ast_sip_supplement path_supplement
enum ast_sip_supplement_priority priority