diff --git a/composer.json b/composer.json index 2724c12..ebfe783 100644 --- a/composer.json +++ b/composer.json @@ -31,10 +31,10 @@ "require": { "php": ">=7.2|^8.0", "twilio/sdk": "~6.0|^7.16", - "illuminate/notifications": "^7.0 || ^8.0 || ^9.0 || ^10.0|^11.0", - "illuminate/support": "^7.0 || ^8.0 || ^9.0 || ^10.0|^11.0", - "illuminate/events": "^7.0 || ^8.0 || ^9.0 || ^10.0|^11.0", - "illuminate/queue": "^7.0 || ^8.0 || ^9.0 || ^10.0|^11.0" + "illuminate/notifications": "^7.0 || ^8.0 || ^9.0 || ^10.0|^11.0|^12.0", + "illuminate/support": "^7.0 || ^8.0 || ^9.0 || ^10.0|^11.0|^12.0", + "illuminate/events": "^7.0 || ^8.0 || ^9.0 || ^10.0|^11.0|^12.0", + "illuminate/queue": "^7.0 || ^8.0 || ^9.0 || ^10.0|^11.0|^12.0" }, "require-dev": { "mockery/mockery": "^1.3", diff --git a/src/Twilio.php b/src/Twilio.php index 76b6d62..d015885 100644 --- a/src/Twilio.php +++ b/src/Twilio.php @@ -136,6 +136,7 @@ protected function makeCall(TwilioCallMessage $message, ?string $to): CallInstan 'status', 'fallbackUrl', 'fallbackMethod', + 'machineDetection', ]); if (! $from = $this->getFrom($message)) { diff --git a/src/TwilioCallMessage.php b/src/TwilioCallMessage.php index da4b160..b3a8970 100755 --- a/src/TwilioCallMessage.php +++ b/src/TwilioCallMessage.php @@ -7,6 +7,9 @@ class TwilioCallMessage extends TwilioMessage public const STATUS_CANCELED = 'canceled'; public const STATUS_COMPLETED = 'completed'; + public const MACHINE_DETECTION_ENABLE = 'Enable'; + public const MACHINE_DETECTION_DETECT_MESSAGE_END = 'DetectMessageEnd'; + /** * @var null|string */ @@ -27,6 +30,11 @@ class TwilioCallMessage extends TwilioMessage */ public $fallbackMethod; + /** + * @var null|string + */ + public $machineDetection; + /** * Set the message url. * @@ -91,4 +99,17 @@ public function fallbackMethod(string $fallbackMethod): self return $this; } + + /** + * Set the answering machine detection mode. + * + * @param string $machineDetection + * @return $this + */ + public function machineDetection(string $machineDetection): self + { + $this->machineDetection = $machineDetection; + + return $this; + } } diff --git a/tests/Unit/TwilioCallMessageTest.php b/tests/Unit/TwilioCallMessageTest.php index 38ee9f7..ec83a53 100644 --- a/tests/Unit/TwilioCallMessageTest.php +++ b/tests/Unit/TwilioCallMessageTest.php @@ -50,6 +50,7 @@ public function it_can_set_optional_parameters() $message->statusCallbackMethod('PUT'); $message->fallbackUrl('http://example.com'); $message->fallbackMethod('PUT'); + $message->machineDetection(TwilioCallMessage::MACHINE_DETECTION_ENABLE); $this->assertEquals(TwilioCallMessage::STATUS_CANCELED, $message->status); $this->assertEquals('PUT', $message->method); @@ -57,5 +58,6 @@ public function it_can_set_optional_parameters() $this->assertEquals('PUT', $message->statusCallbackMethod); $this->assertEquals('http://example.com', $message->fallbackUrl); $this->assertEquals('PUT', $message->fallbackMethod); + $this->assertEquals(TwilioCallMessage::MACHINE_DETECTION_ENABLE, $message->machineDetection); } }