~singpolyma/cheogram-sip

c2f7d2d354d546a6d0421e93ee05c91cff0b6cfc — Stephen Paul Weber 9 months ago 3e0eec3
Error payload is often last

Asterisk seems to care about the payload being <error/> and not just the
type="error", which is probably a bug in asterisk, but this whole thing is a
workaround for missing asterisk stuff so here we are.
1 files changed, 2 insertions(+), 2 deletions(-)

M gateway.hs
M gateway.hs => gateway.hs +2 -2
@@ 6,7 6,7 @@ import System.IO
	(stdout, stderr, hSetBuffering, BufferMode(LineBuffering))
import Control.Concurrent              (threadDelay)
import Control.Concurrent.STM          (STM)
import Control.Error                   (exceptT, ExceptT(..), headZ, throwE)
import Control.Error                   (exceptT, ExceptT(..), headZ, throwE, lastZ)
import Control.Lens                    (over, set, at, _Right, traverseOf)
import Network                         (PortID (PortNumber))
import System.Clock                    (TimeSpec(..))


@@ 169,7 169,7 @@ main = do
							}
				| XMPP.ReceivedMessage m <- stanza,
				  XMPP.messageType m == XMPP.MessageError,
				  (errPayload:_) <- XMPP.messagePayloads m,
				  Just errPayload <- lastZ $ XMPP.messagePayloads m,
				  Just sid <- T.stripPrefix (s"proposal%") =<< XMPP.messageID m -> do
					minit <- liftIO $ Cache.lookup' sessionInitiates sid
					forM_ minit $ \init -> do