Skip to content

Commit

Permalink
Add support for callStateUrl and callStateEvents (#821)
Browse files Browse the repository at this point in the history
* add callStateUrl and callStateEvents to dial and connect

* changeset
  • Loading branch information
Edoardo Gallo committed Jul 3, 2023
1 parent 69c8041 commit 4e1116b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
5 changes: 5 additions & 0 deletions .changeset/unlucky-planets-fly.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@signalwire/core': minor
---

Add support for `callStateUrl` and `callStateEvents` when dialing and connecting Voice Call.
26 changes: 16 additions & 10 deletions packages/core/src/types/voiceCall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,20 +151,24 @@ export interface SipHeader {
value: string
}

export interface VoiceCallPhoneParams {
interface VoiceCallParams {
timeout?: number
callStateUrl?: string
callStateEvents?: CallingCallState[]
}

export interface VoiceCallPhoneParams extends VoiceCallParams {
type: 'phone'
from?: string
to: string
timeout?: number
}

export type OmitType<T> = Omit<T, 'type'>

export interface VoiceCallSipParams {
export interface VoiceCallSipParams extends VoiceCallParams {
type: 'sip'
from: string
to: string
timeout?: number
headers?: SipHeader[]
codecs?: SipCodec[]
webrtcMedia?: boolean
Expand Down Expand Up @@ -789,14 +793,18 @@ export type InternalVoiceCallEntity = {
* ==========
*/

type CallDeviceParamsShared = {
timeout?: number
max_duration?: number
call_state_url?: string
call_state_events?: string[]
}
export interface CallingCallPhoneDevice {
type: 'phone'
params: {
from_number: string
to_number: string
timeout: number
max_duration: number
}
} & CallDeviceParamsShared
}

export interface CallingCallSIPDevice {
Expand All @@ -805,12 +813,10 @@ export interface CallingCallSIPDevice {
from: string
from_name?: string
to: string
timeout?: number
max_duration?: number
headers?: SipHeader[]
codecs?: SipCodec[]
webrtc_media?: boolean
}
} & CallDeviceParamsShared
}

type CallingCallDevice = CallingCallPhoneDevice | CallingCallSIPDevice
Expand Down

0 comments on commit 4e1116b

Please sign in to comment.