Ejemplo n.º 1
0
     }
     break;
 case 'recording':
     if (isset($_REQUEST['testing'])) {
         // ?? what is this?
         break;
     }
     $dialer->add_voice_message();
     break;
 default:
     // rolling through users, populate dial list from state
     #$class = $dialer->state['type']; // state tells us wether its a DialList or DialListUser object
     #$dial_list = $class::load($dialer->state);
     // more verbose to be compatible with older versions of PHP
     if ($dialer->state['type'] == 'DialList') {
         $dial_list = DialList::load($dialer->state);
     } else {
         $dial_list = DialListUser::load($dialer->state);
     }
     // get the next valid user
     $dialed = false;
     do {
         $to_dial = $dial_list->next();
         if ($to_dial instanceof VBX_User || $to_dial instanceof VBX_Device) {
             $dialed = $dialer->dial($to_dial);
             if ($dialed) {
                 $dialer->state = $dial_list->get_state();
             }
         }
     } while (!$dialed && ($to_dial instanceof VBX_User || $to_dial instanceof VBX_Device));
     if (!$dialed) {
Ejemplo n.º 2
0
 */
try {
    switch ($dialer->state) {
        case 'voicemail':
            $dialer->noanswer();
            break;
        case 'hangup':
            $dialer->hangup();
            break;
        case 'recording':
            $dialer->add_voice_message();
            break;
        default:
            if ($dialer->dial_whom_selector === 'user-or-group') {
                // create a dial list from the input state
                $dial_list = DialList::get($dialer->dial_whom_user_or_group);
                while (count($dial_list)) {
                    $to_dial = $dial_list->next();
                    if ($to_dial instanceof VBX_Device) {
                        $dialed = $dialer->dial($to_dial);
                    }
                }
                if (!$dialed) {
                    // nobody to call, push directly to voicemail
                    $dialer->noanswer();
                }
            } elseif ($dialer->dial_whom_selector === 'number') {
                $dialer->dial($dialer->dial_whom_number);
            }
            break;
    }