"Fossies" - the Fresh Open Source Software Archive

Member "bayonne-1.2.16/drivers/vpb/hangup.cpp" (22 Jan 2003, 1972 Bytes) of package /linux/misc/old/bayonne-1.2.16.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "hangup.cpp" see the Fossies "Dox" file reference documentation.

    1 // Copyright (C) 2000 Open Source Telecom Corporation.
    2 //  
    3 // This program is free software; you can redistribute it and/or modify
    4 // it under the terms of the GNU General Public License as published by
    5 // the Free Software Foundation; either version 2 of the License, or
    6 // (at your option) any later version.
    7 // 
    8 // This program is distributed in the hope that it will be useful,
    9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
   10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   11 // GNU General Public License for more details.
   12 // 
   13 // You should have received a copy of the GNU General Public License
   14 // along with this program; if not, write to the Free Software 
   15 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
   16 
   17 #include "driver.h"
   18 
   19 #ifdef  CCXX_NAMESPACES
   20 using namespace std;
   21 namespace ost {
   22 #endif
   23 
   24 bool VPBTrunk::hangupHandler(TrunkEvent *event)
   25 {
   26     timeout_t reset;
   27 
   28     switch(event->id)
   29     {
   30     case TRUNK_ENTER_STATE:
   31         synctimer = exittimer = 0;
   32         enterState("hangup");
   33         status[id] = 'h';
   34         endTimer();
   35         disjoin(TRUNK_STOP_DISCONNECT);
   36         if(tgi.pid)
   37             kill(tgi.pid, SIGHUP);
   38         if(thread)
   39             reset = thread->stop();
   40         else
   41             reset = 0;
   42         setDTMFDetect(false);
   43         flags.dsp = DSP_MODE_INACTIVE;
   44         flags.offhook = false;
   45         vpb_sethook_async(handle, VPB_ONHOOK);
   46         detach();
   47         clearRinging();
   48         if(isStation)
   49             goto done;
   50         if(group->getHangup() > reset)
   51             setTimer(group->getHangup());
   52         else
   53             setTimer(reset);
   54         return true;
   55     case TRUNK_TIMER_EXPIRED:
   56 done:
   57         stopServices();
   58         flags.reset = false;
   59         handler = &VPBTrunk::idleHandler;
   60         return true;
   61     case TRUNK_MAKE_IDLE:
   62     case TRUNK_STOP_DISCONNECT:
   63     case TRUNK_LINE_WINK:
   64     case TRUNK_STATION_FLASH:
   65     case TRUNK_STATION_ONHOOK:
   66     case TRUNK_CPA_DIALTONE:
   67         return true;
   68     case TRUNK_RINGING_ON:
   69         endTimer();
   70         flags.reset = false;
   71         handler = &VPBTrunk::idleHandler;
   72         return idleHandler(event);
   73     }
   74     return false;
   75 }
   76 
   77 #ifdef  CCXX_NAMESPACES
   78 };
   79 #endif