static void set_sipdomain_variable(struct ast_sip_session *session)
{
- pjsip_sip_uri *sip_ruri = pjsip_uri_get_uri(session->request_uri);
- size_t size = pj_strlen(&sip_ruri->host) + 1;
+ const pj_str_t *host = ast_sip_pjsip_uri_get_hostname(session->request_uri);
+ size_t size = pj_strlen(host) + 1;
char *domain = ast_alloca(size);
- ast_copy_pj_str(domain, &sip_ruri->host, size);
+ ast_copy_pj_str(domain, host, size);
pbx_builtin_setvar_helper(session->channel, "SIPDOMAIN", domain);
return;
;mailbox_state_filter= ; Optional regular expression used to filter what
; mailboxes we accept events for.
+
+
+;================================TEL URIs=====================================
+;
+; Asterisk has TEL URI support, but with limited scope. Support is only for
+; TEL URIs present in traffic from a remote party. Asterisk does not generate
+; any TEL URIs of its own.
+;
+; Currently, the allowed request types are INVITE, ACK, BYE, and CANCEL. Any
+; other request type that contains a TEL URI will behave as it did before.
+; TEL URIs are allowed in the request, From, and To headers.
+;
+; You can match a TEL URI From header by IP, header, or auth_username.
AST_VECTOR(ast_sip_service_route_vector, char *);
+static const pj_str_t AST_PJ_STR_EMPTY = { "", 0 };
+
/*!
* \brief Structure for SIP transport information
*/
*/
void ast_sip_transport_state_unregister(struct ast_sip_tpmgr_state_callback *element);
+/*!
+ * \brief Check whether a pjsip_uri is SIP/SIPS or not
+ * \since 16.28.0
+ *
+ * \param uri The pjsip_uri to check
+ *
+ * \retval 1 if true
+ * \retval 0 if false
+ */
+int ast_sip_is_uri_sip_sips(pjsip_uri *uri);
+
+/*!
+ * \brief Check whether a pjsip_uri is allowed or not
+ * \since 16.28.0
+ *
+ * \param uri The pjsip_uri to check
+ *
+ * \retva; 1 if allowed
+ * \retval 0 if not allowed
+ */
+int ast_sip_is_allowed_uri(pjsip_uri *uri);
+
+/*!
+ * \brief Get the user portion of the pjsip_uri
+ * \since 16.28.0
+ *
+ * \param uri The pjsip_uri to get the user from
+ *
+ * \note This function will check what kind of URI it receives and return
+ * the user based off of that
+ *
+ * \return User string or empty string if not present
+ */
+const pj_str_t *ast_sip_pjsip_uri_get_username(pjsip_uri *uri);
+
+/*!
+ * \brief Get the host portion of the pjsip_uri
+ * \since 16.28.0
+ *
+ * \param uri The pjsip_uri to get the host from
+ *
+ * \note This function will check what kind of URI it receives and return
+ * the host based off of that
+ *
+ * \return Host string or empty string if not present
+ */
+const pj_str_t *ast_sip_pjsip_uri_get_hostname(pjsip_uri *uri);
+
+/*!
+ * \brief Get the other_param portion of the pjsip_uri
+ * \since 16.28.0
+ *
+ * \param uri The pjsip_uri to get hte other_param from
+ *
+ * \note This function will check what kind of URI it receives and return
+ * the other_param based off of that
+ *
+ * \return other_param or NULL if not present
+ */
+struct pjsip_param *ast_sip_pjsip_uri_get_other_param(pjsip_uri *uri, const pj_str_t *param_str);
+
#endif /* _RES_PJSIP_H */
return sip_threadpool;
}
+int ast_sip_is_uri_sip_sips(pjsip_uri *uri)
+{
+ return (PJSIP_URI_SCHEME_IS_SIP(uri) || PJSIP_URI_SCHEME_IS_SIPS(uri));
+}
+
+int ast_sip_is_allowed_uri(pjsip_uri *uri)
+{
+ return (ast_sip_is_uri_sip_sips(uri) || PJSIP_URI_SCHEME_IS_TEL(uri));
+}
+
+const pj_str_t *ast_sip_pjsip_uri_get_username(pjsip_uri *uri)
+{
+ if (ast_sip_is_uri_sip_sips(uri)) {
+ pjsip_sip_uri *sip_uri = pjsip_uri_get_uri(uri);
+ if (!sip_uri) {
+ return &AST_PJ_STR_EMPTY;
+ }
+ return &sip_uri->user;
+ } else if (PJSIP_URI_SCHEME_IS_TEL(uri)) {
+ pjsip_tel_uri *tel_uri = pjsip_uri_get_uri(uri);
+ if (!tel_uri) {
+ return &AST_PJ_STR_EMPTY;
+ }
+ return &tel_uri->number;
+ }
+
+ return &AST_PJ_STR_EMPTY;
+}
+
+const pj_str_t *ast_sip_pjsip_uri_get_hostname(pjsip_uri *uri)
+{
+ if (ast_sip_is_uri_sip_sips(uri)) {
+ pjsip_sip_uri *sip_uri = pjsip_uri_get_uri(uri);
+ if (!sip_uri) {
+ return &AST_PJ_STR_EMPTY;
+ }
+ return &sip_uri->host;
+ } else if (PJSIP_URI_SCHEME_IS_TEL(uri)) {
+ return &AST_PJ_STR_EMPTY;
+ }
+
+ return &AST_PJ_STR_EMPTY;
+}
+
+struct pjsip_param *ast_sip_pjsip_uri_get_other_param(pjsip_uri *uri, const pj_str_t *param_str)
+{
+ if (ast_sip_is_uri_sip_sips(uri)) {
+ pjsip_sip_uri *sip_uri = pjsip_uri_get_uri(uri);
+ if (!sip_uri) {
+ return NULL;
+ }
+ return pjsip_param_find(&sip_uri->other_param, param_str);
+ } else if (PJSIP_URI_SCHEME_IS_TEL(uri)) {
+ pjsip_tel_uri *tel_uri = pjsip_uri_get_uri(uri);
+ if (!tel_uri) {
+ return NULL;
+ }
+ return pjsip_param_find(&tel_uri->other_param, param_str);
+ }
+
+ return NULL;
+}
+
#ifdef TEST_FRAMEWORK
AST_TEST_DEFINE(xml_sanitization_end_null)
{
char name[AST_UUID_STR_LEN] = "";
pjsip_uri *from = rdata->msg_info.from->uri;
- if (PJSIP_URI_SCHEME_IS_SIP(from) || PJSIP_URI_SCHEME_IS_SIPS(from)) {
- pjsip_sip_uri *sip_from = pjsip_uri_get_uri(from);
- ast_copy_pj_str(name, &sip_from->user, sizeof(name));
+ if (ast_sip_is_allowed_uri(from)) {
+ ast_copy_pj_str(name, ast_sip_pjsip_uri_get_username(from), sizeof(name));
}
unid = ao2_find(unidentified_requests, rdata->pkt_info.src_name, OBJ_SEARCH_KEY);
*addrs = NULL;
return 0;
}
+
if (!PJSIP_URI_SCHEME_IS_SIP(contact->uri) && !PJSIP_URI_SCHEME_IS_SIPS(contact->uri)) {
*addrs = NULL;
return 0;
pjsip_hdr *hdr;
if (tdata->msg->type == PJSIP_REQUEST_MSG) {
- if (is_sip_uri(tdata->msg->line.req.uri)) {
+ if (ast_sip_is_uri_sip_sips(tdata->msg->line.req.uri)) {
uri = pjsip_uri_get_uri(tdata->msg->line.req.uri);
print_sanitize_debug("Sanitizing Request", PJSIP_URI_IN_REQ_URI, uri);
while ((x_transport = pjsip_param_find(&uri->other_param, &x_name))) {
for (hdr = tdata->msg->hdr.next; hdr != &tdata->msg->hdr; hdr = hdr->next) {
if (hdr->type == PJSIP_H_TO || hdr->type == PJSIP_H_FROM) {
- if (is_sip_uri(((pjsip_fromto_hdr *) hdr)->uri)) {
+ if (ast_sip_is_uri_sip_sips(((pjsip_fromto_hdr *) hdr)->uri)) {
uri = pjsip_uri_get_uri(((pjsip_fromto_hdr *) hdr)->uri);
print_sanitize_debug("Sanitizing From/To header", PJSIP_URI_IN_FROMTO_HDR, uri);
while ((x_transport = pjsip_param_find(&uri->other_param, &x_name))) {
}
}
} else if (hdr->type == PJSIP_H_CONTACT) {
- if (!((pjsip_contact_hdr *) hdr)->star && is_sip_uri(((pjsip_contact_hdr *) hdr)->uri)) {
+ if (!((pjsip_contact_hdr *) hdr)->star && ast_sip_is_uri_sip_sips(((pjsip_contact_hdr *) hdr)->uri)) {
uri = pjsip_uri_get_uri(((pjsip_contact_hdr *) hdr)->uri);
print_sanitize_debug("Sanitizing Contact header", PJSIP_URI_IN_CONTACT_HDR, uri);
while ((x_transport = pjsip_param_find(&uri->other_param, &x_name))) {
if (tdata->msg->type == PJSIP_REQUEST_MSG || !(cseq = pjsip_msg_find_hdr(tdata->msg, PJSIP_H_CSEQ, NULL)) ||
pj_strcmp2(&cseq->method.name, "REGISTER")) {
pjsip_contact_hdr *contact = pjsip_msg_find_hdr(tdata->msg, PJSIP_H_CONTACT, NULL);
- if (contact && (PJSIP_URI_SCHEME_IS_SIP(contact->uri) || PJSIP_URI_SCHEME_IS_SIPS(contact->uri))
+ if (contact && ast_sip_is_uri_sip_sips(contact->uri)
&& !(tdata->msg->type == PJSIP_RESPONSE_MSG && tdata->msg->line.status.code / 100 == 3)) {
pjsip_sip_uri *uri = pjsip_uri_get_uri(contact->uri);
return;
}
+ if (PJSIP_URI_SCHEME_IS_TEL(header_uri)) {
+ return;
+ }
+
uri = pjsip_uri_get_uri(header_uri);
if (!uri) {
return;
}
}
+/* An allow list helper function for tel URI requests */
+static int is_allowed_tel_uri_request(pjsip_rx_data *rdata)
+{
+ struct pjsip_request_line req = rdata->msg_info.msg->line.req;
+ const pjsip_method method = (const pjsip_method)req.method;
+
+ if (pjsip_method_cmp(&method, pjsip_get_invite_method())) {
+ return 1;
+ } else if (pjsip_method_cmp(&method, pjsip_get_ack_method())) {
+ return 1;
+ } else if (pjsip_method_cmp(&method, pjsip_get_bye_method())) {
+ return 1;
+ } else if (pjsip_method_cmp(&method, pjsip_get_cancel_method())) {
+ return 1;
+ }
+
+ return 0;
+}
+
static pj_bool_t on_rx_process_uris(pjsip_rx_data *rdata)
{
pjsip_contact_hdr *contact = NULL;
return PJ_FALSE;
}
- if (!is_sip_uri(rdata->msg_info.msg->line.req.uri)) {
+ if (PJSIP_URI_SCHEME_IS_TEL(rdata->msg_info.msg->line.req.uri)
+ && !is_allowed_tel_uri_request(rdata)) {
print_uri_debug(URI_TYPE_REQUEST, rdata, NULL);
pjsip_endpt_respond_stateless(ast_sip_get_pjsip_endpoint(), rdata,
PJSIP_SC_UNSUPPORTED_URI_SCHEME, NULL, NULL, NULL);
}
remove_x_ast_params(rdata->msg_info.msg->line.req.uri);
- if (!is_sip_uri(rdata->msg_info.from->uri)) {
+ if (!ast_sip_is_allowed_uri(rdata->msg_info.from->uri)) {
print_uri_debug(URI_TYPE_FROM, rdata, (pjsip_hdr *)rdata->msg_info.from);
pjsip_endpt_respond_stateless(ast_sip_get_pjsip_endpoint(), rdata,
PJSIP_SC_UNSUPPORTED_URI_SCHEME, NULL, NULL, NULL);
}
remove_x_ast_params(rdata->msg_info.from->uri);
- if (!is_sip_uri(rdata->msg_info.to->uri)) {
+ if (!ast_sip_is_allowed_uri(rdata->msg_info.to->uri)) {
print_uri_debug(URI_TYPE_TO, rdata, (pjsip_hdr *)rdata->msg_info.to);
pjsip_endpt_respond_stateless(ast_sip_get_pjsip_endpoint(), rdata,
PJSIP_SC_UNSUPPORTED_URI_SCHEME, NULL, NULL, NULL);
{
RAII_VAR(struct ast_sip_endpoint *, endpoint, NULL, ao2_cleanup);
pjsip_uri *ruri;
- pjsip_sip_uri *sip_ruri;
char exten[AST_MAX_EXTENSION];
if (pjsip_method_cmp(&rdata->msg_info.msg->line.req.method, &pjsip_options_method)) {
}
ruri = rdata->msg_info.msg->line.req.uri;
- if (!PJSIP_URI_SCHEME_IS_SIP(ruri) && !PJSIP_URI_SCHEME_IS_SIPS(ruri)) {
+ if (!ast_sip_is_allowed_uri(ruri)) {
send_options_response(rdata, 416);
return PJ_TRUE;
}
- sip_ruri = pjsip_uri_get_uri(ruri);
- ast_copy_pj_str(exten, &sip_ruri->user, sizeof(exten));
+ ast_copy_pj_str(exten, ast_sip_pjsip_uri_get_username(ruri), sizeof(exten));
/*
* We may want to match in the dialplan without any user
{
char cid_name[AST_CHANNEL_NAME];
char cid_num[AST_CHANNEL_NAME];
- pjsip_sip_uri *uri;
pjsip_name_addr *id_name_addr = (pjsip_name_addr *) hdr->uri;
char *semi;
- uri = pjsip_uri_get_uri(id_name_addr);
ast_copy_pj_str(cid_name, &id_name_addr->display, sizeof(cid_name));
- ast_copy_pj_str(cid_num, &uri->user, sizeof(cid_num));
+ ast_copy_pj_str(cid_num, ast_sip_pjsip_uri_get_username(hdr->uri), sizeof(cid_num));
/* Always truncate caller-id number at a semicolon. */
semi = strchr(cid_num, ';');
int remote_connected_num_restricted;
char *local_caller_num;
pjsip_dialog *dlg = ast_sip_subscription_get_dialog(state_data->sub);
- pjsip_sip_uri *dlg_remote_fromhdr = pjsip_uri_get_uri(dlg->local.info->uri);
char remote_target[PJSIP_MAX_URL_SIZE + 32];
char dlg_remote_uri[PJSIP_MAX_URL_SIZE];
char *from_domain_stripped;
pj_xml_node *remote_node, *remote_identity_node, *remote_target_node;
/* We use the local dialog URI to determine the domain to use in the XML itself */
- ast_copy_pj_str(dlg_remote_uri, &dlg_remote_fromhdr->host, sizeof(dlg_remote_uri));
+ ast_copy_pj_str(dlg_remote_uri, ast_sip_pjsip_uri_get_hostname(dlg->local.info->uri), sizeof(dlg_remote_uri));
from_domain_stripped = ast_strip_quoted(dlg_remote_uri, "<", ">");
ast_sip_sanitize_xml(from_domain_stripped, from_domain_sanitized, sizeof(from_domain_sanitized));
struct ast_party_redirecting_reason *data)
{
static const pj_str_t cause_name = { "cause", 5 };
- pjsip_sip_uri *uri = pjsip_uri_get_uri(name_addr);
+ pjsip_uri *uri = name_addr->uri;
pjsip_param *cause = NULL;
unsigned long cause_value = 0;
- if (!PJSIP_URI_SCHEME_IS_SIP(uri) && !PJSIP_URI_SCHEME_IS_SIPS(uri)) {
+ if (!ast_sip_is_allowed_uri(uri)) {
return;
}
- cause = pjsip_param_find(&uri->other_param, &cause_name);
+ cause = ast_sip_pjsip_uri_get_other_param(uri, &cause_name);
if (!cause) {
return;
pjsip_fromto_hdr *hdr;
pjsip_name_addr *name_addr;
- pjsip_sip_uri *uri;
pjsip_param *param;
pjsip_fromto_hdr *old_hdr;
const char *reason_str;
hdr->sname = hdr->name = diversion_name;
name_addr = pjsip_uri_clone(tdata->pool, base);
- uri = pjsip_uri_get_uri(name_addr->uri);
pj_strdup2(tdata->pool, &name_addr->display, id->name.str);
- pj_strdup2(tdata->pool, &uri->user, id->number.str);
+ pj_strdup2(tdata->pool, (pj_str_t *)ast_sip_pjsip_uri_get_username(name_addr->uri), id->number.str);
param = PJ_POOL_ALLOC_T(tdata->pool, pjsip_param);
param->name = reason_name;
static int get_endpoint_details(pjsip_rx_data *rdata, char *domain, size_t domain_size)
{
pjsip_uri *from = rdata->msg_info.from->uri;
- pjsip_sip_uri *sip_from;
- if (!PJSIP_URI_SCHEME_IS_SIP(from) && !PJSIP_URI_SCHEME_IS_SIPS(from)) {
+ if (!ast_sip_is_uri_sip_sips(from)) {
return -1;
}
- sip_from = (pjsip_sip_uri *) pjsip_uri_get_uri(from);
- ast_copy_pj_str(domain, &sip_from->host, domain_size);
+ ast_copy_pj_str(domain, ast_sip_pjsip_uri_get_hostname(from), domain_size);
return 0;
}
static int get_from_header(pjsip_rx_data *rdata, char *username, size_t username_size, char *domain, size_t domain_size)
{
pjsip_uri *from = rdata->msg_info.from->uri;
- pjsip_sip_uri *sip_from;
- if (!PJSIP_URI_SCHEME_IS_SIP(from) && !PJSIP_URI_SCHEME_IS_SIPS(from)) {
+ if (!ast_sip_is_uri_sip_sips(from)) {
return -1;
}
- sip_from = (pjsip_sip_uri *) pjsip_uri_get_uri(from);
- ast_copy_pj_str(username, &sip_from->user, username_size);
- ast_copy_pj_str(domain, &sip_from->host, domain_size);
+
+ ast_copy_pj_str(username, ast_sip_pjsip_uri_get_username(from), username_size);
+ ast_copy_pj_str(domain, ast_sip_pjsip_uri_get_hostname(from), domain_size);
+
return 0;
}
{
RAII_VAR(struct ast_sip_endpoint *, endpt, NULL, ao2_cleanup);
pjsip_uri *ruri = rdata->msg_info.msg->line.req.uri;
- pjsip_sip_uri *sip_ruri;
pjsip_name_addr *name_addr;
char buf[MAX_BODY_SIZE];
const char *field;
int res = 0;
int size;
- if (!PJSIP_URI_SCHEME_IS_SIP(ruri) && !PJSIP_URI_SCHEME_IS_SIPS(ruri)) {
+ if (!ast_sip_is_allowed_uri(ruri)) {
return PJSIP_SC_UNSUPPORTED_URI_SCHEME;
}
- sip_ruri = pjsip_uri_get_uri(ruri);
- ast_copy_pj_str(exten, &sip_ruri->user, AST_MAX_EXTENSION);
+ ast_copy_pj_str(exten, ast_sip_pjsip_uri_get_username(ruri), AST_MAX_EXTENSION);
/*
* We may want to match in the dialplan without any user
* for the subsequent requests and responses & then be able to properly update
* the dialog object for all required events.
*/
-
static int rewrite_route_set(pjsip_rx_data *rdata, pjsip_dialog *dlg)
{
pjsip_rr_hdr *rr = NULL;
static struct pjsip_param *get_uri_option_line(const void *uri)
{
- pjsip_sip_uri *pjuri;
static const pj_str_t LINE_STR = { "line", 4 };
- if (!PJSIP_URI_SCHEME_IS_SIP(uri) && !PJSIP_URI_SCHEME_IS_SIPS(uri)) {
- return NULL;
- }
- pjuri = pjsip_uri_get_uri(uri);
- return pjsip_param_find(&pjuri->other_param, &LINE_STR);
+ return ast_sip_pjsip_uri_get_other_param((pjsip_uri *)uri, &LINE_STR);
}
/*! \brief Endpoint identifier which uses the 'line' parameter to establish a relationship to an outgoing registration */
static struct ast_sip_aor *find_aor(struct ast_sip_endpoint *endpoint, pjsip_uri *uri)
{
char *configured_aors, *aor_name;
- pjsip_sip_uri *sip_uri;
+ const pj_str_t *uri_username;
+ const pj_str_t *uri_hostname;
char *domain_name;
char *username;
struct ast_str *id = NULL;
return NULL;
}
- sip_uri = pjsip_uri_get_uri(uri);
- domain_name = ast_alloca(sip_uri->host.slen + 1);
- ast_copy_pj_str(domain_name, &sip_uri->host, sip_uri->host.slen + 1);
- username = ast_alloca(sip_uri->user.slen + 1);
- ast_copy_pj_str(username, &sip_uri->user, sip_uri->user.slen + 1);
+ uri_hostname = ast_sip_pjsip_uri_get_hostname(uri);
+ domain_name = ast_alloca(uri_hostname->slen + 1);
+ ast_copy_pj_str(domain_name, uri_hostname, uri_hostname->slen + 1);
+
+ uri_username = ast_sip_pjsip_uri_get_username(uri);
+ username = ast_alloca(uri_username->slen + 1);
+ ast_copy_pj_str(username, uri_username, uri_username->slen + 1);
/*
* We may want to match without any user options getting
break;
}
- if (!id && !(id = ast_str_create(strlen(username) + sip_uri->host.slen + 2))) {
+ if (!id && !(id = ast_str_create(strlen(username) + uri_hostname->slen + 2))) {
aor_name = NULL;
break;
}
struct ast_sip_pubsub_body_generator *generator;
struct ast_sip_subscription_handler *handler;
char *resource;
- pjsip_sip_uri *request_uri;
size_t resource_size;
int resp;
struct resource_tree tree;
pjsip_expires_hdr *expires_header;
int64_t expires;
+ const pj_str_t *user;
- request_uri = pjsip_uri_get_uri(rdata->msg_info.msg->line.req.uri);
- resource_size = pj_strlen(&request_uri->user) + 1;
+ user = ast_sip_pjsip_uri_get_username(rdata->msg_info.msg->line.req.uri);
+ resource_size = pj_strlen(user) + 1;
resource = ast_alloca(resource_size);
- ast_copy_pj_str(resource, &request_uri->user, resource_size);
+ ast_copy_pj_str(resource, user, resource_size);
/*
* We may want to match without any user options getting
struct ast_sip_pubsub_body_generator *generator;
char *resource;
pjsip_uri *request_uri;
- pjsip_sip_uri *request_uri_sip;
size_t resource_size;
int resp;
struct resource_tree tree;
pj_status_t dlg_status;
+ const pj_str_t *user;
endpoint = ast_pjsip_rdata_get_endpoint(rdata);
ast_assert(endpoint != NULL);
request_uri = rdata->msg_info.msg->line.req.uri;
- if (!PJSIP_URI_SCHEME_IS_SIP(request_uri) && !PJSIP_URI_SCHEME_IS_SIPS(request_uri)) {
+ if (!ast_sip_is_uri_sip_sips(request_uri)) {
char uri_str[PJSIP_MAX_URL_SIZE];
pjsip_uri_print(PJSIP_URI_IN_REQ_URI, request_uri, uri_str, sizeof(uri_str));
return PJ_TRUE;
}
- request_uri_sip = pjsip_uri_get_uri(request_uri);
- resource_size = pj_strlen(&request_uri_sip->user) + 1;
+ user = ast_sip_pjsip_uri_get_username(request_uri);
+ resource_size = pj_strlen(user) + 1;
resource = ast_alloca(resource_size);
- ast_copy_pj_str(resource, &request_uri_sip->user, resource_size);
+ ast_copy_pj_str(resource, user, resource_size);
/*
* We may want to match without any user options getting
RAII_VAR(struct ast_sip_publication_resource *, resource, NULL, ao2_cleanup);
struct ast_variable *event_configuration_name = NULL;
pjsip_uri *request_uri;
- pjsip_sip_uri *request_uri_sip;
int resp;
+ const pj_str_t *user;
request_uri = rdata->msg_info.msg->line.req.uri;
- if (!PJSIP_URI_SCHEME_IS_SIP(request_uri) && !PJSIP_URI_SCHEME_IS_SIPS(request_uri)) {
+ if (!ast_sip_is_uri_sip_sips(request_uri)) {
char uri_str[PJSIP_MAX_URL_SIZE];
pjsip_uri_print(PJSIP_URI_IN_REQ_URI, request_uri, uri_str, sizeof(uri_str));
return NULL;
}
- request_uri_sip = pjsip_uri_get_uri(request_uri);
- resource_size = pj_strlen(&request_uri_sip->user) + 1;
+ user = ast_sip_pjsip_uri_get_username(request_uri);
+ resource_size = pj_strlen(user) + 1;
resource_name = ast_alloca(resource_size);
- ast_copy_pj_str(resource_name, &request_uri_sip->user, resource_size);
+ ast_copy_pj_str(resource_name, user, resource_size);
/*
* We may want to match without any user options getting
static enum sip_get_destination_result get_destination(struct ast_sip_session *session, pjsip_rx_data *rdata)
{
pjsip_uri *ruri = rdata->msg_info.msg->line.req.uri;
- pjsip_sip_uri *sip_ruri;
struct ast_features_pickup_config *pickup_cfg;
const char *pickupexten;
- if (!PJSIP_URI_SCHEME_IS_SIP(ruri) && !PJSIP_URI_SCHEME_IS_SIPS(ruri)) {
+ if (!ast_sip_is_allowed_uri(ruri)) {
return SIP_GET_DEST_UNSUPPORTED_URI;
}
- sip_ruri = pjsip_uri_get_uri(ruri);
- ast_copy_pj_str(session->exten, &sip_ruri->user, sizeof(session->exten));
+ ast_copy_pj_str(session->exten, ast_sip_pjsip_uri_get_username(ruri), sizeof(session->exten));
/*
* We may want to match in the dialplan without any user