123 #include <pjsip_ua.h> 136 #define MAX_HDR_SIZE 512 137 #define MAX_BODY_SIZE 1024 138 #define MAX_USER_SIZE 128 154 if (rdata->msg_info.msg->body && rdata->msg_info.msg->body->len) {
156 &rdata->msg_info.msg->body->content_type,
"text",
"plain");
158 res = rdata->msg_info.ctype &&
160 &rdata->msg_info.ctype->media,
"text",
"plain");
163 return res ? PJSIP_SC_OK : PJSIP_SC_UNSUPPORTED_MEDIA_TYPE;
177 int res = PJSIP_SC_UNSUPPORTED_MEDIA_TYPE;
178 static const pj_str_t
text = {
"text", 4};
179 static const pj_str_t application = {
"application", 11};
181 if (!(rdata->msg_info.msg->body && rdata->msg_info.msg->body->len > 0)) {
186 if (pj_stricmp(&rdata->msg_info.msg->body->content_type.type, &text) == 0
187 || pj_stricmp(&rdata->msg_info.msg->body->content_type.type, &application) == 0) {
189 }
else if (rdata->msg_info.ctype
190 && (pj_stricmp(&rdata->msg_info.ctype->media.type, &text) == 0
191 || pj_stricmp(&rdata->msg_info.ctype->media.type, &application) == 0)) {
214 const char *
user,
char **uri)
217 char *contact_uri =
NULL;
218 char *after_scheme =
NULL;
230 ast_log(
LOG_WARNING,
"Dest: '%s' MSG SEND FAIL: Couldn't find contact for endpoint '%s'\n",
238 ast_debug(3,
"Dest: '%s' User: '%s' Endpoint: '%s' ContactURI: '%s'\n", to, user, endpoint_name, contact_uri);
243 scheme = contact_uri;
244 after_scheme = strchr(contact_uri,
':');
247 ast_log(
LOG_WARNING,
"Dest: '%s' MSG SEND FAIL: There was no scheme in the contact URI '%s'\n",
254 *after_scheme =
'\0';
263 host = strchr(after_scheme,
'@');
270 *uri =
ast_malloc(strlen(scheme) + strlen(user) + strlen(host) + 3 );
271 sprintf(*uri,
"%s:%s@%s", scheme, user, host);
289 char *endpoint_name =
NULL;
303 char *temp_uri =
ast_malloc(strlen(destination) + strlen(
"sip:") + 1);
304 sprintf(temp_uri,
"sip:%s", destination);
307 ast_debug(3,
"Dest: '%s' Didn't find endpoint so adding scheme and using URI '%s' with default endpoint\n",
316 endpoint_name = destination;
324 ast_log(
LOG_WARNING,
"Dest: '%s' MSG SEND FAIL: Found endpoint '%s' but didn't find an aor/contact for it\n",
332 ast_debug(3,
"Dest: '%s' Found endpoint '%s' and found contact with URI '%s'\n",
333 to, endpoint_name, *uri);
359 char *slash,
char *atsign,
char *scheme)
361 char *endpoint_name =
NULL;
365 char *afterslash = slash + 1;
369 ast_debug(3,
"Dest: '%s' Dialplan format'\n", to);
373 if (!atsign || strchr(afterslash,
'/')) {
380 "Dest: '%s' MSG SEND FAIL: Destinations beginning with 'PJSIP/' must be in the form of 'PJSIP/user@endpoint'\n",
386 endpoint_name = atsign + 1;
387 ast_debug(3,
"Dest: '%s' User: '%s' Endpoint: '%s'\n", to, user, endpoint_name);
395 endpoint_name = destination;
396 ast_debug(3,
"Dest: '%s' Endpoint: '%s'\n", to, endpoint_name);
402 ast_log(
LOG_WARNING,
"Dest: '%s' MSG SEND FAIL: Didn't find endpoint with name '%s'\n",
413 ast_debug(3,
"Dest: '%s' Found endpoint '%s' and found URI '%s' after '/'\n",
414 to, endpoint_name, *uri);
437 ast_debug(3,
"Dest: '%s' User: '%s' Endpoint: '%s' URI: '%s'\n", to, user,
438 endpoint_name, *uri);
454 *uri =
ast_malloc(strlen(afterslash) + strlen(
"sip:") + 1);
455 sprintf(*uri,
"sip:%s", afterslash);
456 ast_debug(3,
"Dest: '%s' Found endpoint '%s' but didn't find aor after '/' so using URI '%s'\n",
457 to, endpoint_name, *uri);
464 ast_debug(3,
"Dest: '%s' Found endpoint '%s' and found aor '%s' after '/'\n",
474 ast_log(
LOG_WARNING,
"Dest: '%s' MSG SEND FAIL: Found endpoint '%s' but didn't find contact for aor '%s'\n",
483 ast_debug(3,
"Dest: '%s' Found endpoint '%s' and found contact with URI '%s' for aor '%s'\n",
506 char *slash,
char *atsign,
char *scheme)
508 char *endpoint_name =
NULL;
511 char *afterat = atsign + 1;
514 endpoint_name = destination;
524 *uri =
ast_malloc(strlen(to) + strlen(
"sip:") + 1);
525 sprintf(*uri,
"sip:%s", to);
527 ast_debug(3,
"Dest: '%s' Didn't find endpoint before the '@' so using URI '%s' with default endpoint\n",
545 ast_log(
LOG_WARNING,
"Dest: '%s' MSG SEND FAIL: Found endpoint '%s' but didn't find contact\n",
552 ast_debug(3,
"Dest: '%s' Found endpoint '%s' and found contact with URI '%s' (discarding domain %s)\n",
553 to, endpoint_name, *uri, afterat);
626 slash = strchr(destination,
'/');
627 atsign = strchr(destination,
'@');
628 scheme =
S_OR(strstr(destination,
"sip:"), strstr(destination,
"sips:"));
630 if (!slash && !atsign && !scheme) {
646 return handle_slash(to, destination, uri, slash, atsign, scheme);
649 if (!endpoint && atsign && !scheme) {
656 return handle_atsign(to, destination, uri, slash, atsign, scheme);
664 ast_debug(3,
"Dest: '%s' Didn't find an endpoint but did find a scheme so using URI '%s' with default endpoint\n",
667 *uri =
ast_malloc(strlen(destination) + strlen(
"sip:") + 1);
668 sprintf(*uri,
"sip:%s", destination);
669 ast_debug(3,
"Dest: '%s' Didn't find an endpoint and didn't find scheme so adding scheme and using URI '%s' with default endpoint\n",
688 pjsip_name_addr *parsed_name_addr;
689 pjsip_sip_uri *sip_uri;
690 pjsip_name_addr *tdata_name_addr;
691 pjsip_sip_uri *tdata_sip_uri;
693 #define DEBUG_BUF_SIZE 256 695 parsed_name_addr = (pjsip_name_addr *) pjsip_parse_uri(tdata->pool, to, strlen(to),
696 PJSIP_PARSE_URI_AS_NAMEADDR);
698 if (!parsed_name_addr || (!PJSIP_URI_SCHEME_IS_SIP(parsed_name_addr->uri)
699 && !PJSIP_URI_SCHEME_IS_SIPS(parsed_name_addr->uri))) {
704 sip_uri = pjsip_uri_get_uri(parsed_name_addr->uri);
707 pjsip_uri_print(PJSIP_URI_IN_FROMTO_HDR, sip_uri, buf,
DEBUG_BUF_SIZE);
708 ast_debug(3,
"Parsed To: %.*s %s\n", (
int)parsed_name_addr->display.slen,
709 parsed_name_addr->display.ptr, buf);
712 tdata_name_addr = (pjsip_name_addr *) PJSIP_MSG_TO_HDR(tdata->msg)->uri;
713 if (!tdata_name_addr || (!PJSIP_URI_SCHEME_IS_SIP(tdata_name_addr->uri)
714 && !PJSIP_URI_SCHEME_IS_SIPS(tdata_name_addr->uri))) {
720 tdata_sip_uri = pjsip_uri_get_uri(tdata_name_addr->uri);
723 pjsip_uri_print(PJSIP_URI_IN_FROMTO_HDR, tdata_sip_uri, buf,
DEBUG_BUF_SIZE);
724 ast_debug(3,
"Original tdata To: %.*s %s\n", (
int)tdata_name_addr->display.slen,
725 tdata_name_addr->display.ptr, buf);
729 pjsip_sip_uri_assign(tdata->pool, tdata_sip_uri, sip_uri);
731 pj_strdup(tdata->pool, &tdata_name_addr->display, &parsed_name_addr->display);
735 pjsip_uri_print(PJSIP_URI_IN_FROMTO_HDR, tdata_sip_uri, buf, 256);
736 ast_debug(3,
"New tdata To: %.*s %s\n", (
int)tdata_name_addr->display.slen,
737 tdata_name_addr->display.ptr, buf);
741 #undef DEBUG_BUF_SIZE 755 pjsip_name_addr *parsed_name_addr;
757 parsed_name_addr = (pjsip_name_addr *) pjsip_parse_uri(tdata->pool, to, strlen(to),
758 PJSIP_PARSE_URI_AS_NAMEADDR);
760 if (parsed_name_addr) {
761 if (pj_strlen(&parsed_name_addr->display)) {
762 pjsip_name_addr *name_addr =
763 (pjsip_name_addr *) PJSIP_MSG_TO_HDR(tdata->msg)->uri;
765 pj_strdup(tdata->pool, &name_addr->display, &parsed_name_addr->display);
790 pjsip_name_addr *name_addr;
792 pjsip_name_addr *parsed_name_addr;
798 name_addr = (pjsip_name_addr *) PJSIP_MSG_FROM_HDR(tdata->msg)->uri;
799 uri = pjsip_uri_get_uri(name_addr);
801 parsed_name_addr = (pjsip_name_addr *) pjsip_parse_uri(tdata->pool, from,
802 strlen(from), PJSIP_PARSE_URI_AS_NAMEADDR);
803 if (parsed_name_addr) {
804 pjsip_sip_uri *parsed_uri;
806 if (!PJSIP_URI_SCHEME_IS_SIP(parsed_name_addr->uri)
807 && !PJSIP_URI_SCHEME_IS_SIPS(parsed_name_addr->uri)) {
812 parsed_uri = pjsip_uri_get_uri(parsed_name_addr->uri);
814 if (pj_strlen(&parsed_name_addr->display)) {
815 pj_strdup(tdata->pool, &name_addr->display, &parsed_name_addr->display);
819 pj_strdup(tdata->pool, &uri->user, &parsed_uri->user);
820 pj_strdup(tdata->pool, &uri->host, &parsed_uri->host);
821 uri->port = parsed_uri->port;
826 char *
domain = strchr(from,
'@');
831 pj_strset3(&pj_from, from, domain);
832 pj_strdup(tdata->pool, &uri->user, &pj_from);
834 pj_strdup2(tdata->pool, &uri->host, domain + 1);
836 pj_strdup2(tdata->pool, &uri->user, from);
862 static const char *hdr[] = {
877 if (!strcasecmp(name, hdr[i])) {
902 if (!strcasecmp(name,
"Max-Forwards")) {
904 if (sscanf(value,
"%30d", &max_forwards) != 1 || --max_forwards == 0) {
909 sprintf((
char *) value,
"%d", max_forwards);
933 pjsip_hdr *h = rdata->msg_info.msg->hdr.next;
934 pjsip_hdr *
end= &rdata->msg_info.msg->hdr;
937 if ((res = pjsip_hdr_print_on(h, buf,
sizeof(buf)-1)) > 0) {
939 if ((c = strchr(buf,
':'))) {
968 if (!rdata->msg_info.msg->body || !rdata->msg_info.msg->body->len) {
972 if ((res = rdata->msg_info.msg->body->print_body(
973 rdata->msg_info.msg->body, buf, len)) < 0) {
978 while (res > 0 && ((buf[--res] ==
'\r') || (buf[res] ==
'\n')));
1006 scheme = strncmp(buf,
"sip", 3) ?
"pjsip:" :
"pj";
1007 count = strlen(scheme);
1008 if (count + size >= capacity) {
1010 "too large for given buffer\n");
1014 memmove(res + count, buf, size);
1015 memcpy(res, scheme, count);
1038 pjsip_uri *ruri = rdata->msg_info.msg->line.req.uri;
1039 pjsip_sip_uri *sip_ruri;
1040 pjsip_name_addr *name_addr;
1048 if (!PJSIP_URI_SCHEME_IS_SIP(ruri) && !PJSIP_URI_SCHEME_IS_SIPS(ruri)) {
1049 return PJSIP_SC_UNSUPPORTED_URI_SCHEME;
1052 sip_ruri = pjsip_uri_get_uri(ruri);
1064 context =
S_OR(endpt->message_context, endpt->context);
1069 name_addr = (pjsip_name_addr *)rdata->msg_info.to->uri;
1070 size = pjsip_uri_print(PJSIP_URI_IN_FROMTO_HDR, name_addr, buf,
sizeof(buf) - 1);
1072 return PJSIP_SC_INTERNAL_SERVER_ERROR;
1078 name_addr = (pjsip_name_addr *)rdata->msg_info.from->uri;
1079 size = pjsip_uri_print(PJSIP_URI_IN_FROMTO_HDR, name_addr, buf,
sizeof(buf) - 1);
1081 return PJSIP_SC_INTERNAL_SERVER_ERROR;
1086 field = pj_sockaddr_print(&rdata->pkt_info.src_addr, buf,
sizeof(buf) - 1, 3);
1089 switch (rdata->tp_info.transport->key.type) {
1090 case PJSIP_TRANSPORT_UDP:
1091 case PJSIP_TRANSPORT_UDP6:
1094 case PJSIP_TRANSPORT_TCP:
1095 case PJSIP_TRANSPORT_TCP6:
1098 case PJSIP_TRANSPORT_TLS:
1099 case PJSIP_TRANSPORT_TLS6:
1103 field = rdata->tp_info.transport->type_name;
1107 if (
print_body(rdata, buf,
sizeof(buf) - 1) > 0) {
1114 if (endpt->id.self.name.valid) {
1115 res |=
ast_msg_set_var(msg,
"PJSIP_ENDPOINT", endpt->id.self.name.str);
1120 return !res ? PJSIP_SC_OK : PJSIP_SC_INTERNAL_SERVER_ERROR;
1152 if (!(destination = strchr(destination,
':'))) {
1166 uri_params = strchr(mdata->
from,
'@');
1167 if (uri_params && (uri_params = strchr(mdata->
from,
';'))) {
1175 static const pj_str_t CONTENT_TYPE = {
"Content-Type",
sizeof(
"Content-Type") - 1 };
1177 const char *content_type =
ast_msg_get_var(msg, pj_strbuf(&CONTENT_TYPE));
1179 pj_str_t
type, subtype;
1180 pjsip_ctype_hdr *parsed;
1183 parsed = pjsip_parse_hdr(tdata->pool, &CONTENT_TYPE,
1194 pj_strdup_with_null(tdata->pool, &type, &parsed->media.type);
1195 pj_strdup_with_null(tdata->pool, &subtype, &parsed->media.subtype);
1197 body->
type = pj_strbuf(&type);
1198 body->
subtype = pj_strbuf(&subtype);
1231 pjsip_tx_data *tdata;
1235 ast_debug(3,
"mdata From: %s msg From: %s mdata Destination: %s msg To: %s\n",
1241 "PJSIP MESSAGE - Could not find endpoint '%s' and no default outbound endpoint configured\n",
1247 "MdataDestination: %s\r\n" 1292 #ifdef TEST_FRAMEWORK 1294 pjsip_name_addr *tdata_name_addr;
1295 pjsip_sip_uri *tdata_sip_uri;
1299 tdata_name_addr = (pjsip_name_addr *) PJSIP_MSG_TO_HDR(tdata->msg)->uri;
1300 tdata_sip_uri = pjsip_uri_get_uri(tdata_name_addr->uri);
1301 pjsip_uri_print(PJSIP_URI_IN_FROMTO_HDR, tdata_sip_uri, touri,
sizeof(touri));
1302 tdata_name_addr = (pjsip_name_addr *) PJSIP_MSG_FROM_HDR(tdata->msg)->uri;
1303 tdata_sip_uri = pjsip_uri_get_uri(tdata_name_addr->uri);
1304 pjsip_uri_print(PJSIP_URI_IN_FROMTO_HDR, tdata_sip_uri, fromuri,
sizeof(fromuri));
1309 "MdataDestination: %s\r\n" 1312 "RequestURI: %s\r\n" 1330 pjsip_tx_data_dec_ref(tdata);
1341 ast_debug(1,
"Sending message to '%s' (via endpoint %s) from '%s'\n",
1378 static pj_status_t
send_response(pjsip_rx_data *rdata,
enum pjsip_status_code code,
1379 pjsip_dialog *dlg, pjsip_transaction *tsx)
1381 pjsip_tx_data *tdata;
1385 if (status != PJ_SUCCESS) {
1391 status = pjsip_dlg_send_response(dlg, tsx, tdata);
1400 if (status != PJ_SUCCESS) {
1409 enum pjsip_status_code code;
1418 if (code != PJSIP_SC_OK) {
1430 if (code != PJSIP_SC_OK) {
1437 ast_debug(1,
"MESSAGE request received, but no handler wanted it\n");
1459 enum pjsip_status_code code;
1462 pjsip_transaction *tsx = pjsip_rdata_get_tsx(rdata);
1465 pjsip_name_addr *name_addr;
1478 if (code != PJSIP_SC_OK) {
1485 name_addr = (pjsip_name_addr *) rdata->msg_info.from->uri;
1486 from_len = pj_strlen(&name_addr->display);
1499 name_addr = (pjsip_name_addr *) rdata->msg_info.to->uri;
1500 to_len = pj_strlen(&name_addr->display);
1510 attrs[pos].
value =
ast_alloca(rdata->msg_info.msg->body->content_type.type.slen
1511 + rdata->msg_info.msg->body->content_type.subtype.slen + 2);
1512 sprintf(attrs[pos].
value,
"%.*s/%.*s",
1513 (
int)rdata->msg_info.msg->body->content_type.type.slen,
1514 rdata->msg_info.msg->body->content_type.type.ptr,
1515 (
int)rdata->msg_info.msg->body->content_type.subtype.slen,
1516 rdata->msg_info.msg->body->content_type.subtype.ptr);
1522 if (!attrs[pos].value) {
1523 send_response(rdata, PJSIP_SC_INTERNAL_SERVER_ERROR, dlg, tsx);
1526 ast_copy_string(attrs[pos].value, rdata->msg_info.msg->body->data, rdata->msg_info.msg->body->len + 1);
1532 send_response(rdata, PJSIP_SC_INTERNAL_SERVER_ERROR, dlg, tsx);
1536 ast_debug(1,
"Received in-dialog MESSAGE from '%s:%s': %s %s\n",
1546 send_response(rdata, PJSIP_SC_INTERNAL_SERVER_ERROR, dlg, tsx);
1560 .name = {
"Messaging Module", 16},
1562 .priority = PJSIP_MOD_PRIORITY_APPLICATION,
1586 if (!message_serializer) {
1610 .requires =
"res_pjsip,res_pjsip_session",
struct ast_party_caller * ast_channel_caller(struct ast_channel *chan)
static char exten[AST_MAX_EXTENSION]
#define AST_SIP_USER_OPTIONS_TRUNCATE_CHECK(str)
Truncate the URI user field options string if enabled.
int ast_msg_set_tech(struct ast_msg *msg, const char *fmt,...)
Set the technology associated with this message.
Asterisk main include file. File version handling, generic pbx functions.
const char * ast_msg_get_var(struct ast_msg *msg, const char *name)
Get the specified variable on the message.
static int insert_user_in_contact_uri(const char *to, const char *endpoint_name, const char *aors, const char *user, char **uri)
Find a contact and insert a "user@" into its URI.
static int update_to_display_name(pjsip_tx_data *tdata, char *to)
static enum pjsip_status_code rx_data_to_ast_msg(pjsip_rx_data *rdata, struct ast_msg *msg)
enum ast_msg_data_attribute_type type
int ast_msg_set_context(struct ast_msg *msg, const char *fmt,...)
Set the dialplan context for this message.
int ast_msg_set_body(struct ast_msg *msg, const char *fmt,...)
Set the 'body' text of a message (in UTF-8)
const pjsip_method pjsip_message_method
struct ast_party_name name
Subscriber name.
struct ast_msg * ast_msg_alloc(void)
Allocate a message.
int ast_msg_var_iterator_next(const struct ast_msg *msg, struct ast_msg_var_iterator *iter, const char **name, const char **value)
Get the next variable name and value that is set for sending outbound.
static enum pjsip_status_code check_content_type(const pjsip_rx_data *rdata)
const char *const name
Name of this message technology.
Structure used to transport a message through the frame core.
char * str
Subscriber name (Malloced)
int ast_msg_tech_register(const struct ast_msg_tech *tech)
Register a message technology.
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.
static const struct ast_msg_tech msg_tech
#define ast_strdup(str)
A wrapper for strdup()
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.
struct ast_sip_endpoint * ast_sip_default_outbound_endpoint(void)
Retrieve the default outbound endpoint.
void ast_sip_session_unregister_supplement(struct ast_sip_session_supplement *supplement)
Unregister a an supplement to SIP session processing.
Out-of-call text message support.
struct pjsip_inv_session * inv_session
const char * ast_msg_get_body(const struct ast_msg *msg)
Get the body of a message.
A structure describing a SIP session.
void ast_msg_var_iterator_destroy(struct ast_msg_var_iterator *iter)
Destroy a message variable iterator.
static char * sip_to_pjsip(char *buf, int size, int capacity)
static int load_module(void)
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_msg_set_to(struct ast_msg *msg, const char *fmt,...)
Set the 'to' URI of a message.
int ast_sip_add_header(pjsip_tx_data *tdata, const char *name, const char *value)
Add a header to an outbound SIP message.
#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.
const char * ast_msg_get_to(const struct ast_msg *msg)
Retrieve the destination of this message.
static int unload_module(void)
struct ast_sip_endpoint * ast_pjsip_rdata_get_endpoint(pjsip_rx_data *rdata)
Get the looked-up endpoint on an out-of dialog request or response.
static struct ast_taskprocessor * message_serializer
int ast_sip_create_response(const pjsip_rx_data *rdata, int st_code, struct ast_sip_contact *contact, pjsip_tx_data **p_tdata)
General purpose method for creating a SIP response.
struct ast_party_id id
Caller party ID.
#define ast_debug(level,...)
Log a DEBUG message.
static enum pjsip_status_code vars_to_headers(const struct ast_msg *msg, pjsip_tx_data *tdata)
static void update_content_type(pjsip_tx_data *tdata, struct ast_msg *msg, struct ast_sip_body *body)
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.
static struct ast_mansession session
void ast_msg_var_unref_current(struct ast_msg_var_iterator *iter)
Unref a message var from inside an iterator loop.
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.
#define AST_MAX_EXTENSION
Caller Party information.
#define ao2_ref(o, delta)
static void msg_data_destroy(void *obj)
int ast_sip_send_stateful_response(pjsip_rx_data *rdata, pjsip_tx_data *tdata, struct ast_sip_endpoint *sip_endpoint)
Send a stateful response to an out of dialog request.
#define ast_strdupa(s)
duplicate a string in memory from the stack
static pjsip_module messaging_module
const char * ast_sorcery_object_get_id(const void *object)
Get the unique identifier of a sorcery object.
struct ast_channel * channel
#define ast_malloc(len)
A wrapper for malloc()
int ast_msg_set_var(struct ast_msg *msg, const char *name, const char *value)
Set a variable on the message going to the dialplan.
An entity with which Asterisk communicates.
int ast_sip_register_service(pjsip_module *module)
Register a SIP service in Asterisk.
Core PBX routines and definitions.
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.
static struct ast_sip_endpoint * handle_slash(const char *to, char *destination, char **uri, char *slash, char *atsign, char *scheme)
int ast_sip_is_content_type(pjsip_media_type *content_type, char *type, char *subtype)
Checks if the given content type matches type/subtype.
#define ast_test_suite_event_notify(s, f,...)
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
int ast_msg_queue(struct ast_msg *msg)
Queue a message for routing through the dialplan.
struct ast_msg * ast_msg_ref(struct ast_msg *msg)
Bump a msg's ref count.
int ast_msg_data_queue_frame(struct ast_channel *channel, struct ast_msg_data *msg)
Queue an AST_FRAME_TEXT_DATA frame containing an ast_msg_data structure.
static int headers_to_vars(const pjsip_rx_data *rdata, struct ast_msg *msg)
static int print_body(pjsip_rx_data *rdata, char *buf, int len)
int ast_msg_tech_unregister(const struct ast_msg_tech *tech)
Unregister a message technology.
const char * ast_msg_get_from(const struct ast_msg *msg)
Retrieve the source of this message.
Channel datastore data for max forwards.
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
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.
static int update_from(pjsip_tx_data *tdata, char *from)
struct ast_taskprocessor * ast_sip_create_serializer(const char *name)
Create a new serializer for SIP tasks.
static enum pjsip_status_code check_content_type_in_dialog(const pjsip_rx_data *rdata)
char * ast_skip_blanks(const char *str)
Gets a pointer to the first non-whitespace character in a string.
#define ao2_alloc(data_size, destructor_fn)
static struct ast_sip_endpoint * get_outbound_endpoint(const char *to, char **uri)
struct ast_sip_contact * ast_sip_location_retrieve_first_aor_contact(const struct ast_sip_aor *aor)
Retrieve the first bound contact for an AOR.
static int update_to_uri(pjsip_tx_data *tdata, char *to)
Module has failed to load, may be in an inconsistent state.
An API for managing task processing threads that can be shared across modules.
int ast_msg_set_exten(struct ast_msg *msg, const char *fmt,...)
Set the dialplan extension for this message.
static int sip_msg_send(const struct ast_msg *msg, const char *destination, const char *from)
structure to hold users read from users.conf
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",)
int ast_msg_set_from(struct ast_msg *msg, const char *fmt,...)
Set the 'from' URI of a message.
A supplement to SIP message processing.
pjsip_endpoint * ast_sip_get_pjsip_endpoint(void)
Get a pointer to the PJSIP endpoint.
static int msg_send(void *data)
A ast_taskprocessor structure is a singleton by name.
int ast_msg_set_endpoint(struct ast_msg *msg, const char *fmt,...)
Set the technology's endpoint associated with this message.
static int incoming_in_dialog_request(struct ast_sip_session *session, struct pjsip_rx_data *rdata)
struct ast_sorcery * ast_sip_get_sorcery(void)
Get a pointer to the SIP sorcery structure.
int ast_msg_has_destination(const struct ast_msg *msg)
Determine if a particular message has a destination via some handler.
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
#define S_OR(a, b)
returns the equivalent of logic or for strings: first one if not empty, otherwise second one...
void * ast_taskprocessor_unreference(struct ast_taskprocessor *tps)
Unreference the specified taskprocessor and its reference count will decrement.
const char * ast_channel_name(const struct ast_channel *chan)
void ast_sip_unregister_service(pjsip_module *module)
static pj_status_t send_response(pjsip_rx_data *rdata, enum pjsip_status_code code, pjsip_dialog *dlg, pjsip_transaction *tsx)
static int force_inline attribute_pure ast_begins_with(const char *str, const char *prefix)
static struct ast_sip_session_supplement messaging_supplement
static struct msg_data * msg_data_create(const struct ast_msg *msg, const char *destination, const char *from)
unsigned char valid
TRUE if the name information is valid/present.
static char context[AST_MAX_CONTEXT]
struct ast_msg * ast_msg_destroy(struct ast_msg *msg)
Destroy an ast_msg.
const ast_string_field aors
#define ASTERISK_GPL_KEY
The text the key() function should return.
#define DEBUG_ATLEAST(level)
Asterisk module definitions.
static struct ast_sip_endpoint * handle_atsign(const char *to, char *destination, char **uri, char *slash, char *atsign, char *scheme)
static int is_msg_var_blocked(const char *name)
static struct ast_sip_endpoint * handle_single_token(const char *to, char *destination, char **uri)
const ast_string_field value
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.
#define ast_sip_session_register_supplement(supplement)
static pj_bool_t module_on_rx_request(pjsip_rx_data *rdata)
struct ast_msg_var_iterator * ast_msg_var_iterator_init(const struct ast_msg *msg)
Create a new message variable iterator.