-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A library for writing AGI scripts for Asterisk -- -- Asterisk is an open-source Voice over IP server (VoIP). Asterisk -- provides an Asterisk Gateway Interface (AGI), which can be used to -- write external programs that interact with Asterisk. It is typically -- used for creating Interactive Voice Response (IVR) systems. @package AGI @version 1.2 module Network.AGI data Digit Pound :: Digit Star :: Digit Zero :: Digit One :: Digit Two :: Digit Three :: Digit Four :: Digit Five :: Digit Six :: Digit Seven :: Digit Eight :: Digit Nine :: Digit data AGI a -- | Top-level wrapper for single-shot AGI scripts. Example: main = -- run yourAGI Ignore run :: AGI a -> Handler -> IO a -- | Top-level for long running AGI scripts. Example: main = fastAGI -- Nothing yourAGI You should be sure to compile with -threaded. -- Note that yourAGI may be running simultaneously in multiple -- threads, so you will need some concurrency control for shared data. -- TODO: support a hang-up handler fastAGI :: Maybe PortID -> (HostName -> PortNumber -> AGI a) -> IO () -- | runInternal - run an AGI script using the supplied Handles for input -- and output You probably want run or fastAGI. This -- function is exposed so that 3rd party libraries such as HAppS can -- easily add support for FastAGI support. TODO: support general method -- of handling extra arguments (query_string vs command-line arguments) runInternal :: AGI a -> Handle -> Handle -> IO a ppDigit :: Digit -> Char ppEscapeDigits :: [Digit] -> String data SoundType WAV :: SoundType GSM :: SoundType sendRecv :: Command -> AGI String -- | answer channel if not already in answer state answer :: AGI Bool hangUp :: Maybe String -> AGI Bool getData :: FilePath -> Maybe Integer -> Maybe Integer -> AGI (Maybe ([Digit], Bool)) data RecordResult FailureToWrite :: RecordResult FailureOnWaitFor :: RecordResult HangUp :: RecordResult Interrupted :: Digit -> RecordResult Timeout :: RecordResult RandomError :: String -> RecordResult sayDigits :: [Digit] -> [Digit] -> AGI (Maybe (Maybe Digit)) -- | sayNumber says the specified number sayNumber :: Integer -> [Digit] -> AGI (Maybe (Maybe Digit)) streamFile :: FilePath -> [Digit] -> Maybe Integer -> AGI (Either Integer (Maybe Digit, Integer)) -- | wait for channel to receive a DTMF digit. waitForDigit :: Integer -> AGI (Maybe (Maybe Digit)) record :: FilePath -> SoundType -> [Digit] -> Maybe Integer -> Maybe Integer -> Bool -> Maybe Integer -> AGI (RecordResult, Integer) instance Eq RecordResult instance Show RecordResult instance Eq SoundType instance Eq Digit instance Ord Digit instance Read Digit instance Show Digit instance Enum Digit instance Monad AGI instance MonadIO AGI instance Functor AGI instance MonadError IOError AGI instance MonadReader AGIEnv AGI instance Show SoundType