-
Notifications
You must be signed in to change notification settings - Fork 7
/
index.d.ts
1873 lines (1859 loc) · 70.2 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Generated by dts-bundle v0.7.3
// Dependencies for this module:
// ../../events
// ../../plivo-jssip
declare module 'plivo-browser-sdk' {
import { Client, ConfiguationOptions } from 'plivo-browser-sdk/client';
class Plivo {
client: Client;
constructor(options: ConfiguationOptions);
}
export default Plivo;
}
declare module 'plivo-browser-sdk/client' {
import { EventEmitter } from 'events';
import { WebSocketInterface, UA, RTCSession } from 'plivo-jssip';
import { Logger, AvailableLogMethods, AvailableFlagValues, DtmfOptions } from 'plivo-browser-sdk/logger';
import { CallSession } from 'plivo-browser-sdk/managers/callSession';
import { StatsSocket } from 'plivo-browser-sdk/stats/ws';
import { OutputDevices, InputDevices, RingToneDevices } from 'plivo-browser-sdk/media/audioDevice';
import { NoiseSuppression } from 'plivo-browser-sdk/rnnoise/NoiseSuppression';
import { LoggerUtil } from 'plivo-browser-sdk/utils/loggerUtil';
export interface PlivoObject {
log: typeof Logger;
sendEvents?: (obj: any, session: CallSession) => void;
AppError?: (obj: any, log: any) => boolean;
audioConstraints?: MediaTrackConstraints;
}
export interface ConfiguationOptions {
codecs?: string[];
enableTracking?: boolean;
enableQualityTracking?: AvailableFlagValues;
debug?: AvailableLogMethods;
permOnClick?: boolean;
enableIPV6?: boolean;
audioConstraints?: MediaTrackConstraints;
dscp?: boolean;
appId?: null | string;
appSecret?: null | string;
registrationDomainSocket?: string[] | null;
clientRegion?: null | string;
preDetectOwa?: boolean;
disableRtpTimeOut?: boolean;
allowMultipleIncomingCalls?: boolean;
closeProtection?: boolean;
maxAverageBitrate?: number;
useDefaultAudioDevice?: boolean;
registrationRefreshTimer?: number;
enableNoiseReduction?: boolean;
usePlivoStunServer?: boolean;
dtmfOptions?: DtmfOptions;
}
export interface BrowserDetails {
browser: string;
version: number;
}
export interface ExtraHeaders {
[key: string]: string;
}
export interface Storage {
local_audio: any[];
remote_audio: any[];
mosLocalMeasures: any[];
jitterLocalMeasures: number[];
jitterRemoteMeasures: number[];
packetLossRemoteMeasures: number[];
packetLossLocalMeasures: number[];
rtt: number[];
mosRemoteMeasures: number[];
audioCodec: null | string;
startAnalysis: boolean;
warning: {
audioLocalMeasures: boolean;
audioRemoteMeasures: boolean;
mosLocalMeasures: boolean;
mosRemoteMeasures: boolean;
jitterLocalMeasures: boolean;
jitterRemoteMeasures: boolean;
packetLossRemoteMeasures: boolean;
packetLossLocalMeasures: boolean;
rtt: boolean;
ice_connection: boolean;
};
}
export interface ConnectionInfo {
reason: string;
state: string;
}
/**
* Initializes the client.
* @public
*/
export class Client extends EventEmitter {
/**
* Holds the browser details of the client
* @private
*/
browserDetails: BrowserDetails;
/**
* Set to true if you want to ask for mic permission just
* before call connection. Otherwise it will be asked only on page load
* @private
*/
permOnClick: boolean;
/**
* Play the ringtone audio for incoming calls if this flag is set to true
* Otherwise do not play audio.
* @private
*/
ringToneFlag: boolean;
/**
* Callback to perform login after previous connection is disconnected successfully
* @private
*/
loginCallback: any;
/**
* Play the ringtone audio for outgoing calls in ringing state if this flag is set to true
* Otherwise do not play audio.
* @private
*/
ringToneBackFlag: boolean;
/**
* Play the connect tone audio for outgoing calls in sending state if this flag is set to true
* Otherwise do not play audio.
* @private
*/
connectToneFlag: boolean;
/**
* Set to true if logged in. Otherwise set to false
* @private
*/
isLoggedIn: boolean;
/**
* Timer for reconnecting to the media connection if any network issue happen
* @private
*/
reconnectInterval: null | ReturnType<typeof setInterval>;
/**
* Controls the number of times media reconnection happens
* @private
*/
reconnectTryCount: number;
/**
* Holds the JSSIP user agent for the logged in user
* @private
*/
phone: UA | null;
/**
* Holds the incoming or outgoing call session details
* @private
*/
_currentSession: null | CallSession;
/**
* Holds the incoming or outgoing JSSIP RTCSession(WebRTC media session)
* @private
*/
callSession: null | RTCSession;
/**
* Unique identifier generated for a call by server
* @private
*/
callUUID: null | string;
/**
* Specifies whether the call direction is incoming or outgoing
* @private
*/
callDirection: null | string;
/**
* Holds the SpeechRecognition instance which listens for
* speech when the user speaks on mute
* @private
*/
speechRecognition: any;
/**
* Holds the loggerUtil instance which keeps the
* value of username and sipCallID to attached to each log
* @private
*/
loggerUtil: LoggerUtil;
noiseSuppresion: NoiseSuppression;
/**
* Specifies whether the noise suppression should be enabled or not
* @private
*/
enableNoiseReduction: boolean | undefined;
/**
* Contains the identifier for previous incoming or outgoing call
* @private
*/
lastCallUUID: null | string;
/**
* Holds the call session of previous incoming or outgoing call
* @private
*/
_lastCallSession: null | CallSession;
/**
* Contains the ongoing incoming calls identifiers with their call session
* @private
*/
incomingInvites: Map<string, any>;
/**
* Contains the ongoing incoming calls identifiers with their start time
* @private
*/
incomingCallsInitiationTime: Map<string, any>;
/**
* Holds the call session of previous incoming call
* @private
*/
lastIncomingCall: null | CallSession;
/**
* Holds the callstats.io instance for sending the stats to callstats.io
* @private
*/
callStats: any;
/**
* Username given when logging in
* @private
*/
userName: null | string;
/**
* Password given when logging in
* @private
*/
password: null | string;
/**
* Access Token given when logging in
* @private
*/
accessToken: null | string;
/**
* Access Token object given when logging in
* @private
*/
accessTokenObject: null | any;
/**
* boolean that tells which type of login method is called
* @private
*/
isAccessTokenGenerator: boolean | null;
/**
* boolean that tells if user logged in through access token
* @private
*/
isAccessToken: boolean;
/**
* access token expiry
* @private
*/
accessTokenExpiryInEpoch: number | null;
/**
* Access Token Outgoing Grant
* @private
*/
isOutgoingGrant: boolean | null;
/**
* Access Token Incoming Grant
* @private
*/
isIncomingGrant: boolean | null;
/**
* Access Token abstract class that needs to be implemented
* @private
*/
accessTokenInterface: any;
/**
* Flag to monitor the feedback api that gets called after the token is expired
* @private
*/
deferFeedback: null | boolean;
/**
* Flag that tells if unregister is pending or not
* @private
*/
isUnregisterPending: null | boolean;
/**
* Options passed by the user while instantiating the client class
* @private
*/
options: ConfiguationOptions;
/**
* It is a unique identifer which is not null when callstats permission is present
* @private
*/
callstatskey: null | string;
/**
* Set to true if RTP stats needed to be sent for the call.Otherwise RTP stats are not sent
* @private
*/
rtp_enabled: boolean;
/**
* Set to true if user is using callstats.io
* @private
*/
statsioused: boolean;
/**
* Describes whether the call is in mute state or not
* @private
*/
isCallMuted: boolean;
/**
* Specifically used for SpeechRecognition
* Describes whether the call is in mute state or not
* @private
*/
isMuteCalled: boolean;
/**
* All audio related information
* @public
*/
audio: {
/**
* Return a promise with the list of available devices
*/
availableDevices: (filter: string) => Promise<MediaDeviceInfo[]>;
/**
* Object with getter and setter functions for ringtone devices
*/
ringtoneDevices: RingToneDevices;
/**
* Object with getter and setter functions for microphone devices
*/
microphoneDevices: InputDevices;
/**
* Object with getter and setter functions for audio output devices
*/
speakerDevices: OutputDevices;
/**
* Return a promise with the list of audio output devices
*/
revealAudioDevices: (arg: string) => Promise<string | MediaStream>;
};
/**
* Audio constraints object that will be passed to webRTC getUserMedia()
* @private
*/
audioConstraints: MediaTrackConstraints;
/**
* Holds the previous one way audio detection details
* @private
*/
owaLastDetect: {
time: Date;
isOneWay: boolean;
};
/**
* Specifies the interval at which one way audio detection happens
* @private
*/
owaDetectTime: number;
/**
* explains whether call should be muted
* @private
*/
shouldMuteCall: boolean;
/**
* Holds the websocket instance created for sending stats
* @private
*/
statsSocket: null | StatsSocket;
/**
* Contains available audio devices.This is done for backward compatiblity
* @private
*/
audioDevDic: any;
/**
* It is a wrapper over ringback tone audio element.
* It is used for playing and pausing ringtone audio for outgoing call
* @private
*/
ringBackToneView: null | HTMLAudioElement;
/**
* It is a wrapper over ring tone audio element.
* It is used for playing and pausing ringtone audio for incoming call
* @private
*/
ringToneView: null | HTMLAudioElement;
/**
* Holds rtp stat information which will be used in capturing media metrics
* @private
*/
storage: Storage | null;
/**
* Holds the websocket instance created for SIP signalling purpose
* @private
*/
plivoSocket: WebSocketInterface;
/**
* Holds the connection state of the SDK
* @private
*/
connectionInfo: ConnectionInfo;
/**
* Responsible for playing audio stream of remote user during call
* @private
*/
remoteView: any;
/**
* It is a wrapper over connect tone audio element.
* It is used for playing and pausing connect tone audio for outgoing call
* @private
*/
connectToneView: HTMLAudioElement;
/**
* Explains whether login method is called.
* @private
*/
isLoginCalled: boolean;
/**
* Explains whether logout method is called.
* @private
*/
isLogoutCalled: boolean;
/**
* Maintains a setInterval which checks for network change in idle state
* @private
*/
networkChangeInterval: null | ReturnType<typeof setInterval>;
/**
* Maintains a setInterval which checks for WS reconnection
* @private
*/
connectionRetryInterval: null | ReturnType<typeof setInterval>;
/**
* Calculate time taken for different stats
* @private
*/
timeTakenForStats: {
[key: string]: {
init: number;
end?: number;
};
};
/**
* Holds network disconnected timestamp
* @private
*/
networkDisconnectedTimestamp: number | null;
/**
* Holds network reconnection timestamp
* @private
*/
networkReconnectionTimestamp: number | null;
/**
* Holds current network information
* @private
*/
currentNetworkInfo: {
networkType: string;
ip: string;
};
/**
* Determines whether any audio device got toggled during current session
* @private
*/
deviceToggledInCurrentSession: boolean;
/**
* Determines whether any audio device got toggled during current session
* @private
*/
useDefaultAudioDevice: boolean;
/**
* Determines whether network got changed during current session
* @private
*/
networkChangeInCurrentSession: boolean;
/**
* Holds a boolean to get initial network info
* @private
*/
didFetchInitialNetworkInfo: boolean;
/**
* Determines which js framework sdk is running with
* @private
*/
jsFramework: string[];
/**
* Get current version of the SDK
*/
version: string;
/**
* Register using user credentials.
* @param {String} userName
* @param {String} password
*/
login: (username: string, password: string) => boolean;
/**
* Register using user access token.
* @param {String} accessToken
*/
loginWithAccessToken: (accessToken: string) => boolean;
/**
* Register using user access token.
* @param {Any} accessTokenObject
*/
loginWithAccessTokenGenerator: (accessTokenObject: any) => boolean;
/**
* get error string by error code
* @param {number} errorCode
*/
getErrorStringByErrorCodes: (errorCode: number) => string;
/**
* Unregister and clear stats timer, socket.
*/
logout: () => boolean;
/**
* Start an outbound call.
* @param {String} phoneNumber - It can be a sip endpoint/number
* @param {Object} extraHeaders - (Optional) Custom headers which are passed in the INVITE.
* They should start with 'X-PH'
*/
call: (phoneNumber: string, extraHeaders: ExtraHeaders) => boolean;
/**
* Answer the incoming call.
* @param {String} callUUID - (Optional) Provide latest CallUUID to answer the call
* @param {String} actionOnOtherIncomingCalls - (Optional) Specify action(reject, ignore,
* letring)
* for next incoming calls when already on call
*/
answer: (callUUID: string, actionOnOtherIncomingCalls: string) => boolean;
/**
* Hangup the call(Outgoing/Incoming).
*/
hangup: () => boolean;
/**
* Reject the Incoming call.
* @param {String} callUUID - (Optional) Provide latest CallUUID to reject the call
*/
reject: (callUUID: string) => boolean;
/**
* Ignore the Incoming call.
* @param {String} callUUID - (Optional) Provide latest CallUUID to ignore the call
*/
ignore: (callUUID: string) => boolean;
/**
* Send DTMF for call(Outgoing/Incoming).
* @param {String} digit - Send the digits as dtmf 'digit'
* ("1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "*", "#")
*/
sendDtmf: (digit: string | number) => void;
/**
* Mute the call(Outgoing/Incoming).
*/
mute: () => boolean;
/**
* Unmute the call(Outgoing/Incoming).
*/
unmute: () => boolean;
/**
* Configure the ringtone played when an incoming call starts ringing.
* @param {Any} val - Can be media url or boolean value for enabling/disabling default ringtone
*/
setRingTone: (val: string | boolean) => boolean;
/**
* Configure the ringtone played when an outgoing call starts ringing.
* @param {Any} val - Can be media url or boolean value for enabling/disabling default ringtone
*/
setRingToneBack: (val: string | boolean) => boolean;
/**
* Configure the audio played when an outgoing call is being connected.
* @param {Boolean} val - Enable/Disable default connect tone
*/
setConnectTone: (val: boolean) => boolean;
/**
* Starts the Noise Reduction.
* @param {Boolean} val - true if noise reduction is started, else false
*/
startNoiseReduction: () => Promise<boolean>;
/**
* stops the Noise Reduction.
* @param {Boolean} val - true if noise reduction is stopped, else false
*/
stopNoiseReduction: () => Promise<boolean>;
/**
* Configure the audio played when sending a DTMF.
* @param {String} digit - Specify digit for which audio needs to be configured
* @param {String} url - Media url for playing audio
*/
setDtmfTone: (digit: string, url: string | boolean) => boolean;
/**
* Get the CallUUID if a call is active.
* @returns Current CallUUID
*/
getCallUUID: () => string | null;
/**
* Check if the client is in registered state.
* @returns Current CallUUID
*/
isRegistered: () => boolean | null;
/**
* Check if the client is in connecting state.
* @returns Current CallUUID
*/
isConnecting: () => boolean | null;
/**
* Check if the client is in connected state.
* @returns Current CallUUID
*/
isConnected: () => boolean | null;
/**
* Get the CallUUID of the latest answered call.
*/
getLastCallUUID: () => string | null;
/**
* Get a list of incoming calls which are active.
*/
getIncomingCalls: () => any[];
/**
* Update log level
* @param {String} debug - log level
*/
setDebug: (debug: AvailableLogMethods) => void;
/**
* Get RTCPeerConnection object
*/
getPeerConnection: () => {
status: string;
pc: any;
};
/**
* Get webRTC support, return true if webRTC is supported
*/
webRTC: () => boolean;
/**
* Get supported browsers
*/
supportedBrowsers: () => string;
/**
* Configure the audio played when sending a DTMF.
* @param {String} callUUID - Specify CallUUID for which feedback needs to be sent
* @param {String} starRating - Rate the call from 1 to 5
* @param {Array<String>} issues - Provide suspected issues
* @param {String} note - Send any remarks
* @param {Boolean} sendConsoleLogs - Send browser logs to Plivo
*/
submitCallQualityFeedback: (callUUID: string, starRating: string, issues: string[], note: string, sendConsoleLogs: boolean) => Promise<string>;
clearOnLogout(): void;
/**
* @constructor
* @param options - (Optional) client configuration parameters
* @private
*/
constructor(options: ConfiguationOptions);
setExpiryTimeInEpoch: (timeInEpoch: number) => void;
getTokenExpiryTimeInEpoch: () => number | null;
}
}
declare module 'plivo-browser-sdk/logger' {
import { Client } from 'plivo-browser-sdk/client';
import { LoggerUtil } from 'plivo-browser-sdk/utils/loggerUtil';
export type AvailableLogMethods = 'INFO' | 'DEBUG' | 'WARN' | 'ERROR' | 'ALL' | 'OFF' | 'ALL-PLAIN';
export type AvailableFlagValues = 'ALL' | 'NONE' | 'REMOTEONLY' | 'LOCALONLY';
export interface DtmfOptions {
sendDtmfType: string[];
}
interface LoggerOptions {
enableDate?: boolean;
loggingName?: 'PlivoSDK';
logMethod?: AvailableLogMethods;
}
/**
* Create a new logger.
*/
class PlivoLogger {
constructor(options?: LoggerOptions);
info: (...rest: any[]) => void;
debug: (...rest: any[]) => void;
warn: (...rest: any[]) => void;
error: (...rest: any[]) => void;
setLevel: (method: AvailableLogMethods) => string;
level: () => string;
consolelogs: () => string[];
/**
* Enable sip logs if log level is ALL.
* @param {AvailableLogMethods} debugLevel - passed by user while initializing client
*/
enableSipLogs: (debugLevel: AvailableLogMethods) => void;
setLoggerUtil(loggerUtil: LoggerUtil): void;
/**
* Send logs to Plivo kibana.
*/
send: (client: Client) => void;
}
export const Logger: PlivoLogger;
export {};
}
declare module 'plivo-browser-sdk/managers/callSession' {
import { RTCSession, SessionIceCandidateEvent, SessionFailedEvent, SessionEndedEvent } from 'plivo-jssip';
import * as C from 'plivo-browser-sdk/constants';
import { Client, ExtraHeaders } from 'plivo-browser-sdk/client';
import { GetRTPStats } from 'plivo-browser-sdk/stats/rtpStats';
export interface CallSessionOptions {
callUUID?: string;
sipCallID: string | null;
direction: string;
src: string;
dest: string;
session: RTCSession;
extraHeaders: ExtraHeaders;
call_initiation_time?: number;
client: Client;
stirShakenState: string;
}
export interface CallInfo {
callUUID: string;
direction: string;
src: string;
dest: string;
state: string;
stirShakenState: string;
extraHeaders: ExtraHeaders;
protocol: string;
originator: string;
reason: string;
code: number;
}
export interface SignallingInfo {
call_initiation_time?: number;
answer_time?: number;
call_confirmed_time?: number;
post_dial_delay?: number;
hangup_time?: number;
hangup_party?: string;
hangup_reason?: string;
invite_time?: number;
call_progress_time?: number;
signalling_errors?: {
timestamp: number;
error_code: string;
error_description: string;
};
ring_start_time?: number;
}
export interface MediaConnectionInformation {
[key: string]: number;
}
/**
* Initializes the CallSession.
*/
export class CallSession {
/**
* Describes the various states of the call
* @private
*/
STATE: {
INITIALIZED: string;
RINGING: string;
ANSWERED: string;
REJECTED: string;
IGNORED: string;
CANCELED: string;
FAILED: string;
ENDED: string;
};
SPEECH_STATE: {
STOPPED: string;
STARTING: string;
RUNNING: string;
STOPPING: string;
STOPPED_AFTER_DETECTION: string;
STOPPED_DUE_TO_NETWORK_ERROR: string;
};
/**
* Unique identifier generated for a call by server
* @private
*/
callUUID: string | null;
/**
* call signed or not it will have these options ‘verified’ | ‘not_verified’ | ‘Not_applicable’
* @private
*/
stirShakenState: string;
/**
* Identifier generated by JSSIP when a new RTCSession is created for the call
* @private
*/
sipCallID: string | null;
/**
* Specifies whether the call direction is incoming or outgoing
* @private
*/
direction: string;
/**
* Sip endpoint or a number from which a new call is made
* @private
*/
src: string;
/**
* Sip endpoint or a number to which a new call is received
* @private
*/
dest: string;
/**
* Holds the state of the incoming or outgoing call
* @private
*/
state: string;
/**
* Holds the status if call is terminated during ringing state
* @private
*/
isCallTerminatedDuringRinging: boolean;
/**
* Holds the current status of speechrecgnition
* @private
*/
speech_state: string;
/**
* Custom headers which are passed in the INVITE. They should start with 'X-PH'
* @private
*/
extraHeaders: ExtraHeaders;
/**
* Holds the WebRTC media session
* @private
*/
session: RTCSession;
/**
* Holds stage(call state name and time) at each state of the call
* @private
*/
connectionStages: string[];
/**
* Set to true if ice candidate gathering starts
* @private
*/
gotInitalIce: boolean;
/**
* Holds the RTP stats instance which is used for collecting rtp stats
* @private
*/
stats: GetRTPStats | null;
/**
* Holds the server flags received in 200 OK
* @private
*/
serverFeatureFlags: Array<string>;
/**
* Holds timestamp for each state of call
* @private
*/
signallingInfo: SignallingInfo;
/**
* Holds stream status and timestamp for each state of ice connection
* @private
*/
mediaConnectionInfo: MediaConnectionInformation | {};
/**
* Delta between INVITE request and RINGING response for a call
* @private
*/
postDialDelayEndTime: number | null;
candidateList: Map<string, C.CandidateListType>;
candidatePairsList: Map<string, C.CandidatePairListType>;
/**
* Update CallUUID in session.
* @param {String} callUUID - active call(Outgoing/Incoming) CallUUID
*/
setCallUUID: (callUUID: string | null) => void;
/**
* Update state in session.
* @param {String} state - active call(Outgoing/Incoming) state(this.STATE)
*/
setState: (state: string) => void;
setSpeechState: (state: string) => void;
/**
* Add stage at each state of call.
* @param {String} stage - Has state name and time at which state change happens
*/
addConnectionStage: (stage: string) => void;
/**
* Get all stages for the call.
*/
getConnectionStages: () => string[];
/**
* Add Plivo stats object.
* @param {GetRTPStats} stats - RTP stats object
*/
setCallStats: (stats: GetRTPStats) => void;
/**
* Clear stats timers and audio levels.
*/
clearCallStats: () => void;
/**
* Update signalling information(holds timestamp for each state of call).
* @param {SignallingInfo} object - contains signalling information
*/
updateSignallingInfo: (object: SignallingInfo) => void;
/**
* Update media connection information(holds timestamp for media stream changes).
* @param {MediaConnectionInfo} object - contains media connection information
*/
updateMediaConnectionInfo: (object: MediaConnectionInformation) => void;
/**
* Get signalling information.
*/
getSignallingInfo: () => SignallingInfo;
stopSpeechRecognition: (clientObj: Client) => void;
startSpeechRecognition: (clientObj: Client) => void;
/**
* Get media connection information.
*/
getMediaConnectionInfo: () => MediaConnectionInformation;
/**
* Add PostDialDelay(Delta between INVITE request and RINGING response) for a call.
* @param {Number} time - current timestamp
*/
setPostDialDelayEndTime: (time: number) => void;
/**
* Get basic call information.
*/
getCallInfo: (originator: string, protocol?: string, reason?: string, code?: number) => CallInfo;
/**
* Triggered when the user answers the call(Outgoing/Incoming) and got or received 200 OK.
* @param {Client} clientObject - client reference
*/
onAccepted: (cs: Client) => void;
/**
* Triggered when the user answers the call(Outgoing/Incoming) and got or received 200 OK.
* @param {Client} clientObject - client reference
*/
onRinging: (cs: Client) => void;
/**
* Triggered when the user answers the call(Outgoing/Incoming) and got or received ACK.
* @param {Client} clientObject - client reference
*/
onConfirmed: (cs: Client) => void;
/**
* Triggered when a new ice candidate is gathered.
* @param {Client} clientObject - client reference
* @param {SessionIceCandidateEvent} event - rtcsession information
*/
onIceCandidate: (cs: Client, event: SessionIceCandidateEvent) => void;
/**
* Triggered when ice candidates gathering is timed out.
* @param {Client} clientObject - client reference
* @param {Number} sec - ice timeout seconds
*/
onIceTimeout: (cs: Client, sec: number) => void;
/**
* Triggered when a call(Outgoing/Incoming) is rejected or invalid.
* @param {Client} clientObject - client reference
* @param {SessionFailedEvent} evt - rtcsession information
*/
onFailed: (cs: Client, event: SessionFailedEvent) => void;
/**
* Triggered when a call(Outgoing/Incoming) hung up.
* @param {Client} clientObject - client reference
* @param {SessionEndedEvent} evt - rtcsession information
*/
onEnded: (cs: Client, event: SessionEndedEvent) => void;
/**
* Triggered when user media is not accessible.
* @param {Client} clientObject - client reference
* @param {Error} err - reason for issue
*/
onGetUserMediaFailed: (cs: Client, error: Error) => void;
/**
* Triggered when peer connection issues(creating offer, answer and setting description) occur.
* @param {Client} clientObject - client reference
* @param {String} msg - type of issue
* @param {Function} callStatscb - callstats.io callback for each issue
* @param {Error} err - reason for issue
*/
handlePeerConnectionFailures: (cs: Client, msg: string | Error, callStatscb: () => void, err: Error) => void;
/**
* @constructor
* @param {CallSessionOptions} options - call(Outgoing/Incoming) information
* @private
*/
constructor(options: CallSessionOptions);
}
}
declare module 'plivo-browser-sdk/stats/ws' {
import { Client } from 'plivo-browser-sdk/client';
/**
* Initialize stats socket.
*/
export class StatsSocket {
/**
* URL to establish websocket connection
* @private
*/
url: string;
/**
* Holds the instance of websocket
* @private
*/
ws: null | WebSocket;
/**
* Holds a bollean which determines whether the socket is trying for a connection
* @private
*/
isConnecting: boolean;
/**
* Stores the messages in buffer if websocket is unable to send message