@webex/calling 3.8.1 → 3.9.0-multipleLLM.1
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/dist/CallSettings/WxCallBackendConnector.js +2 -2
- package/dist/CallSettings/WxCallBackendConnector.js.map +1 -1
- package/dist/CallSettings/WxCallBackendConnector.test.js +94 -27
- package/dist/CallSettings/WxCallBackendConnector.test.js.map +1 -1
- package/dist/CallSettings/types.js.map +1 -1
- package/dist/CallingClient/CallingClient.js +186 -111
- package/dist/CallingClient/CallingClient.js.map +1 -1
- package/dist/CallingClient/CallingClient.test.js +258 -102
- package/dist/CallingClient/CallingClient.test.js.map +1 -1
- package/dist/CallingClient/calling/call.js +26 -13
- package/dist/CallingClient/calling/call.js.map +1 -1
- package/dist/CallingClient/calling/call.test.js +8 -6
- package/dist/CallingClient/calling/call.test.js.map +1 -1
- package/dist/CallingClient/constants.js +4 -3
- package/dist/CallingClient/constants.js.map +1 -1
- package/dist/CallingClient/line/index.js +3 -4
- package/dist/CallingClient/line/index.js.map +1 -1
- package/dist/CallingClient/line/line.test.js +6 -11
- package/dist/CallingClient/line/line.test.js.map +1 -1
- package/dist/CallingClient/registration/register.js +486 -380
- package/dist/CallingClient/registration/register.js.map +1 -1
- package/dist/CallingClient/registration/register.test.js +441 -309
- package/dist/CallingClient/registration/register.test.js.map +1 -1
- package/dist/CallingClient/registration/types.js.map +1 -1
- package/dist/CallingClient/registration/webWorker.js +115 -0
- package/dist/CallingClient/registration/webWorker.js.map +1 -0
- package/dist/CallingClient/registration/webWorker.test.js +256 -0
- package/dist/CallingClient/registration/webWorker.test.js.map +1 -0
- package/dist/CallingClient/registration/webWorkerStr.js +15 -0
- package/dist/CallingClient/registration/webWorkerStr.js.map +1 -0
- package/dist/CallingClient/windowsChromiumIceWarmupUtils.js +146 -0
- package/dist/CallingClient/windowsChromiumIceWarmupUtils.js.map +1 -0
- package/dist/Errors/types.js +2 -0
- package/dist/Errors/types.js.map +1 -1
- package/dist/Metrics/index.js +77 -74
- package/dist/Metrics/index.js.map +1 -1
- package/dist/Metrics/index.test.js +70 -4
- package/dist/Metrics/index.test.js.map +1 -1
- package/dist/Metrics/types.js.map +1 -1
- package/dist/common/Utils.js +46 -37
- package/dist/common/Utils.js.map +1 -1
- package/dist/common/Utils.test.js +281 -132
- package/dist/common/Utils.test.js.map +1 -1
- package/dist/common/types.js +8 -1
- package/dist/common/types.js.map +1 -1
- package/dist/module/CallSettings/WxCallBackendConnector.js +1 -1
- package/dist/module/CallingClient/CallingClient.js +39 -10
- package/dist/module/CallingClient/calling/call.js +13 -0
- package/dist/module/CallingClient/constants.js +3 -2
- package/dist/module/CallingClient/line/index.js +3 -3
- package/dist/module/CallingClient/registration/register.js +102 -66
- package/dist/module/CallingClient/registration/webWorker.js +59 -0
- package/dist/module/CallingClient/registration/webWorkerStr.js +93 -0
- package/dist/module/CallingClient/windowsChromiumIceWarmupUtils.js +62 -0
- package/dist/module/Errors/types.js +2 -0
- package/dist/module/Metrics/index.js +31 -32
- package/dist/module/common/Utils.js +15 -4
- package/dist/module/common/types.js +7 -0
- package/dist/types/CallSettings/types.d.ts +1 -1
- package/dist/types/CallSettings/types.d.ts.map +1 -1
- package/dist/types/CallingClient/CallingClient.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/call.d.ts.map +1 -1
- package/dist/types/CallingClient/constants.d.ts +3 -2
- package/dist/types/CallingClient/constants.d.ts.map +1 -1
- package/dist/types/CallingClient/line/index.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/register.d.ts +2 -2
- package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/types.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/webWorker.d.ts +2 -0
- package/dist/types/CallingClient/registration/webWorker.d.ts.map +1 -0
- package/dist/types/CallingClient/registration/webWorkerStr.d.ts +3 -0
- package/dist/types/CallingClient/registration/webWorkerStr.d.ts.map +1 -0
- package/dist/types/CallingClient/windowsChromiumIceWarmupUtils.d.ts +7 -0
- package/dist/types/CallingClient/windowsChromiumIceWarmupUtils.d.ts.map +1 -0
- package/dist/types/Errors/types.d.ts +2 -0
- package/dist/types/Errors/types.d.ts.map +1 -1
- package/dist/types/Metrics/index.d.ts.map +1 -1
- package/dist/types/Metrics/types.d.ts +3 -2
- package/dist/types/Metrics/types.d.ts.map +1 -1
- package/dist/types/common/Utils.d.ts.map +1 -1
- package/dist/types/common/types.d.ts +13 -0
- package/dist/types/common/types.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/common/types.js
CHANGED
|
@@ -4,7 +4,7 @@ var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/defi
|
|
|
4
4
|
_Object$defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.ServiceIndicator = exports.SORT_BY = exports.SORT = exports.RegistrationStatus = exports.HTTP_METHODS = exports.DecodeType = exports.CallType = exports.CallDirection = exports.CALLING_BACKEND = exports.ALLOWED_SERVICES = void 0;
|
|
7
|
+
exports.WorkerMessageType = exports.ServiceIndicator = exports.SORT_BY = exports.SORT = exports.RegistrationStatus = exports.HTTP_METHODS = exports.DecodeType = exports.CallType = exports.CallDirection = exports.CALLING_BACKEND = exports.ALLOWED_SERVICES = void 0;
|
|
8
8
|
var _constants = require("./constants");
|
|
9
9
|
var ALLOWED_SERVICES = exports.ALLOWED_SERVICES = /*#__PURE__*/function (ALLOWED_SERVICES) {
|
|
10
10
|
ALLOWED_SERVICES["MOBIUS"] = "mobius";
|
|
@@ -65,4 +65,11 @@ var DecodeType = exports.DecodeType = /*#__PURE__*/function (DecodeType) {
|
|
|
65
65
|
DecodeType["ORGANIZATION"] = "ORGANIZATION";
|
|
66
66
|
return DecodeType;
|
|
67
67
|
}({});
|
|
68
|
+
var WorkerMessageType = exports.WorkerMessageType = /*#__PURE__*/function (WorkerMessageType) {
|
|
69
|
+
WorkerMessageType["START_KEEPALIVE"] = "START_KEEPALIVE";
|
|
70
|
+
WorkerMessageType["CLEAR_KEEPALIVE"] = "CLEAR_KEEPALIVE";
|
|
71
|
+
WorkerMessageType["KEEPALIVE_SUCCESS"] = "KEEPALIVE_SUCCESS";
|
|
72
|
+
WorkerMessageType["KEEPALIVE_FAILURE"] = "KEEPALIVE_FAILURE";
|
|
73
|
+
return WorkerMessageType;
|
|
74
|
+
}({});
|
|
68
75
|
//# sourceMappingURL=types.js.map
|
package/dist/common/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_constants","require","ALLOWED_SERVICES","exports","HTTP_METHODS","RegistrationStatus","CALLING_BACKEND","CallType","CallDirection","SORT","SORT_BY","ServiceIndicator","DecodeType"],"sources":["types.ts"],"sourcesContent":["import {SCIM_ENTERPRISE_USER, SCIM_WEBEXIDENTITY_USER} from './constants';\n\nexport type MobiusDeviceId = string;\nexport type MobiusDeviceUri = string;\nexport type SettingEnabled = boolean;\n\nexport enum ALLOWED_SERVICES {\n MOBIUS = 'mobius',\n JANUS = 'janus',\n}\nexport enum HTTP_METHODS {\n GET = 'GET',\n POST = 'POST',\n PATCH = 'PATCH',\n PUT = 'PUT',\n DELETE = 'DELETE',\n}\n\nexport enum RegistrationStatus {\n IDLE = 'IDLE',\n ACTIVE = 'active',\n INACTIVE = 'inactive',\n}\n\nexport enum CALLING_BACKEND {\n WXC = 'WEBEX_CALLING',\n BWRKS = 'BROADWORKS_CALLING',\n UCM = 'UCM_CALLING',\n INVALID = 'Calling backend is currently not supported',\n}\n\nexport type DeviceList = unknown;\nexport type CallId = string; // guid;\nexport type CorrelationId = string;\nexport enum CallType {\n URI = 'uri',\n TEL = 'tel',\n}\nexport type CallDetails = {\n type: CallType;\n address: string; // sip address\n};\n\nexport type CallDestination = CallDetails;\nexport enum CallDirection {\n INBOUND = 'inbound',\n OUTBOUND = 'outbound',\n}\nexport type AvatarId = string;\nexport type DisplayName = string;\nexport type DisplayInformation = {\n avatarSrc: AvatarId | undefined;\n name: DisplayName | undefined;\n num: string | undefined;\n id: string | undefined;\n};\n\nexport type WebexRequestPayload = {\n method?: HTTP_METHODS;\n uri?: string;\n addAuthHeader?: boolean;\n headers?: {\n [key: string]: string | null;\n };\n body?: object;\n statusCode?: number;\n json?: boolean;\n service?: ALLOWED_SERVICES;\n};\n\nexport type ErrorCode = string;\n\nexport type Digit = string | number;\n\nexport type ServerInfo = {\n region: string;\n uris: string[];\n};\n\nexport type MobiusServers = {\n primary: ServerInfo;\n backup: ServerInfo;\n};\n\nexport type IpInfo = {\n ipv4: string;\n ipv6: string;\n};\n\nexport type DeviceType = {\n deviceId: string;\n uri: string;\n status: string;\n lastSeen: string;\n addresses: string[];\n clientDeviceUri: string;\n};\n\nexport type RegionInfo = {\n countryCode: string;\n clientRegion: string;\n};\n\nexport interface IDeviceInfo {\n userId?: string;\n errorCode?: number;\n\n device?: DeviceType;\n devices?: DeviceType[];\n keepaliveInterval?: number;\n callKeepaliveInterval?: number;\n voicePortalNumber?: number;\n voicePortalExtension?: number;\n // cSpell:disable\n rehomingIntervalMin?: number;\n rehomingIntervalMax?: number;\n /* cSpell:enable */\n}\n\nexport interface IMetaContext {\n file?: string;\n method?: string;\n}\n\nexport enum SORT {\n ASC = 'ASC',\n DESC = 'DESC',\n DEFAULT = 'DESC',\n}\n\nexport enum SORT_BY {\n END_TIME = 'endTime',\n DEFAULT = 'endTime',\n START_TIME = 'startTime',\n}\n\nexport enum ServiceIndicator {\n CALLING = 'calling',\n CONTACT_CENTER = 'contactcenter',\n GUEST_CALLING = 'guestcalling',\n}\n\nexport type ServiceData = {\n indicator: ServiceIndicator;\n domain?: string;\n};\n\nexport type PhoneNumber = {\n type: string;\n value: string;\n primary?: boolean;\n};\n\nexport type PersonInfo = {\n id: string;\n emails: string[];\n phoneNumbers: PhoneNumber[];\n displayName: string;\n nickName: string;\n firstName: string;\n lastName: string;\n avatar: string;\n orgId: string;\n created: string;\n lastModified: string;\n lastActivity: string;\n status: string;\n type: string;\n};\n\nexport type PeopleListResponse = {\n items: PersonInfo[];\n notFoundIds: string[];\n};\n\nexport enum DecodeType {\n PEOPLE = 'PEOPLE',\n ORGANIZATION = 'ORGANIZATION',\n}\n\nexport type ContactDetail = {\n type?: string;\n value: string;\n};\n\nexport interface URIAddress {\n value: string;\n type: string;\n primary?: boolean;\n}\n\nexport type KmsKey = {\n uri: string;\n userId: string;\n createDate: string;\n expirationDate: string;\n bindDate?: string;\n resourceUri?: string;\n};\n\nexport type KmsResourceObject = {\n uri: string;\n keyUris: string[];\n authorizationUris: string[];\n};\n\nexport interface Name {\n familyName: string;\n givenName: string;\n}\n\nexport interface Address {\n city?: string;\n country?: string;\n state?: string;\n street?: string;\n zipCode?: string;\n}\n\ninterface WebexIdentityMeta {\n organizationId: string;\n}\ninterface WebexIdentityUser {\n sipAddresses?: URIAddress[];\n meta?: WebexIdentityMeta;\n}\n\ninterface Manager {\n value: string;\n displayName: string;\n $ref: string;\n}\n\ninterface EnterpriseUser {\n department?: string;\n manager?: Manager;\n}\n\ninterface Resource {\n schemas: string[];\n id: string;\n userName: string;\n active?: boolean;\n name?: Name;\n displayName?: string;\n emails?: URIAddress[];\n userType: string;\n phoneNumbers?: PhoneNumber[];\n photos?: ContactDetail[];\n addresses?: Address[];\n [SCIM_WEBEXIDENTITY_USER]?: WebexIdentityUser;\n [SCIM_ENTERPRISE_USER]?: EnterpriseUser;\n}\n\nexport interface SCIMListResponse {\n schemas: string[];\n totalResults: number;\n itemsPerPage: number;\n startIndex: number;\n Resources: Resource[];\n}\n\nexport type LogsMetaData = {\n callId?: string;\n feedbackId?: string;\n correlationId?: string;\n};\n\nexport type UploadLogsResponse = {\n trackingid?: string;\n url?: string;\n userId?: string;\n feedbackId: string;\n correlationId?: string;\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAA0E,IAM9DC,gBAAgB,GAAAC,OAAA,CAAAD,gBAAA,0BAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAA,OAAhBA,gBAAgB;AAAA;AAAA,IAIhBE,YAAY,GAAAD,OAAA,CAAAC,YAAA,0BAAZA,YAAY;EAAZA,YAAY;EAAZA,YAAY;EAAZA,YAAY;EAAZA,YAAY;EAAZA,YAAY;EAAA,OAAZA,YAAY;AAAA;AAAA,IAQZC,kBAAkB,GAAAF,OAAA,CAAAE,kBAAA,0BAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAA,OAAlBA,kBAAkB;AAAA;AAAA,IAMlBC,eAAe,GAAAH,OAAA,CAAAG,eAAA,0BAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAA,OAAfA,eAAe;AAAA,OAQE;AAAA,IAEjBC,QAAQ,GAAAJ,OAAA,CAAAI,QAAA,0BAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAAA,OAARA,QAAQ;AAAA;AAAA,IAURC,aAAa,GAAAL,OAAA,CAAAK,aAAA,0BAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAA,OAAbA,aAAa;AAAA;AAAA,IAgFbC,IAAI,GAAAN,OAAA,CAAAM,IAAA,0BAAJA,IAAI;EAAJA,IAAI;EAAJA,IAAI;EAAJA,IAAI;EAAA,OAAJA,IAAI;AAAA;AAAA,IAMJC,OAAO,GAAAP,OAAA,CAAAO,OAAA,0BAAPA,OAAO;EAAPA,OAAO;EAAPA,OAAO;EAAPA,OAAO;EAAA,OAAPA,OAAO;AAAA;AAAA,IAMPC,gBAAgB,GAAAR,OAAA,CAAAQ,gBAAA,0BAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAA,OAAhBA,gBAAgB;AAAA;AAAA,IAuChBC,UAAU,GAAAT,OAAA,CAAAS,UAAA,0BAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAA,OAAVA,UAAU;AAAA"}
|
|
1
|
+
{"version":3,"names":["_constants","require","ALLOWED_SERVICES","exports","HTTP_METHODS","RegistrationStatus","CALLING_BACKEND","CallType","CallDirection","SORT","SORT_BY","ServiceIndicator","DecodeType","WorkerMessageType"],"sources":["types.ts"],"sourcesContent":["import {SCIM_ENTERPRISE_USER, SCIM_WEBEXIDENTITY_USER} from './constants';\n\nexport type MobiusDeviceId = string;\nexport type MobiusDeviceUri = string;\nexport type SettingEnabled = boolean;\n\nexport enum ALLOWED_SERVICES {\n MOBIUS = 'mobius',\n JANUS = 'janus',\n}\nexport enum HTTP_METHODS {\n GET = 'GET',\n POST = 'POST',\n PATCH = 'PATCH',\n PUT = 'PUT',\n DELETE = 'DELETE',\n}\n\nexport enum RegistrationStatus {\n IDLE = 'IDLE',\n ACTIVE = 'active',\n INACTIVE = 'inactive',\n}\n\nexport enum CALLING_BACKEND {\n WXC = 'WEBEX_CALLING',\n BWRKS = 'BROADWORKS_CALLING',\n UCM = 'UCM_CALLING',\n INVALID = 'Calling backend is currently not supported',\n}\n\nexport type DeviceList = unknown;\nexport type CallId = string; // guid;\nexport type CorrelationId = string;\nexport enum CallType {\n URI = 'uri',\n TEL = 'tel',\n}\nexport type CallDetails = {\n type: CallType;\n address: string; // sip address\n};\n\nexport type CallDestination = CallDetails;\nexport enum CallDirection {\n INBOUND = 'inbound',\n OUTBOUND = 'outbound',\n}\nexport type AvatarId = string;\nexport type DisplayName = string;\nexport type DisplayInformation = {\n avatarSrc: AvatarId | undefined;\n name: DisplayName | undefined;\n num: string | undefined;\n id: string | undefined;\n};\n\nexport type WebexRequestPayload = {\n method?: HTTP_METHODS;\n uri?: string;\n addAuthHeader?: boolean;\n headers?: {\n [key: string]: string | null;\n };\n body?: object;\n statusCode?: number;\n json?: boolean;\n service?: ALLOWED_SERVICES;\n};\n\nexport type ErrorCode = string;\n\nexport type Digit = string | number;\n\nexport type ServerInfo = {\n region: string;\n uris: string[];\n};\n\nexport type MobiusServers = {\n primary: ServerInfo;\n backup: ServerInfo;\n};\n\nexport type IpInfo = {\n ipv4: string;\n ipv6: string;\n};\n\nexport type DeviceType = {\n deviceId: string;\n uri: string;\n status: string;\n lastSeen: string;\n addresses: string[];\n clientDeviceUri: string;\n};\n\nexport type RegionInfo = {\n countryCode: string;\n clientRegion: string;\n};\n\nexport interface IDeviceInfo {\n userId?: string;\n errorCode?: number;\n\n device?: DeviceType;\n devices?: DeviceType[];\n keepaliveInterval?: number;\n callKeepaliveInterval?: number;\n voicePortalNumber?: number;\n voicePortalExtension?: number;\n // cSpell:disable\n rehomingIntervalMin?: number;\n rehomingIntervalMax?: number;\n /* cSpell:enable */\n}\n\nexport interface IMetaContext {\n file?: string;\n method?: string;\n}\n\nexport enum SORT {\n ASC = 'ASC',\n DESC = 'DESC',\n DEFAULT = 'DESC',\n}\n\nexport enum SORT_BY {\n END_TIME = 'endTime',\n DEFAULT = 'endTime',\n START_TIME = 'startTime',\n}\n\nexport enum ServiceIndicator {\n CALLING = 'calling',\n CONTACT_CENTER = 'contactcenter',\n GUEST_CALLING = 'guestcalling',\n}\n\nexport type ServiceData = {\n indicator: ServiceIndicator;\n domain?: string;\n};\n\nexport type PhoneNumber = {\n type: string;\n value: string;\n primary?: boolean;\n};\n\nexport type PersonInfo = {\n id: string;\n emails: string[];\n phoneNumbers: PhoneNumber[];\n displayName: string;\n nickName: string;\n firstName: string;\n lastName: string;\n avatar: string;\n orgId: string;\n created: string;\n lastModified: string;\n lastActivity: string;\n status: string;\n type: string;\n};\n\nexport type PeopleListResponse = {\n items: PersonInfo[];\n notFoundIds: string[];\n};\n\nexport enum DecodeType {\n PEOPLE = 'PEOPLE',\n ORGANIZATION = 'ORGANIZATION',\n}\n\nexport type ContactDetail = {\n type?: string;\n value: string;\n};\n\nexport interface URIAddress {\n value: string;\n type: string;\n primary?: boolean;\n}\n\nexport type KmsKey = {\n uri: string;\n userId: string;\n createDate: string;\n expirationDate: string;\n bindDate?: string;\n resourceUri?: string;\n};\n\nexport type KmsResourceObject = {\n uri: string;\n keyUris: string[];\n authorizationUris: string[];\n};\n\nexport interface Name {\n familyName: string;\n givenName: string;\n}\n\nexport interface Address {\n city?: string;\n country?: string;\n state?: string;\n street?: string;\n zipCode?: string;\n}\n\ninterface WebexIdentityMeta {\n organizationId: string;\n}\ninterface WebexIdentityUser {\n sipAddresses?: URIAddress[];\n meta?: WebexIdentityMeta;\n}\n\ninterface Manager {\n value: string;\n displayName: string;\n $ref: string;\n}\n\ninterface EnterpriseUser {\n department?: string;\n manager?: Manager;\n}\n\ninterface Resource {\n schemas: string[];\n id: string;\n userName: string;\n active?: boolean;\n name?: Name;\n displayName?: string;\n emails?: URIAddress[];\n userType: string;\n phoneNumbers?: PhoneNumber[];\n photos?: ContactDetail[];\n addresses?: Address[];\n [SCIM_WEBEXIDENTITY_USER]?: WebexIdentityUser;\n [SCIM_ENTERPRISE_USER]?: EnterpriseUser;\n}\n\nexport interface SCIMListResponse {\n schemas: string[];\n totalResults: number;\n itemsPerPage: number;\n startIndex: number;\n Resources: Resource[];\n}\n\nexport enum WorkerMessageType {\n START_KEEPALIVE = 'START_KEEPALIVE',\n CLEAR_KEEPALIVE = 'CLEAR_KEEPALIVE',\n KEEPALIVE_SUCCESS = 'KEEPALIVE_SUCCESS',\n KEEPALIVE_FAILURE = 'KEEPALIVE_FAILURE',\n}\n\nexport type KeepaliveStatusMessage = {\n type: WorkerMessageType.KEEPALIVE_SUCCESS | WorkerMessageType.KEEPALIVE_FAILURE;\n err?: unknown;\n keepAliveRetryCount?: number;\n statusCode?: number;\n};\n\nexport type LogsMetaData = {\n callId?: string;\n feedbackId?: string;\n correlationId?: string;\n broadworksCorrelationInfo?: string;\n};\n\nexport type UploadLogsResponse = {\n trackingid?: string;\n url?: string;\n userId?: string;\n feedbackId: string;\n correlationId?: string;\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAA0E,IAM9DC,gBAAgB,GAAAC,OAAA,CAAAD,gBAAA,0BAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAA,OAAhBA,gBAAgB;AAAA;AAAA,IAIhBE,YAAY,GAAAD,OAAA,CAAAC,YAAA,0BAAZA,YAAY;EAAZA,YAAY;EAAZA,YAAY;EAAZA,YAAY;EAAZA,YAAY;EAAZA,YAAY;EAAA,OAAZA,YAAY;AAAA;AAAA,IAQZC,kBAAkB,GAAAF,OAAA,CAAAE,kBAAA,0BAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAA,OAAlBA,kBAAkB;AAAA;AAAA,IAMlBC,eAAe,GAAAH,OAAA,CAAAG,eAAA,0BAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAA,OAAfA,eAAe;AAAA,OAQE;AAAA,IAEjBC,QAAQ,GAAAJ,OAAA,CAAAI,QAAA,0BAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAAA,OAARA,QAAQ;AAAA;AAAA,IAURC,aAAa,GAAAL,OAAA,CAAAK,aAAA,0BAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAA,OAAbA,aAAa;AAAA;AAAA,IAgFbC,IAAI,GAAAN,OAAA,CAAAM,IAAA,0BAAJA,IAAI;EAAJA,IAAI;EAAJA,IAAI;EAAJA,IAAI;EAAA,OAAJA,IAAI;AAAA;AAAA,IAMJC,OAAO,GAAAP,OAAA,CAAAO,OAAA,0BAAPA,OAAO;EAAPA,OAAO;EAAPA,OAAO;EAAPA,OAAO;EAAA,OAAPA,OAAO;AAAA;AAAA,IAMPC,gBAAgB,GAAAR,OAAA,CAAAQ,gBAAA,0BAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAA,OAAhBA,gBAAgB;AAAA;AAAA,IAuChBC,UAAU,GAAAT,OAAA,CAAAS,UAAA,0BAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAA,OAAVA,UAAU;AAAA;AAAA,IAuFVC,iBAAiB,GAAAV,OAAA,CAAAU,iBAAA,0BAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAA,OAAjBA,iBAAiB;AAAA"}
|
|
@@ -289,7 +289,7 @@ export class WxCallBackendConnector {
|
|
|
289
289
|
const vmResponse = await this.getVoicemailSetting();
|
|
290
290
|
if (vmResponse.statusCode === 200) {
|
|
291
291
|
const vm = vmResponse.data.callSetting;
|
|
292
|
-
if (vm.enabled && vm.sendAllCalls
|
|
292
|
+
if (vm.enabled && vm.sendAllCalls?.enabled) {
|
|
293
293
|
const response = {
|
|
294
294
|
...cfResponse,
|
|
295
295
|
data: {
|
|
@@ -13,6 +13,7 @@ import { CALLING_CLIENT_FILE, CALLS_CLEARED_HANDLER_UTIL, CALLING_USER_AGENT, CI
|
|
|
13
13
|
import Line from './line';
|
|
14
14
|
import { METRIC_EVENT, REG_ACTION, METRIC_TYPE } from '../Metrics/types';
|
|
15
15
|
import { getMetricManager } from '../Metrics';
|
|
16
|
+
import windowsChromiumIceWarmup from './windowsChromiumIceWarmupUtils';
|
|
16
17
|
export class CallingClient extends Eventing {
|
|
17
18
|
sdkConnector;
|
|
18
19
|
webex;
|
|
@@ -69,17 +70,36 @@ export class CallingClient extends Eventing {
|
|
|
69
70
|
method: this.constructor.name,
|
|
70
71
|
});
|
|
71
72
|
}
|
|
72
|
-
this.
|
|
73
|
-
|
|
74
|
-
this.webex.internal.services._hostCatalog[
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
73
|
+
if (this.webex.internal.services._hostCatalog) {
|
|
74
|
+
this.mobiusClusters =
|
|
75
|
+
(mobiusServiceHost && this.webex.internal.services._hostCatalog[mobiusServiceHost]) ||
|
|
76
|
+
this.webex.internal.services._hostCatalog[MOBIUS_US_PROD] ||
|
|
77
|
+
this.webex.internal.services._hostCatalog[MOBIUS_EU_PROD] ||
|
|
78
|
+
this.webex.internal.services._hostCatalog[MOBIUS_US_INT] ||
|
|
79
|
+
this.webex.internal.services._hostCatalog[MOBIUS_EU_INT];
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
const mobiusObject = this.webex.internal.services._services.find((item) => item.serviceName === 'mobius');
|
|
83
|
+
this.mobiusClusters = [mobiusObject.serviceUrls[0].baseUrl];
|
|
84
|
+
}
|
|
78
85
|
this.mobiusHost = '';
|
|
79
86
|
this.registerSessionsListener();
|
|
80
87
|
this.registerCallsClearedListener();
|
|
81
88
|
}
|
|
82
89
|
async init() {
|
|
90
|
+
try {
|
|
91
|
+
await windowsChromiumIceWarmup({
|
|
92
|
+
iceServers: [
|
|
93
|
+
{ urls: 'stun:stun01a-us.bcld.webex.com:5004' },
|
|
94
|
+
{ urls: 'stun:stun02a-us.bcld.webex.com:5004' },
|
|
95
|
+
],
|
|
96
|
+
timeoutMs: 1000,
|
|
97
|
+
});
|
|
98
|
+
log.info(`ICE warmup completed`, '');
|
|
99
|
+
}
|
|
100
|
+
catch (err) {
|
|
101
|
+
log.warn(`ICE warmup failed: ${err}`, '');
|
|
102
|
+
}
|
|
83
103
|
await this.getMobiusServers();
|
|
84
104
|
await this.createLine();
|
|
85
105
|
this.detectNetworkChange();
|
|
@@ -113,13 +133,19 @@ export class CallingClient extends Eventing {
|
|
|
113
133
|
}, NETWORK_FLAP_TIMEOUT);
|
|
114
134
|
}
|
|
115
135
|
async getClientRegionInfo() {
|
|
136
|
+
let abort;
|
|
116
137
|
log.info(METHOD_START_MESSAGE, {
|
|
117
138
|
file: CALLING_CLIENT_FILE,
|
|
118
139
|
method: METHODS.GET_CLIENT_REGION_INFO,
|
|
119
140
|
});
|
|
120
141
|
const regionInfo = {};
|
|
121
142
|
for (const mobius of this.mobiusClusters) {
|
|
122
|
-
|
|
143
|
+
if (mobius.host) {
|
|
144
|
+
this.mobiusHost = `https://${mobius.host}${API_V1}`;
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
this.mobiusHost = mobius;
|
|
148
|
+
}
|
|
123
149
|
try {
|
|
124
150
|
const temp = await this.webex.request({
|
|
125
151
|
uri: `${this.mobiusHost}${URL_ENDPOINT}${IP_ENDPOINT}`,
|
|
@@ -152,12 +178,15 @@ export class CallingClient extends Eventing {
|
|
|
152
178
|
method: METHODS.GET_CLIENT_REGION_INFO,
|
|
153
179
|
file: CALLING_CLIENT_FILE,
|
|
154
180
|
});
|
|
155
|
-
handleCallingClientErrors(err, (clientError) => {
|
|
156
|
-
this.metricManager.submitRegistrationMetric(METRIC_EVENT.REGISTRATION_ERROR, REG_ACTION.REGISTER, METRIC_TYPE.BEHAVIORAL, clientError);
|
|
181
|
+
abort = await handleCallingClientErrors(err, (clientError) => {
|
|
182
|
+
this.metricManager.submitRegistrationMetric(METRIC_EVENT.REGISTRATION_ERROR, REG_ACTION.REGISTER, METRIC_TYPE.BEHAVIORAL, GET_MOBIUS_SERVERS_UTIL, 'UNKNOWN', err.headers?.trackingId ?? '', undefined, clientError);
|
|
157
183
|
this.emit(CALLING_CLIENT_EVENT_KEYS.ERROR, clientError);
|
|
158
184
|
}, { method: GET_MOBIUS_SERVERS_UTIL, file: CALLING_CLIENT_FILE });
|
|
159
185
|
regionInfo.clientRegion = '';
|
|
160
186
|
regionInfo.countryCode = '';
|
|
187
|
+
if (abort) {
|
|
188
|
+
return regionInfo;
|
|
189
|
+
}
|
|
161
190
|
}
|
|
162
191
|
}
|
|
163
192
|
return regionInfo;
|
|
@@ -214,7 +243,7 @@ export class CallingClient extends Eventing {
|
|
|
214
243
|
file: CALLING_CLIENT_FILE,
|
|
215
244
|
});
|
|
216
245
|
handleCallingClientErrors(err, (clientError) => {
|
|
217
|
-
this.metricManager.submitRegistrationMetric(METRIC_EVENT.REGISTRATION_ERROR, REG_ACTION.REGISTER, METRIC_TYPE.BEHAVIORAL, clientError);
|
|
246
|
+
this.metricManager.submitRegistrationMetric(METRIC_EVENT.REGISTRATION_ERROR, REG_ACTION.REGISTER, METRIC_TYPE.BEHAVIORAL, GET_MOBIUS_SERVERS_UTIL, 'UNKNOWN', err.headers?.trackingId ?? '', undefined, clientError);
|
|
218
247
|
this.emit(CALLING_CLIENT_EVENT_KEYS.ERROR, clientError);
|
|
219
248
|
}, { method: GET_MOBIUS_SERVERS_UTIL, file: CALLING_CLIENT_FILE });
|
|
220
249
|
useDefault = true;
|
|
@@ -653,6 +653,7 @@ export class Call extends Eventing {
|
|
|
653
653
|
await uploadLogs({
|
|
654
654
|
correlationId: this.correlationId,
|
|
655
655
|
callId: this.callId,
|
|
656
|
+
broadworksCorrelationInfo: this.broadworksCorrelationInfo,
|
|
656
657
|
});
|
|
657
658
|
}
|
|
658
659
|
}
|
|
@@ -695,6 +696,7 @@ export class Call extends Eventing {
|
|
|
695
696
|
await uploadLogs({
|
|
696
697
|
correlationId: this.correlationId,
|
|
697
698
|
callId: this.callId,
|
|
699
|
+
broadworksCorrelationInfo: this.broadworksCorrelationInfo,
|
|
698
700
|
});
|
|
699
701
|
}
|
|
700
702
|
}
|
|
@@ -737,6 +739,7 @@ export class Call extends Eventing {
|
|
|
737
739
|
await uploadLogs({
|
|
738
740
|
correlationId: this.correlationId,
|
|
739
741
|
callId: this.callId,
|
|
742
|
+
broadworksCorrelationInfo: this.broadworksCorrelationInfo,
|
|
740
743
|
});
|
|
741
744
|
}
|
|
742
745
|
}
|
|
@@ -826,6 +829,7 @@ export class Call extends Eventing {
|
|
|
826
829
|
await uploadLogs({
|
|
827
830
|
correlationId: this.correlationId,
|
|
828
831
|
callId: this.callId,
|
|
832
|
+
broadworksCorrelationInfo: this.broadworksCorrelationInfo,
|
|
829
833
|
});
|
|
830
834
|
}
|
|
831
835
|
}
|
|
@@ -875,6 +879,7 @@ export class Call extends Eventing {
|
|
|
875
879
|
await uploadLogs({
|
|
876
880
|
correlationId: this.correlationId,
|
|
877
881
|
callId: this.callId,
|
|
882
|
+
broadworksCorrelationInfo: this.broadworksCorrelationInfo,
|
|
878
883
|
});
|
|
879
884
|
}
|
|
880
885
|
}
|
|
@@ -991,6 +996,7 @@ export class Call extends Eventing {
|
|
|
991
996
|
await uploadLogs({
|
|
992
997
|
correlationId: this.correlationId,
|
|
993
998
|
callId: this.callId,
|
|
999
|
+
broadworksCorrelationInfo: this.broadworksCorrelationInfo,
|
|
994
1000
|
});
|
|
995
1001
|
}
|
|
996
1002
|
}, DEFAULT_SESSION_TIMER);
|
|
@@ -1108,6 +1114,7 @@ export class Call extends Eventing {
|
|
|
1108
1114
|
await uploadLogs({
|
|
1109
1115
|
correlationId: this.correlationId,
|
|
1110
1116
|
callId: this.callId,
|
|
1117
|
+
broadworksCorrelationInfo: this.broadworksCorrelationInfo,
|
|
1111
1118
|
});
|
|
1112
1119
|
}
|
|
1113
1120
|
}
|
|
@@ -1163,6 +1170,7 @@ export class Call extends Eventing {
|
|
|
1163
1170
|
await uploadLogs({
|
|
1164
1171
|
correlationId: this.correlationId,
|
|
1165
1172
|
callId: this.callId,
|
|
1173
|
+
broadworksCorrelationInfo: this.broadworksCorrelationInfo,
|
|
1166
1174
|
});
|
|
1167
1175
|
}
|
|
1168
1176
|
}
|
|
@@ -1211,6 +1219,7 @@ export class Call extends Eventing {
|
|
|
1211
1219
|
await uploadLogs({
|
|
1212
1220
|
correlationId: this.correlationId,
|
|
1213
1221
|
callId: this.callId,
|
|
1222
|
+
broadworksCorrelationInfo: this.broadworksCorrelationInfo,
|
|
1214
1223
|
});
|
|
1215
1224
|
}
|
|
1216
1225
|
}
|
|
@@ -1244,6 +1253,7 @@ export class Call extends Eventing {
|
|
|
1244
1253
|
await uploadLogs({
|
|
1245
1254
|
correlationId: this.correlationId,
|
|
1246
1255
|
callId: this.callId,
|
|
1256
|
+
broadworksCorrelationInfo: this.broadworksCorrelationInfo,
|
|
1247
1257
|
});
|
|
1248
1258
|
}
|
|
1249
1259
|
}
|
|
@@ -1313,6 +1323,7 @@ export class Call extends Eventing {
|
|
|
1313
1323
|
await uploadLogs({
|
|
1314
1324
|
correlationId: this.correlationId,
|
|
1315
1325
|
callId: this.callId,
|
|
1326
|
+
broadworksCorrelationInfo: this.broadworksCorrelationInfo,
|
|
1316
1327
|
});
|
|
1317
1328
|
}
|
|
1318
1329
|
};
|
|
@@ -1579,6 +1590,7 @@ export class Call extends Eventing {
|
|
|
1579
1590
|
await uploadLogs({
|
|
1580
1591
|
correlationId: this.correlationId,
|
|
1581
1592
|
callId: this.callId,
|
|
1593
|
+
broadworksCorrelationInfo: this.broadworksCorrelationInfo,
|
|
1582
1594
|
});
|
|
1583
1595
|
}
|
|
1584
1596
|
}
|
|
@@ -1608,6 +1620,7 @@ export class Call extends Eventing {
|
|
|
1608
1620
|
await uploadLogs({
|
|
1609
1621
|
correlationId: this.correlationId,
|
|
1610
1622
|
callId: this.callId,
|
|
1623
|
+
broadworksCorrelationInfo: this.broadworksCorrelationInfo,
|
|
1611
1624
|
});
|
|
1612
1625
|
}
|
|
1613
1626
|
}
|
|
@@ -105,10 +105,10 @@ export const BASE_REG_RETRY_TIMER_VAL_IN_SEC = 30;
|
|
|
105
105
|
export const SEC_TO_MSEC_MFACTOR = 1000;
|
|
106
106
|
export const MINUTES_TO_SEC_MFACTOR = 60;
|
|
107
107
|
export const REG_RANDOM_T_FACTOR_UPPER_LIMIT = 10000;
|
|
108
|
-
export const REG_TRY_BACKUP_TIMER_VAL_IN_SEC =
|
|
109
|
-
export const REG_TRY_BACKUP_TIMER_VAL_FOR_CC_IN_SEC = 114;
|
|
108
|
+
export const REG_TRY_BACKUP_TIMER_VAL_IN_SEC = 114;
|
|
110
109
|
export const REG_FAILBACK_429_MAX_RETRIES = 5;
|
|
111
110
|
export const RETRY_TIMER_UPPER_LIMIT = 60;
|
|
111
|
+
export const REGISTRATION_UTIL = 'triggerRegistration';
|
|
112
112
|
export const REGISTER_UTIL = 'attemptRegistrationWithServers';
|
|
113
113
|
export const GET_MOBIUS_SERVERS_UTIL = 'getMobiusServers';
|
|
114
114
|
export const KEEPALIVE_UTIL = 'startKeepaliveTimer';
|
|
@@ -148,6 +148,7 @@ export const METHODS = {
|
|
|
148
148
|
HANDLE_OUTGOING_ROAP_ANSWER: 'handleOutgoingRoapAnswer',
|
|
149
149
|
HANDLE_INCOMING_ROAP_OFFER: 'handleIncomingRoapOffer',
|
|
150
150
|
HANDLE_INCOMING_ROAP_ANSWER: 'handleIncomingRoapAnswer',
|
|
151
|
+
INIT: 'init',
|
|
151
152
|
FORCE_SEND_STATS_REPORT: 'forceSendStatsReport',
|
|
152
153
|
UPDATE_ACTIVE_MOBIUS: 'updateActiveMobius',
|
|
153
154
|
DEQUEUE_WS_EVENTS: 'dequeueWsEvents',
|
|
@@ -69,9 +69,6 @@ export default class Line extends Eventing {
|
|
|
69
69
|
this.registration.setMobiusServers(this.#primaryMobiusUris, this.#backupMobiusUris);
|
|
70
70
|
await this.registration.triggerRegistration();
|
|
71
71
|
});
|
|
72
|
-
if (this.mobiusDeviceId) {
|
|
73
|
-
this.callManager.updateLine(this.mobiusDeviceId, this);
|
|
74
|
-
}
|
|
75
72
|
}
|
|
76
73
|
async deregister() {
|
|
77
74
|
log.info(METHOD_START_MESSAGE, {
|
|
@@ -93,6 +90,9 @@ export default class Line extends Eventing {
|
|
|
93
90
|
this.rehomingIntervalMax = rehomingIntervalMax;
|
|
94
91
|
this.voicePortalNumber = voicePortalNumber;
|
|
95
92
|
this.voicePortalExtension = voicePortalExtension;
|
|
93
|
+
if (this.mobiusDeviceId) {
|
|
94
|
+
this.callManager.updateLine(this.mobiusDeviceId, this);
|
|
95
|
+
}
|
|
96
96
|
}
|
|
97
97
|
lineEmitter = (event, deviceInfo, lineError) => {
|
|
98
98
|
log.info(METHOD_START_MESSAGE, {
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { v4 as uuid } from 'uuid';
|
|
2
2
|
import { METHOD_START_MESSAGE } from '../../common/constants';
|
|
3
3
|
import { emitFinalFailure, handleRegistrationErrors, uploadLogs } from '../../common';
|
|
4
|
-
import
|
|
4
|
+
import webWorkerStr from './webWorkerStr';
|
|
5
|
+
import { METRIC_EVENT, METRIC_TYPE, REG_ACTION, } from '../../Metrics/types';
|
|
5
6
|
import { getMetricManager } from '../../Metrics';
|
|
6
7
|
import { getCallManager } from '../calling';
|
|
7
8
|
import log from '../../Logger';
|
|
8
9
|
import SDKConnector from '../../SDKConnector';
|
|
9
|
-
import { ALLOWED_SERVICES, HTTP_METHODS, RegistrationStatus, ServiceIndicator, } from '../../common/types';
|
|
10
|
-
import { CALLING_USER_AGENT, CISCO_DEVICE_URL, DEVICES_ENDPOINT_RESOURCE, SPARK_USER_AGENT, WEBEX_WEB_CLIENT, BASE_REG_RETRY_TIMER_VAL_IN_SEC, BASE_REG_TIMER_MFACTOR, SEC_TO_MSEC_MFACTOR, REG_RANDOM_T_FACTOR_UPPER_LIMIT, REG_TRY_BACKUP_TIMER_VAL_IN_SEC, MINUTES_TO_SEC_MFACTOR, REG_429_RETRY_UTIL, REG_FAILBACK_429_MAX_RETRIES, FAILBACK_UTIL, REGISTRATION_FILE, DEFAULT_REHOMING_INTERVAL_MIN, DEFAULT_REHOMING_INTERVAL_MAX, DEFAULT_KEEPALIVE_INTERVAL,
|
|
10
|
+
import { ALLOWED_SERVICES, HTTP_METHODS, RegistrationStatus, ServiceIndicator, WorkerMessageType, } from '../../common/types';
|
|
11
|
+
import { CALLING_USER_AGENT, CISCO_DEVICE_URL, DEVICES_ENDPOINT_RESOURCE, SPARK_USER_AGENT, WEBEX_WEB_CLIENT, BASE_REG_RETRY_TIMER_VAL_IN_SEC, BASE_REG_TIMER_MFACTOR, SEC_TO_MSEC_MFACTOR, REG_RANDOM_T_FACTOR_UPPER_LIMIT, REG_TRY_BACKUP_TIMER_VAL_IN_SEC, MINUTES_TO_SEC_MFACTOR, REG_429_RETRY_UTIL, REG_FAILBACK_429_MAX_RETRIES, FAILBACK_UTIL, REGISTRATION_FILE, DEFAULT_REHOMING_INTERVAL_MIN, DEFAULT_REHOMING_INTERVAL_MAX, DEFAULT_KEEPALIVE_INTERVAL, FAILOVER_UTIL, REGISTER_UTIL, RETRY_TIMER_UPPER_LIMIT, KEEPALIVE_UTIL, REGISTRATION_UTIL, METHODS, URL_ENDPOINT, } from '../constants';
|
|
11
12
|
import { LINE_EVENTS } from '../line/types';
|
|
12
13
|
export class Registration {
|
|
13
14
|
sdkConnector;
|
|
@@ -18,7 +19,6 @@ export class Registration {
|
|
|
18
19
|
registrationStatus;
|
|
19
20
|
failbackTimer;
|
|
20
21
|
activeMobiusUrl;
|
|
21
|
-
keepaliveTimer;
|
|
22
22
|
rehomingIntervalMin;
|
|
23
23
|
rehomingIntervalMax;
|
|
24
24
|
mutex;
|
|
@@ -35,6 +35,7 @@ export class Registration {
|
|
|
35
35
|
failoverImmediately = false;
|
|
36
36
|
retryAfter;
|
|
37
37
|
scheduled429Retry = false;
|
|
38
|
+
webWorker;
|
|
38
39
|
constructor(webex, serviceData, mutex, lineEmitter, logLevel, jwe) {
|
|
39
40
|
this.jwe = jwe;
|
|
40
41
|
this.sdkConnector = SDKConnector;
|
|
@@ -73,17 +74,6 @@ export class Registration {
|
|
|
73
74
|
this.primaryMobiusUris = primaryMobiusUris;
|
|
74
75
|
this.backupMobiusUris = backupMobiusUris;
|
|
75
76
|
}
|
|
76
|
-
async postKeepAlive(url) {
|
|
77
|
-
return this.webex.request({
|
|
78
|
-
uri: `${url}/status`,
|
|
79
|
-
method: HTTP_METHODS.POST,
|
|
80
|
-
headers: {
|
|
81
|
-
[CISCO_DEVICE_URL]: this.webex.internal.device.url,
|
|
82
|
-
[SPARK_USER_AGENT]: CALLING_USER_AGENT,
|
|
83
|
-
},
|
|
84
|
-
service: ALLOWED_SERVICES.MOBIUS,
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
77
|
async deleteRegistration(url, deviceId, deviceUrl) {
|
|
88
78
|
let response;
|
|
89
79
|
try {
|
|
@@ -167,9 +157,7 @@ export class Registration {
|
|
|
167
157
|
method: FAILOVER_UTIL,
|
|
168
158
|
};
|
|
169
159
|
let interval = this.getRegRetryInterval(attempt);
|
|
170
|
-
const TIMER_THRESHOLD =
|
|
171
|
-
? REG_TRY_BACKUP_TIMER_VAL_FOR_CC_IN_SEC
|
|
172
|
-
: REG_TRY_BACKUP_TIMER_VAL_IN_SEC;
|
|
160
|
+
const TIMER_THRESHOLD = REG_TRY_BACKUP_TIMER_VAL_IN_SEC;
|
|
173
161
|
if (timeElapsed + interval > TIMER_THRESHOLD) {
|
|
174
162
|
const excessVal = timeElapsed + interval - TIMER_THRESHOLD;
|
|
175
163
|
interval -= excessVal;
|
|
@@ -230,6 +218,40 @@ export class Registration {
|
|
|
230
218
|
this.failbackTimer = undefined;
|
|
231
219
|
}
|
|
232
220
|
}
|
|
221
|
+
async isPrimaryActive() {
|
|
222
|
+
let status;
|
|
223
|
+
for (const mobiusUrl of this.primaryMobiusUris) {
|
|
224
|
+
try {
|
|
225
|
+
const baseUri = mobiusUrl.replace(URL_ENDPOINT, '/');
|
|
226
|
+
const response = await this.webex.request({
|
|
227
|
+
uri: `${baseUri}ping`,
|
|
228
|
+
method: HTTP_METHODS.GET,
|
|
229
|
+
headers: {
|
|
230
|
+
[CISCO_DEVICE_URL]: this.webex.internal.device.url,
|
|
231
|
+
[SPARK_USER_AGENT]: CALLING_USER_AGENT,
|
|
232
|
+
},
|
|
233
|
+
service: ALLOWED_SERVICES.MOBIUS,
|
|
234
|
+
});
|
|
235
|
+
const { statusCode } = response;
|
|
236
|
+
if (statusCode === 200) {
|
|
237
|
+
log.info(`Ping successful for primary Mobius: ${mobiusUrl}`, {
|
|
238
|
+
file: REGISTRATION_FILE,
|
|
239
|
+
method: FAILBACK_UTIL,
|
|
240
|
+
});
|
|
241
|
+
status = 'up';
|
|
242
|
+
break;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
catch (error) {
|
|
246
|
+
log.warn(`Ping failed for primary Mobius: ${mobiusUrl} with error: ${error}`, {
|
|
247
|
+
file: REGISTRATION_FILE,
|
|
248
|
+
method: FAILBACK_UTIL,
|
|
249
|
+
});
|
|
250
|
+
status = 'down';
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
return status === 'up';
|
|
254
|
+
}
|
|
233
255
|
isFailbackRequired() {
|
|
234
256
|
return this.isDeviceRegistered() && this.primaryMobiusUris.indexOf(this.activeMobiusUrl) === -1;
|
|
235
257
|
}
|
|
@@ -260,7 +282,8 @@ export class Registration {
|
|
|
260
282
|
async executeFailback() {
|
|
261
283
|
await this.mutex.runExclusive(async () => {
|
|
262
284
|
if (this.isFailbackRequired()) {
|
|
263
|
-
|
|
285
|
+
const primaryServerStatus = await this.isPrimaryActive();
|
|
286
|
+
if (Object.keys(this.callManager.getActiveCalls()).length === 0 && primaryServerStatus) {
|
|
264
287
|
log.info(`Attempting failback to primary.`, {
|
|
265
288
|
file: REGISTRATION_FILE,
|
|
266
289
|
method: this.executeFailback.name,
|
|
@@ -284,7 +307,7 @@ export class Registration {
|
|
|
284
307
|
}
|
|
285
308
|
}
|
|
286
309
|
else {
|
|
287
|
-
log.info('Active calls present, deferring failback to next cycle.', {
|
|
310
|
+
log.info('Active calls present or primary Mobius is down, deferring failback to next cycle.', {
|
|
288
311
|
file: REGISTRATION_FILE,
|
|
289
312
|
method: this.executeFailback.name,
|
|
290
313
|
});
|
|
@@ -376,7 +399,7 @@ export class Registration {
|
|
|
376
399
|
}
|
|
377
400
|
async triggerRegistration() {
|
|
378
401
|
if (this.primaryMobiusUris.length > 0) {
|
|
379
|
-
const abort = await this.attemptRegistrationWithServers(
|
|
402
|
+
const abort = await this.attemptRegistrationWithServers(REGISTRATION_UTIL, this.primaryMobiusUris);
|
|
380
403
|
if (!this.isDeviceRegistered() && !abort) {
|
|
381
404
|
await this.startFailoverTimer();
|
|
382
405
|
}
|
|
@@ -396,6 +419,9 @@ export class Registration {
|
|
|
396
419
|
return abort;
|
|
397
420
|
}
|
|
398
421
|
for (const url of servers) {
|
|
422
|
+
const serverType = (this.primaryMobiusUris.includes(url) && 'PRIMARY') ||
|
|
423
|
+
(this.backupMobiusUris?.includes(url) && 'BACKUP') ||
|
|
424
|
+
'UNKNOWN';
|
|
399
425
|
try {
|
|
400
426
|
abort = false;
|
|
401
427
|
this.registrationStatus = RegistrationStatus.INACTIVE;
|
|
@@ -407,16 +433,16 @@ export class Registration {
|
|
|
407
433
|
const resp = await this.postRegistration(url);
|
|
408
434
|
this.deviceInfo = resp.body;
|
|
409
435
|
this.registrationStatus = RegistrationStatus.ACTIVE;
|
|
436
|
+
this.setActiveMobiusUrl(url);
|
|
410
437
|
this.lineEmitter(LINE_EVENTS.REGISTERED, resp.body);
|
|
411
438
|
log.log(`Registration successful for deviceId: ${this.deviceInfo.device?.deviceId} userId: ${this.userId}`, {
|
|
412
439
|
file: REGISTRATION_FILE,
|
|
413
440
|
method: METHODS.REGISTER,
|
|
414
441
|
});
|
|
415
|
-
this.setActiveMobiusUrl(url);
|
|
416
442
|
this.setIntervalValues(this.deviceInfo);
|
|
417
443
|
this.metricManager.setDeviceInfo(this.deviceInfo);
|
|
418
|
-
this.metricManager.submitRegistrationMetric(METRIC_EVENT.REGISTRATION, REG_ACTION.REGISTER, METRIC_TYPE.BEHAVIORAL, undefined);
|
|
419
|
-
this.startKeepaliveTimer(this.deviceInfo.device?.uri, this.deviceInfo.keepaliveInterval);
|
|
444
|
+
this.metricManager.submitRegistrationMetric(METRIC_EVENT.REGISTRATION, REG_ACTION.REGISTER, METRIC_TYPE.BEHAVIORAL, caller, serverType, resp.headers?.trackingid ?? '', undefined, undefined);
|
|
445
|
+
this.startKeepaliveTimer(this.deviceInfo.device?.uri, this.deviceInfo.keepaliveInterval, serverType);
|
|
420
446
|
this.initiateFailback();
|
|
421
447
|
break;
|
|
422
448
|
}
|
|
@@ -429,7 +455,7 @@ export class Registration {
|
|
|
429
455
|
else {
|
|
430
456
|
this.lineEmitter(LINE_EVENTS.UNREGISTERED);
|
|
431
457
|
}
|
|
432
|
-
this.metricManager.submitRegistrationMetric(METRIC_EVENT.REGISTRATION_ERROR, REG_ACTION.REGISTER, METRIC_TYPE.BEHAVIORAL, clientError);
|
|
458
|
+
this.metricManager.submitRegistrationMetric(METRIC_EVENT.REGISTRATION_ERROR, REG_ACTION.REGISTER, METRIC_TYPE.BEHAVIORAL, caller, serverType, body.headers?.trackingid ?? '', undefined, clientError);
|
|
433
459
|
}, { method: caller, file: REGISTRATION_FILE }, (retryAfter, retryCaller) => this.handle429Retry(retryAfter, retryCaller), this.restoreRegistrationCallBack());
|
|
434
460
|
if (this.registrationStatus === RegistrationStatus.ACTIVE) {
|
|
435
461
|
log.info(`[${caller}] : Device is already restored, active mobius url: ${this.activeMobiusUrl}`, {
|
|
@@ -446,57 +472,67 @@ export class Registration {
|
|
|
446
472
|
}
|
|
447
473
|
return abort;
|
|
448
474
|
}
|
|
449
|
-
startKeepaliveTimer(url, interval) {
|
|
450
|
-
let keepAliveRetryCount = 0;
|
|
475
|
+
async startKeepaliveTimer(url, interval, serverType) {
|
|
451
476
|
this.clearKeepaliveTimer();
|
|
452
477
|
const RETRY_COUNT_THRESHOLD = this.isCCFlow ? 4 : 5;
|
|
453
|
-
this.
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
478
|
+
await this.mutex.runExclusive(async () => {
|
|
479
|
+
if (this.isDeviceRegistered()) {
|
|
480
|
+
const accessToken = await this.webex.credentials.getUserToken();
|
|
481
|
+
if (!this.webWorker) {
|
|
482
|
+
const blob = new Blob([webWorkerStr], { type: 'application/javascript' });
|
|
483
|
+
const blobUrl = URL.createObjectURL(blob);
|
|
484
|
+
this.webWorker = new Worker(blobUrl);
|
|
485
|
+
URL.revokeObjectURL(blobUrl);
|
|
486
|
+
this.webWorker.postMessage({
|
|
487
|
+
type: WorkerMessageType.START_KEEPALIVE,
|
|
488
|
+
accessToken: String(accessToken),
|
|
489
|
+
deviceUrl: String(this.webex.internal.device.url),
|
|
490
|
+
interval,
|
|
491
|
+
retryCountThreshold: RETRY_COUNT_THRESHOLD,
|
|
492
|
+
url,
|
|
493
|
+
});
|
|
494
|
+
this.webWorker.onmessage = async (event) => {
|
|
495
|
+
const logContext = {
|
|
496
|
+
file: REGISTRATION_FILE,
|
|
497
|
+
method: this.startKeepaliveTimer.name,
|
|
498
|
+
};
|
|
499
|
+
if (event.data.type === WorkerMessageType.KEEPALIVE_SUCCESS) {
|
|
500
|
+
log.info(`Sent Keepalive, status: ${event.data.statusCode}`, logContext);
|
|
464
501
|
this.lineEmitter(LINE_EVENTS.RECONNECTED);
|
|
465
502
|
}
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
503
|
+
if (event.data.type === WorkerMessageType.KEEPALIVE_FAILURE) {
|
|
504
|
+
const error = event.data.err;
|
|
505
|
+
log.warn(`Keep-alive missed ${event.data.keepAliveRetryCount} times. Status -> ${error.statusCode} `, logContext);
|
|
506
|
+
const abort = await handleRegistrationErrors(error, (clientError, finalError) => {
|
|
507
|
+
if (finalError) {
|
|
508
|
+
this.lineEmitter(LINE_EVENTS.ERROR, undefined, clientError);
|
|
509
|
+
}
|
|
510
|
+
this.metricManager.submitRegistrationMetric(METRIC_EVENT.REGISTRATION, REG_ACTION.KEEPALIVE_FAILURE, METRIC_TYPE.BEHAVIORAL, KEEPALIVE_UTIL, serverType, error.headers?.trackingid ?? '', event.data.keepAliveRetryCount, clientError);
|
|
511
|
+
}, { method: KEEPALIVE_UTIL, file: REGISTRATION_FILE });
|
|
512
|
+
if (abort || event.data.keepAliveRetryCount >= RETRY_COUNT_THRESHOLD) {
|
|
513
|
+
this.failoverImmediately = this.isCCFlow;
|
|
514
|
+
this.setStatus(RegistrationStatus.INACTIVE);
|
|
515
|
+
this.clearKeepaliveTimer();
|
|
516
|
+
this.clearFailbackTimer();
|
|
517
|
+
this.lineEmitter(LINE_EVENTS.UNREGISTERED);
|
|
518
|
+
if (!abort) {
|
|
519
|
+
await this.reconnectOnFailure(KEEPALIVE_UTIL);
|
|
520
|
+
}
|
|
475
521
|
}
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
if (abort || keepAliveRetryCount >= RETRY_COUNT_THRESHOLD) {
|
|
479
|
-
this.failoverImmediately = this.isCCFlow;
|
|
480
|
-
this.setStatus(RegistrationStatus.INACTIVE);
|
|
481
|
-
this.clearKeepaliveTimer();
|
|
482
|
-
this.clearFailbackTimer();
|
|
483
|
-
this.lineEmitter(LINE_EVENTS.UNREGISTERED);
|
|
484
|
-
if (!abort) {
|
|
485
|
-
await this.reconnectOnFailure(this.startKeepaliveTimer.name);
|
|
522
|
+
else {
|
|
523
|
+
this.lineEmitter(LINE_EVENTS.RECONNECTING);
|
|
486
524
|
}
|
|
487
525
|
}
|
|
488
|
-
|
|
489
|
-
this.lineEmitter(LINE_EVENTS.RECONNECTING);
|
|
490
|
-
}
|
|
491
|
-
}
|
|
526
|
+
};
|
|
492
527
|
}
|
|
493
|
-
}
|
|
494
|
-
}
|
|
528
|
+
}
|
|
529
|
+
});
|
|
495
530
|
}
|
|
496
531
|
clearKeepaliveTimer() {
|
|
497
|
-
if (this.
|
|
498
|
-
|
|
499
|
-
this.
|
|
532
|
+
if (this.webWorker) {
|
|
533
|
+
this.webWorker.postMessage({ type: WorkerMessageType.CLEAR_KEEPALIVE });
|
|
534
|
+
this.webWorker.terminate();
|
|
535
|
+
this.webWorker = undefined;
|
|
500
536
|
}
|
|
501
537
|
}
|
|
502
538
|
isReconnectPending() {
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { v4 as uuid } from 'uuid';
|
|
2
|
+
import { HTTP_METHODS, WorkerMessageType } from '../../common/types';
|
|
3
|
+
let keepaliveTimer;
|
|
4
|
+
export const messageHandler = (event) => {
|
|
5
|
+
const { type } = event.data;
|
|
6
|
+
const postKeepAlive = async (accessToken, deviceUrl, url) => {
|
|
7
|
+
const response = await fetch(`${url}/status`, {
|
|
8
|
+
method: HTTP_METHODS.POST,
|
|
9
|
+
headers: {
|
|
10
|
+
'cisco-device-url': deviceUrl,
|
|
11
|
+
'spark-user-agent': 'webex-calling/beta',
|
|
12
|
+
Authorization: `${accessToken}`,
|
|
13
|
+
trackingId: `web_worker_${uuid()}`,
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
if (!response.ok) {
|
|
17
|
+
throw new Error(`Keepalive failed with status: ${response.status}`);
|
|
18
|
+
}
|
|
19
|
+
return response;
|
|
20
|
+
};
|
|
21
|
+
if (type === WorkerMessageType.START_KEEPALIVE) {
|
|
22
|
+
let keepAliveRetryCount = 0;
|
|
23
|
+
const { accessToken, deviceUrl, interval, retryCountThreshold, url } = event.data;
|
|
24
|
+
if (keepaliveTimer) {
|
|
25
|
+
clearInterval(keepaliveTimer);
|
|
26
|
+
keepaliveTimer = undefined;
|
|
27
|
+
}
|
|
28
|
+
keepaliveTimer = setInterval(async () => {
|
|
29
|
+
if (keepAliveRetryCount < retryCountThreshold) {
|
|
30
|
+
try {
|
|
31
|
+
const res = await postKeepAlive(accessToken, deviceUrl, url);
|
|
32
|
+
const statusCode = res.status;
|
|
33
|
+
if (keepAliveRetryCount > 0) {
|
|
34
|
+
postMessage({
|
|
35
|
+
type: WorkerMessageType.KEEPALIVE_SUCCESS,
|
|
36
|
+
statusCode,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
keepAliveRetryCount = 0;
|
|
40
|
+
}
|
|
41
|
+
catch (err) {
|
|
42
|
+
keepAliveRetryCount += 1;
|
|
43
|
+
postMessage({
|
|
44
|
+
type: WorkerMessageType.KEEPALIVE_FAILURE,
|
|
45
|
+
err,
|
|
46
|
+
keepAliveRetryCount,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}, interval * 1000);
|
|
51
|
+
}
|
|
52
|
+
if (type === WorkerMessageType.CLEAR_KEEPALIVE) {
|
|
53
|
+
if (keepaliveTimer) {
|
|
54
|
+
clearInterval(keepaliveTimer);
|
|
55
|
+
keepaliveTimer = undefined;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
self.addEventListener('message', messageHandler);
|