xinyao-agent-call-sdk 1.1.60 → 1.1.62
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/utils/call_api.d.ts +51 -0
- package/websocket/index.d.ts +1 -1
- package/xy_call_sdk.esm.js +1 -1
- package/xy_call_sdk.js +1 -1
package/package.json
CHANGED
package/utils/call_api.d.ts
CHANGED
|
@@ -33,6 +33,57 @@ declare class Call_Api {
|
|
|
33
33
|
password: string;
|
|
34
34
|
};
|
|
35
35
|
constructor({ onCallBack, params, element, callInfoData, storeInfo, agentInfo, outCallConfig, Agent, hangupInit, saveLog, }: Props);
|
|
36
|
+
/**
|
|
37
|
+
call_event = ({ useName }: { useName: string }) => {
|
|
38
|
+
if (!useName) {
|
|
39
|
+
this.#onCallBack(resultError({ data: `parameter [useName] is not undefined`, event: 'call_failed' }));
|
|
40
|
+
} else {
|
|
41
|
+
let username = useName;
|
|
42
|
+
if (!useName) {
|
|
43
|
+
this.#onCallBack(
|
|
44
|
+
resultError({ data: '请输入被叫号码或被叫信息,例如:1000或者sip:1000@example.com)', event: 'call_failed' }),
|
|
45
|
+
);
|
|
46
|
+
} else if (useName.indexOf('sip:') === -1 && useName.indexOf('@') < 0) {
|
|
47
|
+
username = `sip:${useName}@${Call_Api._userData.sipAddr}`;
|
|
48
|
+
}
|
|
49
|
+
this.action_call(username);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
action_call = (username) => {
|
|
53
|
+
this.#_pluginHandle.createOffer({
|
|
54
|
+
tracks: [
|
|
55
|
+
{
|
|
56
|
+
type: 'audio',
|
|
57
|
+
capture: true,
|
|
58
|
+
recv: true,
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
trickle: true,
|
|
62
|
+
success: (jsep: JanusJS.JSEP) => {
|
|
63
|
+
const body = {
|
|
64
|
+
request: 'call',
|
|
65
|
+
uri: username,
|
|
66
|
+
autoaccept_reinvites: false,
|
|
67
|
+
referId: undefined,
|
|
68
|
+
};
|
|
69
|
+
this.#TIMEOUT && clearTimeout(this.#TIMEOUT);
|
|
70
|
+
this.#TIMEOUT = setTimeout(() => {
|
|
71
|
+
if (this.#_ready) {
|
|
72
|
+
this.#_pluginHandle.send({ message: body, jsep });
|
|
73
|
+
}
|
|
74
|
+
}, 1500);
|
|
75
|
+
},
|
|
76
|
+
error: (err) => {
|
|
77
|
+
this.#onCallBack(resultError({ data: err || '', event: 'call_failed' }));
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
// 发送按键
|
|
82
|
+
send_button_event = (dtmf: string) => {
|
|
83
|
+
this.#_pluginHandle.dtmf({ dtmf: { tones: dtmf, duration: 0, gap: 0 } });
|
|
84
|
+
};
|
|
85
|
+
**/
|
|
86
|
+
hangup_call_event: () => void;
|
|
36
87
|
on_answer({ error }: CallAPIParams): void;
|
|
37
88
|
out_call({ error, user_called, user_data, skill_id }: OutCallParamsType): Promise<void>;
|
|
38
89
|
answer({ error }: CallAPIParams): void;
|
package/websocket/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ declare class Websocket {
|
|
|
10
10
|
private msgTimerRef;
|
|
11
11
|
private startTime;
|
|
12
12
|
private readonly onCallBack;
|
|
13
|
-
constructor(agentInfo: agentDataType, onCallBack: OnCallBackType, callInfoData: CallInfoMsgType, storeInfo: StoreInfoType, Agent: Agent, onAnswer: () => void, URL: string, inCallConfig: InCallSettingType, onDetach: (is_sdk?: boolean) => void, hangupInit: () => void, saveLog: (log: LogType) => void);
|
|
13
|
+
constructor(agentInfo: agentDataType, onCallBack: OnCallBackType, callInfoData: CallInfoMsgType, storeInfo: StoreInfoType, Agent: Agent, onAnswer: () => void, URL: string, inCallConfig: InCallSettingType, onDetach: (is_sdk?: boolean) => void, hangupInit: () => void, saveLog: (log: LogType) => void, hangupJanus: () => void);
|
|
14
14
|
createWorker(): Worker;
|
|
15
15
|
private initWebSocket;
|
|
16
16
|
private onWsMes;
|