Author: derek Date: Mon Sep 25 22:42:11 2006 New Revision: 129 Modified: sofaswitch/trunk/callflow/src/Makefile.am sofaswitch/trunk/callflow/src/Makefile.in sofaswitch/trunk/callflow/src/callflow.cpp sofaswitch/trunk/callflow/src/callflow.h sofaswitch/trunk/callflow/src/conditional.cpp sofaswitch/trunk/callflow/src/dnd.cpp sofaswitch/trunk/callflow/src/dnd.h sofaswitch/trunk/callflow/src/drawshape.h sofaswitch/trunk/callflow/src/makecall.cpp sofaswitch/trunk/callflow/src/python.cpp sofaswitch/trunk/callflow/src/senddtmf.cpp sofaswitch/trunk/callflow/src/senddtmf.h sofaswitch/trunk/callflow/src/transfermedia.cpp Log: Commit midway through of adding new shapes. Include several fixes to adjust handling of python variables. Modified: sofaswitch/trunk/callflow/src/Makefile.am ============================================================================== --- sofaswitch/trunk/callflow/src/Makefile.am (original) +++ sofaswitch/trunk/callflow/src/Makefile.am Mon Sep 25 22:42:11 2006 @@ -7,29 +7,96 @@ override CXXFLAGS = @CXXFLAGS@ -I.. callflow_SOURCES = \ + ../bitmaps/ContEnd.xpm \ + ../bitmaps/ContEndFor.xpm \ + ../bitmaps/ContFor.xpm \ + ../bitmaps/ContStart.xpm \ + ../bitmaps/ControlsEndHere.xpm \ + ../bitmaps/ControlsIf.xpm \ + ../bitmaps/Controlsend.xpm \ + ../bitmaps/Controlsend_for.xpm \ + ../bitmaps/Controlsfor.xpm \ + ../bitmaps/Controlsstart.xpm \ + ../bitmaps/EditCopy.xpm \ + ../bitmaps/EditCut.xpm \ + ../bitmaps/EditPaste.xpm \ + ../bitmaps/FileE_xit.xpm \ + ../bitmaps/FileNew.xpm \ + ../bitmaps/FileOpen.xpm \ + ../bitmaps/FileSave.xpm \ + ../bitmaps/FileSave__As.xpm \ + ../bitmaps/HelpAbout.xpm \ + ../bitmaps/HelpManual.xpm \ + ../bitmaps/JoinObjects.xpm \ + ../bitmaps/Python.xpm \ + ../bitmaps/RequestNode.xpm \ + ../bitmaps/compile.xpm \ + ../bitmaps/eventer.xpm \ + ../bitmaps/makecall.xpm \ + ../bitmaps/miniclock.xpm \ + ../bitmaps/newgraph.xpm \ + ../bitmaps/newshape.xpm \ + ../bitmaps/senddtmf.xpm \ + ../bitmaps/stoptimer.xpm \ + ../bitmaps/readfromfile.xpm \ + ../bitmaps/writetofile.xpm \ + ../bitmaps/transfermedia.xpm \ callflow.cpp \ + callflow.h \ canvas.cpp \ + canvas.h \ conditional.cpp \ + conditional.h \ dnd.cpp \ + dnd.h \ drawshape.cpp \ + drawshape.h \ endcall.cpp \ + endcall.h \ endfor.cpp \ + endfor.h \ endhere.cpp \ + endhere.h \ eventer.cpp \ + eventer.h \ information.cpp \ + information.h \ joinblocks.cpp \ + joinblocks.h \ listpoints.cpp \ + listpoints.h \ loadnewgraph.cpp \ + loadnewgraph.h \ makecall.cpp \ + makecall.h \ python.cpp \ + python.h \ + readfromfile.cpp \ + readfromfile.h \ requestnode.cpp \ + requestnode.h \ + senddtmf.cpp \ + senddtmf.h \ shapelist.cpp \ + shapelist.h \ shapeselect.cpp \ + shapeselect.h \ startfor.cpp \ + startfor.h \ starthere.cpp \ + starthere.h \ stoptimer.cpp \ + stoptimer.h \ timer.cpp \ - transfermedia.cpp + timer.h \ + transfermedia.cpp \ + transfermedia.h \ + writetofile.cpp \ + writetofile.h + + + + Modified: sofaswitch/trunk/callflow/src/Makefile.in ============================================================================== --- sofaswitch/trunk/callflow/src/Makefile.in (original) +++ sofaswitch/trunk/callflow/src/Makefile.in Mon Sep 25 22:42:11 2006 @@ -53,9 +53,10 @@ endcall.$(OBJEXT) endfor.$(OBJEXT) endhere.$(OBJEXT) \ eventer.$(OBJEXT) information.$(OBJEXT) joinblocks.$(OBJEXT) \ listpoints.$(OBJEXT) loadnewgraph.$(OBJEXT) makecall.$(OBJEXT) \ - python.$(OBJEXT) requestnode.$(OBJEXT) shapelist.$(OBJEXT) \ - shapeselect.$(OBJEXT) startfor.$(OBJEXT) starthere.$(OBJEXT) \ - stoptimer.$(OBJEXT) timer.$(OBJEXT) transfermedia.$(OBJEXT) + python.$(OBJEXT) requestnode.$(OBJEXT) senddtmf.$(OBJEXT) \ + shapelist.$(OBJEXT) shapeselect.$(OBJEXT) startfor.$(OBJEXT) \ + starthere.$(OBJEXT) stoptimer.$(OBJEXT) timer.$(OBJEXT) \ + transfermedia.$(OBJEXT) callflow_OBJECTS = $(am_callflow_OBJECTS) am__DEPENDENCIES_1 = callflow_DEPENDENCIES = $(am__DEPENDENCIES_1) @@ -70,6 +71,14 @@ CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(callflow_SOURCES) DIST_SOURCES = $(callflow_SOURCES) ETAGS = etags @@ -176,29 +185,86 @@ SUFFIXES = .cpp .rc callflow_LDADD = $(WX_LIBS) callflow_SOURCES = \ + ../bitmaps/ContEnd.xpm \ + ../bitmaps/ContEndFor.xpm \ + ../bitmaps/ContFor.xpm \ + ../bitmaps/ContStart.xpm \ + ../bitmaps/ControlsEndHere.xpm \ + ../bitmaps/ControlsIf.xpm \ + ../bitmaps/Controlsend.xpm \ + ../bitmaps/Controlsend_for.xpm \ + ../bitmaps/Controlsfor.xpm \ + ../bitmaps/Controlsstart.xpm \ + ../bitmaps/EditCopy.xpm \ + ../bitmaps/EditCut.xpm \ + ../bitmaps/EditPaste.xpm \ + ../bitmaps/FileE_xit.xpm \ + ../bitmaps/FileNew.xpm \ + ../bitmaps/FileOpen.xpm \ + ../bitmaps/FileSave.xpm \ + ../bitmaps/FileSave__As.xpm \ + ../bitmaps/HelpAbout.xpm \ + ../bitmaps/HelpManual.xpm \ + ../bitmaps/JoinObjects.xpm \ + ../bitmaps/Python.xpm \ + ../bitmaps/RequestNode.xpm \ + ../bitmaps/compile.xpm \ + ../bitmaps/eventer.xpm \ + ../bitmaps/makecall.xpm \ + ../bitmaps/miniclock.xpm \ + ../bitmaps/newgraph.xpm \ + ../bitmaps/newshape.xpm \ + ../bitmaps/senddtmf.xpm \ + ../bitmaps/stoptimer.xpm \ + ../bitmaps/transfermedia.xpm \ callflow.cpp \ + callflow.h \ canvas.cpp \ + canvas.h \ conditional.cpp \ + conditional.h \ dnd.cpp \ + dnd.h \ drawshape.cpp \ + drawshape.h \ endcall.cpp \ + endcall.h \ endfor.cpp \ + endfor.h \ endhere.cpp \ + endhere.h \ eventer.cpp \ + eventer.h \ information.cpp \ + information.h \ joinblocks.cpp \ + joinblocks.h \ listpoints.cpp \ + listpoints.h \ loadnewgraph.cpp \ + loadnewgraph.h \ makecall.cpp \ + makecall.h \ python.cpp \ + python.h \ requestnode.cpp \ + requestnode.h \ + senddtmf.cpp \ + senddtmf.h \ shapelist.cpp \ + shapelist.h \ shapeselect.cpp \ + shapeselect.h \ startfor.cpp \ + startfor.h \ starthere.cpp \ + starthere.h \ stoptimer.cpp \ + stoptimer.h \ timer.cpp \ - transfermedia.cpp + timer.h \ + transfermedia.cpp \ + transfermedia.h all: all-am @@ -287,6 +353,7 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/makecall.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/python.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/requestnode.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/senddtmf.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shapelist.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shapeselect.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/startfor.Po@am__quote@ Modified: sofaswitch/trunk/callflow/src/callflow.cpp ============================================================================== --- sofaswitch/trunk/callflow/src/callflow.cpp (original) +++ sofaswitch/trunk/callflow/src/callflow.cpp Mon Sep 25 22:42:11 2006 @@ -36,15 +36,18 @@ #include "bitmaps/FileSave.xpm" #include "bitmaps/FileSave__As.xpm" #include "bitmaps/JoinObjects.xpm" -#include "bitmaps/makecall.xpm" #include "bitmaps/Python.xpm" #include "bitmaps/RequestNode.xpm" #include "bitmaps/compile.xpm" #include "bitmaps/eventer.xpm" +#include "bitmaps/makecall.xpm" #include "bitmaps/miniclock.xpm" #include "bitmaps/newgraph.xpm" +#include "bitmaps/readfromfile.xpm" +#include "bitmaps/senddtmf.xpm" #include "bitmaps/stoptimer.xpm" #include "bitmaps/transfermedia.xpm" +#include "bitmaps/writetofile.xpm" class MyFrame ; @@ -77,10 +80,13 @@ EVT_MENU ( wxH_CONTROLSMAKECALL, MyFrame::OnControlsMakeCall) EVT_MENU ( wxH_CONTROLSPYTHON, MyFrame::OnControlspython) EVT_MENU ( wxH_CONTROLSREQUESTNODE, MyFrame::OnControlsrequestnode) + EVT_MENU ( wxH_CONTROLSSENDDTMF, MyFrame::OnControlsSendDtmf) EVT_MENU ( wxH_CONTROLSSTARTHERE, MyFrame::OnControlsstarthere) EVT_MENU ( wxH_CONTROLSSTOPTIMER, MyFrame::OnControlsStopTimer) EVT_MENU ( wxH_CONTROLSTIMER, MyFrame::OnControlsTimer) EVT_MENU ( wxH_CONTROLSTRANSFERMEDIA, MyFrame::OnControlsTransferMedia) + EVT_MENU ( wxH_CONTROLSREADFROMFILE, MyFrame::OnControlsReadFromFile) + EVT_MENU ( wxH_CONTROLSWRITETOFILE, MyFrame::onControlsWriteToFile) EVT_MENU ( wxH_EDITCOPY, MyFrame::OnEditCopy) EVT_MENU ( wxH_EDITCUT, MyFrame::OnEditCut) EVT_MENU ( wxH_EDITPASTE, MyFrame::OnEditPaste) @@ -132,27 +138,30 @@ wxMenu * Help_menu = new wxMenu ; wxMenu * Controls_menu = new wxMenu ; wxMenu * File_menu = new wxMenu ; - File_menu -> Append ( wxH_FILENEW, wxT("&New"), wxT("")); - File_menu -> Append ( wxH_FILEOPEN, wxT("&Open"), wxT("")); - File_menu -> Append ( wxH_FILESAVE, wxT("&Save"), wxT("")); - File_menu -> Append ( wxH_FILESAVE__AS, wxT("Save &As"), wxT("")); - File_menu -> Append ( wxH_FILEE_XIT, wxT("E&xit"), wxT("")); - Controls_menu -> Append ( wxH_CONTROLSCONNECT_OBJECTS, wxT("connect objects"), wxT("")); - Controls_menu -> Append ( wxH_CONTROLSEND, wxT("end"), wxT("")); - Controls_menu -> Append ( wxH_CONTROLSENDHERE, wxT("end here"), wxT("")); - Controls_menu -> Append ( wxH_CONTROLSEND_FOR, wxT("end for"), wxT("")); - Controls_menu -> Append ( wxH_CONTROLSEVENTER, wxT("event reg/wait"), wxT("")); - Controls_menu -> Append ( wxH_CONTROLSFOR, wxT("for"), wxT("")); - Controls_menu -> Append ( wxH_CONTROLSIF, wxT("if"), wxT("")); + File_menu -> Append ( wxH_FILENEW, wxT("&New"), wxT("")); + File_menu -> Append ( wxH_FILEOPEN, wxT("&Open"), wxT("")); + File_menu -> Append ( wxH_FILESAVE, wxT("&Save"), wxT("")); + File_menu -> Append ( wxH_FILESAVE__AS, wxT("Save &As"), wxT("")); + File_menu -> Append ( wxH_FILEE_XIT, wxT("E&xit"), wxT("")); + Controls_menu -> Append ( wxH_CONTROLSCONNECT_OBJECTS, wxT("connect objects"), wxT("")); + Controls_menu -> Append ( wxH_CONTROLSEND, wxT("end"), wxT("")); + Controls_menu -> Append ( wxH_CONTROLSENDHERE, wxT("end here"), wxT("")); + Controls_menu -> Append ( wxH_CONTROLSEND_FOR, wxT("end for"), wxT("")); + Controls_menu -> Append ( wxH_CONTROLSEVENTER, wxT("event reg/wait"), wxT("")); + Controls_menu -> Append ( wxH_CONTROLSFOR, wxT("for"), wxT("")); + Controls_menu -> Append ( wxH_CONTROLSIF, wxT("if"), wxT("")); Controls_menu -> Append ( wxH_CONTROLSLOADNEWGRAPH, wxT("load pre-existing compiled graph"), wxT("")); - Controls_menu -> Append ( wxH_CONTROLSMAKECALL, wxT("make a call"), wxT("")); - Controls_menu -> Append ( wxH_CONTROLSPYTHON, wxT("python"), wxT("")); - Controls_menu -> Append ( wxH_CONTROLSREQUESTNODE, wxT("request node"), wxT("")); - Controls_menu -> Append ( wxH_CONTROLSSTARTHERE, wxT("start here"), wxT("")); - Controls_menu -> Append ( wxH_CONTROLSSTOPTIMER, wxT("stop running timer"), wxT("")); - Controls_menu -> Append ( wxH_CONTROLSTIMER, wxT("timer"), wxT("")); - Controls_menu -> Append ( wxH_CONTROLSTRANSFERMEDIA, wxT("transfer media between entities"), wxT("")); - Help_menu -> Append ( wxH_HELPMANUAL, wxT("Manual"), wxT("")); + Controls_menu -> Append ( wxH_CONTROLSMAKECALL, wxT("make a call"), wxT("")); + Controls_menu -> Append ( wxH_CONTROLSPYTHON, wxT("python"), wxT("")); + Controls_menu -> Append ( wxH_CONTROLSREADFROMFILE, wxT("read audio from file"), wxT("")); + Controls_menu -> Append ( wxH_CONTROLSREQUESTNODE, wxT("request node"), wxT("")); + Controls_menu -> Append ( wxH_CONTROLSSENDDTMF, wxT("send dtmf"), wxT("")); + Controls_menu -> Append ( wxH_CONTROLSSTARTHERE, wxT("start here"), wxT("")); + Controls_menu -> Append ( wxH_CONTROLSSTOPTIMER, wxT("stop running timer"), wxT("")); + Controls_menu -> Append ( wxH_CONTROLSTIMER, wxT("timer"), wxT("")); + Controls_menu -> Append ( wxH_CONTROLSTRANSFERMEDIA, wxT("transfer media between workers"), wxT("")); + Controls_menu -> Append ( wxH_CONTROLSWRITETOFILE, wxT("write audio to file"), wxT("")); + Help_menu -> Append ( wxH_HELPMANUAL, wxT("Manual"), wxT("")); Help_menu -> AppendSeparator () ; Help_menu -> Append ( wxH_HELPABOUT, wxT("About"), wxT("")); Edit_menu -> Append ( wxH_EDITCUT, wxT("&Cut"), wxT("")); @@ -221,12 +230,19 @@ file.Close(); currentFileName = filedlg.GetPath(); canvas->ReadShapeInformationFromFile(currentFileName); + SetStatusText(wxString::Format("Read source code from %s", currentFileName.c_str())); + SetNewWindowName(currentFileName); } else { wxMessageBox(wxString::Format("Unable to open the file %s to read from", filedlg.GetFilename().c_str())); return; } } +void MyFrame::SetNewWindowName(wxString & newFileName) +{ + wxString title = "CallFlow " + newFileName; + SetLabel(title); +} void MyFrame::OnFileSave (wxCommandEvent & event) { @@ -242,6 +258,7 @@ file.Close(); canvas->ShapeInformationToFile(currentFileName); SetStatusText(wxString::Format("Saved source code to %s", currentFileName.c_str())); + SetNewWindowName(currentFileName); } else { wxMessageBox(wxString::Format("Unable to open the file %s for saving", currentFileName.c_str())); return; @@ -270,6 +287,7 @@ file.Close(); canvas->ShapeInformationToFile(currentFileName); SetStatusText(wxString::Format("Saved source code to %s", currentFileName.c_str())); + SetNewWindowName(currentFileName); } @@ -301,7 +319,8 @@ toolBar->AddTool(wxH_CONTROLSSTARTHERE, wxBitmap ( Controlsstart ), wxT("Start processing")); toolBar->AddTool(wxH_CONTROLSENDHERE, wxBitmap ( ControlsEndHere ), wxT("End processing")); - toolBar->AddTool(wxH_CONTROLSREQUESTNODE, wxBitmap (RequestNode ), wxT("Query Supervisor for worker")); + toolBar->AddTool(wxH_CONTROLSREQUESTNODE, wxBitmap (RequestNode ), wxT("Query Supervisor for worker node")); + toolBar->AddTool(wxH_CONTROLSSENDDTMF, wxBitmap (senddtmf), wxT("Send DTMF string to worker node")); toolBar->AddTool(wxH_CONTROLSIF, wxBitmap ( ControlsIf_xpm ), wxT("Test a condition")); toolBar->AddTool(wxH_CONTROLSTIMER, wxBitmap ( miniclock_xpm ), wxT("Start a timer")); toolBar->AddTool(wxH_CONTROLSSTOPTIMER, wxBitmap ( stoptimer ), wxT("Stop specified timer")); @@ -312,6 +331,8 @@ toolBar->AddTool(wxH_CONTROLSPYTHON, wxBitmap ( Python_xpm ), wxT("arbitrary python code")); toolBar->AddTool(wxH_CONTROLSCONNECT_OBJECTS, wxBitmap ( JoinObjects ), wxT("Join objects with multi segmented lines")); + toolBar->AddTool(wxH_CONTROLSWRITETOFILE, wxBitmap ( writetofile ), wxT("send audio to file")); + toolBar->AddTool(wxH_CONTROLSREADFROMFILE, wxBitmap ( readfromfile ),wxT("read audio from file")); toolBar->AddTool(wxH_CONTROLSTRANSFERMEDIA, wxBitmap ( transfermedia ), wxT("transfer media between workers")); toolBar->AddTool(wxH_CONTROLSLOADNEWGRAPH, wxBitmap ( newgraph ), wxT("open existing graph file to handle new task")); toolBar->AddSeparator() ; @@ -340,7 +361,13 @@ canvas->SetEditingMode(MyCanvas::PlaceOneShape); } +void MyFrame::OnControlsSendDtmf (wxCommandEvent & WXUNUSED(event)) +{ + imageTypeForPlacing = DndShape::SendDtmf; + canvas->SetEditingMode(MyCanvas::PlaceOneShape); +} + void MyFrame::OnControlsend (wxCommandEvent & WXUNUSED(event)) { imageTypeForPlacing = DndShape::EndCall; @@ -396,6 +423,18 @@ void MyFrame::OnControlsTransferMedia (wxCommandEvent & WXUNUSED(event)) { imageTypeForPlacing = DndShape::TransferMedia; + canvas->SetEditingMode(MyCanvas::PlaceOneShape); +} + +void MyFrame::OnControlsReadFromFile (wxCommandEvent & WXUNUSED(event)) +{ + imageTypeForPlacing = DndShape::ReadFromFile; + canvas->SetEditingMode(MyCanvas::PlaceOneShape); +} + +void MyFrame::OnControlsWriteToFile (wxCommandEvent & WXUNUSED(event)) +{ + imageTypeForPlacing = DndShape::WriteToFile; canvas->SetEditingMode(MyCanvas::PlaceOneShape); } Modified: sofaswitch/trunk/callflow/src/callflow.h ============================================================================== --- sofaswitch/trunk/callflow/src/callflow.h (original) +++ sofaswitch/trunk/callflow/src/callflow.h Mon Sep 25 22:42:11 2006 @@ -23,9 +23,12 @@ wxH_CONTROLSMAKECALL, wxH_CONTROLSPYTHON, wxH_CONTROLSREQUESTNODE, + wxH_CONTROLSSENDDTMF, wxH_CONTROLSSTARTHERE, wxH_CONTROLSSTOPTIMER, wxH_CONTROLSTIMER, + wxH_CONTROLSWRITETOFILE, + wxH_CONTROLSREADFROMFILE, wxH_CONTROLSTRANSFERMEDIA, wxH_EDITCOPY, wxH_EDITCUT, @@ -101,6 +104,19 @@ handle some audio functionality. */ void OnControlsrequestnode (wxCommandEvent & event); + /**Called in response to a user comand to get an answering machine worker + to send audio to a file */ + void OnControlsWriteToFile (wxCommandEvent & event); + + /**Called in response to a user comand to get an answering machine worker + to grab audio from a file, and send it to the other end */ + void OnControlsReadFromFile (wxCommandEvent & event); + + /**Called in response to a user comand to add a "Send Dtmf" widget to the + current graph. This widget will cause the dtmf char string to go to the + remote sofaswitch worker. */ + void OnControlsSendDtmf (wxCommandEvent & event); + /**Called in response to a user comand to add a "End" ??? widget to the current graph */ void OnControlsend (wxCommandEvent & event); @@ -206,6 +222,10 @@ void CloseJoinBlocks(); protected: + /**Write a new name to the top of the window - the current file has changed, and + display the new name of the current file on the window */ + void SetNewWindowName(wxString & newFileName); + /**The shape that we much add to the current graph. This shape would be, for example, a Conditional (or if) if the user had just sent a MyFrame::OnControlsif() command */ Modified: sofaswitch/trunk/callflow/src/conditional.cpp ============================================================================== --- sofaswitch/trunk/callflow/src/conditional.cpp (original) +++ sofaswitch/trunk/callflow/src/conditional.cpp Mon Sep 25 22:42:11 2006 @@ -80,14 +80,13 @@ bool DndShapeConditional::WriteSystemCode(wxTextFile & file) { - file.AddLine(" def Conditional(self, aTuple): "); - file.AddLine(" a,b,c = aTuple"); - wxString test = wxString::Format(" if %s:", - displayData[1].data.c_str()); - file.AddLine(test); - file.AddLine(" return self.data[a][\"OutputTrue\"]"); - file.AddLine(" return self.data[a][\"OutputFalse\"]"); - file.AddLine(""); + file.AddLine(" def Conditional(self, aTuple): "); + file.AddLine(" a,b,c = aTuple "); + file.AddLine(" test = self.data[a][\"Test\"] "); + file.AddLine(" if eval(test) : "); + file.AddLine(" return self.data[a][\"OutputTrue\"] "); + file.AddLine(" return self.data[a][\"OutputFalse\"] "); + file.AddLine(" "); return true; } Modified: sofaswitch/trunk/callflow/src/dnd.cpp ============================================================================== --- sofaswitch/trunk/callflow/src/dnd.cpp (original) +++ sofaswitch/trunk/callflow/src/dnd.cpp Mon Sep 25 22:42:11 2006 @@ -366,6 +366,9 @@ if (thisKind == RequestNode) return DndShapeRequestNode::GetKindName(); + if (thisKind == SendDtmf) + return DndShapeSendDtmf::GetKindName(); + if (thisKind == StartFor) return DndShapeStartFor::GetKindName(); @@ -400,8 +403,14 @@ return DndShapeEventer::GetKindName(); if (thisKind == TransferMedia) - return DndShapeTransferMedia::GetKindName(); + return DndShapeTransferMedia::GetKindName(); + if (thisKind == ReadFromFile) + return DndShapeReadFromFile::GetKindName(); + + if (thisKind == WriteToFile) + return DndShapeWriteToFile::GetKindName(); + if (thisKind == LoadNewGraph) return DndShapeLoadNewGraph::GetKindName(); @@ -498,13 +507,16 @@ case LoadNewGraph: return new DndShapeLoadNewGraph(); case MakeCall: return new DndShapeMakeCall(); case Python: return new DndShapePython(); + case ReadFromFile: return new DndShapeReadFromFile(); case RequestNode: return new DndShapeRequestNode(); case Select: return new DndShapeSelect(); + case SendDtmf: return new DndShapeSendDtmf(); case StartFor: return new DndShapeStartFor(); case StartHere: return new DndShapeStartHere(); case StopTimer: return new DndShapeStopTimer(); case Timer: return new DndShapeTimer(); case TransferMedia: return new DndShapeTransferMedia(); + case WriteToFile: return new DndShapeWriteToFile(); default: printf("Unknown construction of shape %d\n", shapeRequired); } Modified: sofaswitch/trunk/callflow/src/dnd.h ============================================================================== --- sofaswitch/trunk/callflow/src/dnd.h (original) +++ sofaswitch/trunk/callflow/src/dnd.h Mon Sep 25 22:42:11 2006 @@ -266,8 +266,11 @@ /**13*/ StopTimer /**Stop a running timer, so it will not generate an event etc */, /**14*/ Eventer /**Mark me as registering for an event. Possibly, wait for the registered for event */, /**15*/ TransferMedia /**Transfer media from one sofaswitch entity to another */, - /**16*/ LoadNewGraph /**Read in an existing graph file (pre compiled) for a new thread of exeuction */, - /* 15*/ KnownShapes /**Indicates the number of known shapes we can manage */ + /**16*/ ReadFromFile /**Read audio from a .wav file (answering machine specific) */, + /**17*/ WriteToFile /**Write audio into a .wav file (answering machine specific) */ + /**18*/ LoadNewGraph /**Read in an existing graph file (pre compiled) for a new thread of exeuction */, + /**19*/ SendDtmf /**Send a dtmf symbol to some sofaswitch worker node */, + /* 20*/ KnownShapes /**Indicates the number of known shapes we can manage */ }; /**Constructor to a predefined shape */ Modified: sofaswitch/trunk/callflow/src/drawshape.h ============================================================================== --- sofaswitch/trunk/callflow/src/drawshape.h (original) +++ sofaswitch/trunk/callflow/src/drawshape.h Mon Sep 25 22:42:11 2006 @@ -10,12 +10,14 @@ #include "loadnewgraph.h" #include "makecall.h" #include "python.h" +#include "readfromfile.h" #include "requestnode.h" +#include "senddtmf.h" #include "shapeselect.h" #include "startfor.h" #include "starthere.h" #include "timer.h" #include "transfermedia.h" - +#include "writetofile.h" #endif Modified: sofaswitch/trunk/callflow/src/makecall.cpp ============================================================================== --- sofaswitch/trunk/callflow/src/makecall.cpp (original) +++ sofaswitch/trunk/callflow/src/makecall.cpp Mon Sep 25 22:42:11 2006 @@ -39,7 +39,7 @@ { file.AddLine(" def Make_Call(self, sTuple): "); file.AddLine(" a,b,c = sTuple "); - file.AddLine(" rhost = self.data[a][\"worker node\"] "); + file.AddLine(" rhost = eval(self.data[a][\"worker node\"]) "); file.AddLine(" rhost += \":CALLNODE \" + self.data[a][\"call destination\"] + \"\\0\" "); file.AddLine(" self.transport.write(rhost) "); file.AddLine(" return self.data[a][\"Output\"] "); @@ -59,10 +59,10 @@ file.AddLine(wxString::Format(" %s, ", outputLabel.c_str())); file.AddLine(wxString::Format(" \"worker node\" : ")); - file.AddLine(wxString::Format(" %s, ", displayData[1].data.c_str())); + file.AddLine(wxString::Format(" \"%s\", ", displayData[1].data.c_str())); file.AddLine(wxString::Format(" \"call destination\" : ")); - file.AddLine(wxString::Format(" %s, ", displayData[2].data.c_str())); + file.AddLine(wxString::Format(" \"%s\", ", displayData[2].data.c_str())); file.AddLine(wxString::Format(" },")); Modified: sofaswitch/trunk/callflow/src/python.cpp ============================================================================== --- sofaswitch/trunk/callflow/src/python.cpp (original) +++ sofaswitch/trunk/callflow/src/python.cpp Mon Sep 25 22:42:11 2006 @@ -36,6 +36,7 @@ { DrawCompileError(dc); dc.SetBrush(wxBrush(*wxBLACK, wxSOLID)); + dc.SetPen(*wxBLACK_PEN); wxPoint p1(m_rect.GetPosition()); wxPoint pA(p1.x + 25, p1.y + 15); Modified: sofaswitch/trunk/callflow/src/senddtmf.cpp ============================================================================== --- sofaswitch/trunk/callflow/src/senddtmf.cpp (original) +++ sofaswitch/trunk/callflow/src/senddtmf.cpp Mon Sep 25 22:42:11 2006 @@ -13,12 +13,12 @@ #include "shapelist.h" -#include "makecall.h" +#include "senddtmf.h" ///////////////////////////////////////////////////////////////////////////// -DndShapeMakeCall::DndShapeMakeCall() - : DndShape(MakeCall) +DndShapeSendDtmf::DndShapeSendDtmf() + : DndShape(SendDtmf) { wxSize newSize(50, 50); SetSize(newSize); @@ -35,12 +35,12 @@ AdjustIoPoints(); } -bool DndShapeMakeCall::WriteSystemCode(wxTextFile & file) +bool DndShapeSendDtmf::WriteSystemCode(wxTextFile & file) { file.AddLine(" def Make_Call(self, sTuple): "); file.AddLine(" a,b,c = sTuple "); file.AddLine(" rhost = eval(self.data[a][\"worker node\"]) "); - file.AddLine(" rhost += \":CALLNODE \" + self.data[a][\"call destination\"] + \"\\0\" "); + file.AddLine(" rhost += \":SENDDTMF \" + eval(self.data[a][\"dtmf to send\"]) + \"\\0\" "); file.AddLine(" self.transport.write(rhost) "); file.AddLine(" return self.data[a][\"Output\"] "); file.AddLine(""); @@ -48,7 +48,7 @@ return true; } -bool DndShapeMakeCall::WriteThisShapeInfo(wxTextFile & file) +bool DndShapeSendDtmf::WriteThisShapeInfo(wxTextFile & file) { file.AddLine(wxString::Format(" \"%s\" : { ", GetKey().c_str())); @@ -61,7 +61,7 @@ file.AddLine(wxString::Format(" \"worker node\" : ")); file.AddLine(wxString::Format(" \"%s\", ", displayData[1].data.c_str())); - file.AddLine(wxString::Format(" \"call destination\" : ")); + file.AddLine(wxString::Format(" \"dtmf to send\" : ")); file.AddLine(wxString::Format(" \"%s\", ", displayData[2].data.c_str())); file.AddLine(wxString::Format(" },")); @@ -70,7 +70,7 @@ } -void DndShapeMakeCall::Draw(wxDC& dc) +void DndShapeSendDtmf::Draw(wxDC& dc) { DrawCompileError(dc); dc.SetBrush(wxBrush(*wxBLACK, wxSOLID)); @@ -78,21 +78,20 @@ wxPoint p1(m_rect.GetPosition()); wxPoint pA(p1.x + 25, p1.y); - wxPoint pB(p1.x + 25, p1.y + 10); + wxPoint pB(p1.x + 25, p1.y + 15); - wxPoint pY(p1.x + 25, p1.y + 40); + wxPoint pY(p1.x + 25, p1.y + 35); wxPoint pZ(p1.x + 25, p1.y + 50); - wxPoint pL(p1.x + 3, p1.y+14); - wxPoint pR(p1.x + 47, p1.y + 16); - wxPoint pM(p1.x + 22, p1.y + 12); - wxPoint pL1(pL.x + 0, pL.y+1); - wxPoint pR1(pR.x + 0, pR.y + 1); - dc.DrawLine(pL, pM); - dc.DrawLine(pR, pM); - dc.DrawLine(pL1, pM); - dc.DrawLine(pR1, pM); - + wxPoint pL(p1.x + 3, p1.y+15); + wxPoint pR(p1.x + 47, p1.y + 15); + wxPoint pL1(pL.x, pL.y + 20); + wxPoint pR1(pR.x, pR.y + 20); + dc.DrawLine(pL, pR); + dc.DrawLine(pL1, pR1); + DrawArrow(dc, pR, ArrowRight, Loose); + DrawArrow(dc, pR1, ArrowRight, Loose); + dc.DrawLine(pA, pB); if (InputPointConnected(0)) DrawArrow(dc, pB, ArrowDown, Connected); @@ -106,14 +105,15 @@ DrawArrow(dc, pZ, ArrowDown, Loose); wxFont f = wxFont(*wxITALIC_FONT); - f.SetPointSize(7); + f.SetPointSize(12); dc.SetFont(f); - for (int i = 0; i < 9; i++){ - wxString text = wxString::Format("%d", i+1); + wxString msg("DTMF"); + for (int i = 0; i < 4; i++){ + wxString text = msg.Mid(i, 1); wxCoord w, h; dc.GetTextExtent(text, &w, &h); - int xPos = m_rect.x + 17 + ((i%3)*9) - (w/2); - int yPos = m_rect.y + 18 + ((i/3)*9) - (h/2); + int xPos = m_rect.x + 17 + (i*9) - (w/2); + int yPos = m_rect.y + 26 - (h/2); dc.DrawText(text, xPos, yPos); } Modified: sofaswitch/trunk/callflow/src/senddtmf.h ============================================================================== --- sofaswitch/trunk/callflow/src/senddtmf.h (original) +++ sofaswitch/trunk/callflow/src/senddtmf.h Mon Sep 25 22:42:11 2006 @@ -1,34 +1,34 @@ -#ifndef MAKE_CALL_H -#define MAKE_CALL_H +#ifndef SEND_DTMF_H +#define SEND_DTMF_H #include "dnd.h" ////////////////////////////////////////////////////////////////////////////////////////////// -/**Define a create a call shape. Store values for size, location, input & output points. +/**Define a create a send dtmf shape. . Store values for size, location, input & output points. This instance has the ability to draw this shape to a specified location on the canvas */ -class DndShapeMakeCall : public DndShape +class DndShapeSendDtmf : public DndShape { public: /**Construtor, Define this shape in terms of size and points etc */ - DndShapeMakeCall(); + DndShapeSendDtmf(); /**Destroy this shape, and log it */ - virtual ~DndShapeMakeCall() + virtual ~DndShapeSendDtmf() { } /**Draw this particular shape to the screen..*/ virtual void Draw(wxDC& dc); - /**Write the code generic to this Make Call shape */ + /**Write the code generic to this Send DTMF shape */ virtual bool WriteSystemCode(wxTextFile & file); /**Write the dictionary containing relevant points for this shape */ virtual bool WriteThisShapeInfo(wxTextFile & file); /** Used to report the name of this particular class. */ - static wxString GetKindName() { return wxString("Make Call"); } + static wxString GetKindName() { return wxString("Send Dtmf"); } }; -#endif // MAKE_CALL_H +#endif // SEND_DTMF_H Modified: sofaswitch/trunk/callflow/src/transfermedia.cpp ============================================================================== --- sofaswitch/trunk/callflow/src/transfermedia.cpp (original) +++ sofaswitch/trunk/callflow/src/transfermedia.cpp Mon Sep 25 22:42:11 2006 @@ -69,12 +69,12 @@ bool DndShapeTransferMedia::WriteSystemCode(wxTextFile & file) { - file.AddLine(" def TransferMedia(self, sTuple): "); + file.AddLine(" def Transfer_Media(self, sTuple): "); file.AddLine(" a,b,c = sTuple "); - file.AddLine(" rhost = self.data[a][\"worker node\"] "); - file.AddLine(" rhost += \":TRANSFERUDP \" + self.data[a][\"worker receiver\"] + \"\\0\" "); + file.AddLine(" rhost = eval(self.data[a][\"worker node\"]) "); + file.AddLine(" rhost += \":TRANSFERUDP \" + eval(self.data[a][\"worker receiver\"]) + \"\\0\" "); file.AddLine(" self.transport.write(rhost) "); - file.AddLine(" return self.data[a][\"Output\"] "); + file.AddLine(" return self.data[a][\"Output\"] "); file.AddLine(""); return true;
participants (1)
-
SofaSWITCH SVN