0

When I put Twilio call on hold or press any digit Twilio drops the call.

Here are the Twimls I am returing.

When Phone Ringing:

<?xml version="1.0" encoding="UTF-8"?>
<Response>
    <Record maxLength="6960" playBeep="false" timeout="6960" trim="do-not-trim"/>
</Response>

When phone put on hold or pressed any digit:

<?xml version="1.0" encoding="UTF-8"?>
<Response/>
DRP
  • 91
  • 1
  • 1
  • 6

1 Answers1

0

Twilio developer evangelist here.

When you return an empty <Response> that tells Twilio that there's nothing left to do, so the call will end. You need to add some TwiML to tell Twilio what to do next with the call. If a user is on hold, then perhaps <Play> some music?

Let me know if that helps at all.

Edit

OK, there might be a few things going on here.

First up, your <Record> has no action attribute. This means that when the user finishes their recording Twilio will make a request to the current URL to see what to do next. This can lead to looping behaviour.

Secondly, the default value for the <Record> tag's finishOnKey attribute is '1234567890*#', any character. So, when a user presses a key the recording will end and as far as I can see, the call will loop.

You are saying in the comments that you want to continue the call. If you mean continue taking the recording, then perhaps you need to set finishOnKey to an empty string, so that hitting a key doesn't stop the recording. Alternatively, if you expect the call to carry on with something else, then you should add an action URL to the <Record> tag and implement some new TwiML that does something else for that URL. I suggested using <Play> but you have the choice of all available TwiML to carry the call on.

philnash
  • 70,667
  • 10
  • 60
  • 88
  • But I don't want to play any music. Just want the call to be continued. is there any TWIML tag to do so? – DRP Apr 19 '17 at 10:39
  • I've updated my answer. Let me know if that helps at all. – philnash Apr 19 '17 at 11:32
  • doesn't work. As soon as user put the call on hold, Twilio hangs up the call. – DRP Apr 20 '17 at 05:21
  • How is the user putting the call on hold? – philnash Apr 21 '17 at 07:49
  • Basically I am developing a call recorder app for iPhone that records the call using three way calling (conference). So user will dial the Twilio number . Then put call on hold and add other person in call and merge both calls. – DRP Apr 22 '17 at 09:04
  • Ok, cool, but what is the user doing to put the call on hold in this case? Are you making a call to the API? – philnash Apr 22 '17 at 14:58