public function hangUpConversation($request, $response)
 {/*{{{*/
     $curOperator = DAL::get()->find_by_userid("TeleOperator", $this->curUser->id);
     if ($curOperator->isNull())
     {
         throw new TelConfException('您没有开通坐席功能请联系管理员开通!');
     }
     $conversationId = $request->conversationid;
     if(false == empty($conversationId))
     {
         TeleConversationClient::getInstance()->operatorEndConversation($curOperator, $conversationId);
     }
     return parent::DIRECT_OUTPUT;
 }/*}}}*/
 public function attendance($request, $response)
 {
     /*{{{*/
     $options = array();
     $queueId = $request->queueId;
     $workId = $request->workId;
     $queueList = $this->curOperator->returnServiceQueues();
     $workIds = DAL::get()->queryWorkIds('TeleOperator', array_keys($queueList));
     $fromDate = $request->fromDate;
     $toDate = $request->toDate;
     $fromDate = empty($fromDate) ? XDateTime::today()->toShortString() : $request->fromDate;
     $toDate = empty($toDate) ? XDateTime::today()->toShortString() : $request->toDate;
     $dayDiff = XDateTime::dayDiff(XDateTime::valueOf($fromDate), XDateTime::valueOf($toDate));
     if (0 < $dayDiff) {
         throw new TelConfException('每次仅可查询一天的数据');
     }
     $teleOperatorIds = DAL::get()->find_id_by_serviceQueueAndValid('TeleOperator', array_keys($queueList));
     $options['teleOperatorIds'] = $teleOperatorIds;
     $teleOperators = DAL::get()->find('TeleOperator', $teleOperatorIds);
     if (false == empty($queueId)) {
         $workIds = DAL::get()->queryWorkIds('TeleOperator', $queueId);
         $selectedOperatorIds = DAL::get()->find_id_by_serviceQueueAndValid('TeleOperator', $queueId);
         $options['teleOperatorIds'] = $selectedOperatorIds;
         $options['queueId'] = $queueId;
         $teleOperators = DAL::get()->find('TeleOperator', $selectedOperatorIds);
     }
     if (false == empty($workId)) {
         $teleOperator = DAL::get()->find_by_workid('TeleOperator', $workId);
         if (false == $teleOperator->isNull()) {
             $options['teleOperatorIds'] = $teleOperator->id;
         }
     }
     $options['fromDate'] = $fromDate;
     $options['toDate'] = $toDate;
     if ('calc' == $request->doaction && false == empty($queueId)) {
         $ids = TeleConversationClient::getInstance()->attendance($options);
     }
     $logList = array();
     if (false == empty($ids)) {
         $logList = DAL::get()->find('TelLog', $ids);
     }
     $response->logList = $logList;
     $response->teleOperators = $teleOperators;
     $response->fromDate = $fromDate;
     $response->toDate = $toDate;
     $response->selectedQueueId = $queueId;
     $response->selectedWorkId = $workId;
     $response->queueList = $queueList;
     $response->workIds = $workIds;
 }
 /**
  * agentsOffWork 
  * 对上班的全部坐席强制下班 
  * @param mixed $request 
  * @param mixed $response 
  * @access public
  * @return void
  */
 public function agentsOffWork($request, $response)
 {
     /*{{{*/
     $failResult = array();
     $servicequeueIds = DAL::get()->find_all_ids('ServiceQueue');
     $operatorIds = DAL::get()->queryTeleOperators('TeleOperator', $servicequeueIds);
     if (false == empty($operatorIds)) {
         foreach ($operatorIds as $operatorId) {
             $res = TeleConversationClient::getInstance()->forceOffWork($operatorId);
             if (false == $res) {
                 $operator = DAL::get()->find('TeleOperator', $operatorId);
                 $failResult[] = $operator->workId;
             }
         }
     }
     $msg = "坐席下班成功!";
     if (false == empty($failResult)) {
         $msg = '远程下班失败工号:' . implode(",", $failResult);
     }
     echo $msg;
     return parent::DIRECT_OUTPUT;
 }