0

I'm trying to enable access to a menu after a call as been dialed and answered. For example, an agent dials a number, which uses the verb to place a call. During that call the person called asks to be transferred to a different agent, extension or queue. I have read about putting a call into a conference and using the hangupOnStar attribute to put the person called on hold and bring up a menu for the agent to further manipulate the call but have been unsuccessful. It seems that pressing the '*' button ends the call and therefore the DialCallSid belongs to a completed call which can't be updated.

mcpacific
  • 165
  • 2
  • 12

1 Answers1

0

I was originally going about this the wrong way. This is for an Outbound call, so I was able to successfully create a "on hold" conference, dial up a caller using the REST API, then add the caller to the conference. I was also able to harness the hangupOnStar attribute to enable leaving the conference and going to a menu.

Here is the code in my first function:

public function makeOutboundConference(Request $request) {
  $sid = "ACxxxxxxxxxxxxxxxxxxxxxxxxx";
  $token = "xxxxxxxxxxxxxxxxxxxxxxxxxxx";

  $response = new Twiml();
  $dial = $response->dial(
    [
      'hangupOnStar' => true,
      'action' => 'url-to-incall-menu',
      'method' => 'POST'
    ]
  );
  $dial->conference("On Hold",
    [
      'beep' => false,
    ]
  );

  $client = new Client($sid, $token);

  try {
    $call = $client->calls->create(
      $to,
      $callerId,
      array('url' => 'fq-url-to-connect-caller')
    );

  } catch (Exception $e) {
    error_log("Error: " . $e->getMessage());
  }

  return $response;
}

and my second function to add the person called to the conference:

public function showConnectCaller(Request $request) {

  $response = new Twiml();
  $dial = $response->dial();
  $dial->conference(
    "On Hold",
    [
      'record' => 'record-from-start',
      'beep' => false,
      'endConferenceOnExit' => true,
    ]
  );

  return $response;

}

Twilio: Can I make OUTBOUND Conference Calls? was very helpful.

mcpacific
  • 165
  • 2
  • 12