29 #include <pjsip_simple.h> 257 #define DEFAULT_PUBLISHER_BUCKETS 119 262 #define MAX_UNLOAD_TIMEOUT_TIME 35 268 #define DEFAULT_STATE_BUCKETS 31 299 const char *right_key = arg;
304 right_key = object_right->
id;
307 cmp = strcmp(object_left->
id, right_key);
366 &publisher->
timer, 0)) {
376 pj_time_val delay = { .sec = 0, };
380 if (expiration > 0) {
381 delay.sec = expiration - PJSIP_PUBLISHC_DELAY_BEFORE_REFRESH;
386 if (delay.sec < PJSIP_PUBLISHC_DELAY_BEFORE_REFRESH) {
387 delay.sec = PJSIP_PUBLISHC_DELAY_BEFORE_REFRESH;
430 pjsip_tpselector selector = { .type = PJSIP_TPSELECTOR_NONE, };
434 pjsip_tx_data_set_transport(tdata, &selector);
443 pjsip_tx_data *tdata;
445 if (pjsip_publishc_unpublish(publisher->
client, &tdata) == PJ_SUCCESS) {
447 pjsip_publishc_send(publisher->
client, tdata);
494 ast_debug(2,
"Could not find handler for event '%s' for outbound publish client '%s'\n",
497 ast_log(
LOG_ERROR,
"Failed to start outbound publish with event '%s' for client '%s'\n",
576 char *uri,
size_t size)
599 char *uri,
size_t size)
620 ast_log(
LOG_ERROR,
"Handler does not implement required callbacks. Cannot register\n");
623 ast_log(
LOG_ERROR,
"No event package specified for event publisher handler. Cannot register\n");
629 ast_log(
LOG_ERROR,
"Unable to register event publisher handler for event %s. " 630 "A handler is already registered\n", handler->
event_name);
646 if (handler == iter) {
697 const char *uid_ptr =
uid;
709 datastore->info =
info;
716 if (!datastore->uid) {
754 pjsip_tx_data *tdata;
757 if (publisher->destroy || publisher->sending || !(message =
AST_LIST_FIRST(&publisher->queue))) {
761 if (pjsip_publishc_publish(publisher->client, PJ_FALSE, &tdata) != PJ_SUCCESS) {
767 pjsip_tx_data_dec_ref(tdata);
773 status = pjsip_publishc_send(publisher->client, tdata);
774 if (status == PJ_EBUSY) {
777 }
else if (status != PJ_SUCCESS) {
781 publisher->sending = message;
801 size_t type_len = 0, subtype_len = 0, body_text_len = 0;
812 type_len = strlen(body->
type) + 1;
813 subtype_len = strlen(body->
subtype) + 1;
814 body_text_len = strlen(body->
body_text) + 1;
817 message =
ast_calloc(1,
sizeof(*message) + type_len + subtype_len + body_text_len);
854 pj_pool_t *
pool,
const char *uri,
const char *
user, pj_str_t *res_uri)
858 pjsip_sip_uri *parsed_uri;
861 pj_strdup2_with_null(pool, &tmp, uri);
862 if (!(parsed = pjsip_parse_uri(pool, tmp.ptr, tmp.slen, 0))) {
866 if (!(parsed_uri = pjsip_uri_get_uri(parsed))) {
871 pj_strdup2(pool, &parsed_uri->user, user);
879 if ((size = pjsip_uri_print(PJSIP_URI_IN_OTHER, parsed_uri, res_uri->ptr,
883 res_uri->ptr[size] =
'\0';
884 res_uri->slen = size;
891 pj_str_t *
server_uri, pj_str_t *to_uri, pj_str_t *from_uri)
896 ast_log(
LOG_ERROR,
"Invalid server URI '%s' specified on outbound publish '%s'\n",
902 to_uri->ptr = server_uri->ptr;
903 to_uri->slen = server_uri->slen;
905 ast_log(
LOG_ERROR,
"Invalid to URI '%s' specified on outbound publish '%s'\n",
916 from_uri->ptr = server_uri->ptr;
917 from_uri->slen = server_uri->slen;
919 ast_log(
LOG_ERROR,
"Invalid from URI '%s' specified on outbound publish '%s'\n",
939 pjsip_publishc_opt opt = {
940 .queue_request = PJ_FALSE,
951 &publisher->
client) != PJ_SUCCESS) {
959 pjsip_route_hdr route_set, *route;
960 static const pj_str_t ROUTE_HNAME = {
"Route", 5 };
962 pj_list_init(&route_set);
964 if (!(route = pjsip_parse_hdr(pjsip_publishc_get_pool(publisher->
client), &ROUTE_HNAME,
966 pjsip_publishc_destroy(publisher->
client);
969 pj_list_insert_nodes_before(&route_set, route);
971 pjsip_publishc_set_route_set(publisher->
client, &route_set);
977 ast_log(
LOG_ERROR,
"Could not create pool for URI validation on outbound publish '%s'\n",
979 pjsip_publishc_destroy(publisher->
client);
985 pjsip_publishc_destroy(publisher->
client);
989 pj_cstr(&event,
publish->event);
990 if (pjsip_publishc_init(publisher->
client, &event, &server_uri, &from_uri, &to_uri,
991 publish->expiration) != PJ_SUCCESS) {
992 ast_log(
LOG_ERROR,
"Failed to initialize publishing client on outbound publish '%s'\n",
995 pjsip_publishc_destroy(publisher->
client);
1039 publisher =
ao2_alloc(
sizeof(*publisher) + (user ? strlen(user) : 0) + 1,
1057 publisher->
timer.user_data = publisher;
1060 strcpy(publisher->
user, user);
1062 *publisher->
user =
'\0';
1076 ast_log(
LOG_ERROR,
"Unable to create publisher for outbound publish '%s'\n",
1142 pjsip_publishc_destroy(publisher->
client);
1262 #define DESTROY_CLIENT() do { \ 1263 pjsip_publishc_destroy(publisher->client); \ 1264 publisher->client = NULL; \ 1265 ao2_ref(publisher, -1); } while (0) 1270 pjsip_tx_data *tdata;
1272 if (publisher->destroy) {
1273 if (publisher->sending) {
1274 publisher->sending =
NULL;
1288 if (param->code == 401 || param->code == 407) {
1289 pjsip_transaction *tsx = pjsip_rdata_get_tsx(param->rdata);
1292 param->rdata, tsx->last_tx, &tdata)) {
1294 pjsip_publishc_send(publisher->client, tdata);
1296 publisher->auth_attempts++;
1298 if (publisher->auth_attempts ==
publish->max_auth_attempts) {
1300 ast_log(
LOG_ERROR,
"Reached maximum number of PUBLISH authentication attempts on outbound publish '%s'\n",
1308 publisher->auth_attempts = 0;
1310 if (param->code == 412) {
1313 ast_log(
LOG_ERROR,
"Failed to create a new outbound publish client for '%s' on 412 response\n",
1319 publisher->sending =
NULL;
1320 }
else if (param->code == 423) {
1322 pjsip_expires_hdr *expires;
1324 expires = pjsip_msg_find_hdr(param->rdata->msg_info.msg, PJSIP_H_MIN_EXPIRES,
NULL);
1325 if (!expires || !expires->ivalue) {
1327 ast_log(
LOG_ERROR,
"Received 423 response on outbound publish '%s' without a Min-Expires header\n",
1332 pjsip_publishc_update_expires(publisher->client, expires->ivalue);
1333 publisher->sending =
NULL;
1334 }
else if (publisher->sending) {
1338 publisher->sending =
NULL;
1339 if (!param->rdata) {
1350 if (!publisher->client) {
1363 #define DATASTORE_BUCKETS 53 1376 uid = datastore->
uid;
1391 const char *right_key = arg;
1396 right_key = object_right->
uid;
1399 cmp = strcmp(object_left->
uid, right_key);
1402 cmp = strncmp(object_left->
uid, right_key, strlen(right_key));
1449 sip_outbound_publisher_hash_fn,
NULL, sip_outbound_publisher_cmp_fn);
1457 strcpy(state->
id,
id);
1468 ast_log(
LOG_ERROR,
"Server URI or hostname length exceeds pjproject limit or is not a sip(s) uri: '%s' on outbound publish '%s'\n",
1478 ast_log(
LOG_ERROR,
"From URI or hostname length exceeds pjproject limit or is not a sip(s) uri: '%s' on outbound publish '%s'\n",
1484 ast_log(
LOG_ERROR,
"To URI or hostname length exceeds pjproject limit or is not a sip(s) uri: '%s' on outbound publish '%s'\n",
1528 ast_log(
LOG_ERROR,
"Unable to reinitialize client(s) for outbound publish '%s'\n",
1547 #define ADD_TO_NEW_STATES(__obj) \ 1549 ao2_link(new_states, __obj); \ 1550 ao2_ref(__obj, -1); } } while (0) 1586 return res == 1 ? 0 : -1;
1602 !(publisher = sip_outbound_publish_client_add_publisher(new_state->
client,
NULL))) {
1631 ast_debug(2,
"Waiting for publication to complete for unload.\n");
1634 ast_log(
LOG_WARNING,
"Unload incomplete. Could not stop %d outbound publications. Try again later.\n",
1642 shutdown_group =
NULL;
1653 if (!shutdown_group) {
1662 ast_log(
LOG_ERROR,
"Unable to register 'outbound-publish' type with sorcery\n");
1706 .requires =
"res_pjproject,res_pjsip",
enum sip_cc_notify_state state
static int publisher_client_send(void *obj, void *arg, void *data, int flags)
static int sip_outbound_publisher_reinit_all(void *data)
void ast_taskprocessor_build_name(char *buf, unsigned int size, const char *format,...)
Build a taskprocessor name with a sequence number on the end.
int ast_sip_auth_vector_init(struct ast_sip_auth_vector *vector, const char *auth_names)
Initialize an auth vector with the configured values.
Asterisk main include file. File version handling, generic pbx functions.
#define AST_LIST_FIRST(head)
Returns the first entry contained in a list.
#define AST_RWLOCK_DEFINE_STATIC(rwlock)
AO2_STRING_FIELD_HASH_FN(sip_outbound_publisher, user)
static int unload_module(void)
#define DEFAULT_STATE_BUCKETS
Default number of client state container buckets.
#define AST_RWLIST_HEAD_STATIC(name, type)
Defines a structure to be used to hold a read/write list of specified type, statically initialized...
unsigned int started
Publishing has been fully started and event type informed.
static ast_rwlock_t load_lock
Used for locking while loading/reloading.
#define SCOPED_WRLOCK(varname, lock)
scoped lock specialization for write locks
The arg parameter is a search key, but is not an object.
static int datastore_hash(const void *obj, int flags)
void ast_sip_unregister_event_publisher_handler(struct ast_sip_event_publisher_handler *handler)
Unregister a publish handler.
static int sip_outbound_publisher_set_uris(pj_pool_t *pool, struct sip_outbound_publisher *publisher, pj_str_t *server_uri, pj_str_t *to_uri, pj_str_t *from_uri)
struct ast_sip_auth_vector outbound_auths
Configured authentication credentials.
#define AST_RWLIST_WRLOCK(head)
Write locks a list.
void ast_sip_auth_vector_destroy(struct ast_sip_auth_vector *vector)
Free contents of an auth vector.
static void sip_outbound_publish_state_destroy(void *obj)
Destructor function for publish state.
#define ao2_callback(c, flags, cb_fn, arg)
struct ast_serializer_shutdown_group * ast_serializer_shutdown_group_alloc(void)
Create a serializer group shutdown control object.
void ast_sip_publish_client_remove_datastore(struct ast_sip_outbound_publish_client *client, const char *name)
Remove a publication datastore from an event publisher.
#define AST_RWLIST_UNLOCK(head)
Attempts to unlock a read/write based list.
int(* start_publishing)(struct ast_sip_outbound_publish *configuration, struct ast_sip_outbound_publish_client *client)
Called when a publisher should start publishing.
const ast_string_field outbound_proxy
Outbound proxy to use.
Structure for variables, used for configurations and for channel variables.
static pj_pool_t * pool
Global memory pool for configuration and timers.
char user[0]
User, if any, associated with the publisher.
static int explicit_publish_destroy(void *data)
struct sip_outbound_publish_message::@484 entry
Linked list information.
Perform no matching, return all objects.
enum ast_cc_service_type service
static void stop_publishing(struct ast_sip_outbound_publish_client *client, struct ast_sip_event_publisher_handler *handler)
Full structure for sorcery.
Type for a default handler that should do nothing.
void ast_sip_publish_client_remove(struct ast_sip_outbound_publish_client *client, const char *user)
Remove the user from the client (stopping it from publishing)
Structure for a data store type.
struct ast_datastore * ast_sip_publish_client_get_datastore(struct ast_sip_outbound_publish_client *client, const char *name)
Retrieve an event publisher datastore.
#define ao2_global_obj_ref(holder)
void ao2_iterator_destroy(struct ao2_iterator *iter)
Destroy a container iterator.
#define AST_DECLARE_STRING_FIELDS(field_list)
Declare the fields needed in a structure.
#define ast_sorcery_apply_config(sorcery, name)
Return all matching objects.
struct sip_outbound_publisher::@485 queue
Queue of outgoing publish messages to send.
#define AST_LIST_EMPTY(head)
Checks whether the specified list contains any entries.
int ast_sip_publish_client_add_datastore(struct ast_sip_outbound_publish_client *client, struct ast_datastore *datastore)
Add a datastore to a SIP event publisher.
struct ast_sip_outbound_publish_client * client
Outbound publish client.
int ast_pjproject_get_buildopt(char *option, char *format_string,...)
Retrieve a pjproject build option.
#define ast_strdup(str)
A wrapper for strdup()
Structure for a data store object.
AO2_STRING_FIELD_CMP_FN(sip_outbound_publisher, user)
#define AST_TASKPROCESSOR_MAX_NAME
Suggested maximum taskprocessor name length (less null terminator).
int ast_serializer_shutdown_group_join(struct ast_serializer_shutdown_group *shutdown_group, int timeout)
Wait for the serializers in the group to shutdown with timeout.
int ast_sip_push_task_wait_servant(struct ast_taskprocessor *serializer, int(*sip_task)(void *), void *task_data)
Push a task to SIP servants and wait for it to complete.
static void sip_outbound_publish_datastore_destroy(void *obj)
#define ast_rwlock_unlock(a)
struct ast_sip_body body
Optional body.
Outbound publish state information (persists for lifetime of a publish)
static int sip_outbound_publisher_set_uri(pj_pool_t *pool, const char *uri, const char *user, pj_str_t *res_uri)
static struct ast_sip_outbound_publish_state * sip_outbound_publish_state_alloc(struct ast_sip_outbound_publish *publish)
Allocator function for publish client.
static int sip_publisher_service_queue(void *data)
char * to_uri
The To URI for this specific publisher.
unsigned int multi_user
The publishing client is used for multiple users when true.
static int sip_outbound_publisher_reinit(void *obj, void *arg, int flags)
#define ast_strlen_zero(foo)
Asterisk datastore objects.
int(* stop_publishing)(struct ast_sip_outbound_publish_client *client)
Called when a publisher should stop publishing.
#define AST_RWLIST_RDLOCK(head)
Read locks a list.
static int current_state_reusable(struct ast_sip_outbound_publish *publish, struct ast_sip_outbound_publish_state *current_state)
#define ast_debug(level,...)
Log a DEBUG message.
#define ast_sorcery_object_field_register_custom(sorcery, type, name, default_val, config_handler, sorcery_handler, multiple_handler, flags,...)
Register a field within an object with custom handlers.
static void sip_outbound_publish_destroy(void *obj)
Destructor function for publish information.
const char * ast_sip_publish_client_get_user_from_uri(struct ast_sip_outbound_publish_client *client, const char *user, char *uri, size_t size)
Get the From URI the client will use for a specific user.
char body_contents[0]
Extra space for body contents.
The arg parameter is a partial search key similar to OBJ_SEARCH_KEY.
#define FLDSET(type,...)
Convert a struct and list of fields to an argument list of field offsets.
struct sip_outbound_publish_message * next
Outbound publish client state information (persists for lifetime of a publish)
int ast_sorcery_object_unregister(struct ast_sorcery *sorcery, const char *type)
Unregister an object type.
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.
Type for default option handler for unsigned integers.
static int send_unpublish_task(void *data)
Task for sending an unpublish.
#define ast_string_field_init(x, size)
Initialize a field pool and fields.
Callbacks that event publisher handlers will define.
#define AST_RWLIST_TRAVERSE
const char * event_name
The name of the event this handler deals with.
#define AST_STRING_FIELD(name)
Declare a string field.
static int datastore_cmp(void *obj, void *arg, int flags)
#define ao2_ref(o, delta)
const char * ast_sip_publish_client_get_to_uri(struct ast_sip_outbound_publish_client *client)
Get the To URI the client will use.
const struct ast_datastore_info * info
void(* destroy)(void *data)
#define AST_RWLIST_REMOVE_CURRENT
const char * ast_sorcery_object_get_id(const void *object)
Get the unique identifier of a sorcery object.
static void * sip_outbound_publish_alloc(const char *name)
Allocator function for publish information.
#define DATASTORE_BUCKETS
#define SCOPED_LOCK(varname, lock, lockfunc, unlockfunc)
Scoped Locks.
#define ADD_TO_NEW_STATES(__obj)
struct ao2_container * container
struct ast_taskprocessor * ast_sip_create_serializer_group(const char *name, struct ast_serializer_shutdown_group *shutdown_group)
Create a new serializer for SIP tasks.
int ast_sip_create_request_with_auth(const struct ast_sip_auth_vector *auths, pjsip_rx_data *challenge, pjsip_tx_data *tdata, pjsip_tx_data **new_request)
Create a response to an authentication challenge.
#define AST_LIST_REMOVE_HEAD(head, field)
Removes and returns the head entry from a list.
static int pjsip_max_url_size
struct ao2_container * datastores
Publisher datastores set up by handlers.
AST_LIST_HEAD_NOLOCK(contactliststruct, contact)
static struct ast_sip_event_publisher_handler * find_publisher_handler_for_event_name(const char *event_name)
#define ast_sorcery_object_register(sorcery, type, alloc, transform, apply)
Register an object type.
static void sip_outbound_publish_client_destroy(void *obj)
Destructor function for publish client.
static struct sip_outbound_publisher * sip_outbound_publish_client_add_publisher(struct ast_sip_outbound_publish_client *client, const char *user)
pj_timer_entry timer
Timer entry for refreshing publish.
#define AST_RWLIST_TRAVERSE_SAFE_BEGIN
struct ast_taskprocessor * serializer
Serializer for stuff and things.
static void cancel_publish_refresh(struct sip_outbound_publisher *publisher)
Helper function which cancels the refresh timer on a publisher.
static struct sip_outbound_publisher * sip_outbound_publish_client_get_publisher(struct ast_sip_outbound_publish_client *client, const char *user)
static void sip_outbound_publish_timer_cb(pj_timer_heap_t *timer_heap, struct pj_timer_entry *entry)
Publish client timer callback function.
static struct ast_serializer_shutdown_group * shutdown_group
static int cancel_and_unpublish(void *obj, void *arg, int flags)
Helper function which cancels and un-publishes a no longer used client.
char * from_uri
The From URI for this specific publisher.
int ast_sip_publish_client_send(struct ast_sip_outbound_publish_client *client, const struct ast_sip_body *body)
Send an outgoing PUBLISH message using a client.
static int sip_outbound_publisher_init(void *data)
Helper function that allocates a pjsip publish client and configures it.
#define AST_LIST_INSERT_TAIL(head, elm, field)
Appends a list entry to the tail of a list.
struct ast_sip_outbound_publish_client * owner
The client object that 'owns' this client.
#define ao2_container_alloc_hash(ao2_options, container_options, n_buckets, hash_fn, sort_fn, cmp_fn)
const ast_string_field transport
Explicit transport to use for publish.
int ast_sip_register_event_publisher_handler(struct ast_sip_event_publisher_handler *handler)
Register an event publisher handler.
#define SORCERY_OBJECT(details)
Macro which must be used at the beginning of each sorcery capable object.
static int sip_outbound_publish_apply(const struct ast_sorcery *sorcery, void *obj)
Apply function which finds or allocates a state structure.
static void sub_add_handler(struct ast_sip_event_publisher_handler *handler)
const char * ast_sip_publish_client_get_user_to_uri(struct ast_sip_outbound_publish_client *client, const char *user, char *uri, size_t size)
Get the To URI the client will use for a specific user.
pjsip_publishc * client
Underlying publish client.
static int outbound_auth_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int outbound_publish_state_hash(const void *obj, const int flags)
hashing function for state objects
int ast_sip_push_task(struct ast_taskprocessor *serializer, int(*sip_task)(void *), void *task_data)
Pushes a task to SIP servants.
unsigned int max_auth_attempts
Maximum number of auth attempts before stopping the publish client.
#define ao2_global_obj_release(holder)
Type for default option handler for bools (ast_true/ast_false)
#define ast_sorcery_apply_default(sorcery, type, name, data)
int ast_sip_publish_client_user_send(struct ast_sip_outbound_publish_client *client, const char *user, const struct ast_sip_body *body)
Send an outgoing PUBLISH message based on the user.
#define ao2_callback_data(container, flags, cb_fn, arg, data)
unsigned int auth_attempts
The number of auth attempts done.
Outbound publish information.
#define ao2_iterator_next(iter)
#define ao2_alloc(data_size, destructor_fn)
const ast_string_field server_uri
URI for the entity and server.
Queued outbound publish message.
struct ast_sip_outbound_publish * publish
Outbound publish information.
#define AST_LIST_ENTRY(type)
Declare a forward link structure inside a list entry.
struct ast_datastore * ast_sip_publish_client_alloc_datastore(const struct ast_datastore_info *info, const char *uid)
Alternative for ast_datastore_alloc()
#define SCOPED_AO2LOCK(varname, obj)
scoped lock specialization for ao2 mutexes.
#define ast_calloc(num, len)
A wrapper for calloc()
static int load_module(void)
static struct sip_outbound_publisher * sip_outbound_publisher_alloc(struct ast_sip_outbound_publish_client *client, const char *user)
char * ast_uuid_generate_str(char *buf, size_t size)
Generate a UUID string.
static struct ao2_container * get_publishes_and_update_state(void)
#define STRFLDSET(type,...)
Convert a struct and a list of stringfield fields to an argument list of field offsets.
static void schedule_publish_refresh(struct sip_outbound_publisher *publisher, int expiration)
Helper function which sets up the timer to send publication.
Module has failed to load, may be in an inconsistent state.
#define ao2_find(container, arg, flags)
An API for managing task processing threads that can be shared across modules.
const char * ast_sip_publish_client_get_from_uri(struct ast_sip_outbound_publish_client *client)
Get the From URI the client will use.
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",)
void * ast_sorcery_retrieve_by_fields(const struct ast_sorcery *sorcery, const char *type, unsigned int flags, struct ast_variable *fields)
Retrieve an object or multiple objects using specific fields.
#define ast_sorcery_object_field_register(sorcery, type, name, default_val, opt_type, flags,...)
Register a field within an object.
pjsip_endpoint * ast_sip_get_pjsip_endpoint(void)
Get a pointer to the PJSIP endpoint.
#define ast_rwlock_wrlock(a)
const ast_string_field event
The event type to publish.
#define ao2_global_obj_replace_unref(holder, obj)
struct ao2_container * publishers
Container of all the client publishing objects.
#define AST_RWLIST_INSERT_TAIL
static struct ast_sip_outbound_publish_state * sip_publish_state_get(const char *id)
The arg parameter is an object of the same type.
struct sip_outbound_publish_message * sending
The message currently being sent.
#define AST_VECTOR_GET(vec, idx)
Get an element from a vector.
static void sip_outbound_publish_synchronize(struct ast_sip_event_publisher_handler *removed)
Helper function which starts or stops publish clients when applicable.
A ast_taskprocessor structure is a singleton by name.
int ast_sip_validate_uri_length(const char *uri)
static void sip_outbound_publish_callback(struct pjsip_publishc_cbparam *param)
Callback function for publish client responses.
static struct ast_sorcery * sorcery
static int reload_module(void)
struct ast_sorcery * ast_sip_get_sorcery(void)
Get a pointer to the SIP sorcery structure.
When we need to walk through a container, we use an ao2_iterator to keep track of the current positio...
const ast_string_field from_uri
URI for the From header.
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.
static struct ao2_container * new_states
Used on [re]loads to hold new state data.
static void handler(const char *name, int response_code, struct ast_variable *get_params, struct ast_variable *path_vars, struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
struct ast_sip_outbound_publish_client * ast_sip_publish_client_get(const char *name)
Find a publish client using its name.
Type for default option handler for stringfields.
unsigned int expiration
Requested expiration time.
unsigned int destroy
Publish client should be destroyed.
static int can_reuse_publish(struct ast_sip_outbound_publish *existing, struct ast_sip_outbound_publish *applied)
static int validate_publish_config(struct ast_sip_outbound_publish *publish)
static void sip_outbound_publisher_destroy(void *obj)
Destructor function for publish client.
const ast_string_field to_uri
URI for the To header.
Search option field mask.
void * ast_sorcery_generic_alloc(size_t size, ao2_destructor_fn destructor)
Allocate a generic sorcery capable object.
static pj_timer_heap_t * timer_heap
Global timer heap.
void ast_sip_tpselector_unref(pjsip_tpselector *selector)
Unreference a pjsip_tpselector.
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.
#define MAX_UNLOAD_TIMEOUT_TIME
static AO2_GLOBAL_OBJ_STATIC(current_states)
static int cancel_refresh_timer_task(void *data)
Task for cancelling a refresh timer.
#define ast_string_field_free_memory(x)
free all memory - to be called before destroying the object
static void set_transport(struct sip_outbound_publisher *publisher, pjsip_tx_data *tdata)
struct ao2_iterator ao2_iterator_init(struct ao2_container *c, int flags) attribute_warn_unused_result
Create an iterator for a container.
#define AST_RWLIST_TRAVERSE_SAFE_END
static int outbound_publish_state_cmp(void *obj, void *arg, int flags)
comparator function for client objects
#define AST_VECTOR_SIZE(vec)
Get the number of elements in a vector.
void ast_sorcery_reload_object(const struct ast_sorcery *sorcery, const char *type)
Inform any wizards of a specific object type to reload persistent objects.
static force_inline int attribute_pure ast_str_hash(const char *str)
Compute a hash value on a string.
int ast_sip_set_tpselector_from_transport_name(const char *transport_name, pjsip_tpselector *selector)
Sets pjsip_tpselector from ast_sip_transport.
#define ao2_link(container, obj)