summaryrefslogtreecommitdiff
path: root/res/res_pjsip_phoneprov_provider.c
diff options
context:
space:
mode:
authorGeorge Joseph <george.joseph@fairview5.com>2014-11-21 17:49:39 +0000
committerGeorge Joseph <george.joseph@fairview5.com>2014-11-21 17:49:39 +0000
commit4394e0431c81e80741273e4f3f63be4137716ff5 (patch)
treec53b605fe5fe54bb7d2d8768d476bff8f64b7437 /res/res_pjsip_phoneprov_provider.c
parentd663e045f5613ba5b0620a3bb6f3f0fe0c35b1dc (diff)
sorcery: Make is_object_field_registered handle field names that are regexes.
As a result of https://reviewboard.asterisk.org/r/3305, res_sorcery_realtime was tossing database fields that didn't have an exact match to a sorcery registered field. This broke the ability to use regexes as field names which manifested itself as a failure of res_pjsip_phoneprov_provider which uses this capability. It also broke handling of fields that start with '@' in realtime but I don't think anyone noticed. This patch does the following... * Modifies ast_sorcery_fields_register to pre-compile the name regex. * Modifies ast_sorcery_is_object_field_registered to test the regex if it exists instead of doing an exact strcmp. * Modifies res_pjsip_phoneprov_provider with a few tweaks to get it to work with realtime. Tested-by: George Joseph Review: https://reviewboard.asterisk.org/r/4185/ ........ Merged revisions 428543 from http://svn.asterisk.org/svn/asterisk/branches/12 ........ Merged revisions 428544 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@428545 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_pjsip_phoneprov_provider.c')
-rw-r--r--res/res_pjsip_phoneprov_provider.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/res/res_pjsip_phoneprov_provider.c b/res/res_pjsip_phoneprov_provider.c
index 0480f0bbd..61b026f7c 100644
--- a/res/res_pjsip_phoneprov_provider.c
+++ b/res/res_pjsip_phoneprov_provider.c
@@ -289,7 +289,7 @@ static int load_users(void)
int user_count = 0;
char port_string[6];
- c = ast_sorcery_retrieve_by_regex(sorcery, "phoneprov", "");
+ c = ast_sorcery_retrieve_by_fields(sorcery, "phoneprov", AST_RETRIEVE_FLAG_MULTIPLE, NULL);
if (!c) {
ast_log(LOG_ERROR, "Retrieve by regex failed to allocate a container.\n");
return -1;
@@ -377,12 +377,7 @@ static int load_module(void)
return AST_MODULE_LOAD_DECLINE;
}
- if (ast_sorcery_apply_default(sorcery, "phoneprov", "config",
- "pjsip.conf,criteria=type=phoneprov")) {
- ast_log(LOG_ERROR, "Unable to register object phoneprov.\n");
- ast_sorcery_unref(sorcery);
- return AST_MODULE_LOAD_DECLINE;
- }
+ ast_sorcery_apply_default(sorcery, "phoneprov", "config", "pjsip.conf,criteria=type=phoneprov");
ast_sorcery_object_register(sorcery, "phoneprov", phoneprov_alloc, NULL,
users_apply_handler);