Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
asterisk
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Voice
asterisk
Commits
a2caade2
Commit
a2caade2
authored
7 years ago
by
Joshua Colp
Committed by
Gerrit Code Review
7 years ago
Browse files
Options
Downloads
Plain Diff
Merge "res_pjsip: Use sorcery prefix operation for contact lookup"
parents
5db911bf
6c53fb5d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
res/res_pjsip/location.c
+10
-9
10 additions, 9 deletions
res/res_pjsip/location.c
with
10 additions
and
9 deletions
res/res_pjsip/location.c
+
10
−
9
View file @
a2caade2
...
...
@@ -82,16 +82,17 @@ static void aor_deleted_observer(const void *object)
{
const
struct
ast_sip_aor
*
aor
=
object
;
const
char
*
aor_id
=
ast_sorcery_object_get_id
(
object
);
/* Give enough space for ^ at the beginning and ;@ at the end, since that is our object naming scheme */
char
regex
[
strlen
(
aor_id
)
+
4
];
/* Give enough space for ;@ at the end, since that is our object naming scheme */
size_t
prefix_len
=
strlen
(
aor_id
)
+
sizeof
(
";@"
)
-
1
;
char
prefix
[
prefix_len
+
1
];
struct
ao2_container
*
contacts
;
if
(
aor
->
permanent_contacts
)
{
ao2_callback
(
aor
->
permanent_contacts
,
OBJ_NODATA
|
OBJ_MULTIPLE
|
OBJ_UNLINK
,
destroy_contact
,
NULL
);
}
s
n
printf
(
re
gex
,
sizeof
(
regex
)
,
"
^
%s;@"
,
aor_id
);
if
(
!
(
contacts
=
ast_sorcery_retrieve_by_re
ge
x
(
ast_sip_get_sorcery
(),
"contact"
,
re
gex
)))
{
sprintf
(
p
re
fix
,
"%s;@"
,
aor_id
);
/* Safe */
if
(
!
(
contacts
=
ast_sorcery_retrieve_by_
p
re
fi
x
(
ast_sip_get_sorcery
(),
"contact"
,
p
re
fix
,
prefix_len
)))
{
return
;
}
/* Destroy any contacts that may still exist that were made for this AoR */
...
...
@@ -223,13 +224,13 @@ struct ao2_container *ast_sip_location_retrieve_aor_contacts_nolock(const struct
struct
ao2_container
*
ast_sip_location_retrieve_aor_contacts_nolock_filtered
(
const
struct
ast_sip_aor
*
aor
,
unsigned
int
flags
)
{
/* Give enough space for ^ at the beginning and ;@ at the end, since that is our object naming scheme */
char
regex
[
strlen
(
ast_sorcery_object_get_id
(
aor
))
+
4
];
/* Give enough space for ;@ at the end, since that is our object naming scheme */
size_t
prefix_len
=
strlen
(
ast_sorcery_object_get_id
(
aor
))
+
sizeof
(
";@"
)
-
1
;
char
prefix
[
prefix_len
+
1
];
struct
ao2_container
*
contacts
;
snprintf
(
regex
,
sizeof
(
regex
),
"^%s;@"
,
ast_sorcery_object_get_id
(
aor
));
if
(
!
(
contacts
=
ast_sorcery_retrieve_by_regex
(
ast_sip_get_sorcery
(),
"contact"
,
regex
)))
{
sprintf
(
prefix
,
"%s;@"
,
ast_sorcery_object_get_id
(
aor
));
/* Safe */
if
(
!
(
contacts
=
ast_sorcery_retrieve_by_prefix
(
ast_sip_get_sorcery
(),
"contact"
,
prefix
,
prefix_len
)))
{
return
NULL
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment