TP-89230 | universal call sdk
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import IAdapter from "@universal-call-sdk/common/Interfaces/IAdapter.ts";
|
||||
import GenericObject from "@universal-call-sdk/common/types/GenericObject.ts";
|
||||
import {RequestKeys} from "./types.ts";
|
||||
import {AmeyoInitializationOptions, RequestKeys, StateType} from "./types.ts";
|
||||
import MessagingType from "../types/MessagingType.ts";
|
||||
import {
|
||||
ameyoHangupUser,
|
||||
@@ -31,7 +31,7 @@ class AmeyoAdapter implements IAdapter {
|
||||
private currentCallMetadata: GenericObject;
|
||||
private sipAccountInfo: GenericObject;
|
||||
|
||||
constructor(options : GenericObject) {
|
||||
constructor(options : AmeyoInitializationOptions) {
|
||||
console.log('AmeyoAdapter constructor');
|
||||
const script = document.createElement('script');
|
||||
script.src = 'assets/js/sip5ml.js'; // Assuming it's placed in the public folder
|
||||
@@ -134,15 +134,15 @@ class AmeyoAdapter implements IAdapter {
|
||||
this.currentCallMetadata = {...this.currentCallMetadata, ...data?.data}
|
||||
}
|
||||
};
|
||||
registerOnCallIncoming(callback: ()=> void) {
|
||||
registerOnCallIncoming(callback: (callState: StateType)=> void) {
|
||||
console.log('registerOnCallIncoming');
|
||||
this.callbacks.onCallIncoming = callback;
|
||||
}
|
||||
registerOnCallConnected(callback: ()=> void) {
|
||||
registerOnCallConnected(callback: (callState: StateType)=> void) {
|
||||
console.log('registerOnCallConnected');
|
||||
this.callbacks.onCallConnected = callback;
|
||||
}
|
||||
registerOnCallDisconnected(callback: ()=> void) {
|
||||
registerOnCallDisconnected(callback: (callState: StateType)=> void) {
|
||||
console.log('registerOnCallDisconnected');
|
||||
this.callbacks.onCallDisconnected = callback;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import exp from "constants";
|
||||
|
||||
export type GenericObject = {
|
||||
[key: string]: any;
|
||||
};
|
||||
@@ -22,6 +24,13 @@ export enum RequestKeys {
|
||||
AUTO_SELECT_EXTENSION = 'auto_select_extension'
|
||||
}
|
||||
|
||||
export type AmeyoInitializationOptions = {
|
||||
userName: string,
|
||||
password: string,
|
||||
eventListenerUrl: string,
|
||||
baseUrl: string
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
BASE_AMEYO_URL: string
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
import useCallSdk from "./useCallSdk.ts";
|
||||
|
||||
|
||||
export default useCallSdk;
|
||||
Reference in New Issue
Block a user