<?php
/**
* This code was generated by
* \ / _ _ _| _ _
* | (_)\/(_)(_|\/| |(/_ v1.0.0
* / /
*/
namespace Twilio\Rest\Api\V2010\Account;
use Twilio\Options;
use Twilio\Values;
abstract class CallOptions {
/**
* @param string $url The absolute URL that returns TwiML for this call
* @param string $twiml TwiML instructions for the call
* @param string $applicationSid The SID of the Application resource that will
* handle the call
* @param string $method HTTP method to use to fetch TwiML
* @param string $fallbackUrl Fallback URL in case of error
* @param string $fallbackMethod HTTP Method to use with fallback_url
* @param string $statusCallback The URL we should call to send status
* information to your application
* @param string[] $statusCallbackEvent The call progress events that we send
* to the `status_callback` URL.
* @param string $statusCallbackMethod HTTP Method to use with status_callback
* @param string $sendDigits The digits to dial after connecting to the number
* @param int $timeout Number of seconds to wait for an answer
* @param bool $record Whether to record the call
* @param string $recordingChannels The number of channels in the final
* recording
* @param string $recordingStatusCallback The URL that we call when the
* recording is available to be accessed
* @param string $recordingStatusCallbackMethod The HTTP method we should use
* when calling the
* `recording_status_callback` URL
* @param string $sipAuthUsername The username used to authenticate the caller
* making a SIP call
* @param string $sipAuthPassword The password required to authenticate the
* user account specified in `sip_auth_username`.
* @param string $machineDetection Enable machine detection or end of greeting
* detection
* @param int $machineDetectionTimeout Number of seconds to wait for machine
* detection
* @param string[] $recordingStatusCallbackEvent The recording status events
* that will trigger calls to the
* URL specified in
* `recording_status_callback`
* @param string $trim Set this parameter to control trimming of silence on the
* recording.
* @param string $callerId The phone number, SIP address, or Client identifier
* that made this call. Phone numbers are in E.164
* format (e.g., +16175551212). SIP addresses are
* formatted as `name@company.com`.
* @param int $machineDetectionSpeechThreshold Number of milliseconds for
* measuring stick for the length
* of the speech activity
* @param int $machineDetectionSpeechEndThreshold Number of milliseconds of
* silence after speech activity
* @param int $machineDetectionSilenceTimeout Number of milliseconds of initial
* silence
* @param string $asyncAmd Enable asynchronous AMD
* @param string $asyncAmdStatusCallback The URL we should call to send amd
* status information to your application
* @param string $asyncAmdStatusCallbackMethod HTTP Method to use with
* async_amd_status_callback
* @param string $byoc BYOC trunk SID (Beta)
* @param string $callReason Reason for the call (Branded Calls Beta)
* @param string $callToken A token string needed to invoke a forwarded call
* with a CallerId recieved on a previous incoming call
* @param string $recordingTrack Which track(s) to record
* @param int $timeLimit The maximum duration of the call in seconds.
* @return CreateCallOptions Options builder
*/
public static function create(string $url = Values::NONE, string $twiml = Values::NONE, string $applicationSid = Values::NONE, string $method = Values::NONE, string $fallbackUrl = Values::NONE, string $fallbackMethod = Values::NONE, string $statusCallback = Values::NONE, array $statusCallbackEvent = Values::ARRAY_NONE, string $statusCallbackMethod = Values::NONE, string $sendDigits = Values::NONE, int $timeout = Values::NONE, bool $record = Values::NONE, string $recordingChannels = Values::NONE, string $recordingStatusCallback = Values::NONE, string $recordingStatusCallbackMethod = Values::NONE, string $sipAuthUsername = Values::NONE, string $sipAuthPassword = Values::NONE, string $machineDetection = Values::NONE, int $machineDetectionTimeout = Values::NONE, array $recordingStatusCallbackEvent = Values::ARRAY_NONE, string $trim = Values::NONE, string $callerId = Values::NONE, int $machineDetectionSpeechThreshold = Values::NONE, int $machineDetectionSpeechEndThreshold = Values::NONE, int $machineDetectionSilenceTimeout = Values::NONE, string $asyncAmd = Values::NONE, string $asyncAmdStatusCallback = Values::NONE, string $asyncAmdStatusCallbackMethod = Values::NONE, string $byoc = Values::NONE, string $callReason = Values::NONE, string $callToken = Values::NONE, string $recordingTrack = Values::NONE, int $timeLimit = Values::NONE): CreateCallOptions {
return new CreateCallOptions($url, $twiml, $applicationSid, $method, $fallbackUrl, $fallbackMethod, $statusCallback, $statusCallbackEvent, $statusCallbackMethod, $sendDigits, $timeout, $record, $recordingChannels, $recordingStatusCallback, $recordingStatusCallbackMethod, $sipAuthUsername, $sipAuthPassword, $machineDetection, $machineDetectionTimeout, $recordingStatusCallbackEvent, $trim, $callerId, $machineDetectionSpeechThreshold, $machineDetectionSpeechEndThreshold, $machineDetectionSilenceTimeout, $asyncAmd, $asyncAmdStatusCallback, $asyncAmdStatusCallbackMethod, $byoc, $callReason, $callToken, $recordingTrack, $timeLimit);
}
/**
* @param string $to Phone number or Client identifier of calls to include
* @param string $from Phone number or Client identifier to filter `from` on
* @param string $parentCallSid Parent call SID to filter on
* @param string $status The status of the resources to read
* @param string $startTimeBefore Only include calls that started on this date
* @param string $startTime Only include calls that started on this date
* @param string $startTimeAfter Only include calls that started on this date
* @param string $endTimeBefore Only include calls that ended on this date
* @param string $endTime Only include calls that ended on this date
* @param string $endTimeAfter Only include calls that ended on this date
* @return ReadCallOptions Options builder
*/
public static function read(string $to = Values::NONE, string $from = Values::NONE, string $parentCallSid = Values::NONE, string $status = Values::NONE, string $startTimeBefore = Values::NONE, string $startTime = Values::NONE, string $startTimeAfter = Values::NONE, string $endTimeBefore = Values::NONE, string $endTime = Values::NONE, string $endTimeAfter = Values::NONE): ReadCallOptions {
return new ReadCallOptions($to, $from, $parentCallSid, $status, $startTimeBefore, $startTime, $startTimeAfter, $endTimeBefore, $endTime, $endTimeAfter);
}
/**
* @param string $url The absolute URL that returns TwiML for this call
* @param string $method HTTP method to use to fetch TwiML
* @param string $status The new status to update the call with.
* @param string $fallbackUrl Fallback URL in case of error
* @param string $fallbackMethod HTTP Method to use with fallback_url
* @param string $statusCallback The URL we should call to send status
* information to your application
* @param string $statusCallbackMethod HTTP Method to use to call
* status_callback
* @param string $twiml TwiML instructions for the call
* @param int $timeLimit The maximum duration of the call in seconds.
* @return UpdateCallOptions Options builder
*/
public static function update(string $url = Values::NONE, string $method = Values::NONE, string $status = Values::NONE, string $fallbackUrl = Values::NONE, string $fallbackMethod = Values::NONE, string $statusCallback = Values::NONE, string $statusCallbackMethod = Values::NONE, string $twiml = Values::NONE, int $timeLimit = Values::NONE): UpdateCallOptions {
return new UpdateCallOptions($url, $method, $status, $fallbackUrl, $fallbackMethod, $statusCallback, $statusCallbackMethod, $twiml, $timeLimit);
}
}
class CreateCallOptions extends Options {
/**
* @param string $url The absolute URL that returns TwiML for this call
* @param string $twiml TwiML instructions for the call
* @param string $applicationSid The SID of the Application resource that will
* handle the call
* @param string $method HTTP method to use to fetch TwiML
* @param string $fallbackUrl Fallback URL in case of error
* @param string $fallbackMethod HTTP Method to use with fallback_url
* @param string $statusCallback The URL we should call to send status
* information to your application
* @param string[] $statusCallbackEvent The call progress events that we send
* to the `status_callback` URL.
* @param string $statusCallbackMethod HTTP Method to use with status_callback
* @param string $sendDigits The digits to dial after connecting to the number
* @param int $timeout Number of seconds to wait for an answer
* @param bool $record Whether to record the call
* @param string $recordingChannels The number of channels in the final
* recording
* @param string $recordingStatusCallback The URL that we call when the
* recording is available to be accessed
* @param string $recordingStatusCallbackMethod The HTTP method we should use
* when calling the
* `recording_status_callback` URL
* @param string $sipAuthUsername The username used to authenticate the caller
* making a SIP call
* @param string $sipAuthPassword The password required to authenticate the
* user account specified in `sip_auth_username`.
* @param string $machineDetection Enable machine detection or end of greeting
* detection
* @param int $machineDetectionTimeout Number of seconds to wait for machine
* detection
* @param string[] $recordingStatusCallbackEvent The recording status events
* that will trigger calls to the
* URL specified in
* `recording_status_callback`
* @param string $trim Set this parameter to control trimming of silence on the
* recording.
* @param string $callerId The phone number, SIP address, or Client identifier
* that made this call. Phone numbers are in E.164
* format (e.g., +16175551212). SIP addresses are
* formatted as `name@company.com`.
* @param int $machineDetectionSpeechThreshold Number of milliseconds for
* measuring stick for the length
* of the speech activity
* @param int $machineDetectionSpeechEndThreshold Number of milliseconds of
* silence after speech activity
* @param int $machineDetectionSilenceTimeout Number of milliseconds of initial
* silence
* @param string $asyncAmd Enable asynchronous AMD
* @param string $asyncAmdStatusCallback The URL we should call to send amd
* status information to your application
* @param string $asyncAmdStatusCallbackMethod HTTP Method to use with
* async_amd_status_callback
* @param string $byoc BYOC trunk SID (Beta)
* @param string $callReason Reason for the call (Branded Calls Beta)
* @param string $callToken A token string needed to invoke a forwarded call
* with a CallerId recieved on a previous incoming call
* @param string $recordingTrack Which track(s) to record
* @param int $timeLimit The maximum duration of the call in seconds.
*/
public function __construct(string $url = Values::NONE, string $twiml = Values::NONE, string $applicationSid = Values::NONE, string $method = Values::NONE, string $fallbackUrl = Values::NONE, string $fallbackMethod = Values::NONE, string $statusCallback = Values::NONE, array $statusCallbackEvent = Values::ARRAY_NONE, string $statusCallbackMethod = Values::NONE, string $sendDigits = Values::NONE, int $timeout = Values::NONE, bool $record = Values::NONE, string $recordingChannels = Values::NONE, string $recordingStatusCallback = Values::NONE, string $recordingStatusCallbackMethod = Values::NONE, string $sipAuthUsername = Values::NONE, string $sipAuthPassword = Values::NONE, string $machineDetection = Values::NONE, int $machineDetectionTimeout = Values::NONE, array $recordingStatusCallbackEvent = Values::ARRAY_NONE, string $trim = Values::NONE, string $callerId = Values::NONE, int $machineDetectionSpeechThreshold = Values::NONE, int $machineDetectionSpeechEndThreshold = Values::NONE, int $machineDetectionSilenceTimeout = Values::NONE, string $asyncAmd = Values::NONE, string $asyncAmdStatusCallback = Values::NONE, string $asyncAmdStatusCallbackMethod = Values::NONE, string $byoc = Values::NONE, string $callReason = Values::NONE, string $callToken = Values::NONE, string $recordingTrack = Values::NONE, int $timeLimit = Values::NONE) {
$this->options['url'] = $url;
$this->options['twiml'] = $twiml;
$this->options['applicationSid'] = $applicationSid;
$this->options['method'] = $method;
$this->options['fallbackUrl'] = $fallbackUrl;
$this->options['fallbackMethod'] = $fallbackMethod;
$this->options['statusCallback'] = $statusCallback;
$this->options['statusCallbackEvent'] = $statusCallbackEvent;
$this->options['statusCallbackMethod'] = $statusCallbackMethod;
$this->options['sendDigits'] = $sendDigits;
$this->options['timeout'] = $timeout;
$this->options['record'] = $record;
$this->options['recordingChannels'] = $recordingChannels;
$this->options['recordingStatusCallback'] = $recordingStatusCallback;
$this->options['recordingStatusCallbackMethod'] = $recordingStatusCallbackMethod;
$this->options['sipAuthUsername'] = $sipAuthUsername;
$this->options['sipAuthPassword'] = $sipAuthPassword;
$this->options['machineDetection'] = $machineDetection;
$this->options['machineDetectionTimeout'] = $machineDetectionTimeout;
$this->options['recordingStatusCallbackEvent'] = $recordingStatusCallbackEvent;
$this->options['trim'] = $trim;
$this->options['callerId'] = $callerId;
$this->options['machineDetectionSpeechThreshold'] = $machineDetectionSpeechThreshold;
$this->options['machineDetectionSpeechEndThreshold'] = $machineDetectionSpeechEndThreshold;
$this->options['machineDetectionSilenceTimeout'] = $machineDetectionSilenceTimeout;
$this->options['asyncAmd'] = $asyncAmd;
$this->options['asyncAmdStatusCallback'] = $asyncAmdStatusCallback;
$this->options['asyncAmdStatusCallbackMethod'] = $asyncAmdStatusCallbackMethod;
$this->options['byoc'] = $byoc;
$this->options['callReason'] = $callReason;
$this->options['callToken'] = $callToken;
$this->options['recordingTrack'] = $recordingTrack;
$this->options['timeLimit'] = $timeLimit;
}
/**
* The absolute URL that returns the TwiML instructions for the call. We will call this URL using the `method` when the call connects. For more information, see the [Url Parameter](https://www.twilio.com/docs/voice/make-calls#specify-a-url-parameter) section in [Making Calls](https://www.twilio.com/docs/voice/make-calls).
*
* @param string $url The absolute URL that returns TwiML for this call
* @return $this Fluent Builder
*/
public function setUrl(string $url): self {
$this->options['url'] = $url;
return $this;
}
/**
* TwiML instructions for the call Twilio will use without fetching Twiml from url parameter. If both `twiml` and `url` are provided then `twiml` parameter will be ignored. Max 4000 characters.
*
* @param string $twiml TwiML instructions for the call
* @return $this Fluent Builder
*/
public function setTwiml(string $twiml): self {
$this->options['twiml'] = $twiml;
return $this;
}
/**
* The SID of the Application resource that will handle the call, if the call will be handled by an application.
*
* @param string $applicationSid The SID of the Application resource that will
* handle the call
* @return $this Fluent Builder
*/
public function setApplicationSid(string $applicationSid): self {
$this->options['applicationSid'] = $applicationSid;
return $this;
}
/**
* The HTTP method we should use when calling the `url` parameter's value. Can be: `GET` or `POST` and the default is `POST`. If an `application_sid` parameter is present, this parameter is ignored.
*
* @param string $method HTTP method to use to fetch TwiML
* @return $this Fluent Builder
*/
public function setMethod(string $method): self {
$this->options['method'] = $method;
return $this;
}
/**
* The URL that we call using the `fallback_method` if an error occurs when requesting or executing the TwiML at `url`. If an `application_sid` parameter is present, this parameter is ignored.
*
* @param string $fallbackUrl Fallback URL in case of error
* @return $this Fluent Builder
*/
public function setFallbackUrl(string $fallbackUrl): self {
$this->options['fallbackUrl'] = $fallbackUrl;
return $this;
}
/**
* The HTTP method that we should use to request the `fallback_url`. Can be: `GET` or `POST` and the default is `POST`. If an `application_sid` parameter is present, this parameter is ignored.
*
* @param string $fallbackMethod HTTP Method to use with fallback_url
* @return $this Fluent Builder
*/
public function setFallbackMethod(string $fallbackMethod): self {
$this->options['fallbackMethod'] = $fallbackMethod;
return $this;
}
/**
* The URL we should call using the `status_callback_method` to send status information to your application. If no `status_callback_event` is specified, we will send the `completed` status. If an `application_sid` parameter is present, this parameter is ignored. URLs must contain a valid hostname (underscores are not permitted).
*
* @param string $statusCallback The URL we should call to send status
* information to your application
* @return $this Fluent Builder
*/
public function setStatusCallback(string $statusCallback): self {
$this->options['statusCallback'] = $statusCallback;
return $this;
}
/**
* The call progress events that we will send to the `status_callback` URL. Can be: `initiated`, `ringing`, `answered`, and `completed`. If no event is specified, we send the `completed` status. If you want to receive multiple events, specify each one in a separate `status_callback_event` parameter. See the code sample for [monitoring call progress](https://www.twilio.com/docs/voice/api/call-resource?code-sample=code-create-a-call-resource-and-specify-a-statuscallbackevent&code-sdk-version=json). If an `application_sid` is present, this parameter is ignored.
*
* @param string[] $statusCallbackEvent The call progress events that we send
* to the `status_callback` URL.
* @return $this Fluent Builder
*/
public function setStatusCallbackEvent(array $statusCallbackEvent): self {
$this->options['statusCallbackEvent'] = $statusCallbackEvent;
return $this;
}
/**
* The HTTP method we should use when calling the `status_callback` URL. Can be: `GET` or `POST` and the default is `POST`. If an `application_sid` parameter is present, this parameter is ignored.
*
* @param string $statusCallbackMethod HTTP Method to use with status_callback
* @return $this Fluent Builder
*/
public function setStatusCallbackMethod(string $statusCallbackMethod): self {
$this->options['statusCallbackMethod'] = $statusCallbackMethod;
return $this;
}
/**
* A string of keys to dial after connecting to the number, maximum of 32 digits. Valid digits in the string include: any digit (`0`-`9`), '`#`', '`*`' and '`w`', to insert a half second pause. For example, if you connected to a company phone number and wanted to pause for one second, and then dial extension 1234 followed by the pound key, the value of this parameter would be `ww1234#`. Remember to URL-encode this string, since the '`#`' character has special meaning in a URL. If both `SendDigits` and `MachineDetection` parameters are provided, then `MachineDetection` will be ignored.
*
* @param string $sendDigits The digits to dial after connecting to the number
* @return $this Fluent Builder
*/
public function setSendDigits(string $sendDigits): self {
$this->options['sendDigits'] = $sendDigits;
return $this;
}
/**
* The integer number of seconds that we should allow the phone to ring before assuming there is no answer. The default is `60` seconds and the maximum is `600` seconds. For some call flows, we will add a 5-second buffer to the timeout value you provide. For this reason, a timeout value of 10 seconds could result in an actual timeout closer to 15 seconds. You can set this to a short time, such as `15` seconds, to hang up before reaching an answering machine or voicemail.
*
* @param int $timeout Number of seconds to wait for an answer
* @return $this Fluent Builder
*/
public function setTimeout(int $timeout): self {
$this->options['timeout'] = $timeout;
return $this;
}
/**
* Whether to record the call. Can be `true` to record the phone call, or `false` to not. The default is `false`. The `recording_url` is sent to the `status_callback` URL.
*
* @param bool $record Whether to record the call
* @return $this Fluent Builder
*/
public function setRecord(bool $record): self {
$this->options['record'] = $record;
return $this;
}
/**
* The number of channels in the final recording. Can be: `mono` or `dual`. The default is `mono`. `mono` records both legs of the call in a single channel of the recording file. `dual` records each leg to a separate channel of the recording file. The first channel of a dual-channel recording contains the parent call and the second channel contains the child call.
*
* @param string $recordingChannels The number of channels in the final
* recording
* @return $this Fluent Builder
*/
public function setRecordingChannels(string $recordingChannels): self {
$this->options['recordingChannels'] = $recordingChannels;
return $this;
}
/**
* The URL that we call when the recording is available to be accessed.
*
* @param string $recordingStatusCallback The URL that we call when the
* recording is available to be accessed
* @return $this Fluent Builder
*/
public function setRecordingStatusCallback(string $recordingStatusCallback): self {
$this->options['recordingStatusCallback'] = $recordingStatusCallback;
return $this;
}
/**
* The HTTP method we should use when calling the `recording_status_callback` URL. Can be: `GET` or `POST` and the default is `POST`.
*
* @param string $recordingStatusCallbackMethod The HTTP method we should use
* when calling the
* `recording_status_callback` URL
* @return $this Fluent Builder
*/
public function setRecordingStatusCallbackMethod(string $recordingStatusCallbackMethod): self {
$this->options['recordingStatusCallbackMethod'] = $recordingStatusCallbackMethod;
return $this;
}
/**
* The username used to authenticate the caller making a SIP call.
*
* @param string $sipAuthUsername The username used to authenticate the caller
* making a SIP call
* @return $this Fluent Builder
*/
public function setSipAuthUsername(string $sipAuthUsername): self {
$this->options['sipAuthUsername'] = $sipAuthUsername;
return $this;
}
/**
* The password required to authenticate the user account specified in `sip_auth_username`.
*
* @param string $sipAuthPassword The password required to authenticate the
* user account specified in `sip_auth_username`.
* @return $this Fluent Builder
*/
public function setSipAuthPassword(string $sipAuthPassword): self {
$this->options['sipAuthPassword'] = $sipAuthPassword;
return $this;
}
/**
* Whether to detect if a human, answering machine, or fax has picked up the call. Can be: `Enable` or `DetectMessageEnd`. Use `Enable` if you would like us to return `AnsweredBy` as soon as the called party is identified. Use `DetectMessageEnd`, if you would like to leave a message on an answering machine. If `send_digits` is provided, this parameter is ignored. For more information, see [Answering Machine Detection](https://www.twilio.com/docs/voice/answering-machine-detection).
*
* @param string $machineDetection Enable machine detection or end of greeting
* detection
* @return $this Fluent Builder
*/
public function setMachineDetection(string $machineDetection): self {
$this->options['machineDetection'] = $machineDetection;
return $this;
}
/**
* The number of seconds that we should attempt to detect an answering machine before timing out and sending a voice request with `AnsweredBy` of `unknown`. The default timeout is 30 seconds.
*
* @param int $machineDetectionTimeout Number of seconds to wait for machine
* detection
* @return $this Fluent Builder
*/
public function setMachineDetectionTimeout(int $machineDetectionTimeout): self {
$this->options['machineDetectionTimeout'] = $machineDetectionTimeout;
return $this;
}
/**
* The recording status events that will trigger calls to the URL specified in `recording_status_callback`. Can be: `in-progress`, `completed` and `absent`. Defaults to `completed`. Separate multiple values with a space.
*
* @param string[] $recordingStatusCallbackEvent The recording status events
* that will trigger calls to the
* URL specified in
* `recording_status_callback`
* @return $this Fluent Builder
*/
public function setRecordingStatusCallbackEvent(array $recordingStatusCallbackEvent): self {
$this->options['recordingStatusCallbackEvent'] = $recordingStatusCallbackEvent;
return $this;
}
/**
* Whether to trim any leading and trailing silence from the recording. Can be: `trim-silence` or `do-not-trim` and the default is `trim-silence`.
*
* @param string $trim Set this parameter to control trimming of silence on the
* recording.
* @return $this Fluent Builder
*/
public function setTrim(string $trim): self {
$this->options['trim'] = $trim;
return $this;
}
/**
* The phone number, SIP address, or Client identifier that made this call. Phone numbers are in [E.164 format](https://wwnw.twilio.com/docs/glossary/what-e164) (e.g., +16175551212). SIP addresses are formatted as `name@company.com`.
*
* @param string $callerId The phone number, SIP address, or Client identifier
* that made this call. Phone numbers are in E.164
* format (e.g., +16175551212). SIP addresses are
* formatted as `name@company.com`.
* @return $this Fluent Builder
*/
public function setCallerId(string $callerId): self {
$this->options['callerId'] = $callerId;
return $this;
}
/**
* The number of milliseconds that is used as the measuring stick for the length of the speech activity, where durations lower than this value will be interpreted as a human and longer than this value as a machine. Possible Values: 1000-6000. Default: 2400.
*
* @param int $machineDetectionSpeechThreshold Number of milliseconds for
* measuring stick for the length
* of the speech activity
* @return $this Fluent Builder
*/
public function setMachineDetectionSpeechThreshold(int $machineDetectionSpeechThreshold): self {
$this->options['machineDetectionSpeechThreshold'] = $machineDetectionSpeechThreshold;
return $this;
}
/**
* The number of milliseconds of silence after speech activity at which point the speech activity is considered complete. Possible Values: 500-5000. Default: 1200.
*
* @param int $machineDetectionSpeechEndThreshold Number of milliseconds of
* silence after speech activity
* @return $this Fluent Builder
*/
public function setMachineDetectionSpeechEndThreshold(int $machineDetectionSpeechEndThreshold): self {
$this->options['machineDetectionSpeechEndThreshold'] = $machineDetectionSpeechEndThreshold;
return $this;
}
/**
* The number of milliseconds of initial silence after which an `unknown` AnsweredBy result will be returned. Possible Values: 2000-10000. Default: 5000.
*
* @param int $machineDetectionSilenceTimeout Number of milliseconds of initial
* silence
* @return $this Fluent Builder
*/
public function setMachineDetectionSilenceTimeout(int $machineDetectionSilenceTimeout): self {
$this->options['machineDetectionSilenceTimeout'] = $machineDetectionSilenceTimeout;
return $this;
}
/**
* Select whether to perform answering machine detection in the background. Default, blocks the execution of the call until Answering Machine Detection is completed. Can be: `true` or `false`.
*
* @param string $asyncAmd Enable asynchronous AMD
* @return $this Fluent Builder
*/
public function setAsyncAmd(string $asyncAmd): self {
$this->options['asyncAmd'] = $asyncAmd;
return $this;
}
/**
* The URL that we should call using the `async_amd_status_callback_method` to notify customer application whether the call was answered by human, machine or fax.
*
* @param string $asyncAmdStatusCallback The URL we should call to send amd
* status information to your application
* @return $this Fluent Builder
*/
public function setAsyncAmdStatusCallback(string $asyncAmdStatusCallback): self {
$this->options['asyncAmdStatusCallback'] = $asyncAmdStatusCallback;
return $this;
}
/**
* The HTTP method we should use when calling the `async_amd_status_callback` URL. Can be: `GET` or `POST` and the default is `POST`.
*
* @param string $asyncAmdStatusCallbackMethod HTTP Method to use with
* async_amd_status_callback
* @return $this Fluent Builder
*/
public function setAsyncAmdStatusCallbackMethod(string $asyncAmdStatusCallbackMethod): self {
$this->options['asyncAmdStatusCallbackMethod'] = $asyncAmdStatusCallbackMethod;
return $this;
}
/**
* The SID of a BYOC (Bring Your Own Carrier) trunk to route this call with. Note that `byoc` is only meaningful when `to` is a phone number; it will otherwise be ignored. (Beta)
*
* @param string $byoc BYOC trunk SID (Beta)
* @return $this Fluent Builder
*/
public function setByoc(string $byoc): self {
$this->options['byoc'] = $byoc;
return $this;
}
/**
* The Reason for the outgoing call. Use it to specify the purpose of the call that is presented on the called party's phone. (Branded Calls Beta)
*
* @param string $callReason Reason for the call (Branded Calls Beta)
* @return $this Fluent Builder
*/
public function setCallReason(string $callReason): self {
$this->options['callReason'] = $callReason;
return $this;
}
/**
* A token string needed to invoke a forwarded call. A call_token is generated when an incoming call is received on a Twilio number. Pass an incoming call's call_token value to a forwarded call via the call_token parameter when creating a new call. A forwarded call should bear the same CallerID of the original incoming call.
*
* @param string $callToken A token string needed to invoke a forwarded call
* with a CallerId recieved on a previous incoming call
* @return $this Fluent Builder
*/
public function setCallToken(string $callToken): self {
$this->options['callToken'] = $callToken;
return $this;
}
/**
* The audio track to record for the call. Can be: `inbound`, `outbound` or `both`. The default is `both`. `inbound` records the audio that is received by Twilio. `outbound` records the audio that is generated from Twilio. `both` records the audio that is received and generated by Twilio.
*
* @param string $recordingTrack Which track(s) to record
* @return $this Fluent Builder
*/
public function setRecordingTrack(string $recordingTrack): self {
$this->options['recordingTrack'] = $recordingTrack;
return $this;
}
/**
* The maximum duration of the call in seconds. Constraints depend on account and configuration.
*
* @param int $timeLimit The maximum duration of the call in seconds.
* @return $this Fluent Builder
*/
public function setTimeLimit(int $timeLimit): self {
$this->options['timeLimit'] = $timeLimit;
return $this;
}
/**
* Provide a friendly representation
*
* @return string Machine friendly representation
*/
public function __toString(): string {
$options = \http_build_query(Values::of($this->options), '', ' ');
return '[Twilio.Api.V2010.CreateCallOptions ' . $options . ']';
}
}
class ReadCallOptions extends Options {
/**
* @param string $to Phone number or Client identifier of calls to include
* @param string $from Phone number or Client identifier to filter `from` on
* @param string $parentCallSid Parent call SID to filter on
* @param string $status The status of the resources to read
* @param string $startTimeBefore Only include calls that started on this date
* @param string $startTime Only include calls that started on this date
* @param string $startTimeAfter Only include calls that started on this date
* @param string $endTimeBefore Only include calls that ended on this date
* @param string $endTime Only include calls that ended on this date
* @param string $endTimeAfter Only include calls that ended on this date
*/
public function __construct(string $to = Values::NONE, string $from = Values::NONE, string $parentCallSid = Values::NONE, string $status = Values::NONE, string $startTimeBefore = Values::NONE, string $startTime = Values::NONE, string $startTimeAfter = Values::NONE, string $endTimeBefore = Values::NONE, string $endTime = Values::NONE, string $endTimeAfter = Values::NONE) {
$this->options['to'] = $to;
$this->options['from'] = $from;
$this->options['parentCallSid'] = $parentCallSid;
$this->options['status'] = $status;
$this->options['startTimeBefore'] = $startTimeBefore;
$this->options['startTime'] = $startTime;
$this->options['startTimeAfter'] = $startTimeAfter;
$this->options['endTimeBefore'] = $endTimeBefore;
$this->options['endTime'] = $endTime;
$this->options['endTimeAfter'] = $endTimeAfter;
}
/**
* Only show calls made to this phone number, SIP address, Client identifier or SIM SID.
*
* @param string $to Phone number or Client identifier of calls to include
* @return $this Fluent Builder
*/
public function setTo(string $to): self {
$this->options['to'] = $to;
return $this;
}
/**
* Only include calls from this phone number, SIP address, Client identifier or SIM SID.
*
* @param string $from Phone number or Client identifier to filter `from` on
* @return $this Fluent Builder
*/
public function setFrom(string $from): self {
$this->options['from'] = $from;
return $this;
}
/**
* Only include calls spawned by calls with this SID.
*
* @param string $parentCallSid Parent call SID to filter on
* @return $this Fluent Builder
*/
public function setParentCallSid(string $parentCallSid): self {
$this->options['parentCallSid'] = $parentCallSid;
return $this;
}
/**
* The status of the calls to include. Can be: `queued`, `ringing`, `in-progress`, `canceled`, `completed`, `failed`, `busy`, or `no-answer`.
*
* @param string $status The status of the resources to read
* @return $this Fluent Builder
*/
public function setStatus(string $status): self {
$this->options['status'] = $status;
return $this;
}
/**
* Only include calls that started on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read only calls that started on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read calls that started on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read calls that started on or after midnight of this date.
*
* @param string $startTimeBefore Only include calls that started on this date
* @return $this Fluent Builder
*/
public function setStartTimeBefore(string $startTimeBefore): self {
$this->options['startTimeBefore'] = $startTimeBefore;
return $this;
}
/**
* Only include calls that started on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read only calls that started on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read calls that started on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read calls that started on or after midnight of this date.
*
* @param string $startTime Only include calls that started on this date
* @return $this Fluent Builder
*/
public function setStartTime(string $startTime): self {
$this->options['startTime'] = $startTime;
return $this;
}
/**
* Only include calls that started on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read only calls that started on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read calls that started on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read calls that started on or after midnight of this date.
*
* @param string $startTimeAfter Only include calls that started on this date
* @return $this Fluent Builder
*/
public function setStartTimeAfter(string $startTimeAfter): self {
$this->options['startTimeAfter'] = $startTimeAfter;
return $this;
}
/**
* Only include calls that ended on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read only calls that ended on this date. You can also specify an inequality, such as `EndTime<=YYYY-MM-DD`, to read calls that ended on or before midnight of this date, and `EndTime>=YYYY-MM-DD` to read calls that ended on or after midnight of this date.
*
* @param string $endTimeBefore Only include calls that ended on this date
* @return $this Fluent Builder
*/
public function setEndTimeBefore(string $endTimeBefore): self {
$this->options['endTimeBefore'] = $endTimeBefore;
return $this;
}
/**
* Only include calls that ended on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read only calls that ended on this date. You can also specify an inequality, such as `EndTime<=YYYY-MM-DD`, to read calls that ended on or before midnight of this date, and `EndTime>=YYYY-MM-DD` to read calls that ended on or after midnight of this date.
*
* @param string $endTime Only include calls that ended on this date
* @return $this Fluent Builder
*/
public function setEndTime(string $endTime): self {
$this->options['endTime'] = $endTime;
return $this;
}
/**
* Only include calls that ended on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read only calls that ended on this date. You can also specify an inequality, such as `EndTime<=YYYY-MM-DD`, to read calls that ended on or before midnight of this date, and `EndTime>=YYYY-MM-DD` to read calls that ended on or after midnight of this date.
*
* @param string $endTimeAfter Only include calls that ended on this date
* @return $this Fluent Builder
*/
public function setEndTimeAfter(string $endTimeAfter): self {
$this->options['endTimeAfter'] = $endTimeAfter;
return $this;
}
/**
* Provide a friendly representation
*
* @return string Machine friendly representation
*/
public function __toString(): string {
$options = \http_build_query(Values::of($this->options), '', ' ');
return '[Twilio.Api.V2010.ReadCallOptions ' . $options . ']';
}
}
class UpdateCallOptions extends Options {
/**
* @param string $url The absolute URL that returns TwiML for this call
* @param string $method HTTP method to use to fetch TwiML
* @param string $status The new status to update the call with.
* @param string $fallbackUrl Fallback URL in case of error
* @param string $fallbackMethod HTTP Method to use with fallback_url
* @param string $statusCallback The URL we should call to send status
* information to your application
* @param string $statusCallbackMethod HTTP Method to use to call
* status_callback
* @param string $twiml TwiML instructions for the call
* @param int $timeLimit The maximum duration of the call in seconds.
*/
public function __construct(string $url = Values::NONE, string $method = Values::NONE, string $status = Values::NONE, string $fallbackUrl = Values::NONE, string $fallbackMethod = Values::NONE, string $statusCallback = Values::NONE, string $statusCallbackMethod = Values::NONE, string $twiml = Values::NONE, int $timeLimit = Values::NONE) {
$this->options['url'] = $url;
$this->options['method'] = $method;
$this->options['status'] = $status;
$this->options['fallbackUrl'] = $fallbackUrl;
$this->options['fallbackMethod'] = $fallbackMethod;
$this->options['statusCallback'] = $statusCallback;
$this->options['statusCallbackMethod'] = $statusCallbackMethod;
$this->options['twiml'] = $twiml;
$this->options['timeLimit'] = $timeLimit;
}
/**
* The absolute URL that returns the TwiML instructions for the call. We will call this URL using the `method` when the call connects. For more information, see the [Url Parameter](https://www.twilio.com/docs/voice/make-calls#specify-a-url-parameter) section in [Making Calls](https://www.twilio.com/docs/voice/make-calls).
*
* @param string $url The absolute URL that returns TwiML for this call
* @return $this Fluent Builder
*/
public function setUrl(string $url): self {
$this->options['url'] = $url;
return $this;
}
/**
* The HTTP method we should use when calling the `url`. Can be: `GET` or `POST` and the default is `POST`. If an `application_sid` parameter is present, this parameter is ignored.
*
* @param string $method HTTP method to use to fetch TwiML
* @return $this Fluent Builder
*/
public function setMethod(string $method): self {
$this->options['method'] = $method;
return $this;
}
/**
* The new status of the resource. Can be: `canceled` or `completed`. Specifying `canceled` will attempt to hang up calls that are queued or ringing; however, it will not affect calls already in progress. Specifying `completed` will attempt to hang up a call even if it's already in progress.
*
* @param string $status The new status to update the call with.
* @return $this Fluent Builder
*/
public function setStatus(string $status): self {
$this->options['status'] = $status;
return $this;
}
/**
* The URL that we call using the `fallback_method` if an error occurs when requesting or executing the TwiML at `url`. If an `application_sid` parameter is present, this parameter is ignored.
*
* @param string $fallbackUrl Fallback URL in case of error
* @return $this Fluent Builder
*/
public function setFallbackUrl(string $fallbackUrl): self {
$this->options['fallbackUrl'] = $fallbackUrl;
return $this;
}
/**
* The HTTP method that we should use to request the `fallback_url`. Can be: `GET` or `POST` and the default is `POST`. If an `application_sid` parameter is present, this parameter is ignored.
*
* @param string $fallbackMethod HTTP Method to use with fallback_url
* @return $this Fluent Builder
*/
public function setFallbackMethod(string $fallbackMethod): self {
$this->options['fallbackMethod'] = $fallbackMethod;
return $this;
}
/**
* The URL we should call using the `status_callback_method` to send status information to your application. If no `status_callback_event` is specified, we will send the `completed` status. If an `application_sid` parameter is present, this parameter is ignored. URLs must contain a valid hostname (underscores are not permitted).
*
* @param string $statusCallback The URL we should call to send status
* information to your application
* @return $this Fluent Builder
*/
public function setStatusCallback(string $statusCallback): self {
$this->options['statusCallback'] = $statusCallback;
return $this;
}
/**
* The HTTP method we should use when requesting the `status_callback` URL. Can be: `GET` or `POST` and the default is `POST`. If an `application_sid` parameter is present, this parameter is ignored.
*
* @param string $statusCallbackMethod HTTP Method to use to call
* status_callback
* @return $this Fluent Builder
*/
public function setStatusCallbackMethod(string $statusCallbackMethod): self {
$this->options['statusCallbackMethod'] = $statusCallbackMethod;
return $this;
}
/**
* TwiML instructions for the call Twilio will use without fetching Twiml from url. Twiml and url parameters are mutually exclusive
*
* @param string $twiml TwiML instructions for the call
* @return $this Fluent Builder
*/
public function setTwiml(string $twiml): self {
$this->options['twiml'] = $twiml;
return $this;
}
/**
* The maximum duration of the call in seconds. Constraints depend on account and configuration.
*
* @param int $timeLimit The maximum duration of the call in seconds.
* @return $this Fluent Builder
*/
public function setTimeLimit(int $timeLimit): self {
$this->options['timeLimit'] = $timeLimit;
return $this;
}
/**
* Provide a friendly representation
*
* @return string Machine friendly representation
*/
public function __toString(): string {
$options = \http_build_query(Values::of($this->options), '', ' ');
return '[Twilio.Api.V2010.UpdateCallOptions ' . $options . ']';
}
} |