request("/$ApiVersion/Accounts/$AccountSid/Calls", "POST", array( "Caller" => $CallerID, // Outgoing Caller ID you have previously validated with Twilio "Called" => $call_phonenumber, // The phone number you wish to dial "Url" => $url."intro_twiml.php", // the URL of the web application on your server that will handle the call when it connects "Timeout"=>30 )); if($response->IsError) { $err = urlencode($response->ErrorMessage); header("Location: index.php?msg=$err"); die; } else { /* redirect back to the main page with CallSid */ $msg = urlencode("Calling... ".$call_phone_number); header("Location: control_panel.php?msg=$msg&CallSid=".$response->ResponseXml->Call->Sid); die; } } ?>