Twilio and Asterisk Call Duration Issue

Job ID: 38929343

Budget: $250 – $750 USD

Hi,

Please understand the problem we are facing with a specific use case. You need to have knowledge of Twilio, SIP, and Asterisk.

We are trying to achieve the following use case:

A caller dials a Twilio number.
Twilio forwards the call to an Asterisk server.
Asterisk receives the call from Twilio and immediately connects the caller to sip:test sip.linphone.org (essentially bridging the caller directly to the SIP address).
Once the call is connected between the caller and sip:linphone, Twilio should no longer be involved in the call (to avoid duration charges).

The desired flow is: Caller → Twilio → Asterisk → sip linphone

At the end, the connection should be: Caller → sip inphone

We understand that we will need to pay Twilio for the incoming and outgoing legs until the caller is connected to Linphone SIP. However, we do not want Twilio to continue counting and charging for the entire call duration once the connection is established between the caller and the SIP address.

We have:

Asterisk installed on a server
Twilio forwarding the call to the Asterisk server
extensions.conf, pjsip.conf, and all other important configurations set up

Problem:
Right now, the call flow works, and the Linphone client app receives the call successfully. However, Twilio continues to log the call duration and charge for the entire duration of the call.

If you have experience with this specific problem and can provide a solution, please propose your approach, and we can hire you for further work.
Related categories: Asterisk PBX VoIP Twilio SIP