Twilio SIP Call Optimization Specialist

Job ID: 38944279

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.
After some time or under certain conditions, 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.

For more details please check https://community.asterisk.org/t/transfer-call-from-twilio-to-asterisk-without-duration-charges/106024

Extra notes:
Calls always start from PSTN/mobile/landline to the Twilio number. We have webhooks configured for this Twilio number that route the call to our users, which is already working.
We cannot remove Twilio because the calls are already working for our users.
There is only one use case: when a call goes to the Asterisk server; otherwise, our users pick up the call using our custom Android/iOS app, which has the Twilio client.
If no user responds, we call the backup, which is a SIP. While calling the SIP, we are encountering this issue.



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