Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions src/Twilio.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ protected function makeCall(TwilioCallMessage $message, ?string $to): CallInstan
'status',
'fallbackUrl',
'fallbackMethod',
'machineDetection',
]);

if (! $from = $this->getFrom($message)) {
Expand Down
21 changes: 21 additions & 0 deletions src/TwilioCallMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand All @@ -27,6 +30,11 @@ class TwilioCallMessage extends TwilioMessage
*/
public $fallbackMethod;

/**
* @var null|string
*/
public $machineDetection;

/**
* Set the message url.
*
Expand Down Expand Up @@ -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;
}
}
2 changes: 2 additions & 0 deletions tests/Unit/TwilioCallMessageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,14 @@ 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);
$this->assertEquals('http://example.com', $message->statusCallback);
$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);
}
}