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
d7e90997
Commit
d7e90997
authored
7 years ago
by
Joshua Colp
Committed by
Gerrit Code Review
7 years ago
Browse files
Options
Downloads
Plain Diff
Merge "res_pjsip_endpoint_identifier_ip.c: Allow multiple IdentifyDetail AMI events."
parents
3e8b9515
be488eb1
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_endpoint_identifier_ip.c
+32
-25
32 additions, 25 deletions
res/res_pjsip_endpoint_identifier_ip.c
with
32 additions
and
25 deletions
res/res_pjsip_endpoint_identifier_ip.c
+
32
−
25
View file @
d7e90997
...
...
@@ -484,47 +484,54 @@ static int sip_identify_to_ami(const struct ip_identify_match *identify,
return
ast_sip_sorcery_object_to_ami
(
identify
,
buf
);
}
static
int
fi
nd_identify_
by_endpoi
nt
(
void
*
obj
,
void
*
arg
,
int
flags
)
static
int
se
nd_identify_
ami_eve
nt
(
void
*
obj
,
void
*
arg
,
void
*
data
,
int
flags
)
{
struct
ip_identify_match
*
identify
=
obj
;
const
char
*
endpoint_name
=
arg
;
struct
ast_sip_ami
*
ami
=
data
;
struct
ast_str
*
buf
;
return
strcmp
(
identify
->
endpoint_name
,
endpoint_name
)
?
0
:
CMP_MATCH
;
/* Build AMI event */
buf
=
ast_sip_create_ami_event
(
"IdentifyDetail"
,
ami
);
if
(
!
buf
)
{
return
CMP_STOP
;
}
if
(
sip_identify_to_ami
(
identify
,
&
buf
))
{
ast_free
(
buf
);
return
CMP_STOP
;
}
ast_str_append
(
&
buf
,
0
,
"EndpointName: %s
\r\n
"
,
endpoint_name
);
/* Send AMI event */
astman_append
(
ami
->
s
,
"%s
\r\n
"
,
ast_str_buffer
(
buf
));
++
ami
->
count
;
ast_free
(
buf
);
return
0
;
}
static
int
format_ami_endpoint_identify
(
const
struct
ast_sip_endpoint
*
endpoint
,
struct
ast_sip_ami
*
ami
)
{
RAII_VAR
(
struct
ao2_container
*
,
identifies
,
NULL
,
ao2_cleanup
);
RAII_VAR
(
struct
ip_identify_match
*
,
identify
,
NULL
,
ao2_cleanup
);
RAII_VAR
(
struct
ast_str
*
,
buf
,
NULL
,
ast_free
);
struct
ao2_container
*
identifies
;
struct
ast_variable
fields
=
{
.
name
=
"endpoint"
,
.
value
=
ast_sorcery_object_get_id
(
endpoint
),
};
identifies
=
ast_sorcery_retrieve_by_fields
(
ast_sip_get_sorcery
(),
"identify"
,
AST_RETRIEVE_FLAG_MULTIPLE
|
AST_RETRIEVE_FLAG_ALL
,
NULL
);
AST_RETRIEVE_FLAG_MULTIPLE
,
&
fields
);
if
(
!
identifies
)
{
return
-
1
;
}
identify
=
ao2_callback
(
identifies
,
0
,
find_identify_by_endpoint
,
(
void
*
)
ast_sorcery_object_get_id
(
endpoint
));
if
(
!
identify
)
{
return
1
;
}
if
(
!
(
buf
=
ast_sip_create_ami_event
(
"IdentifyDetail"
,
ami
)))
{
return
-
1
;
}
if
(
sip_identify_to_ami
(
identify
,
&
buf
))
{
return
-
1
;
}
ast_str_append
(
&
buf
,
0
,
"EndpointName: %s
\r\n
"
,
ast_sorcery_object_get_id
(
endpoint
));
astman_append
(
ami
->
s
,
"%s
\r\n
"
,
ast_str_buffer
(
buf
));
ami
->
count
++
;
/* Build and send any found identify object's AMI IdentifyDetail event. */
ao2_callback_data
(
identifies
,
OBJ_MULTIPLE
|
OBJ_NODATA
,
send_identify_ami_event
,
(
void
*
)
ast_sorcery_object_get_id
(
endpoint
),
ami
);
ao2_ref
(
identifies
,
-
1
);
return
0
;
}
...
...
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