From 33e242b2504ef4514ab3d113d0349ffab1ddb272 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Wed, 29 Apr 2026 11:18:16 -0400 Subject: [PATCH] MT#55283 support blob64 Change-Id: I18246c941f96761be5134538d0a7032b24b12e84 --- daemon/call_flags.c | 3 +++ daemon/call_interfaces.c | 11 +++++++++++ docs/ng_control_protocol.md | 6 ++++++ include/call_flags.h | 1 + 4 files changed, 21 insertions(+) diff --git a/daemon/call_flags.c b/daemon/call_flags.c index 903fab561..078ece483 100644 --- a/daemon/call_flags.c +++ b/daemon/call_flags.c @@ -1492,6 +1492,9 @@ const char *call_ng_main_flags(const ng_parser_t *parser, str *key, parser_arg v case CSH_LOOKUP("blob"): out->blob = s; break; + case CSH_LOOKUP("blob64"): + out->blob64 = s; + break; case CSH_LOOKUP("bundle"): case CSH_LOOKUP("BUNDLE"): return call_ng_flags_str_list(parser, value, call_ng_flags_bundle, out); diff --git a/daemon/call_interfaces.c b/daemon/call_interfaces.c index 391d538a5..4d9f301ac 100644 --- a/daemon/call_interfaces.c +++ b/daemon/call_interfaces.c @@ -1905,6 +1905,17 @@ const char *call_play_media_ng(ng_command_ctx_t *ctx) { if (err) return err; + g_autoptr(char) b64dec = NULL; + + if (flags.blob64.len && !flags.blob.len) { + b64dec = g_malloc(flags.blob64.len * 3 / 4 + 3); + gint state = 0; + guint save = 0; + size_t out = g_base64_decode_step(flags.blob64.s, flags.blob64.len, (guchar *) b64dec, &state, &save); + + flags.blob = STR_LEN(b64dec, out); + } + for (__auto_type l = monologues.head; l; l = l->next) { struct call_monologue *monologue = l->data; diff --git a/docs/ng_control_protocol.md b/docs/ng_control_protocol.md index 2edeeeddc..ec0f0cfce 100644 --- a/docs/ng_control_protocol.md +++ b/docs/ng_control_protocol.md @@ -2289,6 +2289,12 @@ Media files can be provided through one of these keys: *ng* transport protocol, only very short files can be provided this way, and so this is primarily useful for testing and debugging. +* `blob64` + + Alternative to `blob` which expects a binary media file in base64 encoding. + This is useful for transports which don't natively support binary data + (e.g. JSON). + * `db-id` Contains an integer. This requires the daemon to be configured for accessing a *MySQL* (or *MariaDB*) diff --git a/include/call_flags.h b/include/call_flags.h index af99066df..fd431ce6f 100644 --- a/include/call_flags.h +++ b/include/call_flags.h @@ -178,6 +178,7 @@ struct sdp_ng_flags { str file; str moh_file; str blob; + str blob64; str moh_blob; long long db_id; long long moh_db_id;