fix(apiserver): publish dial events under the call ref TrackCall registers

handleDial published to the calls.track subject keyed by channel.id, while
trackCall registers the client stream keyed by the ref CreateCall returned.
The two identifiers never match, so every dial event was dropped and the
statusStream from Calls.createCall stayed empty for the life of the call.

Resolve the CALL_REF channel variable, which the originate in runCallManager
and the local-ctx-common dialplan both set, and publish under that. Channels
with no call ref have no TrackCall request waiting on them, so the event is
skipped instead of published under an id nothing can match.

Refs #883
This commit is contained in:
dualfroz committed 2026-09-13 15:19:22 +02:00
1 parent e6e485bb10
commit 943658caef
2 files changed
+178 -1

No files matched your search

+14 -1
View File
@@ -143,7 +143,20 @@ class VoiceDispatcher {
}
async handleDial(event: Dial, channel: Channel) {
createHandleDialEventsWithNats(this.nc)(channel.id, event);
// TrackCall registers the stream under the ref CreateCall handed back to
// the client, so the event has to carry that ref and not the channel id.
const callRef = (
await createGetChannelVarWithoutThrow(channel)(ChannelVar.CALL_REF)
)?.value;
if (!callRef) {
logger.silly("no callRef found, ignoring handleDial event", {
channelId: channel?.id
});
return;
}
createHandleDialEventsWithNats(this.nc)(callRef, event);
}
async isHandledElsewhere(channel: Channel) {