Skip to content

Commit

Permalink
Merge pull request #901 from signalwire/gv/realtime_dial_node_id
Browse files Browse the repository at this point in the history
  • Loading branch information
giavac authored Nov 3, 2023
2 parents efc7978 + 2131bb4 commit 6063d4b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .changeset/metal-shirts-switch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@signalwire/realtime-api': patch
'@signalwire/core': patch
---

Add an optional nodeId to call.dial
1 change: 1 addition & 0 deletions packages/core/src/types/voiceCall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,7 @@ export type VoiceCallDisconnectReason =
export interface VoiceCallDialRegionParams {
region?: VoiceRegion
maxPricePerMinute?: number
nodeId?: string
}

export type VoiceCallDialPhoneMethodParams = OmitType<VoiceCallPhoneParams> &
Expand Down
7 changes: 6 additions & 1 deletion packages/realtime-api/src/voice/Voice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,10 +243,11 @@ class VoiceAPI extends BaseConsumer<VoiceClientApiEvents> {
devices: toInternalDevices(devices),
}
} else if ('region' in params) {
const { region, devices: deviceBuilder } = params
const { region, nodeId, devices: deviceBuilder } = params
executeParams = {
tag: this._tag,
region,
node_id: nodeId,
devices: toInternalDevices(deviceBuilder.devices),
}
} else {
Expand All @@ -265,27 +266,31 @@ class VoiceAPI extends BaseConsumer<VoiceClientApiEvents> {
dialPhone({
region,
maxPricePerMinute,
nodeId,
...params
}: VoiceCallDialPhoneMethodParams) {
const devices = new DeviceBuilder().add(DeviceBuilder.Phone(params))
// dial is available through the VoiceClient Proxy
return this.dial({
maxPricePerMinute,
region,
nodeId,
devices,
})
}

dialSip({
region,
maxPricePerMinute,
nodeId,
...params
}: VoiceCallDialSipMethodParams) {
const devices = new DeviceBuilder().add(DeviceBuilder.Sip(params))
// dial is available through the VoiceClient Proxy
return this.dial({
maxPricePerMinute,
region,
nodeId,
devices,
})
}
Expand Down

0 comments on commit 6063d4b

Please sign in to comment.