Twilio API Conference: How to start a participant in hold mode - php

I want to start a conference with 3 participants:
Client
Agent
Supervisor
Where the client would "enter" the conference in hold=true mode.
I did not find in the twilio api documentation how to do that, there is a possibility to start him in mute mode, but that does not serve our needs.
What i could do is to start the conference and then immediately put the client into a hold mode.
But is there is a proper way to do this?
Thank you.

Twilio developer evangelist here.
There is no way to start a participant in hold. But a conference participant on hold is not really participating in the conference.
Could you keep the user waiting by sending them to TwiML that just returned hold music using <Play> until you want to bring them into the conference by redirecting the call?
Alternatively your suggestion to have them join the conference, then immediately send them to hold will work for you.

Related

Using Twilio. Send conference participant to "voicemail" recording if no one joins the conference in X amount of time

With Twilio I am trying to send or redirect a conference participant to a "leave a voicemail" option when no one joins the conference with them within a specific amount of time. I've tried using update announceUrl, but it will not allow me to use the record verb.
Is there another way to do this?
Twilio developer evangelist here.
Rather than using the announceUrl you should update the call using the Calls resource and redirect it to new TwiML that will record the voicemail.

Invitation system (push) for web app

I am creating an web app and a user can start a game with multiple players (your friends). This game is played on 1 device. Is it possible that all invited players get a notification on their device where they can accept or decline the invitation ?
So in steps
Player 1 creates a game and invites player 2 and 3
Player 2 receives a notification on his mobile device and presses accept, he is added as player of that game
Player 3 doesn't have a device and enters his PIN to accept his participation.
The step that I want to have is step2.
I have read about OneSignal who can send push notifications to specific users, but I could not find if you can send a response back (accept or decline). Or is there an other way (without to have a native app).
your question is understood but at this moment a little too broad. But. I will try to answer in concept also :)
Now...you said you already know how to send target specific notification with OneSignal.
What you need to do from now one it cloud be like this:
Attach a link or click or action to that invite. Or when such invite
arrived open a particular view in the app/web/application that you are developing and revives the link.
Attach the session/game/user/object ID to that link and send the call
to you API (which is based on your server). If you have an API, if you don't you can have a very simple API build to handle only such requests with URL xxxx.com/path/to/api/call/var1/var2/var3/etc
From there you can catch the request and reply or adapt accordingly on your server side.
Maybe this Framework can help you to speed up the API dev in PHP. Lumen can do that trick.
You can follow this tutorial here for a fast API development with it.

Twilio sms reply feature

I've created a system based on cron job which generates new tasks for user. When new task is generated cron file sends a sms to user using twilio sms api. Now I want make something like when user reply to that sms with word "Done" that task associated with sms will be completed in my database.
I've set reply URL in twilio account. And everything is working fine. My point is how can I complete that task in database. Is there any feature exist in twilio that can help me to send extra parameter as task id, so that I can fetch that id from reply and update the status of task.
Twilio developer evangelist here.
There's no way in SMS to reply to a specific message (try it yourself in your SMS app on your phone), so there's no ID that you can pass around secretly within conversations.
There are a few ways you can work around this.
If the user is sent only one task at a time, then you can record what their current task is and when you receive the message saying "done" tick that one off and send them the next task.
You could send them a task ID within the message, and tell them to include that ID when they respond to say they are done. You could then parse the ID out of the message and mark it as done in your database.
Or, and this might be too far, you could use a pool of numbers to send tasks out such that each live task for a user has a unique number the user responds to. Then you can look up the task based on the user and the number they replied to. Then you can free up the number for a new task.
Let me know if this helps at all.

Twilio Integration With Laravel

I am facing a problem in my project for several days. I want To integrate Twilio for voice conversation in my laravel App. I want That When a User Want to call the twilio account he need a token that is generated from my site.
For Example :
User A Appoints User B for meeting conversation.
User A gets a token after accepting his meeting By User B.
User B also gets a token. User A then call to the Twilio number.
When he call he needs to submit his token.
After submitting User B notified and needs to submit his token to initiate the phone meeting.
This is all I need to do. But dont know how to fix this. Can you guys please give me some advice of how can I achieve this. Sorry For my Bad English
So, if all your wanting is the logic, here is how I recommend this be implemented.
Meeting creator (John) invites a member of his team (Bob) to his newly created meeting.
The application creates a meeting password for John, saving it in the database. It wouldn't yet create one for Bob because he hasn't accepted the invitation. You can separate "hosts" and "invitees" if you'd like to give them a different experience.
Bob receives a notification (text message, email, etc..)
Bob approves the request, and is then generated a meeting password (which is saved to the database).
The meeting time is near, so Bob & John dial in to the Twilio phone number that you have provided them. Upon picking up (set your incoming call webhook to the logic in your Laravel application) the Laravel application uses TwiML to ask the user to enter their meeting number, and meeting password (or just password, up to you). At this point, the user enters a valid password.
The two calls are connected together using the Twilio API. You don't really need one to wait for the other. Throw them in a conference and let Twilio handle that logic using the Conference and Conference Participants REST API.
Let me know if I am missing something else you need in here.

Outgoing Dial Into Conference From Customer's Number

I am trying to have all my incoming calls automatically go to conference. This part can be achieved using:
<Response>
<Dial>
<Conference>Room <?php echo($_REQUEST['From']);?></Conference>
</Dial>
</Response>
This way, each caller goes into their own separate conference room. The part I can't figure out how to do is the outbound call from that point. I need to make a SIP call to my PBX using the customer's caller id so an agent can answer it. When they answer, they should be sent to the same conference room.
I found this for making outbound calls into a conference. However, I want the outbound call to the agent to use the caller id of the customer. This way, the agent can see the customer's phone number.
The main reason I want to use a conference and not a direct dial is because I want to make it possible for supervisors to call into an active call without interrupting the call between the agent and customer.
Twilio evangelist here.
I believe that when making SIP calls, the From parameter will take any alphanumeric string so you can just provide the customers caller ID as the From value:
$call = $client->account->calls->create($_REQUEST['From'], "sip:agent#example.com", "http://www.example.com/conference.xml", array());
echo $call->sid;
Hope that helps.

Categories