From aedfc116ef0ba90f55c38375890b1c8b11b7d0fd Mon Sep 17 00:00:00 2001 From: gauravs456 Date: Tue, 21 Oct 2025 22:27:04 +0530 Subject: [PATCH] chan_websocket: Add channel_id to MEDIA_START, DRIVER_STATUS and DTMF_END events. Resolves: #1544 --- channels/chan_websocket.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/channels/chan_websocket.c b/channels/chan_websocket.c index 7357005cc1..4057aca477 100644 --- a/channels/chan_websocket.c +++ b/channels/chan_websocket.c @@ -591,8 +591,9 @@ static int process_text_message(struct websocket_pvt *instance, } else if (ast_strings_equal(command, GET_DRIVER_STATUS)) { char *status = NULL; - res = ast_asprintf(&status, "%s queue_length:%d xon_level:%d xoff_level:%d queue_full:%s bulk_media:%s media_paused:%s", + res = ast_asprintf(&status, "%s channel_id:%s queue_length:%d xon_level:%d xoff_level:%d queue_full:%s bulk_media:%s media_paused:%s", DRIVER_STATUS, + ast_channel_uniqueid(instance->channel), instance->frame_queue_length, QUEUE_LENGTH_XON_LEVEL, QUEUE_LENGTH_XOFF_LEVEL, S_COR(instance->queue_full, "true", "false"), @@ -847,8 +848,9 @@ static void *read_thread_handler(void *obj) * This is especially important for outbound connections otherwise * the app won't know who the media is for. */ - res = ast_asprintf(&command, "%s connection_id:%s channel:%s format:%s optimal_frame_size:%d ptime:%d", MEDIA_START, + res = ast_asprintf(&command, "%s connection_id:%s channel:%s channel_id:%s format:%s optimal_frame_size:%d ptime:%d", MEDIA_START, instance->connection_id, ast_channel_name(instance->channel), + ast_channel_uniqueid(instance->channel), ast_format_get_name(instance->native_format), instance->optimal_frame_size, instance->native_codec->default_ms); if (res <= 0 || !command) { @@ -1508,7 +1510,7 @@ static int webchan_send_dtmf_text(struct ast_channel *ast, char digit, unsigned return -1; } - res = ast_asprintf(&command, "%s digit:%c", DTMF_END, digit); + res = ast_asprintf(&command, "%s digit:%c channel_id:%s", DTMF_END, digit, ast_channel_uniqueid(instance->channel)); if (res <= 0 || !command) { ast_log(LOG_ERROR, "%s: Failed to create DTMF_END\n", ast_channel_name(instance->channel)); return 0;