-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Low-level bindings for Asterisk Manager Interface (AMI). -- -- This package provides simple low-level bindings for Asterisk Manager -- Interface (AMI). @package AMI @version 0.1 module Network.AMI -- | Action or response or event parameters type Parameters = [(ByteString, ByteString)] type ActionType = ByteString type EventType = ByteString type ActionID = Integer type ResponseType = ByteString type EventHandler = Parameters -> IO () -- | The AMI monad type AMI a = ReaderT (TVar AMIState) IO a -- | Action packet (sent to Asterisk) data Action Action :: ActionID -> ActionType -> Parameters -> Action -- | Response packet (received from Asterisk) data Response Response :: ActionID -> ResponseType -> Parameters -> [ByteString] -> Response -- | Event packet (received from Asterisk) data Event Event :: EventType -> Parameters -> Event -- | Info needed to connect and authenticate in Asterisk data ConnectInfo ConnectInfo :: String -> Int -> ByteString -> ByteString -> ConnectInfo -- | Host with Asterisk server (e.g. localhost) ciHost :: ConnectInfo -> String -- | Port of Asterisk server (usually 5038) ciPort :: ConnectInfo -> Int -- | Username ciUsername :: ConnectInfo -> ByteString -- | Secret ciSecret :: ConnectInfo -> ByteString -- | Connect, execute acions, disconnect withAMI :: ConnectInfo -> AMI a -> IO a -- | Connect (using MD5 challenge), execute acions, disconnect withAMI_MD5 :: ConnectInfo -> AMI a -> IO a -- | Send an Action packet and return the response. -- -- CAUTION: the response value should be evaluated in order to be removed -- from internal responses queue. Leaving response value un-evaluated -- (e.g. unused) will cause memory leak. query :: ActionType -> Parameters -> AMI Response -- | Add an event handler handleEvent :: EventType -> EventHandler -> AMI () instance Eq Action instance Show Action instance Eq Response instance Show Response instance Eq Event instance Show Event instance Eq ConnectInfo instance Show ConnectInfo