Skip to content

Commit 39eb20c

Browse files
author
Zachary Scally
committed
Added AMD option for machine detection
1 parent 1219ce6 commit 39eb20c

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

PHP/flood.php

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,19 @@ class flood
2727
*/
2828
const TWILIO_XML_PAYLOAD = 'https://twimlets.com/holdmusic?Bucket=com.twilio.music.ambient';
2929

30+
/**
31+
* This property is use full for detecting answaring machines and possible avoiding a honey pot.
32+
* when using this property, you'd have to have logic on your XML payload on how to handle the call
33+
* it is not intuitive to just hang up the CALL on what it detects.
34+
* https://www.twilio.com/docs/api/rest/answering-machine-detection
35+
* https://support.twilio.com/hc/en-us/articles/223132567-Can-Twilio-tell-whether-a-call-was-answered-by-a-human-or-machine-
36+
*
37+
* By enabling this you are spending $0.0075 but could be saying alot more if your creating 15min voice mails...
38+
*
39+
* @var bool;
40+
*/
41+
const TWILIO_AMD_ENABLED = false;
42+
3043
/**
3144
* Twilio Account SID
3245
* Twiilo Auth Token
@@ -101,7 +114,7 @@ public function __construct($args)
101114
} else {
102115
print("The First Argument must be a phone number to flood. (make sure you add +1 or country code to the number).\n");
103116
}
104-
117+
105118
}
106119

107120
/**
@@ -118,8 +131,9 @@ private function call($fromNumber)
118131
$this->numberToCall, // Call this number
119132
$fromNumber, // From a valid Twilio number
120133
array(
121-
'Record' => true,
122-
'url' => self::TWILIO_XML_PAYLOAD
134+
'Record' => true,
135+
'url' => self::TWILIO_XML_PAYLOAD,
136+
'MachineDetection' => self::TWILIO_AMD_ENABLED
123137
)
124138
);
125139

@@ -192,4 +206,4 @@ protected function showLogo()
192206

193207
//include the composer autoloader
194208
require_once('vendor/autoload.php');
195-
new flood($argv);
209+
new flood($argv);

0 commit comments

Comments
 (0)