Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FreePBX Twilio Outbound Ringtone

I have a Twilio SIP trunk connected to FreePbx, all users are using the webrtc module of FreePBX to make calls. They can make and receive calls fine with two way audio, however with outbound calls the caller does not hear ringtone (ringing) as the B number is ringing which is causing some level of confusion with the users.

I've checked the r flag in Outbound Dial Settings and this is enabled but other than this im a little stuck.

[SIP SETTINGS]

   host=hostname
   username=username
   secret=supersecret
   type=peer

In Settings -> Asterisk SIP Settings i have the external and internal networks set

To confirm, using a softphone with the extensions works fine, it's only via WEBRTC.

I've rung wireshark traces and these all show 180 ringing on both ends

Verbose call log: https://pastebin.com/s7BfwUMw

like image 200
Freddy Wetson Avatar asked Nov 29 '17 09:11

Freddy Wetson


1 Answers

Looking at your logs, you're properly receiving the 180 Ringing event from Twilio at 10:17:13, after the call has started at 10:17:09 and has been answered at 10:17:19, so as you spotted it, the problem does not come from the upstream operator not sending the signalling information, but rather from Asterisk, or from the internal WebRTC FreePBX client.

Just thinking here, but if for some reason, your WebRTC client is not ready to handle audio event thought the call has started (and the callee is ringing), then you won't hear any ringback tone. Such situation can occur for example if your WebRTC client starts the call without having gathered all its ICE candidates (this is trickle ICE connection mode, but that should not be the case though, as I think Asterisk does not support it). Unfortunately, there's not much you can do in this case apart from modifying the configuration or JavaScript code of the WebRTC client.

Now, on the Asterisk side, indeed, the r option should do the job. I'm not sure FreePBX allows you to control the dialplan commands, but if it does, you may want to try to force Asterisk to answer the call, then playback a ringing tone while dialing out. The PlayTones function can be useful then.

exten => _44X.,1,Answer
exten => _44X.,n,Wait(1)
exten => _44X.,n,Playtones(ring)
exten => _44X.,n,Wait(3)
exten => _44X.,n,Dial(SIP/...)

Note that you will have to have a indications.conf file properly configured to have this working. I guess other functions like Ringing, Progress can be used, but I think the idea of answering the call before dialing out is worth a try. Of course, this is a bit hacky as the way to go should definitely be to use Dial without the r option.

Hope this helps!

like image 81
Philippe Sultan Avatar answered Oct 03 '22 08:10

Philippe Sultan