diff --git a/main/features.c b/main/features.c index d23bda4a19..aea0d1e97c 100644 --- a/main/features.c +++ b/main/features.c @@ -7384,8 +7384,6 @@ int ast_do_pickup(struct ast_channel *chan, struct ast_channel *target) ast_connected_line_copy_from_caller(&connected_caller, ast_channel_caller(chan)); ast_channel_unlock(chan); connected_caller.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER; - ast_channel_queue_connected_line_update(chan, &connected_caller, NULL); - ast_party_connected_line_free(&connected_caller); ast_cel_report_event(target, AST_CEL_PICKUP, NULL, NULL, chan); @@ -7399,6 +7397,8 @@ int ast_do_pickup(struct ast_channel *chan, struct ast_channel *target) goto pickup_failed; } + ast_channel_queue_connected_line_update(chan, &connected_caller, NULL); + /* setting this flag to generate a reason header in the cancel message to the ringing channel */ ast_set_flag(ast_channel_flags(chan), AST_FLAG_ANSWERED_ELSEWHERE); @@ -7423,6 +7423,7 @@ pickup_failed: if (!ast_channel_datastore_remove(target, ds_pickup)) { ast_datastore_free(ds_pickup); } + ast_party_connected_line_free(&connected_caller); return res; }