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
37e1c479
Commit
37e1c479
authored
9 years ago
by
Matt Jordan
Committed by
Gerrit Code Review
9 years ago
Browse files
Options
Downloads
Plain Diff
Merge "bridge_native_rtp.c: Don't start native RTP bridging after attended transfer." into 13
parents
b74b0713
d558b00c
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
bridges/bridge_native_rtp.c
+22
-6
22 additions, 6 deletions
bridges/bridge_native_rtp.c
with
22 additions
and
6 deletions
bridges/bridge_native_rtp.c
+
22
−
6
View file @
37e1c479
...
...
@@ -50,6 +50,8 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
struct
native_rtp_bridge_data
{
/*! \brief Framehook used to intercept certain control frames */
int
id
;
/*! \brief Set when this framehook has been detached */
unsigned
int
detached
;
};
/*! \brief Internal helper function which gets all RTP information (glue and instances) relating to the given channels */
...
...
@@ -261,6 +263,7 @@ static void native_rtp_bridge_stop(struct ast_bridge *bridge, struct ast_channel
static
struct
ast_frame
*
native_rtp_framehook
(
struct
ast_channel
*
chan
,
struct
ast_frame
*
f
,
enum
ast_framehook_event
event
,
void
*
data
)
{
RAII_VAR
(
struct
ast_bridge
*
,
bridge
,
NULL
,
ao2_cleanup
);
struct
native_rtp_bridge_data
*
native_data
=
data
;
if
(
!
f
||
(
event
!=
AST_FRAMEHOOK_EVENT_WRITE
))
{
return
f
;
...
...
@@ -272,13 +275,22 @@ static struct ast_frame *native_rtp_framehook(struct ast_channel *chan, struct a
/* native_rtp_bridge_start/stop are not being called from bridging
core so we need to lock the bridge prior to calling these functions
Unfortunately that means unlocking the channel, but as it
should not be modified this should be okay...hopefully */
should not be modified this should be okay... hopefully...
unless this channel is being moved around right now and is in
the process of having this framehook removed (which is fine). To
ensure we then don't stop or start when we shouldn't we consult
the data provided. If this framehook has been detached then the
detached variable will be set. This is safe to check as it is only
manipulated with the bridge lock held. */
ast_channel_unlock
(
chan
);
ast_bridge_lock
(
bridge
);
if
(
f
->
subclass
.
integer
==
AST_CONTROL_HOLD
)
{
native_rtp_bridge_stop
(
bridge
,
chan
);
}
else
if
((
f
->
subclass
.
integer
==
AST_CONTROL_UNHOLD
)
||
(
f
->
subclass
.
integer
==
AST_CONTROL_UPDATE_RTP_PEER
))
{
native_rtp_bridge_start
(
bridge
,
chan
);
if
(
!
native_data
->
detached
)
{
if
(
f
->
subclass
.
integer
==
AST_CONTROL_HOLD
)
{
native_rtp_bridge_stop
(
bridge
,
chan
);
}
else
if
((
f
->
subclass
.
integer
==
AST_CONTROL_UNHOLD
)
||
(
f
->
subclass
.
integer
==
AST_CONTROL_UPDATE_RTP_PEER
))
{
native_rtp_bridge_start
(
bridge
,
chan
);
}
}
ast_bridge_unlock
(
bridge
);
ast_channel_lock
(
chan
);
...
...
@@ -403,6 +415,7 @@ static int native_rtp_bridge_framehook_attach(struct ast_bridge_channel *bridge_
static
struct
ast_framehook_interface
hook
=
{
.
version
=
AST_FRAMEHOOK_INTERFACE_VERSION
,
.
event_cb
=
native_rtp_framehook
,
.
destroy_cb
=
__ao2_cleanup
,
.
consume_cb
=
native_rtp_framehook_consume
,
.
disable_inheritance
=
1
,
};
...
...
@@ -412,10 +425,12 @@ static int native_rtp_bridge_framehook_attach(struct ast_bridge_channel *bridge_
}
ast_channel_lock
(
bridge_channel
->
chan
);
hook
.
data
=
ao2_bump
(
data
);
data
->
id
=
ast_framehook_attach
(
bridge_channel
->
chan
,
&
hook
);
ast_channel_unlock
(
bridge_channel
->
chan
);
if
(
data
->
id
<
0
)
{
ao2_cleanup
(
data
);
/* We need to drop both the reference we hold, and the one the framehook would hold */
ao2_ref
(
data
,
-
2
);
return
-
1
;
}
...
...
@@ -435,6 +450,7 @@ static void native_rtp_bridge_framehook_detach(struct ast_bridge_channel *bridge
ast_channel_lock
(
bridge_channel
->
chan
);
ast_framehook_detach
(
bridge_channel
->
chan
,
data
->
id
);
data
->
detached
=
1
;
ast_channel_unlock
(
bridge_channel
->
chan
);
bridge_channel
->
tech_pvt
=
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