0

Whenever a call is placed on the phone app from a client to another client, the call ends with an error and the Twilio console shows the dialed out client number as being converted to numbers instead of client:name. For example: client:adam.weissert appears on the Twilio console as 254368232693477378. If it helps, I currently have the app running on a phone, and am attempting to call a logged in user on our corresponding web application.

From what I know about registering a twilio client, they both need to have an access token registered. For the call attempts I've made, this should not be a problem, which leaves me confused as to how this could happen.

This is the code used to place an outbound call

// Code that helps reproduce the issue
 private fun placeCall(callerID: String) {
        val nonAlphaNum = "[^a-zA-Z0-9]".toRegex()
        var callIdFormat = ""

        if (!callerID.contains(".")) { //if it is not a client id and is a number
            callIdFormat = callerID.replace(" ", "")
            callIdFormat = callIdFormat.replace(nonAlphaNum, "")
        } else {
            callIdFormat = callerID
        }

        params["To"] = callIdFormat

        val connectOptions = ConnectOptions.Builder(UserService.twilioAccessToken!!)
            .params(params)
            .build()

        activeCall = Voice.connect(requireContext().applicationContext, connectOptions, callListener)
    }

Twilio attempts to dial the client id, successfully places a call in to our twilio number, but fails to dial out to a client.

This log does not produce on the front-end, but shows in the twilio console and only shows on the outgoing call

Dial: Twilio does not support calling this number or the number is invalid

I would say this is a critical functionality of the SDK, which makes me think I may just be approaching this incorrectly. I'd appreciate any advice.

1 Answers1

0

I discovered that a twiml app we were utilizing to place outgoing calls was forcing all dial outs to use the twiml.dial() function, which will convert the given string to a readable phone number.

I switched it to differentiate between that and twiml.client() depending on if a client id comes in or a ptsn.