24 #include "asterisk/res_geolocation.h"
25 #include "asterisk/res_pjsip.h"
26 #include "include/res_pjsip_private.h"
27 #include "asterisk/res_pjsip_cli.h"
35 #include "asterisk/statsd.h"
40 #include "asterisk/res_stir_shaken.h"
43 #define PERSISTENT_BUCKETS 53
59 static int persistent_endpoint_hash(
const void *obj,
const int flags)
68 static int persistent_endpoint_cmp(
void *obj,
void *arg,
int flags)
77 static void endpoint_deleted_observer(
const void *
object)
86 .
deleted = endpoint_deleted_observer,
95 if (ast_strlen_zero(var->
value))
return 0;
97 if (!strncmp(var->
name,
"contact_", 8)) {
106 static int acl_to_str(
const void *obj,
const intptr_t *args,
char **buf)
115 if (ast_strlen_zero(first_acl->
name)) {
116 *buf =
"deny/permit";
118 *buf = first_acl->
name;
127 static int contact_acl_to_str(
const void *obj,
const intptr_t *args,
char **buf)
136 if (ast_strlen_zero(first_acl->
name)) {
137 *buf =
"deny/permit";
139 *buf = first_acl->
name;
151 int dtmf = ast_sip_str_to_dtmf(var->
value);
161 static int dtmf_to_str(
const void *obj,
const intptr_t *args,
char **buf)
167 result = ast_sip_dtmf_to_str(endpoint->
dtmf, dtmf_str,
sizeof(dtmf_str));
182 endpoint->
extensions.
flags &= ~(PJSIP_INV_SUPPORT_100REL | PJSIP_INV_REQUIRE_100REL);
186 endpoint->
rel100 = AST_SIP_100REL_SUPPORTED;
187 }
else if (!strcasecmp(var->
value,
"peer_supported")) {
189 endpoint->
rel100 = AST_SIP_100REL_PEER_SUPPORTED;
190 }
else if (!strcasecmp(var->
value,
"required")) {
192 endpoint->
rel100 = AST_SIP_100REL_REQUIRED;
194 endpoint->
rel100 = AST_SIP_100REL_UNSUPPORTED;
202 static int prack_to_str(
const void *obj,
const intptr_t *args,
char **buf)
206 if (endpoint->
rel100 == AST_SIP_100REL_SUPPORTED) {
208 }
else if (endpoint->
rel100 == AST_SIP_100REL_PEER_SUPPORTED) {
209 *buf =
"peer_supported";
210 }
else if (endpoint->
rel100 == AST_SIP_100REL_REQUIRED) {
225 endpoint->
extensions.
flags &= ~(PJSIP_INV_SUPPORT_TIMER | PJSIP_INV_REQUIRE_TIMER
226 | PJSIP_INV_ALWAYS_USE_TIMER);
231 }
else if (!strcasecmp(var->
value,
"required")) {
233 }
else if (!strcasecmp(var->
value,
"always") || !strcasecmp(var->
value,
"forced")) {
234 endpoint->
extensions.
flags |= (PJSIP_INV_SUPPORT_TIMER | PJSIP_INV_ALWAYS_USE_TIMER);
242 static int timers_to_str(
const void *obj,
const intptr_t *args,
char **buf)
260 static int security_mechanism_to_str(
const void *obj,
const intptr_t *args,
char **buf)
274 static const char *security_negotiation_map[] = {
275 [AST_SIP_SECURITY_NEG_NONE] =
"no",
276 [AST_SIP_SECURITY_NEG_MEDIASEC] =
"mediasec",
279 static int security_negotiation_to_str(
const void *obj,
const intptr_t *args,
char **buf)
288 int ast_sip_set_security_negotiation(
enum ast_sip_security_negotiation *
security_negotiation,
const char *
val) {
289 if (!strcasecmp(
"no", val)) {
290 *security_negotiation = AST_SIP_SECURITY_NEG_NONE;
291 }
else if (!strcasecmp(
"mediasec", val)) {
292 *security_negotiation = AST_SIP_SECURITY_NEG_MEDIASEC;
299 static int security_negotiation_handler(
const struct aco_option *opt,
struct ast_variable *var,
void *obj)
317 for (i = 0; i < size; ++i) {
319 ast_free((
char *) name);
329 ast_assert(auths != NULL);
332 ast_sip_auth_vector_destroy(auths);
338 while ((val =
ast_strip(strsep(&auth_names,
",")))) {
339 if (ast_strlen_zero(val)) {
356 ast_sip_auth_vector_destroy(auths);
389 static int inbound_auths_to_str(
const void *obj,
const intptr_t *args,
char **buf)
395 static int outbound_auths_to_str(
const void *obj,
const intptr_t *args,
char **buf)
409 static const char *sip_endpoint_identifier_type2str(
enum ast_sip_endpoint_identifier_type method)
411 const char *str =
"<unknown>";
414 case AST_SIP_ENDPOINT_IDENTIFY_BY_USERNAME:
417 case AST_SIP_ENDPOINT_IDENTIFY_BY_AUTH_USERNAME:
418 str =
"auth_username";
420 case AST_SIP_ENDPOINT_IDENTIFY_BY_IP:
423 case AST_SIP_ENDPOINT_IDENTIFY_BY_HEADER:
426 case AST_SIP_ENDPOINT_IDENTIFY_BY_REQUEST_URI:
442 static int sip_endpoint_identifier_str2type(
const char *str)
446 if (!strcasecmp(str,
"username")) {
447 method = AST_SIP_ENDPOINT_IDENTIFY_BY_USERNAME;
448 }
else if (!strcasecmp(str,
"auth_username")) {
449 method = AST_SIP_ENDPOINT_IDENTIFY_BY_AUTH_USERNAME;
450 }
else if (!strcasecmp(str,
"ip")) {
451 method = AST_SIP_ENDPOINT_IDENTIFY_BY_IP;
452 }
else if (!strcasecmp(str,
"header")) {
453 method = AST_SIP_ENDPOINT_IDENTIFY_BY_HEADER;
454 }
else if (!strcasecmp(str,
"request_uri")) {
455 method = AST_SIP_ENDPOINT_IDENTIFY_BY_REQUEST_URI;
478 while ((val =
ast_strip(strsep(&idents,
",")))) {
479 if (ast_strlen_zero(val)) {
483 method = sip_endpoint_identifier_str2type(val);
485 ast_log(LOG_ERROR,
"Unrecognized identification method %s specified for endpoint %s\n",
503 static int ident_to_str(
const void *obj,
const intptr_t *args,
char **buf)
521 for (idx = 0; idx < methods; ++idx) {
522 enum ast_sip_endpoint_identifier_type method;
523 const char *method_str;
526 method_str = sip_endpoint_identifier_type2str(method);
529 ast_assert(strcmp(method_str,
"<unknown>"));
530 if (!strcmp(method_str,
"<unknown>")) {
534 buf_used += snprintf(*buf + buf_used, buf_size - buf_used,
"%s%s",
535 method_str, idx < methods - 1 ?
"," :
"");
536 if (buf_size <= buf_used) {
538 *(*buf + (buf_size - 1)) =
'\0';
539 ast_log(LOG_WARNING,
"Truncated identify_by string: %s\n", *buf);
563 static int media_address_to_str(
const void *obj,
const intptr_t *args,
char **buf)
574 if (!strcasecmp(var->
value,
"user")) {
576 }
else if (!strcasecmp(var->
value,
"uri_core")) {
578 }
else if (!strcasecmp(var->
value,
"uri_pjsip")) {
581 ast_log(LOG_ERROR,
"Unrecognized redirect method %s specified for endpoint %s\n",
593 if (!strcasecmp(var->
value,
"invite") || !strcasecmp(var->
value,
"reinvite")) {
595 }
else if (!strcasecmp(var->
value,
"update")) {
598 ast_log(LOG_NOTICE,
"Unrecognized option value %s for %s on endpoint %s\n",
605 static const char *id_configuration_refresh_methods[] = {
606 [AST_SIP_SESSION_REFRESH_METHOD_INVITE] =
"invite",
607 [AST_SIP_SESSION_REFRESH_METHOD_UPDATE] =
"update"
610 static int direct_media_method_to_str(
const void *obj,
const intptr_t *args,
char **buf)
619 static int connected_line_method_handler(
const struct aco_option *opt,
struct ast_variable *var,
void *obj)
623 if (!strcasecmp(var->
value,
"invite") || !strcasecmp(var->
value,
"reinvite")) {
625 }
else if (!strcasecmp(var->
value,
"update")) {
628 ast_log(LOG_NOTICE,
"Unrecognized option value %s for %s on endpoint %s\n",
635 static int connected_line_method_to_str(
const void *obj,
const intptr_t *args,
char **buf)
642 static int direct_media_glare_mitigation_handler(
const struct aco_option *opt,
struct ast_variable *var,
void *obj)
646 if (!strcasecmp(var->
value,
"none")) {
648 }
else if (!strcasecmp(var->
value,
"outgoing")) {
650 }
else if (!strcasecmp(var->
value,
"incoming")) {
653 ast_log(LOG_NOTICE,
"Unrecognized option value %s for %s on endpoint %s\n",
661 static const char *direct_media_glare_mitigation_map[] = {
662 [AST_SIP_DIRECT_MEDIA_GLARE_MITIGATION_NONE] =
"none",
663 [AST_SIP_DIRECT_MEDIA_GLARE_MITIGATION_OUTGOING] =
"outgoing",
664 [AST_SIP_DIRECT_MEDIA_GLARE_MITIGATION_INCOMING] =
"incoming"
667 static int direct_media_glare_mitigation_to_str(
const void *obj,
const intptr_t *args,
char **buf)
680 char cid_name[80] = {
'\0' };
681 char cid_num[80] = {
'\0' };
690 ast_callerid_split(var->
value, cid_name,
sizeof(cid_name), cid_num,
sizeof(cid_num));
691 if (!ast_strlen_zero(cid_name)) {
698 if (!ast_strlen_zero(cid_num)) {
708 static int caller_id_to_str(
const void *obj,
const intptr_t *args,
char **buf)
720 size += name ? strlen(name) : 0;
721 size += number ? strlen(number) : 0;
723 if (!(*buf =
ast_calloc(size + 1,
sizeof(
char)))) {
727 ast_callerid_merge(*buf, size + 1, name, number, NULL);
735 if (callingpres == -1 && sscanf(var->
value,
"%d", &callingpres) != 1) {
743 static int caller_id_privacy_to_str(
const void *obj,
const intptr_t *args,
char **buf)
757 ast_free(endpoint->
id.self.
tag);
760 return endpoint->
id.self.
tag ? 0 : -1;
763 static int caller_id_tag_to_str(
const void *obj,
const intptr_t *args,
char **buf)
774 if (!strcasecmp(
"no", var->
value)) {
776 }
else if (!strcasecmp(
"sdes", var->
value)) {
778 }
else if (!strcasecmp(
"dtls", var->
value)) {
788 static const char *media_encryption_map[] = {
789 [AST_SIP_MEDIA_TRANSPORT_INVALID] =
"invalid",
790 [AST_SIP_MEDIA_ENCRYPT_NONE] =
"no",
791 [AST_SIP_MEDIA_ENCRYPT_SDES] =
"sdes",
792 [AST_SIP_MEDIA_ENCRYPT_DTLS] =
"dtls",
795 static int media_encryption_to_str(
const void *obj,
const intptr_t *args,
char **buf)
809 ast_log(LOG_WARNING,
"Endpoint %s: Option 'stir_shaken' is no longer supported. Use 'stir_shaken_profile' instead.\n",
816 static int stir_shaken_to_str(
const void *obj,
const intptr_t *args,
char **buf)
823 static int group_handler(
const struct aco_option *opt,
828 if (!strncmp(var->
name,
"call_group", 10)) {
830 }
else if (!strncmp(var->
name,
"pickup_group", 12)) {
839 static int callgroup_to_str(
const void *obj,
const intptr_t *args,
char **buf)
851 static int pickupgroup_to_str(
const void *obj,
const intptr_t *args,
char **buf)
863 static int named_groups_handler(
const struct aco_option *opt,
868 if (!strncmp(var->
name,
"named_call_group", 16)) {
869 if (ast_strlen_zero(var->
value)) {
876 }
else if (!strncmp(var->
name,
"named_pickup_group", 18)) {
877 if (ast_strlen_zero(var->
value)) {
891 static int named_callgroups_to_str(
const void *obj,
const intptr_t *args,
char **buf)
901 static int named_pickupgroups_to_str(
const void *obj,
const intptr_t *args,
char **buf)
911 static int dtls_handler(
const struct aco_option *opt,
921 front = strtok_r(buf,
"_", &back);
923 int size = strlen(front);
926 front = strtok_r(NULL,
"_", &back);
932 static int dtlsverify_to_str(
const void *obj,
const intptr_t *args,
char **buf)
939 static int dtlsrekey_to_str(
const void *obj,
const intptr_t *args,
char **buf)
947 static int dtlsautogeneratecert_to_str(
const void *obj,
const intptr_t *args,
char **buf)
954 static int dtlscertfile_to_str(
const void *obj,
const intptr_t *args,
char **buf)
961 static int dtlsprivatekey_to_str(
const void *obj,
const intptr_t *args,
char **buf)
968 static int dtlscipher_to_str(
const void *obj,
const intptr_t *args,
char **buf)
975 static int dtlscafile_to_str(
const void *obj,
const intptr_t *args,
char **buf)
982 static int dtlscapath_to_str(
const void *obj,
const intptr_t *args,
char **buf)
989 static const char *ast_rtp_dtls_setup_map[] = {
996 static int dtlssetup_to_str(
const void *obj,
const intptr_t *args,
char **buf)
1005 static const char *ast_rtp_dtls_fingerprint_map[] = {
1010 static int dtlsfingerprint_to_str(
const void *obj,
const intptr_t *args,
char **buf)
1019 static int t38udptl_ec_handler(
const struct aco_option *opt,
1024 if (!strcmp(var->
value,
"none")) {
1026 }
else if (!strcmp(var->
value,
"fec")) {
1028 }
else if (!strcmp(var->
value,
"redundancy")) {
1037 static const char *ast_t38_ec_modes_map[] = {
1038 [UDPTL_ERROR_CORRECTION_NONE] =
"none",
1039 [UDPTL_ERROR_CORRECTION_FEC] =
"fec",
1040 [UDPTL_ERROR_CORRECTION_REDUNDANCY] =
"redundancy"
1043 static int t38udptl_ec_to_str(
const void *obj,
const intptr_t *args,
char **buf)
1053 static int tos_handler(
const struct aco_option *opt,
1060 ast_log(LOG_ERROR,
"Error configuring endpoint '%s' - Could not "
1061 "interpret '%s' value '%s'\n",
1066 if (!strcmp(var->
name,
"tos_audio")) {
1068 }
else if (!strcmp(var->
name,
"tos_video")) {
1078 static int tos_audio_to_str(
const void *obj,
const intptr_t *args,
char **buf)
1088 static int tos_video_to_str(
const void *obj,
const intptr_t *args,
char **buf)
1098 static int from_user_handler(
const struct aco_option *opt,
1103 char *valid_uri_marks =
"-._~%!$&'()*+,;=:";
1106 for (val = var->
value; *val; val++) {
1107 if (!isalpha(*val) && !isdigit(*val) && !strchr(valid_uri_marks, *val)) {
1108 ast_log(LOG_ERROR,
"Error configuring endpoint '%s' - '%s' field "
1109 "contains invalid character '%c'\n",
1120 static int from_user_to_str(
const void *obj,
const intptr_t *args,
char **buf)
1129 static int set_var_handler(
const struct aco_option *opt,
1137 if (ast_strlen_zero(var->
value)) {
1142 val = strchr(name,
'=');
1150 if (!(new_var = ast_variable_new(name, val,
""))) {
1155 ast_variable_list_append(&endpoint->
channel_vars, new_var);
1161 static int set_var_to_str(
const void *obj,
const intptr_t *args,
char **buf)
1176 static int set_var_to_vl(
const void *obj,
struct ast_variable **fields)
1185 static int voicemail_extension_handler(
const struct aco_option *opt,
struct ast_variable *var,
void *obj)
1195 static int voicemail_extension_to_str(
const void *obj,
const intptr_t *args,
char **buf)
1204 static int contact_user_handler(
const struct aco_option *opt,
1215 static int contact_user_to_str(
const void *obj,
const intptr_t *args,
char **buf)
1227 static int call_offer_pref_handler(
const struct aco_option *opt,
1232 int outgoing = strcmp(var->
name,
"outgoing_call_offer_pref") == 0;
1234 int res = ast_sip_call_codec_str_to_pref(&pref, var->
value, outgoing);
1248 static int incoming_call_offer_pref_to_str(
const void *obj,
const intptr_t *args,
char **buf)
1260 static int outgoing_call_offer_pref_to_str(
const void *obj,
const intptr_t *args,
char **buf)
1272 static int codec_prefs_handler(
const struct aco_option *opt,
1285 ast_log(LOG_ERROR,
"Endpoint '%s': %s for option '%s'\n",
1287 ast_free(error_message);
1290 ast_free(error_message);
1292 if (strcmp(var->
name,
"codec_prefs_incoming_offer") == 0) {
1294 ast_log(LOG_ERROR,
"Endpoint '%s': Codec preference '%s' has invalid value '%s' for option: '%s'",
1304 }
else if (strcmp(var->
name,
"codec_prefs_outgoing_offer") == 0) {
1308 }
else if (strcmp(var->
name,
"codec_prefs_incoming_answer") == 0) {
1312 }
else if (strcmp(var->
name,
"codec_prefs_outgoing_answer") == 0) {
1317 ast_log(LOG_ERROR,
"Endpoint '%s': Unsupported option '%s'\n",
1323 if (prefs.prefer == CODEC_NEGOTIATION_PREFER_UNSPECIFIED) {
1324 prefs.prefer = default_prefer;
1327 if (prefs.operation == CODEC_NEGOTIATION_OPERATION_UNSPECIFIED) {
1328 prefs.operation = default_operation;
1331 if (prefs.keep == CODEC_NEGOTIATION_KEEP_UNSPECIFIED) {
1335 if (prefs.transcode == CODEC_NEGOTIATION_TRANSCODE_UNSPECIFIED) {
1342 *option_prefs = prefs;
1348 const void *obj,
const intptr_t *args,
char **buf)
1362 static int incoming_offer_codec_prefs_to_str(
const void *obj,
const intptr_t *args,
char **buf)
1368 static int outgoing_offer_codec_prefs_to_str(
const void *obj,
const intptr_t *args,
char **buf)
1374 static int incoming_answer_codec_prefs_to_str(
const void *obj,
const intptr_t *args,
char **buf)
1380 static int outgoing_answer_codec_prefs_to_str(
const void *obj,
const intptr_t *args,
char **buf)
1386 static void *sip_nat_hook_alloc(
const char *name)
1392 static void persistent_endpoint_destroy(
void *obj)
1399 static int add_to_regcontext(
void *obj,
void *arg,
int flags)
1402 const char *regcontext = arg;
1415 int ast_sip_persistent_endpoint_add_to_regcontext(
const char *regcontext)
1417 if (ast_strlen_zero(regcontext)) {
1423 ast_log(LOG_ERROR,
"Failed to create regcontext '%s'\n", regcontext);
1438 persistent = ao2_find(persistent_endpoints, endpoint_name,
OBJ_SEARCH_KEY);
1449 regcontext = ast_sip_get_regcontext();
1455 if (!ast_strlen_zero(regcontext)) {
1465 blob =
ast_json_pack(
"{s: s}",
"peer_status",
"Unreachable");
1467 if (!ast_strlen_zero(regcontext)) {
1478 ast_free(regcontext);
1489 void ast_sip_persistent_endpoint_publish_contact_state(
const char *endpoint_name,
const struct ast_sip_contact_status *contact_status)
1495 persistent = ao2_find(persistent_endpoints, endpoint_name,
OBJ_SEARCH_KEY);
1500 snprintf(rtt,
sizeof(rtt),
"%" PRId64, contact_status->
rtt);
1502 "contact_status", ast_sip_get_contact_status_label(contact_status->
status),
1503 "aor", contact_status->
aor,
1504 "uri", contact_status->
uri,
1505 "roundtrip_usec", rtt,
1524 persistent = ao2_alloc_options(
sizeof(*persistent), persistent_endpoint_destroy,
1546 static int sip_endpoint_apply_handler(
const struct ast_sorcery *sorcery,
void *obj)
1550 if (!(endpoint->
persistent = persistent_endpoint_find_or_create(endpoint))) {
1555 ast_log(LOG_ERROR,
"Session timer minimum expires time must be 90 or greater on endpoint '%s'\n",
1559 ast_log(LOG_ERROR,
"Session timer expires must be greater than minimum session expires time on endpoint '%s'\n",
1569 if (endpoint->
media.
incoming_call_offer_pref.flags != (AST_SIP_CALL_CODEC_PREF_LOCAL | AST_SIP_CALL_CODEC_PREF_INTERSECT | AST_SIP_CALL_CODEC_PREF_ALL)) {
1570 ast_log(LOG_ERROR,
"Setting both preferred_codec_only and incoming_call_offer_pref is not supported on endpoint '%s'\n",
1604 ast_log(LOG_WARNING,
"DTLS renegotiation is not supported with WebRTC. Disabling dtls_rekey.\n");
1614 if (!ast_strlen_zero(endpoint->geoloc_incoming_call_profile) ||
1615 !ast_strlen_zero(endpoint->geoloc_outgoing_call_profile)) {
1617 if (!ast_geoloc_is_loaded()) {
1618 ast_log(LOG_ERROR,
"A geoloc incoming and/or outgoing call_profile was specified on endpoint '%s'"
1623 if (!ast_strlen_zero(endpoint->geoloc_incoming_call_profile)) {
1624 struct ast_geoloc_profile *profile = ast_geoloc_get_profile(endpoint->geoloc_incoming_call_profile);
1626 ast_log(LOG_ERROR,
"geoloc_incoming_call_profile '%s' on endpoint '%s' doesn't exist\n",
1630 ao2_cleanup(profile);
1633 if (!ast_strlen_zero(endpoint->geoloc_outgoing_call_profile)) {
1634 struct ast_geoloc_profile *profile = ast_geoloc_get_profile(endpoint->geoloc_outgoing_call_profile);
1636 ast_log(LOG_ERROR,
"geoloc_outgoing_call_profile '%s' on endpoint '%s' doesn't exist\n",
1640 ao2_cleanup(profile);
1647 const char *ast_sip_get_device_state(
const struct ast_sip_endpoint *endpoint)
1663 int ast_sip_for_each_channel_snapshot(
1669 if (!on_channel_snapshot || !num_channels) {
1682 res = on_channel_snapshot(snapshot, arg, 0);
1690 int ast_sip_for_each_channel(
1695 return ast_sip_for_each_channel_snapshot(endpoint_snapshot, on_channel_snapshot, arg);
1698 static int active_channels_to_str_cb(
void *
object,
void *arg,
int flags)
1706 static void active_channels_to_str(
const struct ast_sip_endpoint *endpoint,
1711 ast_sip_get_endpoint_snapshot(endpoint), ao2_cleanup);
1713 if (endpoint_snapshot) {
1717 ast_sip_for_each_channel_snapshot(endpoint_snapshot,
1718 active_channels_to_str_cb, str);
1722 #define AMI_DEFAULT_STR_SIZE 512
1741 static void sip_sorcery_object_ami_set_type_name(
const void *obj,
struct ast_str **buf)
1749 int ast_sip_sorcery_object_to_ami(
const void *obj,
struct ast_str **buf)
1759 sip_sorcery_object_ami_set_type_name(obj, buf);
1761 for (i = objset; i; i = i->
next) {
1769 static int sip_endpoints_aors_ami(
void *obj,
void *arg,
int flags)
1775 ast_sip_for_each_contact(aor, ast_sip_contact_to_str, arg);
1784 if (ast_sip_sorcery_object_to_ami(endpoint, buf)) {
1789 ast_sip_get_device_state(endpoint));
1792 active_channels_to_str(endpoint, buf);
1802 ast_sip_create_ami_event(
"EndpointDetail", ami), ast_free);
1808 sip_endpoint_to_ami(endpoint, &buf);
1813 #define AMI_SHOW_ENDPOINTS "PJSIPShowEndpoints"
1814 #define AMI_SHOW_ENDPOINT "PJSIPShowEndpoint"
1824 if (ast_strlen_zero(endpoint_name)) {
1830 if (!strncasecmp(endpoint_name,
"pjsip/", 6)) {
1835 ast_sip_get_sorcery(),
"endpoint", endpoint_name))) {
1841 astman_send_listack(s, m,
"Following are Events for each object associated with the Endpoint",
1845 if (format_ami_endpoint(endpoint, &ami) ||
1846 ast_sip_format_endpoint_ami(endpoint, &ami, &count)) {
1861 if (ast_sip_auths_to_str(auths, &str)) {
1869 static int format_ami_endpoints(
void *obj,
void *arg,
int flags)
1875 ast_sip_create_ami_event(
"EndpointList", ami), ast_free);
1881 sip_sorcery_object_ami_set_type_name(endpoint, &buf);
1895 ast_sip_for_each_aor(endpoint->
aors,
1896 sip_endpoints_aors_ami, &buf);
1899 ast_sip_get_device_state(endpoint));
1902 active_channels_to_str(endpoint, &buf);
1926 astman_send_listack(s, m,
"A listing of Endpoints follows, presented as EndpointList events",
1936 static struct ao2_container *cli_endpoint_get_container(
const char *regex)
1960 static int cli_endpoint_iterate(
void *obj,
ao2_callback_fn callback,
void *args)
1967 static void *cli_endpoint_retrieve_by_id(
const char *
id)
1972 static void cli_endpoint_print_child_header(
char *type,
struct ast_sip_cli_context *context)
1976 formatter_entry = ast_sip_lookup_cli_formatter(type);
1977 if (formatter_entry) {
1978 formatter_entry->print_header(NULL, context, 0);
1982 static int cli_endpoint_print_header(
void *obj,
void *arg,
int flags)
1989 " Endpoint: <Endpoint/CID.....................................> <State.....> <Channels.>\n");
1993 cli_endpoint_print_child_header(
"auth", context);
1994 cli_endpoint_print_child_header(
"aor", context);
1995 cli_endpoint_print_child_header(
"transport", context);
1996 cli_endpoint_print_child_header(
"identify", context);
1997 cli_endpoint_print_child_header(
"channel", context);
2004 static void cli_endpoint_print_child_body(
char *type,
const void *obj,
struct ast_sip_cli_context *context)
2008 formatter_entry = ast_sip_lookup_cli_formatter(type);
2009 if (formatter_entry) {
2010 formatter_entry->iterate((
void *)obj, formatter_entry->print_body, context);
2014 static int cli_endpoint_print_body(
void *obj,
void *arg,
int flags)
2020 char *print_name = NULL;
2030 print_name_len = strlen(
id) + strlen(number) + 2;
2032 snprintf(print_name, print_name_len,
"%s/%s",
id, number);
2036 flexwidth = CLI_LAST_TABSTOP - indent - 2;
2040 flexwidth, flexwidth, print_name ? print_name :
id,
2041 ast_sip_get_device_state(endpoint),
2051 cli_endpoint_print_child_body(
"auth", &endpoint->
outbound_auths, context);
2053 cli_endpoint_print_child_body(
"auth", &endpoint->
inbound_auths, context);
2055 cli_endpoint_print_child_body(
"aor", endpoint->
aors, context);
2056 cli_endpoint_print_child_body(
"transport", endpoint, context);
2057 cli_endpoint_print_child_body(
"identify", endpoint, context);
2058 cli_endpoint_print_child_body(
"channel", endpoint, context);
2069 ast_sip_cli_print_sorcery_objectset(endpoint, context, 0);
2076 AST_CLI_DEFINE(ast_sip_cli_traverse_objects,
"List PJSIP Endpoints",
2077 .
command =
"pjsip list endpoints",
2078 .
usage =
"Usage: pjsip list endpoints [ like <pattern> ]\n"
2079 " List the configured PJSIP endpoints\n"
2080 " Optional regular expression pattern is used to filter the list.\n"),
2081 AST_CLI_DEFINE(ast_sip_cli_traverse_objects,
"Show PJSIP Endpoints",
2082 .
command =
"pjsip show endpoints",
2083 .
usage =
"Usage: pjsip show endpoints [ like <pattern> ]\n"
2084 " List(detailed) the configured PJSIP endpoints\n"
2085 " Optional regular expression pattern is used to filter the list.\n"),
2086 AST_CLI_DEFINE(ast_sip_cli_traverse_objects,
"Show PJSIP Endpoint",
2087 .
command =
"pjsip show endpoint",
2088 .
usage =
"Usage: pjsip show endpoint <id>\n"
2089 " Show the configured PJSIP endpoint\n"),
2095 static void load_all_endpoints(
void)
2100 ao2_cleanup(endpoints);
2113 int ast_res_pjsip_initialize_configuration(
void)
2121 PERSISTENT_BUCKETS, persistent_endpoint_hash, NULL, persistent_endpoint_cmp);
2122 if (!persistent_endpoints) {
2127 ast_log(LOG_ERROR,
"Failed to open SIP sorcery failed to open\n");
2131 ast_sip_initialize_cli();
2133 if (ast_sip_initialize_sorcery_auth()) {
2134 ast_log(LOG_ERROR,
"Failed to register SIP authentication support\n");
2140 ast_sorcery_apply_default(sip_sorcery,
"endpoint",
"config",
"pjsip.conf,criteria=type=endpoint");
2141 ast_sorcery_apply_default(sip_sorcery,
"nat_hook",
"memory", NULL);
2144 ast_log(LOG_ERROR,
"Failed to register SIP endpoint object with sorcery\n");
2151 ast_log(LOG_ERROR,
"Failed to register nat_hook\n");
2183 ast_sorcery_object_field_register_custom(sip_sorcery,
"endpoint",
"direct_media_glare_mitigation",
"none", direct_media_glare_mitigation_handler, direct_media_glare_mitigation_to_str, NULL, 0, 0);
2282 call_offer_pref_handler, incoming_call_offer_pref_to_str, NULL, 0, 0);
2284 call_offer_pref_handler, outgoing_call_offer_pref_to_str, NULL, 0, 0);
2286 "prefer: pending, operation: intersect, keep: all, transcode: allow",
2287 codec_prefs_handler, incoming_offer_codec_prefs_to_str, NULL, 0, 0);
2289 "prefer: pending, operation: union, keep: all, transcode: allow",
2290 codec_prefs_handler, outgoing_offer_codec_prefs_to_str, NULL, 0, 0);
2292 "prefer: pending, operation: intersect, keep: all",
2293 codec_prefs_handler, incoming_answer_codec_prefs_to_str, NULL, 0, 0);
2295 "prefer: pending, operation: intersect, keep: all",
2296 codec_prefs_handler, outgoing_answer_codec_prefs_to_str, NULL, 0, 0);
2298 "stir_shaken", 0, stir_shaken_handler, stir_shaken_to_str, NULL, 0, 0);
2307 if (ast_sip_initialize_sorcery_transport()) {
2308 ast_log(LOG_ERROR,
"Failed to register SIP transport support with sorcery\n");
2314 if (ast_sip_initialize_sorcery_location()) {
2315 ast_log(LOG_ERROR,
"Failed to register SIP location support with sorcery\n");
2323 if (ast_sip_initialize_sorcery_domain_alias()) {
2324 ast_log(LOG_ERROR,
"Failed to register SIP domain aliases support with sorcery\n");
2330 if (ast_sip_initialize_sorcery_global()) {
2331 ast_log(LOG_ERROR,
"Failed to register SIP Global support\n");
2338 if (!endpoint_formatter) {
2339 ast_log(LOG_ERROR,
"Unable to allocate memory for endpoint_formatter\n");
2344 endpoint_formatter->
name =
"endpoint";
2345 endpoint_formatter->
print_header = cli_endpoint_print_header;
2346 endpoint_formatter->
print_body = cli_endpoint_print_body;
2347 endpoint_formatter->
get_container = cli_endpoint_get_container;
2348 endpoint_formatter->
iterate = cli_endpoint_iterate;
2349 endpoint_formatter->
retrieve_by_id = cli_endpoint_retrieve_by_id;
2352 ast_sip_register_cli_formatter(endpoint_formatter);
2357 load_all_endpoints();
2366 void ast_res_pjsip_destroy_configuration(
void)
2373 ast_sip_destroy_sorcery_global();
2374 ast_sip_destroy_sorcery_location();
2375 ast_sip_destroy_sorcery_auth();
2376 ast_sip_destroy_sorcery_transport();
2382 ast_sip_unregister_cli_formatter(endpoint_formatter);
2383 ast_sip_destroy_cli();
2384 ao2_cleanup(persistent_endpoints);
2385 persistent_endpoints = NULL;
2388 int ast_res_pjsip_reload_configuration(
void)
2414 static void endpoint_destructor(
void* obj)
2422 subscription_configuration_destroy(&endpoint->
subscription);
2423 info_configuration_destroy(&endpoint->
info);
2424 media_configuration_destroy(&endpoint->
media);
2453 void *ast_sip_endpoint_alloc(
const char *name)
2460 ao2_cleanup(endpoint);
2466 ao2_cleanup(endpoint);
2470 ao2_cleanup(endpoint);
2475 ao2_cleanup(endpoint);
2478 if (init_subscription_configuration(&endpoint->
subscription)) {
2479 ao2_cleanup(endpoint);
2482 if (init_info_configuration(&endpoint->
info)) {
2483 ao2_cleanup(endpoint);
2486 if (init_media_configuration(&endpoint->
media)) {
2487 ao2_cleanup(endpoint);
2512 RAII_VAR(
char *, name, ast_sip_global_default_outbound_endpoint(), ast_free);
2514 sip_sorcery,
"endpoint", name);
2526 ast_log(LOG_NOTICE,
"Couldn't find auth '%s'. Cannot authenticate\n", name);
2534 void ast_sip_cleanup_auths(
struct ast_sip_auth *auths[],
size_t num_auths)
2537 for (i = 0; i < num_auths; ++i) {
2538 ao2_cleanup(auths[i]);
2552 ast_log(LOG_WARNING,
"Auth object '%s' could not be found\n", name);
#define AST_VECTOR_FREE(vec)
Deallocates this vector.
struct ast_sip_endpoint_pickup_configuration pickup
struct ast_str * output_buffer
struct ast_variable * next
Type for default option handler for format capabilities.
struct ao2_container *(* get_container)(const char *regex)
#define ARRAY_IN_BOUNDS(v, a)
Checks to see if value is within the bounds of the given array.
#define ast_string_field_init_extended(x, field)
Initialize an extended string field.
int presentation
Q.931 encoded presentation-indicator encoded field.
const char * ast_devstate2str(enum ast_device_state devstate) attribute_pure
Convert device state to text string for output.
int ast_rtp_dtls_cfg_parse(struct ast_rtp_dtls_cfg *dtls_cfg, const char *name, const char *value)
Parse DTLS related configuration options.
struct ast_endpoint * endpoint
Asterisk endpoint itself.
void ast_join_delim(char *s, size_t len, const char *const w[], unsigned int size, char delim)
Join an array of strings into a single string.
ast_device_state
Device States.
enum ast_sip_dtmf_mode dtmf
struct ast_sip_mwi_configuration mwi
char * str
Subscriber phone number (Malloced)
const char * ast_named_caller_presentation(int data)
Convert caller ID pres value to text code.
Security Event Reporting API.
#define AST_LIST_LOCK(head)
Locks a list.
struct ast_channel_snapshot_base * base
struct ast_variable * ast_sorcery_objectset_create2(const struct ast_sorcery *sorcery, const void *object, enum ast_sorcery_field_handler_flags flags)
Create an object set (KVP list) for an object.
void astman_append(struct mansession *s, const char *fmt,...)
enum ast_endpoint_state ast_endpoint_get_state(const struct ast_endpoint *endpoint)
Gets the state of the given endpoint.
unsigned int sess_expires
Asterisk main include file. File version handling, generic pbx functions.
const ast_string_field fromuser
#define AST_LIST_FIRST(head)
Returns the first entry contained in a list.
int ao2_container_count(struct ao2_container *c)
Returns the number of elements in a container.
const char * ast_stream_codec_prefs_to_str(const struct ast_stream_codec_negotiation_prefs *prefs, struct ast_str **buf)
Return a string representing the codec preferences.
static char * ast_sockaddr_stringify_addr_remote(const struct ast_sockaddr *addr)
Wrapper around ast_sockaddr_stringify_fmt() to return an address only.
CLI Formatter Registry Entry.
struct ast_json * ast_json_pack(char const *format,...)
Helper for creating complex JSON values.
Endpoint configuration options for INFO packages.
void(* deleted)(const void *object)
Callback for when an object is deleted.
int( ao2_callback_fn)(void *obj, void *arg, int flags)
Type of a generic callback function.
int presentation
Q.931 presentation-indicator and screening-indicator encoded fields.
CallerID (and other GR30) management and generation Includes code and algorithms from the Zapata libr...
void ast_variables_destroy(struct ast_variable *var)
Free variable list.
int ast_sockaddr_parse(struct ast_sockaddr *addr, const char *str, int flags)
Parse an IPv4 or IPv6 address string.
Persistent endpoint information.
int ast_cli_unregister_multiple(struct ast_cli_entry *e, int len)
Unregister multiple commands.
void ast_sorcery_force_reload_object(const struct ast_sorcery *sorcery, const char *type)
Inform any wizards of a specific object type to reload persistent objects even if no changes determin...
int ast_sip_security_mechanism_vector_init(struct ast_sip_security_mechanism_vector *security_mechanisms, const char *value)
Initialize security mechanism vector from string of security mechanisms.
struct ast_endpoint * ast_endpoint_create(const char *tech, const char *resource)
Create an endpoint struct.
The arg parameter is a search key, but is not an object.
const ast_string_field transport
void ast_json_unref(struct ast_json *value)
Decrease refcount on value. If refcount reaches zero, value is freed.
unsigned int devicestate_busy_at
struct ast_party_name name
Subscriber name.
struct ast_sip_endpoint_nat_configuration nat
#define ast_sorcery_object_field_register_alias(sorcery, type, name, default_val, opt_type, flags,...)
Register a field within an object as an alias.
const char * ast_endpoint_get_tech(const struct ast_endpoint *endpoint)
Gets the technology of the given endpoint.
#define AST_STREAM_MAX_CODEC_PREFS_LENGTH
Define for allocating buffer space for to_str() functions.
enum ast_t38_ec_modes error_correction
void astman_send_list_complete_start(struct mansession *s, const struct message *m, const char *event_name, int count)
Start the list complete event.
char * voicemail_extension
Endpoint subscription configuration.
Stasis Message Bus API. See Stasis Message Bus API for detailed documentation.
descriptor for a cli entry.
#define AST_LIST_UNLOCK(head)
Attempts to unlock a list.
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
#define ao2_callback(c, flags, cb_fn, arg)
ao2_callback() is a generic function that applies cb_fn() to all objects in a container, as described below.
struct ast_endpoint_snapshot * ast_endpoint_latest_snapshot(const char *tech, const char *resource)
Retrieve the most recent snapshot for the endpoint with the given name.
char name[ACL_NAME_LENGTH]
#define ao2_container_alloc_list(ao2_options, container_options, sort_fn, cmp_fn)
Allocate and initialize a list container.
Structure for variables, used for configurations and for channel variables.
#define AST_VECTOR_APPEND(vec, elem)
Append an element to a vector, growing the vector if needed.
struct ast_sip_auth_vector outbound_auths
Structure representing a snapshot of channel state.
struct ast_sip_info_recording_configuration recording
struct ast_sip_endpoint_subscription_configuration subscription
Perform no matching, return all objects.
int ast_sorcery_object_id_compare(void *obj, void *arg, int flags)
ao2 object comparator based on sorcery id.
const ast_string_field context
Assume that the ao2_container is already locked.
#define CHARFLDSET(type, field)
A helper macro to pass the appropriate arguments to aco_option_register for OPT_CHAR_ARRAY_T.
Full structure for sorcery.
struct stasis_message_type * stasis_message_type(const struct stasis_message *msg)
Get the message type for a stasis_message.
int(* iterate)(void *container, ao2_callback_fn callback, void *args)
Type for a default handler that should do nothing.
int stasis_subscription_set_filter(struct stasis_subscription *subscription, enum stasis_subscription_message_filter filter)
Set the message type filtering level on a subscription.
struct stasis_message_type * ast_named_acl_change_type(void)
a stasis_message_type for changes against a named ACL or the set of all named ACLs ...
char * str
Subscriber name (Malloced)
#define AST_VECTOR_REMOVE_UNORDERED(vec, idx)
Remove an element from an unordered vector by index.
int ast_str_append(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Append to a thread local dynamic string.
#define ast_cli_register_multiple(e, len)
Register multiple commands.
Return all matching objects.
struct ast_stream_topology * ast_stream_topology_create_from_format_cap(struct ast_format_cap *cap)
A helper function that, given a format capabilities structure, creates a topology and separates the m...
void ast_endpoint_set_state(struct ast_endpoint *endpoint, enum ast_endpoint_state state)
Updates the state of the given endpoint.
Wrapper for an ast_acl linked list.
#define ao2_link_flags(container, obj, flags)
Add an object to a container.
void ast_party_id_free(struct ast_party_id *doomed)
Destroy the party id contents.
#define ast_strdup(str)
A wrapper for strdup()
int ast_str2tos(const char *value, unsigned int *tos)
Convert a string to the appropriate TOS value.
CLI Formatter Context passed to all formatters.
int ast_sip_security_mechanisms_to_str(const struct ast_sip_security_mechanism_vector *security_mechanisms, int add_qvalue, char **buf)
Writes the security mechanisms of an endpoint into a buffer as a string and returns the buffer...
#define ast_to_camel_case(s)
Attempts to convert the given string to camel case using an underscore as the specified delimiter...
void ast_free_ptr(void *ptr)
free() wrapper
Socket address structure.
void astman_send_error_va(struct mansession *s, const struct message *m, const char *fmt,...)
Send error in manager transaction (with va_args support)
ast_endpoint_state
Valid states for an endpoint.
const char * ast_endpoint_get_resource(const struct ast_endpoint *endpoint)
Gets the resource name of the given endpoint.
enum ast_sip_endpoint_identifier_type ident_method
struct ao2_container * ast_sorcery_retrieve_by_regex(const struct ast_sorcery *sorcery, const char *type, const char *regex)
Retrieve multiple objects using a regular expression on their id.
int ast_context_remove_extension(const char *context, const char *extension, int priority, const char *registrar)
Simply remove extension from context.
char * ast_print_group(char *buf, int buflen, ast_group_t group)
Print call and pickup groups into buffer.
#define ast_asprintf(ret, fmt,...)
A wrapper for asprintf()
const char * ast_sorcery_object_get_type(const void *object)
Get the type of a sorcery object.
char * ast_str_truncate(struct ast_str *buf, ssize_t len)
Truncates the enclosed string to the given length.
const char * astman_get_header(const struct message *m, char *var)
Get header from manager transaction.
void * ast_sorcery_retrieve_by_id(const struct ast_sorcery *sorcery, const char *type, const char *id)
Retrieve an object using its unique identifier.
struct ast_acl_list * acl
#define ast_sorcery_unref(sorcery)
Decrease the reference count of a sorcery structure.
struct ast_sip_security_mechanism_vector security_mechanisms
struct ast_sip_endpoint_media_configuration media
Type for default option handler for character array strings.
int ast_str_set(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Set a dynamic string using variable arguments.
Type for default option handler for bools (ast_true/ast_false)
#define ast_stream_codec_operation_to_str(value)
Safely get the name of an "operation" parameter value.
#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.
struct ast_sip_identify_by_vector ident_method_order
Structure for SIP nat hook information.
#define FLDSET(type,...)
Convert a struct and list of fields to an argument list of field offsets.
#define AST_VECTOR_INIT(vec, size)
Initialize a vector.
int ast_devstate_changed(enum ast_device_state state, enum ast_devstate_cache cachable, const char *fmt,...)
Tells Asterisk the State for Device is changed.
struct ast_namedgroups * named_pickupgroups
void astman_send_list_complete_end(struct mansession *s)
End the list complete event.
struct ast_acl_list * contact_acl
#define AST_VECTOR_ELEM_CLEANUP_NOOP(elem)
Vector element cleanup that does nothing.
Type for default option handler for unsigned integers.
int ast_variable_list_replace(struct ast_variable **head, struct ast_variable *replacement)
Replace a variable in the given list with a new value.
#define ast_string_field_init(x, size)
Initialize a field pool and fields.
#define ast_strdupa(s)
duplicate a string in memory from the stack
Access Control of various sorts.
static struct ao2_container * codecs
Registered codecs.
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
char * ast_strip(char *s)
Strip leading/trailing whitespace from a string.
#define S_COR(a, b, c)
returns the equivalent of logic or for strings, with an additional boolean check: second one if not e...
In case you didn't read that giant block of text above the mansession_session struct, the mansession is named this solely to keep the API the same in Asterisk. This structure really represents data that is different from Manager action to Manager action. The mansession_session pointer contained within points to session-specific data.
int ast_sorcery_object_id_sort(const void *obj, const void *arg, int flags)
ao2 object sorter based on sorcery id.
const char * ast_sorcery_object_get_id(const void *object)
Get the unique identifier of a sorcery object.
void *(* retrieve_by_id)(const char *id)
struct ast_namedgroups * named_callgroups
ast_stream_codec_negotiation_prefs_operation_values
The "operation" values.
enum ast_rtp_dtls_hash hash
#define ast_malloc(len)
A wrapper for malloc()
struct ao2_container * container
an ast_acl is a linked list node of ast_ha structs which may have names.
An entity with which Asterisk communicates.
int ast_exists_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid)
Determine whether an extension exists.
enum ast_sip_session_refresh_method refresh_method
#define ast_sorcery_object_register(sorcery, type, alloc, transform, apply)
Register an object type.
#define MAX_OBJECT_FIELD
Maximum length of an object field name.
Core PBX routines and definitions.
int ast_parse_caller_presentation(const char *data)
Convert caller ID text code to value (used in config file parsing)
A snapshot of an endpoint's state.
int ast_acl_list_is_empty(struct ast_acl_list *acl_list)
Determines if an ACL is empty or if it contains entries.
int ast_sorcery_observer_add(const struct ast_sorcery *sorcery, const char *type, const struct ast_sorcery_observer *callbacks)
Add an observer to a specific object type.
enum ast_sip_security_negotiation security_negotiation
#define ast_alloca(size)
call __builtin_alloca to ensure we get gcc builtin semantics
struct ast_sip_endpoint_id_configuration id
int ast_manager_unregister(const char *action)
Unregister a registered manager command.
The AMI - Asterisk Manager Interface - is a TCP protocol created to manage Asterisk with third-party ...
int ast_stream_codec_prefs_parse(const char *pref_string, struct ast_stream_codec_negotiation_prefs *prefs, struct ast_str **error_message)
Parses a string representing the codec prefs into a ast_stream_codec_negotiation_pref structure...
enum ast_rtp_dtls_setup default_setup
struct ast_namedgroups * ast_get_namedgroups(const char *s)
Create an ast_namedgroups set with group names from comma separated string.
struct ast_sip_endpoint_info_configuration info
#define ao2_container_alloc_hash(ao2_options, container_options, n_buckets, hash_fn, sort_fn, cmp_fn)
Allocate and initialize a hash container with the desired number of buckets.
#define ast_sorcery_internal_object_register(sorcery, type, alloc, transform, apply)
Register an internal, hidden object type.
int attribute_pure ast_true(const char *val)
Make sure something is true. Determine if a string containing a boolean value is "true". This function checks to see whether a string passed to it is an indication of an "true" value. It checks to see if the string is "yes", "true", "y", "t", "on" or "1".
struct ast_sip_auth_vector inbound_auths
Support for dynamic strings.
enum ast_rtp_dtls_verify verify
int ao2_container_dup(struct ao2_container *dest, struct ao2_container *src, enum search_flags flags)
Copy all object references in the src container into the dest container.
Interface for a sorcery object type observer.
Type for default option handler for bools (ast_true/ast_false)
struct ast_acl_list * ast_free_acl_list(struct ast_acl_list *acl)
Free a list of ACLs.
struct stasis_message_type * ast_endpoint_state_type(void)
Message type for endpoint state changes.
int ast_rtp_dtls_cfg_validate(struct ast_rtp_dtls_cfg *dtls_cfg)
Validates DTLS related configuration options.
unsigned int preferred_codec_only
static struct stasis_rest_handlers endpoints
REST handler for /api-docs/endpoints.json.
struct ast_sip_timer_options timer
#define SCOPED_AO2LOCK(varname, obj)
scoped lock specialization for ao2 mutexes.
#define ast_calloc(num, len)
A wrapper for calloc()
#define AST_VECTOR_RESET(vec, cleanup)
Reset vector.
#define STRFLDSET(type,...)
Convert a struct and a list of stringfield fields to an argument list of field offsets.
struct stasis_subscription * stasis_unsubscribe_and_join(struct stasis_subscription *subscription)
Cancel a subscription, blocking until the last message is processed.
unsigned int ephemeral_cert
const char *(* get_id)(const void *obj)
void ast_party_id_init(struct ast_party_id *init)
Initialize the given party id structure.
Structure used to handle boolean flags.
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.
void ast_endpoint_blob_publish(struct ast_endpoint *endpoint, struct stasis_message_type *type, struct ast_json *blob)
Creates and publishes a ast_endpoint_blob message.
#define ast_sorcery_object_field_register(sorcery, type, name, default_val, opt_type, flags,...)
Register a field within an object.
void ast_sorcery_load(const struct ast_sorcery *sorcery)
Inform any wizards to load persistent objects.
#define AST_YESNO(x)
return Yes or No depending on the argument.
char * tag
User-set "tag".
void ast_sorcery_reload(const struct ast_sorcery *sorcery)
Inform any wizards to reload persistent objects.
struct ast_endpoint * persistent
#define AST_VECTOR_GET(vec, idx)
Get an element from a vector.
enum ast_sip_100rel_mode rel100
static struct stasis_subscription * acl_change_sub
int ast_add_extension(const char *context, int replace, const char *extension, int priority, const char *label, const char *callerid, const char *application, void *data, void(*datad)(void *), const char *registrar)
Add and extension to an extension context.
struct ast_channel_snapshot * ast_channel_snapshot_get_latest(const char *uniqueid)
Obtain the latest ast_channel_snapshot from the Stasis Message Bus API cache. This is an ao2 object...
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
void ast_append_acl(const char *sense, const char *stuff, struct ast_acl_list **path, int *error, int *named_acl_flag)
Add a rule to an ACL struct.
void ast_rtp_dtls_cfg_free(struct ast_rtp_dtls_cfg *dtls_cfg)
Free contents of a DTLS configuration structure.
int attribute_pure ast_false(const char *val)
Make sure something is false. Determine if a string containing a boolean value is "false"...
int stasis_subscription_accept_message_type(struct stasis_subscription *subscription, const struct stasis_message_type *type)
Indicate to a subscription that we are interested in a message type.
#define ast_sorcery_open()
Open a new sorcery structure.
struct stasis_message_type * ast_endpoint_contact_state_type(void)
Message type for endpoint contact state changes.
struct ast_sip_endpoint_extensions extensions
Abstract JSON element (object, array, string, int, ...).
Type for default option handler for stringfields.
#define ast_stream_codec_param_to_str(value)
Safely get the name of a preference parameter.
ao2_callback_fn * print_header
struct stasis_topic * ast_security_topic(void)
A stasis_topic which publishes messages for security related issues.
ast_stream_codec_negotiation_prefs_prefer_values
The "prefer" values.
unsigned char valid
TRUE if the name information is valid/present.
struct ast_variable * channel_vars
void * ast_sorcery_generic_alloc(size_t size, ao2_destructor_fn destructor)
Allocate a generic sorcery capable object.
struct ast_context * ast_context_find_or_create(struct ast_context **extcontexts, struct ast_hashtab *exttable, const char *name, const char *registrar)
Register a new context or find an existing one.
void ast_stream_topology_free(struct ast_stream_topology *topology)
Unreference and destroy a stream topology.
const ast_string_field aors
#define ast_manager_register_xml(action, authority, func)
Register a manager callback using XML documentation to describe the manager.
ao2_callback_fn * print_body
void ast_endpoint_shutdown(struct ast_endpoint *endpoint)
Shutsdown an ast_endpoint.
void astman_send_error(struct mansession *s, const struct message *m, char *error)
Send error in manager transaction.
char * ast_print_namedgroups(struct ast_str **buf, struct ast_namedgroups *groups)
Print named call groups and named pickup groups.
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
#define ast_string_field_free_memory(x)
free all memory - to be called before destroying the object
enum ast_sip_session_redirect redirect_method
struct ast_variable * ast_variables_dup(struct ast_variable *var)
Duplicate variable list.
unsigned char valid
TRUE if the number information is valid/present.
#define AST_VECTOR_SIZE(vec)
Get the number of elements in a vector.
const ast_string_field name
#define ast_str_create(init_len)
Create a malloc'ed dynamic length string.
Sorcery Data Access Layer API.
static force_inline int attribute_pure ast_str_hash(const char *str)
Compute a hash value on a string.
#define ast_string_field_set(x, field, data)
Set a field to a simple string value.
void astman_send_listack(struct mansession *s, const struct message *m, char *msg, char *listflag)
Send ack in manager transaction to begin a list.
unsigned show_details_only_level_0
struct ast_party_number number
Subscriber phone number.