Skip to content
GitLab
Explore
Sign in
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
971c96e3
Commit
971c96e3
authored
8 years ago
by
zuul
Committed by
Gerrit Code Review
8 years ago
Browse files
Options
Downloads
Plain Diff
Merge "res_pjsip: qualify/unqualify added/deleted realtime endpoints" into 14
parents
05a67b0b
411efb97
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
res/res_pjsip/pjsip_options.c
+40
-1
40 additions, 1 deletion
res/res_pjsip/pjsip_options.c
with
40 additions
and
1 deletion
res/res_pjsip/pjsip_options.c
+
40
−
1
View file @
971c96e3
...
...
@@ -53,6 +53,9 @@ static const char *short_status_map [] = {
[
REMOVED
]
=
"Removed"
,
};
static
void
contact_deleted
(
const
void
*
obj
);
static
void
qualify_and_schedule
(
struct
ast_sip_contact
*
contact
);
const
char
*
ast_sip_get_contact_status_label
(
const
enum
ast_sip_contact_status_type
status
)
{
return
status_map
[
status
];
...
...
@@ -108,6 +111,29 @@ static void *contact_status_alloc(const char *name)
return
status
;
}
static
int
qualify_and_schedule_aor_contact
(
void
*
obj
)
{
struct
ast_sip_contact
*
contact
=
obj
;
struct
ast_sip_aor
*
aor
;
if
(
!
contact
||
ast_strlen_zero
(
contact
->
aor
)
||
!
(
aor
=
ast_sip_location_retrieve_aor
(
contact
->
aor
)))
{
ao2_ref
(
contact
,
-
1
);
return
-
1
;
}
contact
->
qualify_frequency
=
aor
->
qualify_frequency
;
contact
->
qualify_timeout
=
aor
->
qualify_timeout
;
contact
->
authenticate_qualify
=
aor
->
authenticate_qualify
;
ao2_ref
(
aor
,
-
1
);
qualify_and_schedule
(
contact
);
ao2_ref
(
contact
,
-
1
);
return
0
;
}
AST_MUTEX_DEFINE_STATIC
(
creation_lock
);
/*!
...
...
@@ -144,6 +170,18 @@ struct ast_sip_contact_status *ast_res_pjsip_find_or_create_contact_status(const
return
NULL
;
}
/* The permanent contact added after asterisk start should be qualified. */
if
(
ast_test_flag
(
&
ast_options
,
AST_OPT_FLAG_FULLY_BOOTED
)
&&
ast_tvzero
(
contact
->
expiration_time
))
{
/*
* The FULLY_BOOTED to filter out contacts that already existed when asterisk started.
* The zero expiration_time to select only permanent contacts.
*/
ao2_ref
((
struct
ast_sip_contact
*
)
contact
,
+
1
);
if
(
ast_sip_push_task
(
NULL
,
qualify_and_schedule_aor_contact
,
(
struct
ast_sip_contact
*
)
contact
))
{
ao2_ref
((
struct
ast_sip_contact
*
)
contact
,
-
1
);
}
}
ast_statsd_log_string_va
(
"PJSIP.contacts.states.%s"
,
AST_STATSD_GAUGE
,
"+1"
,
1
.
0
,
ast_sip_get_contact_status_label
(
status
->
status
));
...
...
@@ -368,8 +406,9 @@ static int qualify_contact(struct ast_sip_endpoint *endpoint, struct ast_sip_con
endpoint_local
=
find_an_endpoint
(
contact
);
}
if
(
!
endpoint_local
)
{
ast_log
(
LOG_
ERROR
,
"Unable to find an endpoint to qualify contact %s
\n
"
,
ast_log
(
LOG_
WARNING
,
"Unable to find an endpoint to qualify contact %s
. Deleting this contact
\n
"
,
contact
->
uri
);
contact_deleted
(
contact
);
return
-
1
;
}
}
...
...
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