[Freeswitch-svn] [commit] r9008 - freeswitch/trunk/scripts/socket/freepy
Freeswitch SVN
greenlizard at freeswitch.org
Sat Jul 12 23:14:45 EDT 2008
Author: greenlizard
Date: Sat Jul 12 23:14:44 2008
New Revision: 9008
Modified:
freeswitch/trunk/scripts/socket/freepy/README
freeswitch/trunk/scripts/socket/freepy/apirequest.sm
freeswitch/trunk/scripts/socket/freepy/apirequest_sm.py
freeswitch/trunk/scripts/socket/freepy/bgapirequest.sm
freeswitch/trunk/scripts/socket/freepy/bgapirequest_sm.py
freeswitch/trunk/scripts/socket/freepy/loginrequest.sm
freeswitch/trunk/scripts/socket/freepy/loginrequest_sm.py
freeswitch/trunk/scripts/socket/freepy/request.py
Log:
add debugging information
Modified: freeswitch/trunk/scripts/socket/freepy/README
==============================================================================
--- freeswitch/trunk/scripts/socket/freepy/README (original)
+++ freeswitch/trunk/scripts/socket/freepy/README Sat Jul 12 23:14:44 2008
@@ -1,3 +1,24 @@
-Socket library to interface w/ freeswitch mod_event_socket from Twisted python applications.
+DESCRIPTION
+===========
+
+Socket library to interface w/ freeswitch mod_event_socket from Twisted python applications. Used by WikiPBX for all non-http communication w/ Freeswitch.
+
+Install
+=======
+
+See INSTALL
+
+Rebulding State Machines
+========================
+for each .sm file:
+
+java -jar /usr/src/smc/bin/Smc.jar -python -g THE.sm
+
+and loginrequest.sm -> loginrequest_sm.py with the state machine.
+
+TODO: create a Makefile to do this stuff
+TODO: use Miro Samek's HSM framework instead of SMC
+
+
Modified: freeswitch/trunk/scripts/socket/freepy/apirequest.sm
==============================================================================
--- freeswitch/trunk/scripts/socket/freepy/apirequest.sm (original)
+++ freeswitch/trunk/scripts/socket/freepy/apirequest.sm Sat Jul 12 23:14:44 2008
@@ -61,35 +61,35 @@
nil
{
setRequestFinished();
- errbackDeferred("Protocol failure");
+ errbackDeferred("Protocol failure - was not expecting blank line");
}
ContentFinished
nil
{
setRequestFinished();
- errbackDeferred("Protocol failure");
+ errbackDeferred("Protocol failure - was not expecting content to be finished");
}
ContentLength
nil
{
setRequestFinished();
- errbackDeferred("Protocol failure");
+ errbackDeferred("Protocol failure - was not expecting content-length header");
}
ApiResponse
nil
{
setRequestFinished();
- errbackDeferred("Protocol failure");
+ errbackDeferred("Protocol failure - was not expecting api response");
}
ProcessLine(line)
nil
{
setRequestFinished();
- errbackDeferred("Protocol failure");
+ errbackDeferred("Protocol failure - was not expecting needing to process a line");
}
}
Modified: freeswitch/trunk/scripts/socket/freepy/apirequest_sm.py
==============================================================================
--- freeswitch/trunk/scripts/socket/freepy/apirequest_sm.py (original)
+++ freeswitch/trunk/scripts/socket/freepy/apirequest_sm.py Sat Jul 12 23:14:44 2008
@@ -1,8 +1,10 @@
-
-# DO NOT MODIFY THIS CODE - AUTOMATICALLY GENERATED BY SMC
+# DO NOT EDIT.
+# generated by smc (http://smc.sourceforge.net/)
+# from file : apirequest.sm
import statemap
+
class ApiRequestState(statemap.State):
def Entry(self, fsm):
@@ -31,7 +33,7 @@
fsm.getDebugStream().write('TRANSITION : Default\n')
msg = "\n\tState: %s\n\tTransition: %s" % (
fsm.getState().getName(), fsm.getTransition())
- raise TransitionUndefinedException, msg
+ raise statemap.TransitionUndefinedException, msg
class MainMap_Default(ApiRequestState):
@@ -44,7 +46,7 @@
fsm.clearState()
try:
ctxt.setRequestFinished()
- ctxt.errbackDeferred("Protocol failure")
+ ctxt.errbackDeferred("Protocol failure - was not expecting blank line")
finally:
fsm.setState(endState)
@@ -57,7 +59,7 @@
fsm.clearState()
try:
ctxt.setRequestFinished()
- ctxt.errbackDeferred("Protocol failure")
+ ctxt.errbackDeferred("Protocol failure - was not expecting content to be finished")
finally:
fsm.setState(endState)
@@ -70,7 +72,7 @@
fsm.clearState()
try:
ctxt.setRequestFinished()
- ctxt.errbackDeferred("Protocol failure")
+ ctxt.errbackDeferred("Protocol failure - was not expecting content-length header")
finally:
fsm.setState(endState)
@@ -83,7 +85,7 @@
fsm.clearState()
try:
ctxt.setRequestFinished()
- ctxt.errbackDeferred("Protocol failure")
+ ctxt.errbackDeferred("Protocol failure - was not expecting api response")
finally:
fsm.setState(endState)
@@ -96,7 +98,7 @@
fsm.clearState()
try:
ctxt.setRequestFinished()
- ctxt.errbackDeferred("Protocol failure")
+ ctxt.errbackDeferred("Protocol failure - was not expecting needing to process a line")
finally:
fsm.setState(endState)
Modified: freeswitch/trunk/scripts/socket/freepy/bgapirequest.sm
==============================================================================
--- freeswitch/trunk/scripts/socket/freepy/bgapirequest.sm (original)
+++ freeswitch/trunk/scripts/socket/freepy/bgapirequest.sm Sat Jul 12 23:14:44 2008
@@ -43,28 +43,28 @@
nil
{
setRequestFinished();
- errbackDeferred("Protocol failure");
+ errbackDeferred("Protocol failure - was not expecting blank line");
}
CommandReply
nil
{
setRequestFinished();
- errbackDeferred("Protocol failure");
+ errbackDeferred("Protocol failure - was not expecting command reply");
}
ReplyText
nil
{
setRequestFinished();
- errbackDeferred("Protocol failure");
+ errbackDeferred("Protocol failure - was not expecting reply text");
}
ProcessLine(line)
nil
{
setRequestFinished();
- errbackDeferred("Protocol failure");
+ errbackDeferred("Protocol failure - was not expecting line needing to be processed");
}
}
Modified: freeswitch/trunk/scripts/socket/freepy/bgapirequest_sm.py
==============================================================================
--- freeswitch/trunk/scripts/socket/freepy/bgapirequest_sm.py (original)
+++ freeswitch/trunk/scripts/socket/freepy/bgapirequest_sm.py Sat Jul 12 23:14:44 2008
@@ -1,8 +1,10 @@
-
-# DO NOT MODIFY THIS CODE - AUTOMATICALLY GENERATED BY SMC
+# DO NOT EDIT.
+# generated by smc (http://smc.sourceforge.net/)
+# from file : bgapirequest.sm
import statemap
+
class BgApiRequestState(statemap.State):
def Entry(self, fsm):
@@ -28,7 +30,7 @@
fsm.getDebugStream().write('TRANSITION : Default\n')
msg = "\n\tState: %s\n\tTransition: %s" % (
fsm.getState().getName(), fsm.getTransition())
- raise TransitionUndefinedException, msg
+ raise statemap.TransitionUndefinedException, msg
class MainMap_Default(BgApiRequestState):
@@ -41,7 +43,7 @@
fsm.clearState()
try:
ctxt.setRequestFinished()
- ctxt.errbackDeferred("Protocol failure")
+ ctxt.errbackDeferred("Protocol failure - was not expecting blank line")
finally:
fsm.setState(endState)
@@ -54,7 +56,7 @@
fsm.clearState()
try:
ctxt.setRequestFinished()
- ctxt.errbackDeferred("Protocol failure")
+ ctxt.errbackDeferred("Protocol failure - was not expecting command reply")
finally:
fsm.setState(endState)
@@ -67,7 +69,7 @@
fsm.clearState()
try:
ctxt.setRequestFinished()
- ctxt.errbackDeferred("Protocol failure")
+ ctxt.errbackDeferred("Protocol failure - was not expecting reply text")
finally:
fsm.setState(endState)
@@ -80,7 +82,7 @@
fsm.clearState()
try:
ctxt.setRequestFinished()
- ctxt.errbackDeferred("Protocol failure")
+ ctxt.errbackDeferred("Protocol failure - was not expecting line needing to be processed")
finally:
fsm.setState(endState)
Modified: freeswitch/trunk/scripts/socket/freepy/loginrequest.sm
==============================================================================
--- freeswitch/trunk/scripts/socket/freepy/loginrequest.sm (original)
+++ freeswitch/trunk/scripts/socket/freepy/loginrequest.sm Sat Jul 12 23:14:44 2008
@@ -57,35 +57,35 @@
nil
{
setRequestFinished();
- errbackDeferred("Protocol failure");
+ errbackDeferred("Protocol failure - Was not expecting a blank line");
}
AuthRequest
nil
{
setRequestFinished();
- errbackDeferred("Protocol failure");
+ errbackDeferred("Protocol failure - Was not expecting auth request");
}
CommandReply
nil
{
setRequestFinished();
- errbackDeferred("Protocol failure");
+ errbackDeferred("Protocol failure - was not expecting a command reply");
}
ReplyText
nil
{
setRequestFinished();
- errbackDeferred("Protocol failure");
+ errbackDeferred("Protocol failure - was not expecting reply text");
}
ProcessLine(line)
nil
{
setRequestFinished();
- errbackDeferred("Protocol failure");
+ errbackDeferred("Protocol failure - was not expecting need to receive a line that needs to be processed");
}
}
Modified: freeswitch/trunk/scripts/socket/freepy/loginrequest_sm.py
==============================================================================
--- freeswitch/trunk/scripts/socket/freepy/loginrequest_sm.py (original)
+++ freeswitch/trunk/scripts/socket/freepy/loginrequest_sm.py Sat Jul 12 23:14:44 2008
@@ -1,5 +1,6 @@
-
-# DO NOT MODIFY THIS CODE - AUTOMATICALLY GENERATED BY SMC
+# DO NOT EDIT.
+# generated by smc (http://smc.sourceforge.net/)
+# from file : loginrequest.sm
import statemap
@@ -32,7 +33,7 @@
fsm.getDebugStream().write('TRANSITION : Default\n')
msg = "\n\tState: %s\n\tTransition: %s" % (
fsm.getState().getName(), fsm.getTransition())
- raise TransitionUndefinedException, msg
+ raise statemap.TransitionUndefinedException, msg
class MainMap_Default(LoginRequestState):
@@ -45,7 +46,7 @@
fsm.clearState()
try:
ctxt.setRequestFinished()
- ctxt.errbackDeferred("Protocol failure")
+ ctxt.errbackDeferred("Protocol failure - Was not expecting a blank line")
finally:
fsm.setState(endState)
@@ -58,7 +59,7 @@
fsm.clearState()
try:
ctxt.setRequestFinished()
- ctxt.errbackDeferred("Protocol failure")
+ ctxt.errbackDeferred("Protocol failure - Was not expecting auth request")
finally:
fsm.setState(endState)
@@ -71,7 +72,7 @@
fsm.clearState()
try:
ctxt.setRequestFinished()
- ctxt.errbackDeferred("Protocol failure")
+ ctxt.errbackDeferred("Protocol failure - was not expecting a command reply")
finally:
fsm.setState(endState)
@@ -84,7 +85,7 @@
fsm.clearState()
try:
ctxt.setRequestFinished()
- ctxt.errbackDeferred("Protocol failure")
+ ctxt.errbackDeferred("Protocol failure - was not expecting reply text")
finally:
fsm.setState(endState)
@@ -97,7 +98,7 @@
fsm.clearState()
try:
ctxt.setRequestFinished()
- ctxt.errbackDeferred("Protocol failure")
+ ctxt.errbackDeferred("Protocol failure - was not expecting need to receive a line that needs to be processed")
finally:
fsm.setState(endState)
Modified: freeswitch/trunk/scripts/socket/freepy/request.py
==============================================================================
--- freeswitch/trunk/scripts/socket/freepy/request.py (original)
+++ freeswitch/trunk/scripts/socket/freepy/request.py Sat Jul 12 23:14:44 2008
@@ -70,7 +70,7 @@
self.deferred.callback(cbval)
def errbackDeferred(self, result):
- self.deferred.errback(result)
+ self.deferred.errback(Exception(str(result)))
def process(self, line):
"""
More information about the Freeswitch-svn
mailing list