I need help in uhholding the call.I have tried two method.
1. use enqueue verb when i press the hold button I have user the update call method
<Response>
<Enqueue waitUrl="urltoplaytheholdmusic">1111</Enqueue>
</Response>
(and when I press the unhold button I used the same update method and used.)
<Response>
<Queue >1111</Queue>
</Response>
but when used the queue verb call gets disconnected.
2. So I tried an other way to just play the music when I press the hold button.
<Response><Say>We are putting you on hold Please wait!</Say><Play loop="0">https://api.twilio.com/cowbell.mp3</Play></Response>
Now I don't know what to do to unhold the call.
question:reference question
this all i am doing. when I make call I have used the js liberay for that and used this function
function call(dial_number, from_phone) {
params = {
"to_phone": to_phone,
"from_phone": from_phone,
"from_id": current_user_id,
"to_id": user_id
};
connection = Twilio.Device.connect(params);
connection._onAnswer = function(conn) {
console.log(conn.callsid);
/*get parentcall sid when make the call*/
Sid = {
parent_callSid: conn.callsid,
type: 'outgoing'
};
};
}
And to put the call on hold I have used this line of code
function holdaction() {
jQuery.ajax({
url: 'url',
type: 'POST',
data: 'sid=' + parentSid + '&admin_no=' + encodeURIComponent(jQuery('#twilio_from_number').val()) + '&action=' + hold_action,
dataType: 'json',
success: function(data) {}
});
}
This gets the callsid by using the parentcallsid from my db call this functionto put the call on hold
function update_call($callSid, $action, $admin_no = '') {
$rr = array(
"url" => "holdactionurl?type=".$action.
'&admin_no='.$admin_no,
"method" => "POST"
);
$call = $this->client->calls($callSid)->update($rr);
return $call->to;
}
And on holdactionurl I have used this-
<Response>
<Enqueue waitUrl="wait_url">first_queue</Enqueue>
</Response>
And on wait_url I have used this-
<Response>
<Say>You are on hold </Say>
<Redirect>wait_url</Redirect>
</Response>
And I for unholding the call I (means the same number which have put the call on hold) used the same holdaction method with different parameter and the xml code for that is-
<Response>
<Dial>
<Queue>first_queue1</Queue>
</Dial>
</Response>
I know I m doing this wrong but I can't figure out the right way so I will much appreciate If you can help me figure it out what I m doing wrong