twilio->{$env}->outgoingCustomer; } elseif ($from == 'driver') { $from = c::config()->twilio->{$env}->outgoingDriver; } elseif ($from == 'restaurant') { $from = c::config()->twilio->{$env}->outgoingRestaurant; } $from = self::formatNumber($from); $to = self::formatNumber($to); if ($callback) { $callback = ['StatusCallback' => 'http://'.c::config()->host_callback.$callback]; } if (!$from || !$to) { return false; } try { Log::debug([ 'action' => 'calling', 'to' => $to, 'from' => $from, 'msg' => $url, 'callback' => $callback, 'type' => 'call' ]); $call = c::twilio()->account->calls->create($fro, $to, $url, $callback); } catch (Exception $e) { Log::error([ 'action' => 'call failed', 'to' => $to, 'from' => $from, 'msg' => $url, 'callback' => $callback, 'type' => 'call' ]); } return $call; } }