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
0071a993
Commit
0071a993
authored
9 years ago
by
Joshua Colp
Committed by
Gerrit Code Review
9 years ago
Browse files
Options
Downloads
Plain Diff
Merge "pjsip_options: Schedule/unschedule qualifies on AoR creation/destruction" into 13
parents
118d628e
11e54b19
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/pjsip_options.c
+46
-0
46 additions, 0 deletions
res/res_pjsip/pjsip_options.c
with
46 additions
and
0 deletions
res/res_pjsip/pjsip_options.c
+
46
−
0
View file @
0071a993
...
...
@@ -1026,6 +1026,7 @@ static int qualify_and_schedule_cb(void *obj, void *arg, int flags)
initial_interval
=
(
int
)((
initial_interval
*
1000
)
*
ast_random_double
());
unschedule_qualify
(
contact
);
if
(
contact
->
qualify_frequency
)
{
schedule_qualify
(
contact
,
initial_interval
);
}
else
{
...
...
@@ -1155,6 +1156,43 @@ static struct ast_sip_endpoint_formatter contact_status_formatter = {
.
format_ami
=
format_ami_contact_status
};
static
void
aor_observer_modified
(
const
void
*
obj
)
{
struct
ast_sip_aor
*
aor
=
(
void
*
)
obj
;
struct
ao2_container
*
contacts
;
contacts
=
ast_sip_location_retrieve_aor_contacts
(
aor
);
if
(
contacts
)
{
ao2_callback
(
contacts
,
OBJ_NODATA
,
qualify_and_schedule_cb
,
aor
);
ao2_ref
(
contacts
,
-
1
);
}
}
static
int
unschedule_contact_cb
(
void
*
obj
,
void
*
arg
,
int
flags
)
{
unschedule_qualify
(
obj
);
return
CMP_MATCH
;
}
static
void
aor_observer_deleted
(
const
void
*
obj
)
{
const
struct
ast_sip_aor
*
aor
=
obj
;
struct
ao2_container
*
contacts
;
contacts
=
ast_sip_location_retrieve_aor_contacts
(
aor
);
if
(
contacts
)
{
ao2_callback
(
contacts
,
OBJ_NODATA
,
unschedule_contact_cb
,
NULL
);
ao2_ref
(
contacts
,
-
1
);
}
}
static
const
struct
ast_sorcery_observer
observer_callbacks_options
=
{
.
created
=
aor_observer_modified
,
.
updated
=
aor_observer_modified
,
.
deleted
=
aor_observer_deleted
};
int
ast_res_pjsip_init_options_handling
(
int
reload
)
{
static
const
pj_str_t
STR_OPTIONS
=
{
"OPTIONS"
,
7
};
...
...
@@ -1185,6 +1223,13 @@ int ast_res_pjsip_init_options_handling(int reload)
return
-
1
;
}
if
(
ast_sorcery_observer_add
(
ast_sip_get_sorcery
(),
"aor"
,
&
observer_callbacks_options
))
{
pjsip_endpt_unregister_module
(
ast_sip_get_pjsip_endpoint
(),
&
options_module
);
ao2_cleanup
(
sched_qualifies
);
sched_qualifies
=
NULL
;
return
-
1
;
}
internal_sip_register_endpoint_formatter
(
&
contact_status_formatter
);
ast_manager_register2
(
"PJSIPQualify"
,
EVENT_FLAG_SYSTEM
|
EVENT_FLAG_REPORTING
,
ami_sip_qualify
,
NULL
,
NULL
,
NULL
);
ast_cli_register_multiple
(
cli_options
,
ARRAY_LEN
(
cli_options
));
...
...
@@ -1200,6 +1245,7 @@ void ast_res_pjsip_cleanup_options_handling(void)
ast_manager_unregister
(
"PJSIPQualify"
);
internal_sip_unregister_endpoint_formatter
(
&
contact_status_formatter
);
ast_sorcery_observer_remove
(
ast_sip_get_sorcery
(),
"aor"
,
&
observer_callbacks_options
);
pjsip_endpt_unregister_module
(
ast_sip_get_pjsip_endpoint
(),
&
options_module
);
ao2_cleanup
(
sched_qualifies
);
sched_qualifies
=
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