I’m building a custom softphone widget using the Genesys Cloud JavaScript SDK to handle agent interactions. The main goal is to wrap every SDK event in an OpenTelemetry span so I can trace latency across our internal services and the GC platform. Most events work fine, but I’m hitting a wall with the mute and unmute methods on the conversation participant object.
When I call conversation.mute(), the audio stops locally, which is expected. However, the subsequent webhook event or API call that confirms the mute state on the server side seems to lose the trace context I injected earlier in the flow. I suspect the SDK might be stripping headers or using a separate XHR that doesn’t inherit the parent span’s baggage.
Here’s the relevant snippet where I try to capture the trace ID before muting:
const span = tracer.startSpan("agent-mute-action", {
kind: SpanKind.CLIENT,
attributes: { "call.id": conversation.id }
});
const traceId = span.context().traceId;
console.log("Parent Trace ID:", traceId);
// Attempting to mute
await conversation.mute();
span.end();
The mute happens successfully in the UI. But when I check my Jaeger backend, the agent-mute-action span is orphaned. It doesn’t link to the parent span created during the call setup. I’ve tried passing a custom headers object into the SDK client configuration, but the mute method doesn’t accept an options parameter like some of the REST endpoints do.
Is there a way to inject the traceparent header into the underlying WebSocket or XHR request that the mute method triggers? Or am I missing a hook in the SDK to attach metadata to these state-change events? I’ve looked through the genesys-cloud-messenger-sdk docs, but nothing jumps out for low-level header manipulation on participant actions.