diff options
Diffstat (limited to 'apps/app_directed_pickup.c')
-rw-r--r-- | apps/app_directed_pickup.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/apps/app_directed_pickup.c b/apps/app_directed_pickup.c index 605d11faf..cfba99fce 100644 --- a/apps/app_directed_pickup.c +++ b/apps/app_directed_pickup.c @@ -40,6 +40,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/lock.h" #include "asterisk/app.h" #include "asterisk/features.h" +#include "asterisk/callerid.h" #define PICKUPMARK "PICKUPMARK" @@ -91,9 +92,21 @@ static const char *app2 = "PickupChan"; static int pickup_do(struct ast_channel *chan, struct ast_channel *target) { int res = 0; + struct ast_party_connected_line connected_caller; ast_debug(1, "Call pickup on '%s' by '%s'\n", target->name, chan->name); + connected_caller = target->connected; + connected_caller.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER; + ast_channel_update_connected_line(chan, &connected_caller); + + ast_channel_lock(chan); + ast_connected_line_copy_from_caller(&connected_caller, &chan->cid); + ast_channel_unlock(chan); + connected_caller.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER; + ast_channel_queue_connected_line_update(chan, &connected_caller); + ast_party_connected_line_free(&connected_caller); + if ((res = ast_answer(chan))) { ast_log(LOG_WARNING, "Unable to answer '%s'\n", chan->name); return -1; |