@webex/calling 3.5.0 → 3.6.0

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.
Files changed (102) hide show
  1. package/dist/CallHistory/CallHistory.js +195 -67
  2. package/dist/CallHistory/CallHistory.js.map +1 -1
  3. package/dist/CallHistory/CallHistory.test.js +331 -108
  4. package/dist/CallHistory/CallHistory.test.js.map +1 -1
  5. package/dist/CallHistory/callHistoryFixtures.js +25 -1
  6. package/dist/CallHistory/callHistoryFixtures.js.map +1 -1
  7. package/dist/CallHistory/constants.js +4 -1
  8. package/dist/CallHistory/constants.js.map +1 -1
  9. package/dist/CallHistory/types.js.map +1 -1
  10. package/dist/CallingClient/CallingClient.js +2 -2
  11. package/dist/CallingClient/CallingClient.js.map +1 -1
  12. package/dist/CallingClient/CallingClient.test.js +1 -1
  13. package/dist/CallingClient/CallingClient.test.js.map +1 -1
  14. package/dist/CallingClient/calling/CallerId/index.js +14 -5
  15. package/dist/CallingClient/calling/CallerId/index.js.map +1 -1
  16. package/dist/CallingClient/calling/CallerId/index.test.js +6 -6
  17. package/dist/CallingClient/calling/CallerId/index.test.js.map +1 -1
  18. package/dist/CallingClient/calling/call.js +434 -348
  19. package/dist/CallingClient/calling/call.js.map +1 -1
  20. package/dist/CallingClient/calling/call.test.js +516 -386
  21. package/dist/CallingClient/calling/call.test.js.map +1 -1
  22. package/dist/CallingClient/calling/callManager.js +6 -6
  23. package/dist/CallingClient/calling/callManager.js.map +1 -1
  24. package/dist/CallingClient/calling/callManager.test.js +3 -3
  25. package/dist/CallingClient/calling/callManager.test.js.map +1 -1
  26. package/dist/CallingClient/calling/types.js +6 -1
  27. package/dist/CallingClient/calling/types.js.map +1 -1
  28. package/dist/CallingClient/constants.js +2 -3
  29. package/dist/CallingClient/constants.js.map +1 -1
  30. package/dist/CallingClient/line/index.js +14 -7
  31. package/dist/CallingClient/line/index.js.map +1 -1
  32. package/dist/CallingClient/line/line.test.js +84 -22
  33. package/dist/CallingClient/line/line.test.js.map +1 -1
  34. package/dist/CallingClient/line/types.js.map +1 -1
  35. package/dist/CallingClient/registration/register.js +79 -59
  36. package/dist/CallingClient/registration/register.js.map +1 -1
  37. package/dist/CallingClient/registration/register.test.js +1 -1
  38. package/dist/CallingClient/registration/register.test.js.map +1 -1
  39. package/dist/CallingClient/types.js.map +1 -1
  40. package/dist/Events/types.js +2 -0
  41. package/dist/Events/types.js.map +1 -1
  42. package/dist/common/Utils.js +18 -13
  43. package/dist/common/Utils.js.map +1 -1
  44. package/dist/common/Utils.test.js +97 -0
  45. package/dist/common/Utils.test.js.map +1 -1
  46. package/dist/common/constants.js +4 -3
  47. package/dist/common/constants.js.map +1 -1
  48. package/dist/common/types.js +1 -0
  49. package/dist/common/types.js.map +1 -1
  50. package/dist/module/CallHistory/CallHistory.js +64 -2
  51. package/dist/module/CallHistory/callHistoryFixtures.js +24 -0
  52. package/dist/module/CallHistory/constants.js +3 -0
  53. package/dist/module/CallingClient/CallingClient.js +1 -1
  54. package/dist/module/CallingClient/calling/CallerId/index.js +6 -6
  55. package/dist/module/CallingClient/calling/call.js +66 -22
  56. package/dist/module/CallingClient/calling/callManager.js +5 -5
  57. package/dist/module/CallingClient/calling/types.js +5 -0
  58. package/dist/module/CallingClient/constants.js +1 -2
  59. package/dist/module/CallingClient/line/index.js +14 -8
  60. package/dist/module/CallingClient/registration/register.js +12 -4
  61. package/dist/module/Events/types.js +2 -0
  62. package/dist/module/common/Utils.js +12 -5
  63. package/dist/module/common/constants.js +3 -2
  64. package/dist/module/common/types.js +1 -0
  65. package/dist/types/CallHistory/CallHistory.d.ts +4 -2
  66. package/dist/types/CallHistory/CallHistory.d.ts.map +1 -1
  67. package/dist/types/CallHistory/callHistoryFixtures.d.ts +6 -2
  68. package/dist/types/CallHistory/callHistoryFixtures.d.ts.map +1 -1
  69. package/dist/types/CallHistory/constants.d.ts +3 -0
  70. package/dist/types/CallHistory/constants.d.ts.map +1 -1
  71. package/dist/types/CallHistory/types.d.ts +9 -0
  72. package/dist/types/CallHistory/types.d.ts.map +1 -1
  73. package/dist/types/CallingClient/CallingClient.d.ts.map +1 -1
  74. package/dist/types/CallingClient/calling/CallerId/index.d.ts.map +1 -1
  75. package/dist/types/CallingClient/calling/call.d.ts +7 -5
  76. package/dist/types/CallingClient/calling/call.d.ts.map +1 -1
  77. package/dist/types/CallingClient/calling/callManager.d.ts +1 -1
  78. package/dist/types/CallingClient/calling/callManager.d.ts.map +1 -1
  79. package/dist/types/CallingClient/calling/types.d.ts +6 -2
  80. package/dist/types/CallingClient/calling/types.d.ts.map +1 -1
  81. package/dist/types/CallingClient/constants.d.ts +1 -2
  82. package/dist/types/CallingClient/constants.d.ts.map +1 -1
  83. package/dist/types/CallingClient/line/index.d.ts +3 -2
  84. package/dist/types/CallingClient/line/index.d.ts.map +1 -1
  85. package/dist/types/CallingClient/line/types.d.ts +1 -1
  86. package/dist/types/CallingClient/line/types.d.ts.map +1 -1
  87. package/dist/types/CallingClient/registration/register.d.ts +4 -2
  88. package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
  89. package/dist/types/CallingClient/types.d.ts +1 -0
  90. package/dist/types/CallingClient/types.d.ts.map +1 -1
  91. package/dist/types/Contacts/ContactsClient.d.ts +1 -1
  92. package/dist/types/Events/types.d.ts +15 -2
  93. package/dist/types/Events/types.d.ts.map +1 -1
  94. package/dist/types/Voicemail/UcmBackendConnector.d.ts +1 -1
  95. package/dist/types/Voicemail/WxCallBackendConnector.d.ts +1 -1
  96. package/dist/types/common/Utils.d.ts +2 -2
  97. package/dist/types/common/Utils.d.ts.map +1 -1
  98. package/dist/types/common/constants.d.ts +1 -0
  99. package/dist/types/common/constants.d.ts.map +1 -1
  100. package/dist/types/common/types.d.ts +2 -1
  101. package/dist/types/common/types.d.ts.map +1 -1
  102. package/package.json +3 -3
@@ -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}\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"],"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;EAAA,OAAhBA,gBAAgB;AAAA;AAAA,IAsChBC,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"],"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"],"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"}
@@ -2,8 +2,8 @@ import SDKConnector from '../SDKConnector';
2
2
  import { ALLOWED_SERVICES, HTTP_METHODS, SORT, SORT_BY, CALLING_BACKEND, } from '../common/types';
3
3
  import log from '../Logger';
4
4
  import { serviceErrorCodeHandler, getVgActionEndpoint, getCallingBackEnd } from '../common/Utils';
5
- import { APPLICATION_JSON, CALL_HISTORY_FILE, CONTENT_TYPE, FROM_DATE, HISTORY, LIMIT, NUMBER_OF_DAYS, UPDATE_MISSED_CALLS_ENDPOINT, SET_READ_STATE_SUCCESS_MESSAGE, VERSION_1, UNIFIED_COMMUNICATIONS, CONFIG, PEOPLE, LINES, ORG_ID, } from './constants';
6
- import { STATUS_CODE, SUCCESS_MESSAGE, USER_SESSIONS } from '../common/constants';
5
+ import { APPLICATION_JSON, CALL_HISTORY_FILE, CONTENT_TYPE, FROM_DATE, HISTORY, LIMIT, NUMBER_OF_DAYS, UPDATE_MISSED_CALLS_ENDPOINT, SET_READ_STATE_SUCCESS_MESSAGE, VERSION_1, UNIFIED_COMMUNICATIONS, CONFIG, PEOPLE, LINES, ORG_ID, DELETE_CALL_HISTORY_RECORDS_ENDPOINT, SET_DELETE_CALL_RECORDS_SUCCESS_MESSAGE, SET_DELETE_CALL_RECORDS_INVALID_DATE_FORMAT_MESSAGE, } from './constants';
6
+ import { FAILURE_MESSAGE, STATUS_CODE, SUCCESS_MESSAGE, USER_SESSIONS } from '../common/constants';
7
7
  import { COMMON_EVENT_KEYS, MOBIUS_EVENT_KEYS, } from '../Events/types';
8
8
  import { Eventing } from '../Events/impl';
9
9
  export class CallHistory extends Eventing {
@@ -168,6 +168,62 @@ export class CallHistory extends Eventing {
168
168
  return errorStatus;
169
169
  }
170
170
  }
171
+ async deleteCallHistoryRecords(deleteSessionIds) {
172
+ const loggerContext = {
173
+ file: CALL_HISTORY_FILE,
174
+ method: 'deleteCallHistoryRecords',
175
+ };
176
+ const invalidSessions = deleteSessionIds.filter((session) => Number.isNaN(new Date(session.endTime).getTime()));
177
+ if (invalidSessions.length > 0) {
178
+ const invalidSessionIds = invalidSessions.map((session) => session.sessionId).join(', ');
179
+ log.info(`The provided date is malformed or invalid for session IDs: ${invalidSessionIds}`, loggerContext);
180
+ return {
181
+ statusCode: 400,
182
+ data: {
183
+ deleteStatusMessage: SET_DELETE_CALL_RECORDS_INVALID_DATE_FORMAT_MESSAGE,
184
+ },
185
+ message: FAILURE_MESSAGE,
186
+ };
187
+ }
188
+ const santizedSessionIds = deleteSessionIds.map((session) => ({
189
+ ...session,
190
+ endTime: new Date(session.endTime).getTime(),
191
+ }));
192
+ const deleteRequestBody = {
193
+ deleteSessionIds: santizedSessionIds,
194
+ };
195
+ try {
196
+ const deleteCallHistoryRecordContentUrl = `${this.janusUrl}/${HISTORY}/${USER_SESSIONS}/${DELETE_CALL_HISTORY_RECORDS_ENDPOINT}`;
197
+ const response = await fetch(deleteCallHistoryRecordContentUrl, {
198
+ method: HTTP_METHODS.POST,
199
+ headers: {
200
+ [CONTENT_TYPE]: APPLICATION_JSON,
201
+ Authorization: await this.webex.credentials.getUserToken(),
202
+ },
203
+ body: JSON.stringify(deleteRequestBody),
204
+ });
205
+ if (!response.ok) {
206
+ throw new Error(`${response.status}`);
207
+ }
208
+ const data = await response.json();
209
+ log.info(`Call history records are succesfully deleted by the user`, loggerContext);
210
+ const responseDetails = {
211
+ statusCode: data.statusCode,
212
+ data: {
213
+ deleteStatusMessage: SET_DELETE_CALL_RECORDS_SUCCESS_MESSAGE,
214
+ },
215
+ message: SUCCESS_MESSAGE,
216
+ };
217
+ return responseDetails;
218
+ }
219
+ catch (err) {
220
+ const errorInfo = {
221
+ statusCode: err instanceof Error ? Number(err.message) : '',
222
+ };
223
+ const errorStatus = serviceErrorCodeHandler(errorInfo, loggerContext);
224
+ return errorStatus;
225
+ }
226
+ }
171
227
  handleSessionEvents = async (event) => {
172
228
  if (event && event.data.userSessions.userSessions) {
173
229
  this.emit(COMMON_EVENT_KEYS.CALL_HISTORY_USER_SESSION_INFO, event);
@@ -178,10 +234,16 @@ export class CallHistory extends Eventing {
178
234
  this.emit(COMMON_EVENT_KEYS.CALL_HISTORY_USER_VIEWED_SESSIONS, event);
179
235
  }
180
236
  };
237
+ handleUserSessionsDeletedEvents = async (event) => {
238
+ if (event && event.data.deletedSessions) {
239
+ this.emit(COMMON_EVENT_KEYS.CALL_HISTORY_USER_SESSIONS_DELETED, event);
240
+ }
241
+ };
181
242
  registerSessionsListener() {
182
243
  this.sdkConnector.registerListener(MOBIUS_EVENT_KEYS.CALL_SESSION_EVENT_INCLUSIVE, this.handleSessionEvents);
183
244
  this.sdkConnector.registerListener(MOBIUS_EVENT_KEYS.CALL_SESSION_EVENT_LEGACY, this.handleSessionEvents);
184
245
  this.sdkConnector.registerListener(MOBIUS_EVENT_KEYS.CALL_SESSION_EVENT_VIEWED, this.handleUserReadSessionEvents);
246
+ this.sdkConnector.registerListener(MOBIUS_EVENT_KEYS.CALL_SESSION_EVENT_DELETED, this.handleUserSessionsDeletedEvents);
185
247
  }
186
248
  }
187
249
  export const createCallHistoryClient = (webex, logger) => new CallHistory(webex, logger);
@@ -563,6 +563,15 @@ export const MOCK_SESSION_EVENT_VIEWED = {
563
563
  timestamp: 12345,
564
564
  trackingId: 'tracking-id',
565
565
  };
566
+ export const MOCK_SESSION_EVENT_DELETED = {
567
+ id: 'id',
568
+ data: {
569
+ deletedSessions: ['123-456-789-99999-993939'],
570
+ eventType: MOBIUS_EVENT_KEYS.CALL_SESSION_EVENT_DELETED,
571
+ },
572
+ timestamp: 12345,
573
+ trackingId: 'tracking-id',
574
+ };
566
575
  export const MOCK_UPDATE_MISSED_CALL_RESPONSE = {
567
576
  statusCode: 200,
568
577
  data: {
@@ -570,7 +579,22 @@ export const MOCK_UPDATE_MISSED_CALL_RESPONSE = {
570
579
  },
571
580
  message: 'SUCCESS',
572
581
  };
582
+ export const MOCK_DELETE_CALL_HISTORY_RECORDS_RESPONSE = {
583
+ statusCode: 200,
584
+ data: {
585
+ deleteStatusMessage: 'Call history records are deleted by the user.',
586
+ },
587
+ message: 'SUCCESS',
588
+ };
589
+ export const MOCK_DELETE_CALL_HISTORY_INVALID_DATE_RESPONSE = {
590
+ statusCode: 400,
591
+ data: {
592
+ deleteStatusMessage: 'The provided date is malformed or invalid',
593
+ },
594
+ message: 'FAILURE',
595
+ };
573
596
  export const janusSetReadStateUrl = 'https://janus-intb.ciscospark.com/janus/api/v1/history/userSessions/setReadState';
597
+ export const janusMarkAsDeletedUrl = 'https://janus-intb.ciscospark.com/janus/api/v1/history/userSessions/markAsDeleted';
574
598
  export const ERROR_DETAILS_401 = {
575
599
  statusCode: 401,
576
600
  data: {
@@ -2,6 +2,7 @@ export const APPLICATION_JSON = 'application/json';
2
2
  export const CALL_HISTORY_FILE = 'CallHistory';
3
3
  export const CONTENT_TYPE = 'Content-Type';
4
4
  export const CONFIG = 'config';
5
+ export const DELETE_CALL_HISTORY_RECORDS_ENDPOINT = 'markAsDeleted';
5
6
  export const FROM_DATE = '?from';
6
7
  export const HISTORY = 'history';
7
8
  export const LIMIT = 50;
@@ -11,6 +12,8 @@ export const ORG_ID = 'orgId';
11
12
  export const PEOPLE = 'people';
12
13
  export const RESPONSE_MESSAGE = 'responseMessage';
13
14
  export const SET_READ_STATE_SUCCESS_MESSAGE = 'Missed calls are read by the user.';
15
+ export const SET_DELETE_CALL_RECORDS_SUCCESS_MESSAGE = 'Call history records are deleted by the user.';
16
+ export const SET_DELETE_CALL_RECORDS_INVALID_DATE_FORMAT_MESSAGE = 'The provided date is malformed or invalid';
14
17
  export const SUCCESS_MESSAGE = 'SUCCESS';
15
18
  export const STATUS_CODE = 'statusCode';
16
19
  export const USER_SESSIONS = 'userSessions';
@@ -240,7 +240,7 @@ export class CallingClient extends Eventing {
240
240
  });
241
241
  }
242
242
  async createLine() {
243
- const line = new Line(this.webex.internal.device.userId, this.webex.internal.device.url, this.mutex, this.primaryMobiusUris, this.backupMobiusUris, this.getLoggingLevel(), this.sdkConfig?.serviceData);
243
+ const line = new Line(this.webex.internal.device.userId, this.webex.internal.device.url, this.mutex, this.primaryMobiusUris, this.backupMobiusUris, this.getLoggingLevel(), this.sdkConfig?.serviceData, this.sdkConfig?.jwe);
244
244
  this.lineDict[line.lineId] = line;
245
245
  }
246
246
  getLines() {
@@ -1,5 +1,5 @@
1
1
  import log from '../../../Logger/index';
2
- import { CALLER_ID_FILE, FETCH_NAME, VALID_PHONE } from '../../constants';
2
+ import { CALLER_ID_FILE, VALID_PHONE_REGEX } from '../../constants';
3
3
  import SDKConnector from '../../../SDKConnector';
4
4
  import { resolveCallerIdDisplay } from '../../../common';
5
5
  export class CallerId {
@@ -74,11 +74,9 @@ export class CallerId {
74
74
  }
75
75
  parseSipUri(paid) {
76
76
  const result = {};
77
- const data = paid.split('@')[0].replace(/"/g, '');
78
- const nameMatch = FETCH_NAME.exec(data);
79
- const num = data.substring(data.indexOf(':') + 1, data.length);
77
+ const nameMatch = paid.split('<')[0].replace(/"/g, '');
80
78
  if (nameMatch) {
81
- result.name = nameMatch[0].trimEnd();
79
+ result.name = nameMatch.trim();
82
80
  }
83
81
  else {
84
82
  log.warn(`Name field not found!`, {
@@ -86,7 +84,9 @@ export class CallerId {
86
84
  method: 'parseSipUri',
87
85
  });
88
86
  }
89
- const phoneMatch = num.match(VALID_PHONE);
87
+ const data = paid.split('@')[0].replace(/"/g, '');
88
+ const num = data.substring(data.indexOf(':') + 1, data.length);
89
+ const phoneMatch = num.match(VALID_PHONE_REGEX);
90
90
  if (phoneMatch && phoneMatch[0].length === num.length) {
91
91
  result.num = num;
92
92
  }
@@ -2,15 +2,16 @@ import { MediaConnectionEventNames, LocalStreamEventNames, RoapMediaConnection,
2
2
  import { createMachine, interpret } from 'xstate';
3
3
  import { v4 as uuid } from 'uuid';
4
4
  import { EffectEvent } from '@webex/web-media-effects';
5
+ import { RtcMetrics } from '@webex/internal-plugin-metrics';
5
6
  import { ERROR_LAYER, ERROR_TYPE } from '../../Errors/types';
6
- import { handleCallErrors, parseMediaQualityStatistics } from '../../common/Utils';
7
+ import { handleCallErrors, parseMediaQualityStatistics, serviceErrorCodeHandler, } from '../../common/Utils';
7
8
  import { ALLOWED_SERVICES, CallDirection, HTTP_METHODS, } from '../../common/types';
8
9
  import { createCallError } from '../../Errors/catalog/CallError';
9
10
  import { CALL_ENDPOINT_RESOURCE, CALL_FILE, CALL_HOLD_SERVICE, CALL_STATUS_RESOURCE, CALL_TRANSFER_SERVICE, CALLING_USER_AGENT, CALLS_ENDPOINT_RESOURCE, CISCO_DEVICE_URL, DEFAULT_LOCAL_CALL_ID, DEFAULT_SESSION_TIMER, DEVICES_ENDPOINT_RESOURCE, HOLD_ENDPOINT, ICE_CANDIDATES_TIMEOUT, INITIAL_SEQ_NUMBER, MEDIA_ENDPOINT_RESOURCE, NOISE_REDUCTION_EFFECT, RESUME_ENDPOINT, SPARK_USER_AGENT, SUPPLEMENTARY_SERVICES_TIMEOUT, TRANSFER_ENDPOINT, } from '../constants';
10
11
  import SDKConnector from '../../SDKConnector';
11
12
  import { Eventing } from '../../Events/impl';
12
13
  import { CALL_EVENT_KEYS, MEDIA_CONNECTION_EVENT_KEYS, MOBIUS_MIDCALL_STATE, SUPPLEMENTARY_SERVICES, } from '../../Events/types';
13
- import { DisconnectCause, DisconnectCode, MidCallEventType, MobiusCallState, RoapScenario, TransferType, } from './types';
14
+ import { DisconnectCause, DisconnectCode, MidCallEventType, MobiusCallState, MUTE_TYPE, RoapScenario, TransferType, } from './types';
14
15
  import log from '../../Logger';
15
16
  import { createCallerId } from './CallerId';
16
17
  import { METRIC_TYPE, METRIC_EVENT, TRANSFER_ACTION } from '../../Metrics/types';
@@ -49,6 +50,7 @@ export class Call extends Eventing {
49
50
  mediaNegotiationCompleted;
50
51
  receivedRoapOKSeq;
51
52
  localAudioStream;
53
+ rtcMetrics;
52
54
  isMuted() {
53
55
  return this.muted;
54
56
  }
@@ -58,7 +60,7 @@ export class Call extends Eventing {
58
60
  isHeld() {
59
61
  return this.held;
60
62
  }
61
- constructor(activeUrl, webex, destination, direction, deviceId, lineId, deleteCb, indicator) {
63
+ constructor(activeUrl, webex, direction, deviceId, lineId, deleteCb, indicator, destination) {
62
64
  super();
63
65
  this.destination = destination;
64
66
  this.direction = direction;
@@ -98,6 +100,7 @@ export class Call extends Eventing {
98
100
  });
99
101
  this.remoteRoapMessage = null;
100
102
  this.disconnectReason = { code: DisconnectCode.NORMAL, cause: DisconnectCause.NORMAL };
103
+ this.rtcMetrics = new RtcMetrics(this.webex, { callId: this.callId }, this.correlationId);
101
104
  const callMachine = createMachine({
102
105
  schema: {
103
106
  context: {},
@@ -1219,6 +1222,23 @@ export class Call extends Eventing {
1219
1222
  this.mediaConnection.roapMessageReceived(message);
1220
1223
  }
1221
1224
  }
1225
+ forceSendStatsReport = async ({ callFrom }) => {
1226
+ const loggerContext = {
1227
+ file: CALL_FILE,
1228
+ method: this.forceSendStatsReport.name,
1229
+ };
1230
+ try {
1231
+ await this.mediaConnection.forceRtcMetricsSend();
1232
+ log.info(`Successfully uploaded available webrtc telemetry statistics`, loggerContext);
1233
+ log.info(`callFrom: ${callFrom}`, loggerContext);
1234
+ }
1235
+ catch (error) {
1236
+ const errorInfo = error;
1237
+ const errorStatus = serviceErrorCodeHandler(errorInfo, loggerContext);
1238
+ const errorLog = new Error(`Failed to upload webrtc telemetry statistics. ${errorStatus}`);
1239
+ log.error(errorLog, loggerContext);
1240
+ }
1241
+ };
1222
1242
  initMediaConnection(localAudioTrack, debugId) {
1223
1243
  const mediaConnection = new RoapMediaConnection({
1224
1244
  skipInactiveTransceivers: true,
@@ -1236,7 +1256,7 @@ export class Call extends Eventing {
1236
1256
  video: 'inactive',
1237
1257
  screenShareVideo: 'inactive',
1238
1258
  },
1239
- }, debugId || `WebexCallSDK-${this.correlationId}`);
1259
+ }, debugId || `WebexCallSDK-${this.correlationId}`, (data) => this.rtcMetrics.addMetrics(data), () => this.rtcMetrics.closeMetrics(), () => this.rtcMetrics.sendMetricsInQueue());
1240
1260
  this.mediaConnection = mediaConnection;
1241
1261
  }
1242
1262
  getDirection = () => this.direction;
@@ -1250,6 +1270,7 @@ export class Call extends Eventing {
1250
1270
  }
1251
1271
  setCallId = (callId) => {
1252
1272
  this.callId = callId;
1273
+ this.rtcMetrics.updateCallId(callId);
1253
1274
  log.info(`Setting callId : ${this.callId} for correlationId: ${this.correlationId}`, {
1254
1275
  file: CALL_FILE,
1255
1276
  method: this.setCallId.name,
@@ -1325,6 +1346,16 @@ export class Call extends Eventing {
1325
1346
  }
1326
1347
  }
1327
1348
  post = async (roapMessage) => {
1349
+ const basePayload = {
1350
+ device: {
1351
+ deviceId: this.deviceId,
1352
+ correlationId: this.correlationId,
1353
+ },
1354
+ localMedia: {
1355
+ roap: roapMessage,
1356
+ mediaId: uuid(),
1357
+ },
1358
+ };
1328
1359
  return this.webex.request({
1329
1360
  uri: `${this.mobiusUrl}${DEVICES_ENDPOINT_RESOURCE}/${this.deviceId}/${CALL_ENDPOINT_RESOURCE}`,
1330
1361
  method: HTTP_METHODS.POST,
@@ -1333,20 +1364,15 @@ export class Call extends Eventing {
1333
1364
  [CISCO_DEVICE_URL]: this.webex.internal.device.url,
1334
1365
  [SPARK_USER_AGENT]: CALLING_USER_AGENT,
1335
1366
  },
1336
- body: {
1337
- device: {
1338
- deviceId: this.deviceId,
1339
- correlationId: this.correlationId,
1340
- },
1341
- callee: {
1342
- type: this.destination.type,
1343
- address: this.destination.address,
1344
- },
1345
- localMedia: {
1346
- roap: roapMessage,
1347
- mediaId: uuid(),
1348
- },
1349
- },
1367
+ body: this.destination
1368
+ ? {
1369
+ ...basePayload,
1370
+ callee: {
1371
+ type: this.destination.type,
1372
+ address: this.destination.address,
1373
+ },
1374
+ }
1375
+ : basePayload,
1350
1376
  });
1351
1377
  };
1352
1378
  async patch(state) {
@@ -1745,13 +1771,31 @@ export class Call extends Eventing {
1745
1771
  });
1746
1772
  }
1747
1773
  }
1748
- mute = (localAudioStream) => {
1749
- if (localAudioStream) {
1774
+ mute = (localAudioStream, muteType) => {
1775
+ if (!localAudioStream) {
1776
+ log.warn(`Did not find a local stream while muting the call ${this.getCorrelationId()}.`, {
1777
+ file: CALL_FILE,
1778
+ method: 'mute',
1779
+ });
1780
+ return;
1781
+ }
1782
+ if (muteType === MUTE_TYPE.SYSTEM) {
1783
+ if (!localAudioStream.userMuted) {
1784
+ this.muted = localAudioStream.systemMuted;
1785
+ }
1786
+ else {
1787
+ log.info(`Call is muted by the user already - ${this.getCorrelationId()}.`, {
1788
+ file: CALL_FILE,
1789
+ method: 'mute',
1790
+ });
1791
+ }
1792
+ }
1793
+ else if (!localAudioStream.systemMuted) {
1750
1794
  localAudioStream.setUserMuted(!this.muted);
1751
1795
  this.muted = !this.muted;
1752
1796
  }
1753
1797
  else {
1754
- log.warn(`Did not find a local stream while muting the call ${this.getCorrelationId()}.`, {
1798
+ log.info(`Call is muted on the system - ${this.getCorrelationId()}.`, {
1755
1799
  file: CALL_FILE,
1756
1800
  method: 'mute',
1757
1801
  });
@@ -1804,4 +1848,4 @@ export class Call extends Eventing {
1804
1848
  });
1805
1849
  }
1806
1850
  }
1807
- export const createCall = (activeUrl, webex, dest, dir, deviceId, lineId, deleteCb, indicator) => new Call(activeUrl, webex, dest, dir, deviceId, lineId, deleteCb, indicator);
1851
+ export const createCall = (activeUrl, webex, dir, deviceId, lineId, deleteCb, indicator, dest) => new Call(activeUrl, webex, dir, deviceId, lineId, deleteCb, indicator, dest);
@@ -27,16 +27,16 @@ export class CallManager extends Eventing {
27
27
  this.activeMobiusUrl = '';
28
28
  this.listenForWsEvents();
29
29
  }
30
- createCall = (destination, direction, deviceId, lineId) => {
30
+ createCall = (direction, deviceId, lineId, destination) => {
31
31
  log.log('Creating call object', {});
32
- const newCall = createCall(this.activeMobiusUrl, this.webex, destination, direction, deviceId, lineId, (correlationId) => {
32
+ const newCall = createCall(this.activeMobiusUrl, this.webex, direction, deviceId, lineId, (correlationId) => {
33
33
  delete this.callCollection[correlationId];
34
34
  const activeCalls = Object.keys(this.getActiveCalls()).length;
35
35
  log.info(`DELETE:: Deleted corelationId: ${newCall.getCorrelationId()} from CallManager, Number of call records :- ${activeCalls}`, {});
36
36
  if (activeCalls === 0) {
37
37
  this.emit(CALLING_CLIENT_EVENT_KEYS.ALL_CALLS_CLEARED);
38
38
  }
39
- }, this.serviceIndicator);
39
+ }, this.serviceIndicator, destination);
40
40
  this.callCollection[newCall.getCorrelationId()] = newCall;
41
41
  log.log(`New call created with correlationId: ${newCall.getCorrelationId()}`, {});
42
42
  log.info(`ADD:: Added corelationId: ${newCall.getCorrelationId()} to CallManager , Number of call records now:- ${Object.keys(this.getActiveCalls()).length}`, {});
@@ -78,7 +78,7 @@ export class CallManager extends Eventing {
78
78
  let newCall;
79
79
  if (!newId) {
80
80
  const lineId = this.getLineId(mobiusEvent.data.deviceId);
81
- newCall = this.createCall({}, CallDirection.INBOUND, mobiusEvent.data.deviceId, lineId);
81
+ newCall = this.createCall(CallDirection.INBOUND, mobiusEvent.data.deviceId, lineId, {});
82
82
  log.log(`New incoming call created with correlationId from Call Setup message: ${newCall.getCorrelationId()}`, {
83
83
  file: CALL_MANAGER_FILE,
84
84
  method: 'dequeueWsEvents',
@@ -139,7 +139,7 @@ export class CallManager extends Eventing {
139
139
  }
140
140
  else {
141
141
  const lineId = this.getLineId(mobiusEvent.data.deviceId);
142
- activeCall = this.createCall({}, CallDirection.INBOUND, mobiusEvent.data.deviceId, lineId);
142
+ activeCall = this.createCall(CallDirection.INBOUND, mobiusEvent.data.deviceId, lineId, {});
143
143
  log.log(`New incoming call created with correlationId from ROAP Message: ${activeCall.getCorrelationId()}`, {
144
144
  file: CALL_MANAGER_FILE,
145
145
  method: 'dequeueWsEvents',
@@ -51,3 +51,8 @@ export var TransferType;
51
51
  TransferType["BLIND"] = "BLIND";
52
52
  TransferType["CONSULT"] = "CONSULT";
53
53
  })(TransferType || (TransferType = {}));
54
+ export var MUTE_TYPE;
55
+ (function (MUTE_TYPE) {
56
+ MUTE_TYPE["USER"] = "user_mute";
57
+ MUTE_TYPE["SYSTEM"] = "system_mute";
58
+ })(MUTE_TYPE || (MUTE_TYPE = {}));
@@ -42,7 +42,6 @@ export const DUMMY_METRICS = {
42
42
  },
43
43
  };
44
44
  export const DUMMY_MOBIUS_URL = 'https://mobius.aintgen-a-1.int.infra.webex.com/api/v1';
45
- export const FETCH_NAME = /^[a-zA-Z ]+/;
46
45
  export const IP_ENDPOINT = 'myip';
47
46
  export const INITIAL_SEQ_NUMBER = 1;
48
47
  export const MEDIA_ENDPOINT_RESOURCE = 'media';
@@ -57,7 +56,7 @@ export const REGISTER_RETRY_TIMEOUT = 10000;
57
56
  export const SUPPLEMENTARY_SERVICES_TIMEOUT = 10000;
58
57
  export const API_V1 = '/api/v1';
59
58
  export const URL_ENDPOINT = '/calling/web/';
60
- export const VALID_PHONE = /[\d\s()*#+.-]+/;
59
+ export const VALID_PHONE_REGEX = /[\d\s()*#+.-]+/;
61
60
  export const WEB_AGENT = '(web)';
62
61
  export const WEBEX = 'webex';
63
62
  export const WEBEX_WEB_CLIENT = 'webex-web-client';
@@ -1,7 +1,7 @@
1
1
  import { v4 as uuid } from 'uuid';
2
2
  import { CallDirection, RegistrationStatus, ServiceIndicator, } from '../../common/types';
3
3
  import { LINE_EVENTS } from './types';
4
- import { LINE_FILE, VALID_PHONE } from '../constants';
4
+ import { LINE_FILE, VALID_PHONE_REGEX } from '../constants';
5
5
  import log from '../../Logger';
6
6
  import { createRegistration } from '../registration';
7
7
  import { Eventing } from '../../Events/impl';
@@ -33,9 +33,10 @@ export default class Line extends Eventing {
33
33
  voicePortalNumber;
34
34
  voicePortalExtension;
35
35
  callManager;
36
+ serviceData;
36
37
  #primaryMobiusUris;
37
38
  #backupMobiusUris;
38
- constructor(userId, clientDeviceUri, mutex, primaryMobiusUris, backupMobiusUris, logLevel, serviceDataConfig, phoneNumber, extension, voicemail) {
39
+ constructor(userId, clientDeviceUri, mutex, primaryMobiusUris, backupMobiusUris, logLevel, serviceDataConfig, jwe, phoneNumber, extension, voicemail) {
39
40
  super();
40
41
  this.lineId = uuid();
41
42
  this.userId = userId;
@@ -48,13 +49,13 @@ export default class Line extends Eventing {
48
49
  this.#mutex = mutex;
49
50
  this.#primaryMobiusUris = primaryMobiusUris;
50
51
  this.#backupMobiusUris = backupMobiusUris;
51
- const serviceData = serviceDataConfig?.indicator
52
+ this.serviceData = serviceDataConfig?.indicator
52
53
  ? serviceDataConfig
53
54
  : { indicator: ServiceIndicator.CALLING, domain: '' };
54
- validateServiceData(serviceData);
55
- this.registration = createRegistration(this.#webex, serviceData, this.#mutex, this.lineEmitter, logLevel);
55
+ validateServiceData(this.serviceData);
56
+ this.registration = createRegistration(this.#webex, this.serviceData, this.#mutex, this.lineEmitter, logLevel, jwe);
56
57
  log.setLogger(logLevel, LINE_FILE);
57
- this.callManager = getCallManager(this.#webex, serviceData.indicator);
58
+ this.callManager = getCallManager(this.#webex, this.serviceData.indicator);
58
59
  this.incomingCallListener();
59
60
  }
60
61
  async register() {
@@ -117,7 +118,7 @@ export default class Line extends Eventing {
117
118
  makeCall = (dest) => {
118
119
  let call;
119
120
  if (dest) {
120
- const match = dest.address.match(VALID_PHONE);
121
+ const match = dest.address.match(VALID_PHONE_REGEX);
121
122
  if (match && match[0].length === dest.address.length) {
122
123
  const sanitizedNumber = dest.address
123
124
  .replace(/[^[*+]\d#]/gi, '')
@@ -127,7 +128,7 @@ export default class Line extends Eventing {
127
128
  type: dest.type,
128
129
  address: `tel:${sanitizedNumber}`,
129
130
  };
130
- call = this.callManager.createCall(formattedDest, CallDirection.OUTBOUND, this.registration.getDeviceInfo().device?.deviceId, this.lineId);
131
+ call = this.callManager.createCall(CallDirection.OUTBOUND, this.registration.getDeviceInfo().device?.deviceId, this.lineId, formattedDest);
131
132
  log.log(`New call created, callId: ${call.getCallId()}`, {});
132
133
  }
133
134
  else {
@@ -137,6 +138,11 @@ export default class Line extends Eventing {
137
138
  }
138
139
  return call;
139
140
  }
141
+ if (this.serviceData.indicator === ServiceIndicator.GUEST_CALLING) {
142
+ call = this.callManager.createCall(CallDirection.OUTBOUND, this.registration.getDeviceInfo().device?.deviceId, this.lineId);
143
+ log.log(`New guest call created, callId: ${call.getCallId()}`, {});
144
+ return call;
145
+ }
140
146
  return undefined;
141
147
  };
142
148
  incomingCallListener() {
@@ -30,8 +30,11 @@ export class Registration {
30
30
  backupMobiusUris;
31
31
  registerRetry = false;
32
32
  reconnectPending = false;
33
+ jwe;
33
34
  isCCFlow = false;
34
- constructor(webex, serviceData, mutex, lineEmitter, logLevel) {
35
+ failoverImmediately = false;
36
+ constructor(webex, serviceData, mutex, lineEmitter, logLevel, jwe) {
37
+ this.jwe = jwe;
35
38
  this.sdkConnector = SDKConnector;
36
39
  this.serviceData = serviceData;
37
40
  this.isCCFlow = serviceData.indicator === ServiceIndicator.CONTACT_CENTER;
@@ -99,7 +102,7 @@ export class Registration {
99
102
  const deviceInfo = {
100
103
  userId: this.userId,
101
104
  clientDeviceUri: this.webex.internal.device.url,
102
- serviceData: this.serviceData,
105
+ serviceData: this.jwe ? { ...this.serviceData, jwe: this.jwe } : this.serviceData,
103
106
  };
104
107
  return this.webex.request({
105
108
  uri: `${url}device`,
@@ -157,7 +160,7 @@ export class Registration {
157
160
  interval -= excessVal;
158
161
  }
159
162
  let abort;
160
- if (interval > BASE_REG_RETRY_TIMER_VAL_IN_SEC) {
163
+ if (interval > BASE_REG_RETRY_TIMER_VAL_IN_SEC && !this.failoverImmediately) {
161
164
  const scheduledTime = Math.floor(Date.now() / 1000);
162
165
  setTimeout(async () => {
163
166
  await this.mutex.runExclusive(async () => {
@@ -172,6 +175,7 @@ export class Registration {
172
175
  }
173
176
  else if (this.backupMobiusUris.length) {
174
177
  log.log('Failing over to backup servers.', loggerContext);
178
+ this.failoverImmediately = false;
175
179
  abort = await this.attemptRegistrationWithServers(this.startFailoverTimer.name, this.backupMobiusUris);
176
180
  if (!abort && !this.isDeviceRegistered()) {
177
181
  interval = this.getRegRetryInterval();
@@ -349,6 +353,9 @@ export class Registration {
349
353
  }
350
354
  async attemptRegistrationWithServers(caller, servers = this.primaryMobiusUris) {
351
355
  let abort = false;
356
+ if (this.failoverImmediately) {
357
+ return abort;
358
+ }
352
359
  if (this.isDeviceRegistered()) {
353
360
  log.log(`[${caller}] : Device already registered with : ${this.activeMobiusUrl}`, {
354
361
  file: REGISTRATION_FILE,
@@ -441,6 +448,7 @@ export class Registration {
441
448
  this.metricManager.submitRegistrationMetric(METRIC_EVENT.REGISTRATION, REG_ACTION.KEEPALIVE_FAILURE, METRIC_TYPE.BEHAVIORAL, clientError);
442
449
  }, { method: this.startKeepaliveTimer.name, file: REGISTRATION_FILE });
443
450
  if (abort || keepAliveRetryCount >= RETRY_COUNT_THRESHOLD) {
451
+ this.failoverImmediately = this.isCCFlow;
444
452
  this.setStatus(RegistrationStatus.INACTIVE);
445
453
  this.clearKeepaliveTimer();
446
454
  this.clearFailbackTimer();
@@ -518,4 +526,4 @@ export class Registration {
518
526
  }
519
527
  }
520
528
  }
521
- export const createRegistration = (webex, serviceData, mutex, lineEmitter, logLevel) => new Registration(webex, serviceData, mutex, lineEmitter, logLevel);
529
+ export const createRegistration = (webex, serviceData, mutex, lineEmitter, logLevel, jwe) => new Registration(webex, serviceData, mutex, lineEmitter, logLevel, jwe);
@@ -4,6 +4,7 @@ export var COMMON_EVENT_KEYS;
4
4
  COMMON_EVENT_KEYS["CB_VOICEMESSAGE_CONTENT_GET"] = "call_back_voicemail_content_get";
5
5
  COMMON_EVENT_KEYS["CALL_HISTORY_USER_SESSION_INFO"] = "callHistory:user_recent_sessions";
6
6
  COMMON_EVENT_KEYS["CALL_HISTORY_USER_VIEWED_SESSIONS"] = "callHistory:user_viewed_sessions";
7
+ COMMON_EVENT_KEYS["CALL_HISTORY_USER_SESSIONS_DELETED"] = "callHistory:user_sessions_deleted";
7
8
  })(COMMON_EVENT_KEYS || (COMMON_EVENT_KEYS = {}));
8
9
  export var LINE_EVENT_KEYS;
9
10
  (function (LINE_EVENT_KEYS) {
@@ -63,6 +64,7 @@ export var MOBIUS_EVENT_KEYS;
63
64
  MOBIUS_EVENT_KEYS["CALL_SESSION_EVENT_INCLUSIVE"] = "event:janus.user_recent_sessions";
64
65
  MOBIUS_EVENT_KEYS["CALL_SESSION_EVENT_LEGACY"] = "event:janus.user_sessions";
65
66
  MOBIUS_EVENT_KEYS["CALL_SESSION_EVENT_VIEWED"] = "event:janus.user_viewed_sessions";
67
+ MOBIUS_EVENT_KEYS["CALL_SESSION_EVENT_DELETED"] = "event:janus.user_sessions_deleted";
66
68
  })(MOBIUS_EVENT_KEYS || (MOBIUS_EVENT_KEYS = {}));
67
69
  export var MEDIA_CONNECTION_EVENT_KEYS;
68
70
  (function (MEDIA_CONNECTION_EVENT_KEYS) {