fixed protocol incompatibility, make more robust and less anal regarding spurious blank lines, debugging instructions added to README. debug off by default

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9009 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Traun Leyden
2008-07-13 04:10:52 +00:00
parent f01fde034c
commit 995f477475
6 changed files with 65 additions and 63 deletions

View File

@@ -19,6 +19,9 @@ class BgApiRequestState(statemap.State):
def CommandReply(self, fsm):
self.Default(fsm)
def JobUuid(self, fsm):
self.Default(fsm)
def ProcessLine(self, fsm, line):
self.Default(fsm)
@@ -82,7 +85,7 @@ class MainMap_Default(BgApiRequestState):
fsm.clearState()
try:
ctxt.setRequestFinished()
ctxt.errbackDeferred("Protocol failure - was not expecting line needing to be processed")
ctxt.errbackDeferred("Protocol failure handling bgapi response - was not expecting line needing to be processed")
finally:
fsm.setState(endState)
@@ -109,10 +112,15 @@ class MainMap_ApiResponseStarted(MainMap_Default):
class MainMap_GotReplyText(MainMap_Default):
def BlankLine(self, fsm):
ctxt = fsm.getOwner()
if fsm.getDebugFlag() == True:
fsm.getDebugStream().write("TRANSITION : MainMap.GotReplyText.BlankLine()\n")
def JobUuid(self, fsm):
ctxt = fsm.getOwner()
if fsm.getDebugFlag() == True:
fsm.getDebugStream().write("TRANSITION : MainMap.GotReplyText.JobUuid()\n")
fsm.getState().Exit(fsm)
fsm.clearState()
try:
@@ -147,6 +155,11 @@ class BgApiRequest_sm(statemap.FSMContext):
self.getState().CommandReply(self)
self._transition = None
def JobUuid(self):
self._transition = 'JobUuid'
self.getState().JobUuid(self)
self._transition = None
def ProcessLine(self, *arglist):
self._transition = 'ProcessLine'
self.getState().ProcessLine(self, *arglist)