feat(call, voicemail, ivr): add voicemail and IVR call flows with DTMF handling, prompt playback, recording, and dashboard management
This commit is contained in:
@@ -122,6 +122,9 @@ export class SipLeg implements ILeg {
|
||||
onConnected: ((leg: SipLeg) => void) | null = null;
|
||||
onTerminated: ((leg: SipLeg) => void) | null = null;
|
||||
|
||||
/** Callback for SIP INFO messages (used for DTMF relay). */
|
||||
onInfoReceived: ((msg: SipMessage) => void) | null = null;
|
||||
|
||||
constructor(id: string, config: ISipLegConfig) {
|
||||
this.id = id;
|
||||
this.type = config.role === 'device' ? 'sip-device' : 'sip-provider';
|
||||
@@ -464,7 +467,15 @@ export class SipLeg implements ILeg {
|
||||
this.onTerminated?.(this);
|
||||
this.onStateChange?.(this);
|
||||
}
|
||||
// Other in-dialog requests (re-INVITE, INFO, etc.) can be handled here in the future.
|
||||
if (method === 'INFO') {
|
||||
// Respond 200 OK to the INFO request.
|
||||
const ok = SipMessage.createResponse(200, 'OK', msg);
|
||||
this.config.sendSip(ok.serialize(), { address: rinfo.address, port: rinfo.port });
|
||||
|
||||
// Forward to DTMF handler (if attached).
|
||||
this.onInfoReceived?.(msg);
|
||||
}
|
||||
// Other in-dialog requests (re-INVITE, etc.) can be handled here in the future.
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user