Problem:
Every week I get an automated call from some number to my Twilio number. It is very annoying and I don't want to pay (even a penny) every time this caller tries to dial my number.
Solution (Kind of):
When talking to Twilio support and suggesting that they allow you the control to deny numbers from ever reaching your numbers (block list) and therefore reducing harassment and saving precious pennies, they said such a system is not in place. One support rep noticed I was using the OpenVBX and shot me some PHP to reject this number.
I think this will only prevent the number from getting routed through your system, but you will still have to pay for each time these people call. (I'm fairly certain here, but I will verify and correct myself if found otherwise).
In order to block a number in OpenVBX you would need to modify this OpenVBX source file:
plugins/standard/applets/start/twiml.php
// block calls
$caller = normalize_phone_to_E164(isset($_REQUEST['From'])? $ci->input->get_post('From') : '');
$response = new TwimlResponse;
// Update this list of numbers
$block_list = array('+16146526398');
if (in_array($caller, $block_list)){
$response->reject(array('reason' => 'rejected'));
}else{
$next = AppletInstance::getDropZoneUrl('next');
if (!empty($next)) {
$response->redirect($next);
}
}
$response->respond();