mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-20 08:40:16 +00:00
Pickup: Ensure using PICKUPMARK never considers the picking channel.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@402820 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -220,9 +220,15 @@ static int pickup_by_exten(struct ast_channel *chan, const char *exten, const ch
|
|||||||
static int find_by_mark(void *obj, void *arg, void *data, int flags)
|
static int find_by_mark(void *obj, void *arg, void *data, int flags)
|
||||||
{
|
{
|
||||||
struct ast_channel *target = obj;/*!< Potential pickup target */
|
struct ast_channel *target = obj;/*!< Potential pickup target */
|
||||||
|
struct ast_channel *chan = arg;
|
||||||
const char *mark = data;
|
const char *mark = data;
|
||||||
const char *tmp;
|
const char *tmp;
|
||||||
|
|
||||||
|
if (chan == target) {
|
||||||
|
/* The channel attempting to pickup a call cannot pickup itself. */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
ast_channel_lock(target);
|
ast_channel_lock(target);
|
||||||
tmp = pbx_builtin_getvar_helper(target, PICKUPMARK);
|
tmp = pbx_builtin_getvar_helper(target, PICKUPMARK);
|
||||||
if (tmp && !strcasecmp(tmp, mark) && ast_can_pickup(target)) {
|
if (tmp && !strcasecmp(tmp, mark) && ast_can_pickup(target)) {
|
||||||
@@ -241,7 +247,7 @@ static int pickup_by_mark(struct ast_channel *chan, const char *mark)
|
|||||||
int res = -1;
|
int res = -1;
|
||||||
|
|
||||||
/* The found channel is already locked. */
|
/* The found channel is already locked. */
|
||||||
target = ast_channel_callback(find_by_mark, NULL, (char *) mark, 0);
|
target = ast_channel_callback(find_by_mark, chan, (char *) mark, 0);
|
||||||
if (target) {
|
if (target) {
|
||||||
res = ast_do_pickup(chan, target);
|
res = ast_do_pickup(chan, target);
|
||||||
ast_channel_unlock(target);
|
ast_channel_unlock(target);
|
||||||
|
|||||||
Reference in New Issue
Block a user