skip to Main Content

We are getting automated calls coming to twillio. We do have openvbx installed. I am trying to figure out how I can block calls with incoming DID that have 111, 110, or 101 in the beginning. I know how to input static numbers in openvbx and I can successfully block them.

Any help would be appreciated.

2

Answers


  1. Chosen as BEST ANSWER

    I guess there is no support for openvbx on here and from twilio. To post a question here on stackoverflow and tag it openvbx it said I needed to have a certain number of points. I am new to this so my account has no points.

    Anyways I solved my own question. Here is the explanation to other users looking for a similar solution.

    You need to edit plugins/standard/applets/start/twiml.php in your openvbx installation and make it the code below. I hope there is more support out there for openvbx.

    <?php 
    $ci =& get_instance();
    $list = AppletInstance::getValue('list');
    $direction = isset($_REQUEST['Direction']) ? $_REQUEST['Direction'] : 'inbound';
    
    
    // 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('+112345678910');
    
    //pattern analysis to block DIDs
    $patterns = array('111','110','101','+111','+110','+101');
    $position = 0;
    foreach ($patterns as $pattern) {
     if( $position = strpos(' ' . $caller, $pattern)) {
        if( $position == 1 ) $response->reject(array('reason' => 'busy'));
    
      }
    
    }
    
    if (in_array($caller, $block_list)) {
            $response->reject(array('reason' => 'busy'));
    
    }else{
            $next = AppletInstance::getDropZoneUrl('next');
            if (!empty($next)) {
                    $response->redirect($next);
            }
    }
    $response->respond();
    ?>
    

  2. Hi Twilio Customer Support here.

    Have you thought about using the Twilio verb? It will allow you to build a list of numbers you do not wish to receive calls from:

    https://www.twilio.com/docs/api/twiml/reject

    https://www.twilio.com/docs/howto/reject

    Regards,
    Tom

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search