Click_to_call API dialing out as destination number.

We’re having issues using the click_to_call endpoint on our server. When one of our users initiates the call, the server dials OUT to the destination number AS the destination number.

We’ve dumped the variables we’re sending to the API and everything is set properly as far as I can tell.

caller: 602
callee: 12223334444
cid_name: redacted
cid_number: 
cos_id: 1
url: https://OURSERVER/api/v2/core/click_to_call

But, when I go to our provider’s logs (twilio), I see the ‘from’ field is the callee’s number. The call then gets dropped, as the caller-id isn’t recognized.

System Information

|Distro| Debian GNU/Linux 11 (bullseye)|
|Kernel|5.10.0-31-amd64|
|PBX Engine|18.23.1|
|OURSERVER|4.1.0-7|
|PHP Version|8.1.11|

Please disregard, I figured it out. I saw this post and thought to check for enabled diversions. It turns out the user had enabled Follow Me accidentally and it wasn’t set up at all.

So, my specific issue is fixed; but, it doesn’t explain why the call is attempted with the destination number as the Caller-ID. It really should’ve just failed and sent an error back to the API request.

What happens when you set a value for cid_number

Same behavior. I think we just actually screwed up when we dumped the variables, the code IS actually setting the cid_number.

I just tried a quick curl command with and without cid_number (with Follow Me enabled).

  • A normal call shows up as sip:OURNUMBER@OURSERVER in their logs.
  • Follow Me enabled + NO cid_number showed up as sip:sipin@OURSERVER. Twilio rejected it for invalid caller-id.
  • Follow Me enabled + cid_number set shows as sip:DESTINATIONNUMBER@OURSERVER, which was also rejected for invalid caller-id.

I should note too that I was only able to replicate this error when the Follow Me “Initial Ring Time” setting was set to “Not Ring”.

I just thought to try this as well, Follow Me enabled plus setting the cid_number to our outgoing number. This rang the destination number and completed the call, but it just went straight to the local user’s voicemail without ringing their phone.

I assume that’s the intended behavior of Follow Me not being configured with any numbers to try.

The only solution I found so far was to create a new outbound route, set the CID there, and force it to Overwrite the CID. And with that said, use that COS in the Click to Call

Good point, seems to be a decent-enough work around. I might end up doing this for now. (I haven’t heard of this happening, but I worry Twilio is going to start flagging us for using so many unauthorized CID numbers.)

In my opinion, this is a bug that the developers should fix. There’s no situation where we should be calling out as the destination number.

I have other examples where the CID is set as the destination number as well (without the Follow Me mis-config). I’m having a hard time reproducing that issue issue; but, it leads me to believe that this bug is bigger than just a weird edge case.