mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-05 04:11:08 +00:00
res_parking: Minor tweaks.
* Use ast_bridge_channel_lock()/ast_bridge_channel_unlock() instead of ao2_lock()/ao2_unlock() for struct ast_bridge_channel variables. * Use ast_copy_string() instead of inlining it. * Remove an already done TODO comment. * Some whitespace tweaks. ........ Merged revisions 411638 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@411639 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -221,13 +221,14 @@ static int bridge_parking_push(struct ast_bridge_parking *self, struct ast_bridg
|
|||||||
|
|
||||||
if (swap) {
|
if (swap) {
|
||||||
int use_ringing = 0;
|
int use_ringing = 0;
|
||||||
ao2_lock(swap);
|
|
||||||
|
ast_bridge_channel_lock(swap);
|
||||||
pu = swap->bridge_pvt;
|
pu = swap->bridge_pvt;
|
||||||
if (!pu) {
|
if (!pu) {
|
||||||
/* This should be impossible since the only way a channel can enter in the first place
|
/* This should be impossible since the only way a channel can enter in the first place
|
||||||
* is if it has a parked user associated with it */
|
* is if it has a parked user associated with it */
|
||||||
publish_parked_call_failure(bridge_channel->chan);
|
publish_parked_call_failure(bridge_channel->chan);
|
||||||
ao2_unlock(swap);
|
ast_bridge_channel_unlock(swap);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -236,16 +237,15 @@ static int bridge_parking_push(struct ast_bridge_parking *self, struct ast_bridg
|
|||||||
bridge_channel->bridge_pvt = pu;
|
bridge_channel->bridge_pvt = pu;
|
||||||
swap->bridge_pvt = NULL;
|
swap->bridge_pvt = NULL;
|
||||||
|
|
||||||
/* TODO Add a parked call swap message type to relay information about parked channel swaps */
|
|
||||||
|
|
||||||
if (ast_bridge_channel_has_role(swap, "holding_participant")) {
|
if (ast_bridge_channel_has_role(swap, "holding_participant")) {
|
||||||
const char *idle_mode = ast_bridge_channel_get_role_option(swap, "holding_participant", "idle_mode");
|
const char *idle_mode = ast_bridge_channel_get_role_option(swap, "holding_participant", "idle_mode");
|
||||||
|
|
||||||
if (!ast_strlen_zero(idle_mode) && !strcmp(idle_mode, "ringing")) {
|
if (!ast_strlen_zero(idle_mode) && !strcmp(idle_mode, "ringing")) {
|
||||||
use_ringing = 1;
|
use_ringing = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ao2_unlock(swap);
|
ast_bridge_channel_unlock(swap);
|
||||||
|
|
||||||
parking_set_duration(bridge_channel->features, pu);
|
parking_set_duration(bridge_channel->features, pu);
|
||||||
|
|
||||||
@@ -278,6 +278,7 @@ static int bridge_parking_push(struct ast_bridge_parking *self, struct ast_bridg
|
|||||||
|
|
||||||
if (parker == bridge_channel->chan) {
|
if (parker == bridge_channel->chan) {
|
||||||
struct ast_channel *real_parker = ast_channel_get_by_name(blind_transfer);
|
struct ast_channel *real_parker = ast_channel_get_by_name(blind_transfer);
|
||||||
|
|
||||||
if (real_parker) {
|
if (real_parker) {
|
||||||
ao2_cleanup(parker);
|
ao2_cleanup(parker);
|
||||||
parker = real_parker;
|
parker = real_parker;
|
||||||
@@ -286,7 +287,6 @@ static int bridge_parking_push(struct ast_bridge_parking *self, struct ast_bridg
|
|||||||
|
|
||||||
pu = generate_parked_user(self->lot, bridge_channel->chan, parker,
|
pu = generate_parked_user(self->lot, bridge_channel->chan, parker,
|
||||||
park_datastore->parker_dial_string, park_datastore->randomize, park_datastore->time_limit);
|
park_datastore->parker_dial_string, park_datastore->randomize, park_datastore->time_limit);
|
||||||
|
|
||||||
if (!pu) {
|
if (!pu) {
|
||||||
publish_parked_call_failure(bridge_channel->chan);
|
publish_parked_call_failure(bridge_channel->chan);
|
||||||
return -1;
|
return -1;
|
||||||
@@ -294,8 +294,7 @@ static int bridge_parking_push(struct ast_bridge_parking *self, struct ast_bridg
|
|||||||
|
|
||||||
/* If a comeback_override was provided, set it for the parked user's comeback string. */
|
/* If a comeback_override was provided, set it for the parked user's comeback string. */
|
||||||
if (park_datastore->comeback_override) {
|
if (park_datastore->comeback_override) {
|
||||||
strncpy(pu->comeback, park_datastore->comeback_override, sizeof(pu->comeback));
|
ast_copy_string(pu->comeback, park_datastore->comeback_override, sizeof(pu->comeback));
|
||||||
pu->comeback[sizeof(pu->comeback) - 1] = '\0';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Generate ParkedCall Stasis Message */
|
/* Generate ParkedCall Stasis Message */
|
||||||
@@ -304,6 +303,7 @@ static int bridge_parking_push(struct ast_bridge_parking *self, struct ast_bridg
|
|||||||
/* If the parkee and the parker are the same and silence_announce isn't set, play the announcement to the parkee */
|
/* If the parkee and the parker are the same and silence_announce isn't set, play the announcement to the parkee */
|
||||||
if (!strcmp(blind_transfer, ast_channel_name(bridge_channel->chan)) && !park_datastore->silence_announce) {
|
if (!strcmp(blind_transfer, ast_channel_name(bridge_channel->chan)) && !park_datastore->silence_announce) {
|
||||||
char saynum_buf[16];
|
char saynum_buf[16];
|
||||||
|
|
||||||
snprintf(saynum_buf, sizeof(saynum_buf), "%u %u", 0, pu->parking_space);
|
snprintf(saynum_buf, sizeof(saynum_buf), "%u %u", 0, pu->parking_space);
|
||||||
ast_bridge_channel_queue_playfile(bridge_channel, say_parking_space, saynum_buf, NULL);
|
ast_bridge_channel_queue_playfile(bridge_channel, say_parking_space, saynum_buf, NULL);
|
||||||
}
|
}
|
||||||
@@ -339,6 +339,7 @@ static int bridge_parking_push(struct ast_bridge_parking *self, struct ast_bridg
|
|||||||
static void bridge_parking_pull(struct ast_bridge_parking *self, struct ast_bridge_channel *bridge_channel)
|
static void bridge_parking_pull(struct ast_bridge_parking *self, struct ast_bridge_channel *bridge_channel)
|
||||||
{
|
{
|
||||||
RAII_VAR(struct parked_user *, pu, NULL, ao2_cleanup);
|
RAII_VAR(struct parked_user *, pu, NULL, ao2_cleanup);
|
||||||
|
|
||||||
ast_bridge_base_v_table.pull(&self->base, bridge_channel);
|
ast_bridge_base_v_table.pull(&self->base, bridge_channel);
|
||||||
|
|
||||||
/* Take over the bridge channel's pu reference. It will be released when we are done. */
|
/* Take over the bridge channel's pu reference. It will be released when we are done. */
|
||||||
|
Reference in New Issue
Block a user