[asterisk-commits] res pjsip/config domain aliases.c: Add check for missing dom... (asterisk[13])
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Feb 5 16:01:29 CST 2018
Jenkins2 has submitted this change and it was merged. ( https://gerrit.asterisk.org/8158 )
Change subject: res_pjsip/config_domain_aliases.c: Add check for missing domain.
......................................................................
res_pjsip/config_domain_aliases.c: Add check for missing domain.
What is the point of defining an alias and not saying what is being
aliased?
Change-Id: I98a892016ed61dcf5efeb6619fd748925103f0be
---
M res/res_pjsip/config_domain_aliases.c
1 file changed, 20 insertions(+), 2 deletions(-)
Approvals:
Corey Farrell: Looks good to me, but someone else must approve
Kevin Harwell: Looks good to me, approved
Jenkins2: Approved for Submit
diff --git a/res/res_pjsip/config_domain_aliases.c b/res/res_pjsip/config_domain_aliases.c
index 8feff05..944568b 100644
--- a/res/res_pjsip/config_domain_aliases.c
+++ b/res/res_pjsip/config_domain_aliases.c
@@ -34,8 +34,9 @@
static void *domain_alias_alloc(const char *name)
{
- struct ast_sip_domain_alias *alias = ast_sorcery_generic_alloc(sizeof(*alias), domain_alias_destroy);
+ struct ast_sip_domain_alias *alias;
+ alias = ast_sorcery_generic_alloc(sizeof(*alias), domain_alias_destroy);
if (!alias) {
return NULL;
}
@@ -48,6 +49,22 @@
return alias;
}
+/*! \brief Apply handler for domain_alias type */
+static int domain_alias_apply(const struct ast_sorcery *sorcery, void *obj)
+{
+ struct ast_sip_domain_alias *alias = obj;
+
+ if (ast_strlen_zero(alias->domain)) {
+ /*
+ * What is the point of defining an alias and not saying
+ * what is being aliased?
+ */
+ ast_log(LOG_ERROR, "%s '%s' missing required domain being aliased.\n",
+ SIP_SORCERY_DOMAIN_ALIAS_TYPE, ast_sorcery_object_get_id(alias));
+ }
+ return 0;
+}
+
/*! \brief Initialize sorcery with domain alias support */
int ast_sip_initialize_sorcery_domain_alias(void)
{
@@ -55,7 +72,8 @@
ast_sorcery_apply_default(sorcery, SIP_SORCERY_DOMAIN_ALIAS_TYPE, "config", "pjsip.conf,criteria=type=domain_alias");
- if (ast_sorcery_object_register(sorcery, SIP_SORCERY_DOMAIN_ALIAS_TYPE, domain_alias_alloc, NULL, NULL)) {
+ if (ast_sorcery_object_register(sorcery, SIP_SORCERY_DOMAIN_ALIAS_TYPE,
+ domain_alias_alloc, NULL, domain_alias_apply)) {
return -1;
}
--
To view, visit https://gerrit.asterisk.org/8158
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: merged
Gerrit-Change-Id: I98a892016ed61dcf5efeb6619fd748925103f0be
Gerrit-Change-Number: 8158
Gerrit-PatchSet: 2
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-commits/attachments/20180205/c1817d25/attachment.html>
More information about the asterisk-commits
mailing list