public function rebuildConference()
 {
     //move to rebuild method on model
     $Extensions = Extension::where('app', 'ConfBridge')->where('appdata', Auth::user()->customer . '_' . $this->conf_name)->where('customer', Auth::user()->customer)->get();
     foreach ($Extensions as $Extension) {
         Extension::where('context', $Extension->context)->where('exten', $Extension->exten)->where('customer', Auth::user()->customer)->delete();
         AsteriskController::genRoute($Extension->context, $Extension->exten, 'confbridge', $this->id);
     }
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Requests\CreateSpeedDialRequest $request)
 {
     $SpeedDial = SpeedDial::create(['customer' => Auth::user()->customer, 'sd_exten' => $request->input('sd_extension'), 'sd_dest_type' => $request->input('destination_type')]);
     UsedExtension::create(['customer' => Auth::user()->customer, 'extension' => $request->input('sd_extension')]);
     switch ($request->input('destination_type')) {
         case 'hangup':
             $SpeedDial->sd_dest = '';
             break;
         case 'forward':
             $SpeedDial->sd_dest = $request->input('forward');
             break;
         case 'extension':
             $SpeedDial->sd_dest = $request->input('extension');
             break;
         case 'ivr':
             $SpeedDial->sd_dest = $request->input('ivr');
             break;
         case 'ringgroup':
             $SpeedDial->sd_dest = $request->input('ringgroup');
             break;
         case 'schedule':
             $SpeedDial->sd_dest = $request->input('schedule');
             break;
         case 'confbridge':
             $SpeedDial->sd_dest = $request->input('confbridge');
             break;
         case 'voicemail':
             $SpeedDial->sd_dest = $request->input('voicemail');
             break;
         case 'queue':
             $SpeedDial->sd_dest = $request->input('queue');
             break;
         case 'busy':
             $SpeedDial->sd_dest = '';
             break;
         default:
             $SpeedDial->sd_dest = '';
             break;
     }
     $SpeedDial->save();
     AsteriskController::genRoute(Auth::user()->Customer->internal_context, $SpeedDial->sd_exten, $SpeedDial->sd_dest_type, $SpeedDial->sd_dest);
     //$SpeedDial->buildDialPlan();
     \Session::flash('success_message', "Speed Dial created");
     return redirect('/speeddials');
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Requests\ConferenceBridgeRequest $request)
 {
     $Bridge = ConferenceBridge::create(['customer' => Auth::user()->customer, 'conf_name' => $request->input('conf_name'), 'conf_auth' => $request->input('conf_auth')]);
     if ($request->input('conf_extension')) {
         AsteriskController::genRoute(Auth::user()->Customer->internal_context, $request->input('conf_extension'), 'confbridge', $Bridge->id);
         /*Extension::firstOrCreate([
               'context' => Auth::user()->Customer->internal_context,
               'exten' => $request->conf_extension,
               'priority' => '1',
               'app' => 'Answer',
               'appdata' => '',
               'customer' => Auth::user()->customer
           ]);
           $priority=2;
           if($request->input('conf_auth')){
               Extension::firstOrCreate([
                   'context' => Auth::user()->Customer->internal_context,
                   'exten' => $request->conf_extension,
                   'priority' => $priority,
                   'app' => 'Authenticate',
                   'appdata' => $request->input('conf_auth'),
               'customer' => Auth::user()->customer
               ]);
               $priority++;
           }
           Extension::firstOrCreate([
               'context' => Auth::user()->Customer->internal_context,
               'exten' => $request->conf_extension,
               'priority' => $priority,
               'app' => 'ConfBridge',
               'appdata' => Auth::user()->customer.'_'.$request->input('conf_name'),
               'customer' => Auth::user()->customer
           ]);*/
         UsedExtension::create(['customer' => Auth::user()->customer, 'extension' => $request->input('conf_extension')]);
     }
     return redirect('/conf');
 }