Ejemplo n.º 1
0
 public static function genRoute($context, $exten, $type, $dest)
 {
     switch ($type) {
         case 'hangup':
             return "Hangup";
             break;
         case 'forward':
             return "Forward - " . $this->attributes['dest_target'];
             break;
         case 'extension':
             return "Extenstion - ";
             break;
         case 'ivr':
             return "Auto Attendant - ";
             break;
         case 'ringgroup':
             return "Ring Group - ";
             break;
         case 'schedule':
             return "Schedule - ";
             break;
         case 'confbridge':
             $Conf = ConferenceBridge::find($dest);
             Extension::create(['context' => $context, 'exten' => $exten, 'priority' => '1', 'app' => 'Answer', 'appdata' => '', 'customer' => Auth::user()->customer]);
             $priority = 2;
             if ($Conf->conf_auth) {
                 Extension::create(['context' => $context, 'exten' => $exten, 'priority' => $priority, 'app' => 'Authenticate', 'appdata' => $Conf->conf_auth, 'customer' => Auth::user()->customer]);
                 $priority++;
             }
             Extension::create(['context' => $context, 'exten' => $exten, 'priority' => $priority, 'app' => 'ConfBridge', 'appdata' => Auth::user()->customer . '_' . $Conf->conf_name, 'customer' => Auth::user()->customer]);
             break;
         case 'voicemail':
             return "Voicemail - ";
             break;
         case 'queue':
             return "Queue - ";
             break;
         case 'busy':
             return "Busy";
             break;
         default:
             return "Error";
             break;
     }
 }
Ejemplo n.º 2
0
 public function buildDialPlan()
 {
     Extension::where('customer', Auth::user()->customer)->where('context', Auth::user()->Customer->internal_context)->where('exten', $this->exten)->delete();
     switch ($this->getType()) {
         case 'Ring All':
             $Ring = array();
             $tmp = json_decode($this->rg_members, true);
             foreach ($tmp as $u) {
                 array_push($Ring, 'SIP/' . User::find($u)->SIPPeer->name);
             }
             Extension::create(['context' => Auth::user()->Customer->internal_context, 'exten' => $this->exten, 'priority' => 1, 'app' => 'Dial', 'appdata' => implode('&', $Ring) . ',' . $this->rg_time, 'customer' => Auth::user()->customer]);
             Extension::create(['context' => Auth::user()->Customer->internal_context, 'exten' => $this->exten, 'priority' => 2, 'app' => $this->getDefaultApp(), 'appdata' => $this->getDefaultAppData(), 'customer' => Auth::user()->customer]);
             break;
         case 'Hunt':
             break;
     }
 }