iOS Development

ios – How do I get the deal with to switch a name on Linphone?

Spread the love


I’m attempting to provoke a name switch utilizing linphone.

That is the button to press to provoke the decision switch. When this button is pressed It ought to switch the decision. Additionally I wish to see the complete deal with printed to my terminal, print("REMOTE: (remoteAddress)") however I get REMOTE: linphonesw.Handle printed.

ThemeButton(textual content: "Switch a Name") {
                    if let selectedIndex = transferCalls.transferNumbers.firstIndex(the place: { $0.chosen ?? false }) {
                        let selectedTransferNumber = transferCalls.transferNumbers[selectedIndex]

                        // Create SIP deal with utilizing the UserLine info
                        if let line = selectedTransferNumber.line {
                            let sipAddressString = "(line.username ?? "")@(line.area ?? "")"
                            do {
                                let remoteAddress = strive Manufacturing facility.Occasion.createAddress(addr: "sip:" + sipAddressString)
                                
                                print("REMOTE: (remoteAddress)")
                                
                                // Carry out the decision switch utilizing the created SIP deal with
                                phoneManager.transferCall(targetHandle: sipAddressString)
                            } catch {
                                print("Error creating SIP deal with: (error)")
                            }
                        } else {
                            print("Chosen switch quantity doesn't have a sound UserLine.")
                        }
                    }
                }

That is the perform chargeable for creating the deal with.

func transferCall(targetHandle: String) {
        do {
            guard let currentCall = (mCore.currentCall != nil) ? mCore.currentCall : mCore.calls.first else {
                // Deal with the case when there isn't any energetic name
                print("No energetic name to switch.")
                return
            }

            print("Switch ::: Area: (area)")
            print("Switch ::: Goal Deal with: (targetHandle)")

            let remoteAddress = strive Manufacturing facility.Occasion.createAddress(addr: "sip:" + targetHandle + "@" + area)
            print("REMOTE: ———> (remoteAddress)")

            strive currentCall.transferTo(referTo: remoteAddress)
        } catch {
            print("Switch Name Error: (error)")
        }
    }

How do I remedy this?

I’ve tried following the documentation. however there aren’t many working options as that is my first time working with this.

Leave a Reply

Your email address will not be published. Required fields are marked *