-
Notifications
You must be signed in to change notification settings - Fork 28
CUCM Usage Guide
Using the Cisco Webex iOS SDK v3.0, you can place, receive, transfer and merge CUCM calls.
To get started developer need to first login to CUCM and then wait for Phone Services to get connected, once both steps are successful, you are good to start enjoying features of CUCM.
-
Start the UC Services
webex.startUCServices()
-
Check if you're already logged into CUCM
var isUCLoggedIn = webex.isUCLoggedIn() if(isUCLoggedIn) { // Successfully logged in to the CUCM service }
-
If you're not logged in, you can start the login process by providing the UC domain / serverUrl from the user and invoking the below method. Note: Provide only either a domain or a server, but not both.
webex.ucLoginDelegate = self // always ensure ucLoginDelegate is set before invoking below method webex.setUCDomainServerUrl(ucDomain: "cucm.example.com", serverUrl: "cucmserver.example.com")
-
Webex SDK exposes a delegate protocol called
WebexUCLoginDelegate
. This is useful for hooking into the async CUCM operations like login status change, server connection status change, etc. Your class should conform to this protocol and set it appropriately like so:class YourViewController: UIViewController { override func viewDidAppear(_ animated: Bool) { // You need to register your class as a delegate webex.ucLoginDelegate = self } } extension HomeViewController: WebexUCLoginDelegate { func onUCLoggedIn() { // cucm login attempt was successful } func onUCLoginFailed() { // cucm login attempt failed } func onUCServerConnectionStateChanged(status: UCLoginServerConnectionStatus, failureReason: PhoneServiceRegistrationFailureReason) { if status == .Connected { // cucm server connection success } } func loadUCSSOView(to url: String) { // If your cucm server supports SSO based sign in, you'll need to open a webview using `webex.getUCSSOLoginView` helper like below webex.getUCSSOLoginView(parentViewController: self, ssoUrl: url) { success in if let success = success, success { // you're logged in } } } func onUCSSOLoginFailed(failureReason: UCSSOFailureReason) { // If the SSO login failed due to reason like session expiry, you'll need to re login using `webex.retryUCSSOLogin` helper like below webex.retryUCSSOLogin() } func showUCNonSSOLoginView() { // If your cucm server requires a non-sso(username/password) flow, this delegate method will be invoked // You should collect the username / password from user and call the below method webex.setCUCMCredential(username: "user@example.com", password: "SuperSecret") } }
-
Check if you're connected to CUCM server
let status = webex.getUCServerConnectionStatus() if status == .Connected { // You're successfully connected to a CUCM server }
-
Once you're successfully logged in, You can start making calls as usual using either a PSTN number or a sip uri. Use the
webex.phone.dialPhoneNumber()
api to dial phone numbers. Incase of meeting links, spaces, meeting numbers, sip uris and email addresses, you can use the regularwebex.phone.dial()
api. e.g:let mediaOption = MediaOption.audioOnly() webex.phone.dialPhoneNumber("+1800123456", option: mediaOption) { result in switch result { case .success(let call): // Call started successfully case .failure(let error): // Call failed } }
-
Once you have an instance of a cucm call, you can transfer it to another call
guard call.isCUCMCall else { print("Call transfer works only with CUCM calls") return } // Put an active call on hold call.holdCall(putOnHold: true) // start a new call that can be transferred later to the previous call call.startAssociatedCall( dialNumber: "+1800123123", associationType: .transfer, isAudioCall: true) {[weak self] result in switch result { case .success(let newCall): // successfully started an associated call that can be transferred call.transferCall(toCallId: newCall.callId) case .failure(let error): // an error occurred } }
-
Once you have an instance of a cucm call, you can merge it with a new call
guard call.isCUCMCall else { print("Call merge works only with CUCM calls") return } // Put an active call on hold call.holdCall(putOnHold: true) // start a new call that can be transferred later to the previous call call.startAssociatedCall(dialNumber: "+1800123123", associationType: .merge, isAudioCall: true) {[weak self] result in switch result { case .success(let newCall): // successfully started an associated call that can be transferred call.mergeCall(targetCallId: newCall.callId) case .failure(let error): // an error occurred } }
For CUCM incoming call notifications, please visit App Registration For Mobile SDK v3