-
Notifications
You must be signed in to change notification settings - Fork 397
feat(calling): extract getCallingBackend logic to resolveCallingBackend and export resolveCallingBackend #5010
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: next
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -129,7 +129,7 @@ import { | |
| WEBEX_API_BTS, | ||
| BW_XSI_ENDPOINT_VERSION_WITH_SLASH, | ||
| } from './constants'; | ||
| import {Model, WebexSDK} from '../SDKConnector/types'; | ||
| import {Model, WDMDevice, WebexSDK} from '../SDKConnector/types'; | ||
| import SDKConnector from '../SDKConnector'; | ||
| import {CallSettingResponse} from '../CallSettings/types'; | ||
| import {ContactResponse} from '../Contacts/types'; | ||
|
|
@@ -1216,16 +1216,16 @@ export const waitForMsecs = (msec: number) => | |
| }); | ||
|
|
||
| /** | ||
| * Register calling backend. | ||
| * Determine the calling backend from the device object. | ||
| * | ||
| * @param webex -. | ||
| * @param device - The device object containing callingBehavior and entitlement features. | ||
| * @returns CallingBackEnd. | ||
| */ | ||
| export function getCallingBackEnd(webex: WebexSDK): CALLING_BACKEND { | ||
| const entModels: Model[] = webex.internal.device.features.entitlement.models; | ||
| export function resolveCallingBackend(device: WDMDevice): CALLING_BACKEND { | ||
| const entModels: Model[] = device.features.entitlement.models; | ||
| let callingBackend; | ||
|
|
||
| if (webex.internal.device.callingBehavior === NATIVE_WEBEX_TEAMS_CALLING) { | ||
| if (device.callingBehavior === NATIVE_WEBEX_TEAMS_CALLING) { | ||
| for (let i = 0; i < entModels.length; i += 1) { | ||
| if ( | ||
| entModels[i][VALUES][KEY] === ENTITLEMENT_BASIC || | ||
|
|
@@ -1238,13 +1238,23 @@ export function getCallingBackEnd(webex: WebexSDK): CALLING_BACKEND { | |
| break; | ||
| } | ||
| } | ||
| } else if (webex.internal.device.callingBehavior === NATIVE_SIP_CALL_TO_UCM) { | ||
| } else if (device.callingBehavior === NATIVE_SIP_CALL_TO_UCM) { | ||
| callingBackend = CALLING_BACKEND.UCM; | ||
| } else { | ||
| callingBackend = CALLING_BACKEND.INVALID; | ||
| } | ||
|
|
||
| return callingBackend as CALLING_BACKEND; | ||
| return callingBackend || CALLING_BACKEND.INVALID; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Slightly concerned by changing this (even though it should be fine/better), I'll leave that up to sdk team to decide.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think this change will make any impact as the else case already covers this.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the case is if device.callingBehavior === NATIVE_WEBEX_TEAMS_CALLING but none of the expected entitlements are found, in that case, callingBackend will be undefined |
||
| } | ||
|
|
||
| /** | ||
| * Register calling backend. | ||
| * | ||
| * @param webex -. | ||
| * @returns CallingBackEnd. | ||
| */ | ||
| export function getCallingBackEnd(webex: WebexSDK): CALLING_BACKEND { | ||
| return resolveCallingBackend(webex.internal.device); | ||
| } | ||
|
|
||
| /** | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -46,10 +46,13 @@ export { | |
| CallDetails, | ||
| CallDirection, | ||
| CallType, | ||
| CALLING_BACKEND, | ||
| DisplayInformation, | ||
| SORT, | ||
| SORT_BY, | ||
| } from './common/types'; | ||
| export {resolveCallingBackend} from './common/Utils'; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When consumers follow the new public API advertised by this change and import Useful? React with 👍 / 👎. |
||
| export {WDMDevice} from './SDKConnector/types'; | ||
| export {CallError, LineError} from './Errors'; | ||
| export {ICall, TransferType} from './CallingClient/calling/types'; | ||
| export {LOGGER} from './Logger/types'; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.