1
votes

I am using the REST API to send SMS via Twilio.
The file is loaded via my browser which instantiates the client and does the SMS SEND.

            $sms_send = $client->account->sms_messages->create($from, $to, $body);

    $sid = $sms_send->sid;

    //creating session for the SMS ID to pass to SMSUrl
    $_SESSION['sid'] = $sid;

In the body of this text, I have a string phone number that is clickable in the Text Message. It starts a phone call to one of my Twilio numbers.

I see that Twilio suggests cookies to be used, but how exactly can I do this or something else to make sure that the SMS ID follows the SMS text all the way to the call for the Twilio?

My goal is to have something to tie the phone call back to the SMS text message.

Thank you!

1

1 Answers

2
votes

If the receiver clicks the phone number in the SMS to make a phone call (or just dials it), it is just a phone call. There can never be a way to get the SMS ID (or session cookie) directly from that phone call.

I have seen systems using multiple phone numbers, that make the connection based on the time (i.e., send an SMS with a specific phone number, and if you get a call on that phone number within say 10 minutes, they are PROBABLY related.) But, at some point you will probably have to start reusing phone numbers, and then if you get a phone call back on that number, you won't necessarily know which SMS message it was in relation to.

Unless, of course, you based it on which phone number you sent the SMS to, if you get the incoming phone number as CallerID.

However, you will never get the SMS ID or session cookie relating from an outgoing SMS when you receive a related phone call.