3

According to the docs I should be able to have Twilio initiate a call for me with

twilio:place_call( "3125551212", "7735551212", somewebhook);

I can't seem to get it working quite right. Does the webhook need to be there, and if so what should it respond with? I just want to initiate a phone call and have it connect me with my phone- I don't need any other Twilio intervention.

UPDATE:

Okay I think I got it worked out. The webhook (which I'm just putting into KRL) just needs this: twilio:dial("7735551212"); where that number is my number. So the person receiving the call from me will have a few seconds of dead air pause when they first pick up. To help with that, I'm also prepending it with this twilio:say("Hi, one moment please"); Here's the final rule:

rule twilconnect is active {
select when twilio twilconnect                     
{
    twilio:say("Hi, one moment please");        
    twilio:dial("7735551212");
}

}

And the rule that initializes everything looks like this:

rule makethecall is active {
  select when web make_the_call
  pre {
    tocall = event:param("tocall");
  }

  {         
    notify("Calling " + tocall,"...");
    twilio:place_call( tocall, "+17735551212", "http://webhooks.kynetxapps.net/t/{appid}/twilconnect");       
  }

}

Jed
  • 703
  • 6
  • 13

1 Answers1

1

You seemed to have answered your own question, but here seems to be the issue that confused you.

The twilio module's place_call() action is used when you need to initiate a new outbound call when there isn't already a call.

When you want to have an already in process call that you want to connect to an external number, you want the dial() action.

TelegramSam
  • 2,770
  • 1
  • 17
  • 22
  • What tripped me up was thinking that `place_call()` would do it on its own. It seems though that you still need to follow-up with that using `dial` and/or `say`and other commands to actually connect two lines into a call. – Jed Apr 13 '11 at 04:06
  • Dial connects the calls together directly, but it can be easy to get confused there... – TelegramSam Apr 16 '11 at 03:32