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
cfb146e0
Commit
cfb146e0
authored
9 years ago
by
Joshua Colp
Committed by
Gerrit Code Review
9 years ago
Browse files
Options
Downloads
Plain Diff
Merge "res_pjsip: Use a MD5 hash for static Contact IDs" into 13
parents
59134eb7
9184fbeb
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
res/res_pjsip/location.c
+12
-7
12 additions, 7 deletions
res/res_pjsip/location.c
with
12 additions
and
7 deletions
res/res_pjsip/location.c
+
12
−
7
View file @
cfb146e0
...
@@ -393,7 +393,8 @@ static int permanent_uri_handler(const struct aco_option *opt, struct ast_variab
...
@@ -393,7 +393,8 @@ static int permanent_uri_handler(const struct aco_option *opt, struct ast_variab
while
((
contact_uri
=
strsep
(
&
contacts
,
","
)))
{
while
((
contact_uri
=
strsep
(
&
contacts
,
","
)))
{
struct
ast_sip_contact
*
contact
;
struct
ast_sip_contact
*
contact
;
struct
ast_sip_contact_status
*
status
;
struct
ast_sip_contact_status
*
status
;
char
contact_id
[
strlen
(
aor_id
)
+
strlen
(
contact_uri
)
+
2
+
1
];
char
hash
[
33
];
char
contact_id
[
strlen
(
aor_id
)
+
sizeof
(
hash
)
+
2
+
1
];
if
(
!
aor
->
permanent_contacts
)
{
if
(
!
aor
->
permanent_contacts
)
{
aor
->
permanent_contacts
=
ao2_container_alloc_list
(
AO2_ALLOC_OPT_LOCK_NOLOCK
,
aor
->
permanent_contacts
=
ao2_container_alloc_list
(
AO2_ALLOC_OPT_LOCK_NOLOCK
,
...
@@ -403,7 +404,8 @@ static int permanent_uri_handler(const struct aco_option *opt, struct ast_variab
...
@@ -403,7 +404,8 @@ static int permanent_uri_handler(const struct aco_option *opt, struct ast_variab
}
}
}
}
snprintf
(
contact_id
,
sizeof
(
contact_id
),
"%s@@%s"
,
aor_id
,
contact_uri
);
ast_md5_hash
(
hash
,
contact_uri
);
snprintf
(
contact_id
,
sizeof
(
contact_id
),
"%s@@%s"
,
aor_id
,
hash
);
contact
=
ast_sorcery_alloc
(
ast_sip_get_sorcery
(),
"contact"
,
contact_id
);
contact
=
ast_sorcery_alloc
(
ast_sip_get_sorcery
(),
"contact"
,
contact_id
);
if
(
!
contact
)
{
if
(
!
contact
)
{
return
-
1
;
return
-
1
;
...
@@ -779,12 +781,12 @@ static int cli_contact_print_header(void *obj, void *arg, int flags)
...
@@ -779,12 +781,12 @@ static int cli_contact_print_header(void *obj, void *arg, int flags)
{
{
struct
ast_sip_cli_context
*
context
=
arg
;
struct
ast_sip_cli_context
*
context
=
arg
;
int
indent
=
CLI_INDENT_TO_SPACES
(
context
->
indent_level
);
int
indent
=
CLI_INDENT_TO_SPACES
(
context
->
indent_level
);
int
filler
=
CLI_LAST_TABSTOP
-
indent
-
18
;
int
filler
=
CLI_LAST_TABSTOP
-
indent
-
23
;
ast_assert
(
context
->
output_buffer
!=
NULL
);
ast_assert
(
context
->
output_buffer
!=
NULL
);
ast_str_append
(
&
context
->
output_buffer
,
0
,
ast_str_append
(
&
context
->
output_buffer
,
0
,
"%*s: <Aor/ContactUri%*.*s> <Status
....>
<RTT(ms)..>
\n
"
,
"%*s: <Aor/ContactUri%*.*s>
<Hash....>
<Status
>
<RTT(ms)..>
\n
"
,
indent
,
"Contact"
,
filler
,
filler
,
CLI_HEADER_FILLER
);
indent
,
"Contact"
,
filler
,
filler
,
CLI_HEADER_FILLER
);
return
0
;
return
0
;
...
@@ -797,23 +799,26 @@ static int cli_contact_print_body(void *obj, void *arg, int flags)
...
@@ -797,23 +799,26 @@ static int cli_contact_print_body(void *obj, void *arg, int flags)
struct
ast_sip_cli_context
*
context
=
arg
;
struct
ast_sip_cli_context
*
context
=
arg
;
int
indent
;
int
indent
;
int
flexwidth
;
int
flexwidth
;
const
char
*
contact_id
=
ast_sorcery_object_get_id
(
contact
);
const
char
*
hash_start
=
contact_id
+
strlen
(
contact
->
aor
)
+
2
;
RAII_VAR
(
struct
ast_sip_contact_status
*
,
status
,
RAII_VAR
(
struct
ast_sip_contact_status
*
,
status
,
ast_sorcery_retrieve_by_id
(
ast_sip_get_sorcery
(),
CONTACT_STATUS
,
ast_sorcery_object_get_id
(
contact
)
),
ast_sorcery_retrieve_by_id
(
ast_sip_get_sorcery
(),
CONTACT_STATUS
,
contact_id
),
ao2_cleanup
);
ao2_cleanup
);
ast_assert
(
contact
->
uri
!=
NULL
);
ast_assert
(
contact
->
uri
!=
NULL
);
ast_assert
(
context
->
output_buffer
!=
NULL
);
ast_assert
(
context
->
output_buffer
!=
NULL
);
indent
=
CLI_INDENT_TO_SPACES
(
context
->
indent_level
);
indent
=
CLI_INDENT_TO_SPACES
(
context
->
indent_level
);
flexwidth
=
CLI_LAST_TABSTOP
-
indent
-
2
-
strlen
(
contact
->
aor
)
+
1
;
flexwidth
=
CLI_LAST_TABSTOP
-
indent
-
9
-
strlen
(
contact
->
aor
)
+
1
;
ast_str_append
(
&
context
->
output_buffer
,
0
,
"%*s: %s/%-*.*s
%-1
2
.1
2
s %11.3f
\n
"
,
ast_str_append
(
&
context
->
output_buffer
,
0
,
"%*s: %s/%-*.*s %-1
0
.1
0
s
%-7.7s
%11.3f
\n
"
,
indent
,
indent
,
"Contact"
,
"Contact"
,
contact
->
aor
,
contact
->
aor
,
flexwidth
,
flexwidth
,
flexwidth
,
flexwidth
,
contact
->
uri
,
contact
->
uri
,
hash_start
,
ast_sip_get_contact_short_status_label
(
status
?
status
->
status
:
UNKNOWN
),
ast_sip_get_contact_short_status_label
(
status
?
status
->
status
:
UNKNOWN
),
(
status
&&
(
status
->
status
!=
UNKNOWN
)
?
((
long
long
)
status
->
rtt
)
/
1000
.
0
:
NAN
));
(
status
&&
(
status
->
status
!=
UNKNOWN
)
?
((
long
long
)
status
->
rtt
)
/
1000
.
0
:
NAN
));
...
...
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