Revision: 18574
Author: oleg.kulikoff
Date: Wed May 25 04:01:26 2011
Log: Issue 2582: Demo: Remove System.out
http://code.google.com/p/mobicents/source/detail?r=18574
Added:
/trunk/servers/media/examples/telephony/ivr/slee/sbb/src/main/java/org/mobicents/media/demo/ivr/CallSbb.java
Deleted:
/trunk/servers/media/examples/telephony/ivr/slee/sbb/src/main/java/org/mobicents/media/demo/ivr/CallFSMFactory.java
/trunk/servers/media/examples/telephony/ivr/slee/sbb/src/main/java/org/mobicents/media/demo/ivr/Invite.java
/trunk/servers/media/examples/telephony/ivr/slee/sbb/src/main/java/org/mobicents/media/demo/ivr/connection/ConnectionFSMFactory.java
/trunk/servers/media/examples/telephony/ivr/slee/sbb/src/main/java/org/mobicents/media/demo/ivr/menu/MenuFSMFactory.java
Modified:
/trunk/servers/media/examples/telephony/ivr/slee/sbb/src/main/java/org/mobicents/media/demo/fsm/FSMFactory.java
/trunk/servers/media/examples/telephony/ivr/slee/sbb/src/main/java/org/mobicents/media/demo/ivr/StartMenu.java
/trunk/servers/media/examples/telephony/ivr/slee/sbb/src/main/java/org/mobicents/media/demo/ivr/menu/PlayCollectRequest.java
/trunk/servers/media/examples/telephony/ivr/slee/sbb/src/main/resources/META-INF/call-fsm.xml
/trunk/servers/media/examples/telephony/ivr/slee/sbb/src/main/resources/META-INF/sbb-jar.xml
/trunk/servers/media/examples/telephony/ivr/slee/sbb/src/test/java/org/mobicents/media/demo/fsm/FSMFactoryTest.java
/trunk/servers/media/examples/telephony/ivr/slee/services-du/${env.JBOSS_HOME}/server/default/deploy/IVR-Demo-DU-2.1.0-SNAPSHOT.jar
/trunk/servers/media/examples/telephony/ivr/slee/services-du/src/main/resources/services/service.xml
=======================================
--- /dev/null
+++
/trunk/servers/media/examples/telephony/ivr/slee/sbb/src/main/java/org/mobicents/media/demo/ivr/CallSbb.java
Wed May 25 04:01:26 2011
@@ -0,0 +1,242 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright XXXX, Red Hat Middleware LLC, and individual contributors as
indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a full listing
+ * of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU General Public License, v. 2.0.
+ * This program is distributed in the hope that it will be useful, but
WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License,
+ * v. 2.0 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.mobicents.media.demo.ivr;
+
+import jain.protocol.ip.mgcp.message.CreateConnectionResponse;
+import jain.protocol.ip.mgcp.message.DeleteConnectionResponse;
+import jain.protocol.ip.mgcp.message.ModifyConnectionResponse;
+import jain.protocol.ip.mgcp.message.parms.ReturnCode;
+import org.mobicents.media.demo.fsm.Signal;
+import org.mobicents.media.demo.fsm.FSM;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.sip.RequestEvent;
+import javax.slee.ActivityContextInterface;
+import javax.slee.CreateException;
+import javax.slee.RolledBackContext;
+import javax.slee.Sbb;
+import javax.slee.SbbContext;
+import net.java.slee.resource.mgcp.JainMgcpProvider;
+import net.java.slee.resource.mgcp.MgcpActivityContextInterfaceFactory;
+import net.java.slee.resource.sip.SipActivityContextInterfaceFactory;
+import net.java.slee.resource.sip.SleeSipProvider;
+import org.apache.log4j.Logger;
+import org.mobicents.media.demo.fsm.FSMFactory;
+
+/**
+ *
+ * @author kulikov
+ */
+public abstract class CallSbb implements Sbb {
+
+ // SIP
+ private SleeSipProvider provider;
+ private SipActivityContextInterfaceFactory acif;
+ // MGCP
+ private JainMgcpProvider mgcpProvider;
+ private MgcpActivityContextInterfaceFactory mgcpAcif;
+ private SbbContext sbbContext;
+ private Logger logger = Logger.getLogger(CallSbb.class);
+ private FSM callFSM;
+ private FSM connectionFSM;
+ private FSM menuFSM;
+
+ public void setSbbContext(SbbContext sbbContext) {
+ this.sbbContext = sbbContext;
+ try {
+ Context ctx = (Context) new
InitialContext().lookup("java:comp/env");
+
+ // initialize SIP API
+ provider = (SleeSipProvider)
ctx.lookup("slee/resources/jainsip/1.2/provider");
+ acif = (SipActivityContextInterfaceFactory)
ctx.lookup("slee/resources/jainsip/1.2/acifactory");
+
+ // initialize media api
+
+ mgcpProvider = (JainMgcpProvider)
ctx.lookup("slee/resources/jainmgcp/2.0/provider/demo");
+ mgcpAcif = (MgcpActivityContextInterfaceFactory)
ctx.lookup("slee/resources/jainmgcp/2.0/acifactory/demo");
+ } catch (Exception ne) {
+ logger.error("Could not set SBB context:", ne);
+ }
+ }
+
+ public void unsetSbbContext() {
+ this.sbbContext = null;
+ }
+
+ public void onInvite(RequestEvent event, ActivityContextInterface aci)
{
+ logger.info("Resource=SIP, Event=INVITE(initial), State=NULL,
Signal=invite");
+
+ //initialize call FSM
+ try {
+ callFSM =
FSMFactory.load(getClass().getResourceAsStream("/META-INF/call-fsm.xml"));
+ } catch (Exception e) {
+ logger.error("Could not load FSM:", e);
+ return;
+ }
+
+ callFSM.setAttribute("sip-provider", provider);
+ callFSM.setAttribute("sip-activity-factory", acif);
+
+ callFSM.setAttribute("mgcp-provider", mgcpProvider);
+ callFSM.setAttribute("mgcp-activity-factory", mgcpAcif);
+
+ try {
+ menuFSM =
FSMFactory.load(getClass().getResourceAsStream("/META-INF/menu-fsm.xml"));
+ } catch (Exception e) {
+ logger.error("Could not load FSM:", e);
+ return;
+ }
+
+ menuFSM.setAttribute("mgcp-provider", mgcpProvider);
+
+ try {
+ connectionFSM =
FSMFactory.load(getClass().getResourceAsStream("/META-INF/connection-fsm.xml"));
+ } catch (Exception e) {
+ logger.error("Could not load FSM:", e);
+ return;
+ }
+
+
+ connectionFSM.setAttribute("sip-provider", provider);
+ connectionFSM.setAttribute("sip-activity-factory", acif);
+
+ connectionFSM.setAttribute("mgcp-provider", mgcpProvider);
+ connectionFSM.setAttribute("mgcp-activity-factory", mgcpAcif);
+
+ connectionFSM.setAttribute("call", callFSM);
+ connectionFSM.setAttribute("menu", menuFSM);
+
+
+ callFSM.setAttribute("connection", connectionFSM);
+ callFSM.setAttribute("menu", menuFSM);
+
+ //start call creation
+ Signal<RequestEvent> invite = new Signal("connecting", event,
sbbContext, sbbContext.getSbbLocalObject());
+ callFSM.signal(invite);
+
+ logger.info("Resource=FSM, State= " +
callFSM.getState().getName());
+ }
+
+ public void onCreateConnectionResponse(CreateConnectionResponse event,
ActivityContextInterface aci) {
+ logger.info("Receive create connection response");
+ Signal<CreateConnectionResponse> signal = null;
+
+ switch (event.getReturnCode().getValue()) {
+ case ReturnCode.TRANSACTION_EXECUTED_NORMALLY:
+ logger.info("Generating signal: success");
+ signal = new Signal("success", event, sbbContext,
sbbContext.getSbbLocalObject());
+ break;
+ default:
+ logger.info("Generating signal: failure");
+ signal = new Signal("failure", event, sbbContext,
sbbContext.getSbbLocalObject());
+ break;
+ }
+
+ connectionFSM.signal(signal);
+ }
+
+ public void onModifyConnectionResponse(ModifyConnectionResponse event,
ActivityContextInterface aci) {
+ Signal<CreateConnectionResponse> signal = null;
+
+ switch (event.getReturnCode().getValue()) {
+ case ReturnCode.TRANSACTION_EXECUTED_NORMALLY:
+ logger.info("Generating signal: success");
+ signal = new Signal("success", event, sbbContext,
sbbContext.getSbbLocalObject());
+ break;
+ default:
+ logger.info("Generating signal: failure");
+ signal = new Signal("failure", event, sbbContext,
sbbContext.getSbbLocalObject());
+ break;
+ }
+
+ connectionFSM.signal(signal);
+ }
+
+ public void onDeleteConnectionResponse(DeleteConnectionResponse event,
ActivityContextInterface aci) {
+ Signal<CreateConnectionResponse> signal = null;
+
+ switch (event.getReturnCode().getValue()) {
+ case ReturnCode.TRANSACTION_EXECUTED_NORMALLY:
+ logger.info("Generating signal: success");
+ signal = new Signal("success", event, sbbContext,
sbbContext.getSbbLocalObject());
+ break;
+ default:
+ logger.info("Generating signal: failure");
+ signal = new Signal("failure", event, sbbContext,
sbbContext.getSbbLocalObject());
+ break;
+ }
+
+ connectionFSM.signal(signal);
+ }
+
+ public void onConnected(RequestEvent event, ActivityContextInterface
aci) {
+ logger.info("ACK event");
+ Signal s = new Signal("start", event, sbbContext,
sbbContext.getSbbLocalObject());
+ callFSM.signal(s);
+ }
+
+ public void onDisconnecting(RequestEvent event,
ActivityContextInterface aci) {
+ logger.info("BYE event");
+ callFSM.setAttribute("bye", event);
+ Signal s = new Signal("disconnect", event, sbbContext,
sbbContext.getSbbLocalObject());
+ callFSM.signal(s);
+ }
+
+ public void sbbCreate() throws CreateException {
+ }
+
+ public void sbbPostCreate() throws CreateException {
+ }
+
+ public void sbbActivate() {
+ }
+
+ public void sbbPassivate() {
+ }
+
+ public void sbbLoad() {
+ }
+
+ public void sbbStore() {
+ }
+
+ public void sbbRemove() {
+ }
+
+ public void sbbExceptionThrown(Exception excptn, Object o,
ActivityContextInterface aci) {
+ }
+
+ public void sbbRolledBack(RolledBackContext rbc) {
+ }
+
+ public SleeSipProvider getSipProvider() {
+ return this.provider;
+ }
+
+ public JainMgcpProvider getMgcpProvider() {
+ return this.mgcpProvider;
+ }
+
+ public MgcpActivityContextInterfaceFactory
getMgcpActivityContextFactory() {
+ return this.mgcpAcif;
+ }
+
+ public SipActivityContextInterfaceFactory
getSipActivityContextFactory() {
+ return this.acif;
+ }
+}
=======================================
---
/trunk/servers/media/examples/telephony/ivr/slee/sbb/src/main/java/org/mobicents/media/demo/ivr/CallFSMFactory.java
Tue May 24 03:52:17 2011
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright XXXX, Red Hat Middleware LLC, and individual contributors as
indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a full listing
- * of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU General Public License, v. 2.0.
- * This program is distributed in the hope that it will be useful, but
WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU General Public License for more details.
- * You should have received a copy of the GNU General Public License,
- * v. 2.0 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.mobicents.media.demo.ivr;
-
-import org.mobicents.media.demo.fsm.FSM;
-import org.mobicents.media.demo.fsm.State;
-
-/**
- *
- * @author kulikov
- */
-public class CallFSMFactory {
- public static FSM createFSM() {
- FSM fsm = new FSM("Call");
-
- //states
- State inactive = fsm.createState("inactive");
- State connecting = fsm.createState("connecting");
- State connected = fsm.createState("connected");
- State starting = fsm.createState("starting");
-
- State started = fsm.createState("started");
- started.setEnterHandler(new StartMenu());
-
- State disconnecting = fsm.createState("disconnecting");
- State failed = fsm.createState("failed");
-
- //transitions
- inactive.createTransition("connecting", connecting).setHandler(new
ConnectingRequest());
-
- connecting.createTransition("connection_connected",
connected).setHandler(new ConnectedResponse());
- connecting.createTransition("connection_failed", failed);
- connecting.createTransition("abort", inactive);
-
- connected.createTransition("start", starting).setHandler(new
StartTransmissionRequest());
- connected.createTransition("disconnect", inactive);
-
- starting.createTransition("connection_started", started);
- starting.createTransition("connection_failed", failed);
-
- started.createTransition("disconnect",
disconnecting).setHandler(new DeleteConnectionRequest());
-
- disconnecting.createTransition("done", inactive).setHandler(new
DeletedResponse());
-
- fsm.setStart(inactive);
- return fsm;
- }
-}
=======================================
---
/trunk/servers/media/examples/telephony/ivr/slee/sbb/src/main/java/org/mobicents/media/demo/ivr/Invite.java
Wed May 25 00:19:52 2011
+++ /dev/null
@@ -1,250 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright XXXX, Red Hat Middleware LLC, and individual contributors as
indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a full listing
- * of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU General Public License, v. 2.0.
- * This program is distributed in the hope that it will be useful, but
WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU General Public License for more details.
- * You should have received a copy of the GNU General Public License,
- * v. 2.0 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.mobicents.media.demo.ivr;
-
-import jain.protocol.ip.mgcp.message.CreateConnectionResponse;
-import jain.protocol.ip.mgcp.message.DeleteConnectionResponse;
-import jain.protocol.ip.mgcp.message.ModifyConnectionResponse;
-import jain.protocol.ip.mgcp.message.parms.ReturnCode;
-import org.mobicents.media.demo.fsm.Signal;
-import org.mobicents.media.demo.fsm.FSM;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.sip.RequestEvent;
-import javax.slee.ActivityContextInterface;
-import javax.slee.CreateException;
-import javax.slee.RolledBackContext;
-import javax.slee.Sbb;
-import javax.slee.SbbContext;
-import net.java.slee.resource.mgcp.JainMgcpProvider;
-import net.java.slee.resource.mgcp.MgcpActivityContextInterfaceFactory;
-import net.java.slee.resource.sip.SipActivityContextInterfaceFactory;
-import net.java.slee.resource.sip.SleeSipProvider;
-import org.apache.log4j.Logger;
-import org.mobicents.media.demo.fsm.FSMFactory;
-import org.mobicents.media.demo.ivr.connection.ConnectionFSMFactory;
-import org.mobicents.media.demo.ivr.menu.MenuFSMFactory;
-
-/**
- *
- * @author kulikov
- */
-public abstract class Invite implements Sbb {
-
-// SIP
- private SleeSipProvider provider;
- private SipActivityContextInterfaceFactory acif;
-
- // MGCP
- private JainMgcpProvider mgcpProvider;
- private MgcpActivityContextInterfaceFactory mgcpAcif;
-
- private SbbContext sbbContext;
- private Logger logger = Logger.getLogger(Invite.class);
-
- private FSM callFSM;
- private FSM connectionFSM;
- private FSM menuFSM;
-
- public void setSbbContext(SbbContext sbbContext) {
- this.sbbContext = sbbContext;
- try {
- Context ctx = (Context) new
InitialContext().lookup("java:comp/env");
-
- // initialize SIP API
- provider = (SleeSipProvider)
ctx.lookup("slee/resources/jainsip/1.2/provider");
- acif = (SipActivityContextInterfaceFactory)
ctx.lookup("slee/resources/jainsip/1.2/acifactory");
-
- // initialize media api
-
- mgcpProvider = (JainMgcpProvider)
ctx.lookup("slee/resources/jainmgcp/2.0/provider/demo");
- mgcpAcif = (MgcpActivityContextInterfaceFactory)
ctx.lookup("slee/resources/jainmgcp/2.0/acifactory/demo");
- } catch (Exception ne) {
- logger.error("Could not set SBB context:", ne);
- }
- }
-
- public void unsetSbbContext() {
- this.sbbContext = null;
- }
-
- public void onInvite(RequestEvent event, ActivityContextInterface aci)
{
- logger.info("Resource=SIP, Event=INVITE(initial), State=NULL,
Signal=invite");
-
- //initialize call FSM
- try {
- callFSM =
FSMFactory.load(getClass().getResourceAsStream("/META-INF/call-fsm.xml"));
- } catch (Exception e) {
- logger.error("Could not load FSM:", e);
- return;
- }
-
- callFSM.setAttribute("sip-provider", provider);
- callFSM.setAttribute("sip-activity-factory", acif);
-
- callFSM.setAttribute("mgcp-provider", mgcpProvider);
- callFSM.setAttribute("mgcp-activity-factory", mgcpAcif);
-
-// menuFSM = MenuFSMFactory.createFSM();
- try {
- menuFSM =
FSMFactory.load(getClass().getResourceAsStream("/META-INF/connection-fsm.xml"));
- } catch (Exception e) {
- logger.error("Could not load FSM:", e);
- return;
- }
-
- menuFSM.setAttribute("mgcp-provider", mgcpProvider);
-
- try {
- connectionFSM =
FSMFactory.load(getClass().getResourceAsStream("/META-INF/connection-fsm.xml"));
- } catch (Exception e) {
- logger.error("Could not load FSM:", e);
- return;
- }
-
-// connectionFSM = ConnectionFSMFactory.createFSM();
-
- connectionFSM.setAttribute("sip-provider", provider);
- connectionFSM.setAttribute("sip-activity-factory", acif);
-
- connectionFSM.setAttribute("mgcp-provider", mgcpProvider);
- connectionFSM.setAttribute("mgcp-activity-factory", mgcpAcif);
-
- connectionFSM.setAttribute("call", callFSM);
- connectionFSM.setAttribute("menu", menuFSM);
-
-
- callFSM.setAttribute("connection", connectionFSM);
- callFSM.setAttribute("menu", menuFSM);
-
- //start call creation
- Signal<RequestEvent> invite = new Signal("connecting", event,
sbbContext, sbbContext.getSbbLocalObject());
- callFSM.signal(invite);
-
- logger.info("Resource=FSM, State= " +
callFSM.getState().getName());
- }
-
- public void onCreateConnectionResponse(CreateConnectionResponse event,
ActivityContextInterface aci) {
- logger.info("Receive create connection response");
- Signal<CreateConnectionResponse> signal = null;
-
- switch (event.getReturnCode().getValue()) {
- case ReturnCode.TRANSACTION_EXECUTED_NORMALLY :
- logger.info("Generating signal: success");
- signal = new Signal("success", event, sbbContext,
sbbContext.getSbbLocalObject());
- break;
- default :
- logger.info("Generating signal: failure");
- signal = new Signal("failure", event, sbbContext,
sbbContext.getSbbLocalObject());
- break;
- }
-
- connectionFSM.signal(signal);
- }
-
- public void onModifyConnectionResponse(ModifyConnectionResponse event,
ActivityContextInterface aci) {
- Signal<CreateConnectionResponse> signal = null;
-
- switch (event.getReturnCode().getValue()) {
- case ReturnCode.TRANSACTION_EXECUTED_NORMALLY :
- logger.info("Generating signal: success");
- signal = new Signal("success", event, sbbContext,
sbbContext.getSbbLocalObject());
- break;
- default :
- logger.info("Generating signal: failure");
- signal = new Signal("failure", event, sbbContext,
sbbContext.getSbbLocalObject());
- break;
- }
-
- connectionFSM.signal(signal);
- }
-
- public void onDeleteConnectionResponse(DeleteConnectionResponse event,
ActivityContextInterface aci) {
- Signal<CreateConnectionResponse> signal = null;
-
- switch (event.getReturnCode().getValue()) {
- case ReturnCode.TRANSACTION_EXECUTED_NORMALLY :
- logger.info("Generating signal: success");
- signal = new Signal("success", event, sbbContext,
sbbContext.getSbbLocalObject());
- break;
- default :
- logger.info("Generating signal: failure");
- signal = new Signal("failure", event, sbbContext,
sbbContext.getSbbLocalObject());
- break;
- }
-
- connectionFSM.signal(signal);
- }
-
- public void onConnected(RequestEvent event, ActivityContextInterface
aci) {
- logger.info("ACK event");
- Signal s = new Signal("start", event, sbbContext,
sbbContext.getSbbLocalObject());
- callFSM.signal(s);
- }
-
- public void onDisconnecting(RequestEvent event,
ActivityContextInterface aci) {
- logger.info("BYE event");
- callFSM.setAttribute("bye", event);
- Signal s = new Signal("disconnect", event, sbbContext,
sbbContext.getSbbLocalObject());
- callFSM.signal(s);
- }
-
- public void sbbCreate() throws CreateException {
- }
-
- public void sbbPostCreate() throws CreateException {
- }
-
- public void sbbActivate() {
- }
-
- public void sbbPassivate() {
- }
-
- public void sbbLoad() {
- }
-
- public void sbbStore() {
- }
-
- public void sbbRemove() {
- }
-
- public void sbbExceptionThrown(Exception excptn, Object o,
ActivityContextInterface aci) {
- }
-
- public void sbbRolledBack(RolledBackContext rbc) {
- }
-
- public SleeSipProvider getSipProvider() {
- return this.provider;
- }
-
- public JainMgcpProvider getMgcpProvider() {
- return this.mgcpProvider;
- }
-
- public MgcpActivityContextInterfaceFactory
getMgcpActivityContextFactory() {
- return this.mgcpAcif;
- }
-
- public SipActivityContextInterfaceFactory
getSipActivityContextFactory() {
- return this.acif;
- }
-
-}
=======================================
---
/trunk/servers/media/examples/telephony/ivr/slee/sbb/src/main/java/org/mobicents/media/demo/ivr/connection/ConnectionFSMFactory.java
Tue May 17 06:01:04 2011
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright XXXX, Red Hat Middleware LLC, and individual contributors as
indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a full listing
- * of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU General Public License, v. 2.0.
- * This program is distributed in the hope that it will be useful, but
WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU General Public License for more details.
- * You should have received a copy of the GNU General Public License,
- * v. 2.0 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.mobicents.media.demo.ivr.connection;
-
-import org.mobicents.media.demo.fsm.FSM;
-import org.mobicents.media.demo.fsm.State;
-
-/**
- *
- * @author kulikov
- */
-public class ConnectionFSMFactory {
- /**
- * Creates FSM for media connection
- *
- * @return
- */
- public static FSM createFSM() {
- FSM fsm = new FSM("Connection");
-
- //states
- State inactive = fsm.createState("inactive");
- State creating = fsm.createState("creating");
- State created = fsm.createState("created");
- State opening = fsm.createState("opening");
- State opened = fsm.createState("opened");
- State starting = fsm.createState("starting");
- State started = fsm.createState("started");
- State deleting = fsm.createState("deleting");
- State aborting = fsm.createState("aborted");
-
- //transitions
- inactive.createTransition("create_only", creating);
- inactive.createTransition("create_open", opening).setHandler(new
CreateOpenRequest());
- inactive.createTransition("create_start", starting);
-
- creating.createTransition("success", created);
- creating.createTransition("failure", inactive);
- creating.createTransition("abort", aborting);
-
- created.createTransition("modify_open", opening);
- created.createTransition("modify_start", starting);
- created.createTransition("delet", deleting);
-
- opening.createTransition("success", opened).setHandler(new
ConnectionOpenedHandler());
- opening.createTransition("failure", inactive);
- opening.createTransition("abort", aborting);
-
- opened.createTransition("modify_start", starting).setHandler(new
StartRequest());
- opened.createTransition("delete", deleting);
-
- starting.createTransition("success", started).setHandler(new
TransmissionStartedHandler());
- starting.createTransition("abort", aborting);
- starting.createTransition("failure", inactive);
-
- started.createTransition("delete", deleting).setHandler(new
DeleteRequest());
-
- deleting.createTransition("success", inactive).setHandler(new
ConnectionDeletedHandler());
-
- aborting.createTransition("success", deleting);
- aborting.createTransition("failed", inactive);
-
- fsm.setStart(inactive);
- return fsm;
- }
-}
=======================================
---
/trunk/servers/media/examples/telephony/ivr/slee/sbb/src/main/java/org/mobicents/media/demo/ivr/menu/MenuFSMFactory.java
Wed May 25 00:19:52 2011
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright XXXX, Red Hat Middleware LLC, and individual contributors as
indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a full listing
- * of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU General Public License, v. 2.0.
- * This program is distributed in the hope that it will be useful, but
WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU General Public License for more details.
- * You should have received a copy of the GNU General Public License,
- * v. 2.0 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.mobicents.media.demo.ivr.menu;
-
-import org.mobicents.media.demo.fsm.FSM;
-import org.mobicents.media.demo.fsm.State;
-
-/**
- *
- * @author kulikov
- */
-public class MenuFSMFactory {
- private static String url;
-
- public static FSM createFSM() {
- FSM fsm = new FSM("Menu");
-
- //create states
- State inactive = fsm.createState("null");
- State welcome = fsm.createState("welcome");
- State waitingDigit = fsm.createState("waiting");
-
- //create transitions
- inactive.createTransition("start", welcome).setHandler(new
PlayCollectRequest());
-
- welcome.createTransition("listen", waitingDigit).setHandler(new
PlayCollectRequest());
- waitingDigit.createTransition("listen",
waitingDigit).setHandler(new PlayCollectRequest());
- waitingDigit.createTransition("terminate", inactive);
-
-
- fsm.setStart(welcome);
-
- return fsm;
- }
-}
=======================================
---
/trunk/servers/media/examples/telephony/ivr/slee/sbb/src/main/java/org/mobicents/media/demo/fsm/FSMFactory.java
Wed May 25 00:19:52 2011
+++
/trunk/servers/media/examples/telephony/ivr/slee/sbb/src/main/java/org/mobicents/media/demo/fsm/FSMFactory.java
Wed May 25 04:01:26 2011
@@ -111,7 +111,6 @@
}
if (start) fsm.setStart(state);
- System.out.println("Created state: " + name);
}
private static void createTransitions(FSM fsm, Node descriptor) throws
ClassNotFoundException, InstantiationException, IllegalAccessException {
@@ -137,7 +136,6 @@
String handler = attributes.getNamedItem("handler") != null ?
attributes.getNamedItem("handler").getNodeValue() : null;
Transition t = fsm.createTransition(name, source, destination);
- System.out.println("Created transition from " + source +" to " +
destination);
if (handler != null) {
loadTransitionHandler(t, handler);
=======================================
---
/trunk/servers/media/examples/telephony/ivr/slee/sbb/src/main/java/org/mobicents/media/demo/ivr/StartMenu.java
Tue May 24 03:52:17 2011
+++
/trunk/servers/media/examples/telephony/ivr/slee/sbb/src/main/java/org/mobicents/media/demo/ivr/StartMenu.java
Wed May 25 04:01:26 2011
@@ -17,6 +17,7 @@
*/
package org.mobicents.media.demo.ivr;
+import org.apache.log4j.Logger;
import org.mobicents.media.demo.fsm.FSM;
import org.mobicents.media.demo.fsm.Signal;
import org.mobicents.media.demo.fsm.State;
@@ -28,9 +29,13 @@
*/
public class StartMenu implements StateChangeListener {
+ private Logger logger = Logger.getLogger(StartMenu.class);
+
public void process(State state) {
+ logger.info("Starting voice menu");
+
FSM fsm = state.getFSM();
- Signal signal = new Signal("start_menu", null, null, null);
+ Signal signal = new Signal("start", null, null, null);
FSM menuFSM = (FSM) fsm.getAttribute("menu");
menuFSM.signal(signal);
=======================================
---
/trunk/servers/media/examples/telephony/ivr/slee/sbb/src/main/java/org/mobicents/media/demo/ivr/menu/PlayCollectRequest.java
Wed May 25 00:19:52 2011
+++
/trunk/servers/media/examples/telephony/ivr/slee/sbb/src/main/java/org/mobicents/media/demo/ivr/menu/PlayCollectRequest.java
Wed May 25 04:01:26 2011
@@ -83,6 +83,8 @@
rqnt.setSignalRequests(signals);
rqnt.setRequestedEvents(events);
+ //set transaction handler
+
rqnt.setTransactionHandle(mgcpProvider.getUniqueTransactionHandler());
//send message to server
mgcpProvider.sendMgcpEvents(new JainMgcpEvent[]{rqnt});
}
=======================================
---
/trunk/servers/media/examples/telephony/ivr/slee/sbb/src/main/resources/META-INF/call-fsm.xml
Wed May 25 00:19:52 2011
+++
/trunk/servers/media/examples/telephony/ivr/slee/sbb/src/main/resources/META-INF/call-fsm.xml
Wed May 25 04:01:26 2011
@@ -42,7 +42,7 @@
</state>
<!-- transmission started -->
- <state name="started">
+ <state name="started" onEnter="org.mobicents.media.demo.ivr.StartMenu">
<transition name="disconnect" destination="disconnecting"
handler="org.mobicents.media.demo.ivr.DeleteConnectionRequest"/>
</state>
=======================================
---
/trunk/servers/media/examples/telephony/ivr/slee/sbb/src/main/resources/META-INF/sbb-jar.xml
Tue May 17 06:01:04 2011
+++
/trunk/servers/media/examples/telephony/ivr/slee/sbb/src/main/resources/META-INF/sbb-jar.xml
Wed May 25 04:01:26 2011
@@ -3,11 +3,11 @@
"http://java.sun.com/dtd/slee-sbb-jar_1_1.dtd">
<sbb-jar>
<sbb id="invite">
- <description>Initial FSM event</description>
- <sbb-name>InviteSbb</sbb-name>
+ <description>Bridges the gap between resources and
FSM</description>
+ <sbb-name>CallSbb</sbb-name>
<sbb-vendor>org.mobicents</sbb-vendor>
<sbb-version>1.0</sbb-version>
- <sbb-alias>InviteSbb</sbb-alias>
+ <sbb-alias>CallSbb</sbb-alias>
<!-- sbb-ref>
<sbb-name>RecorderSbb</sbb-name>
@@ -31,7 +31,7 @@
<sbb-classes>
<sbb-abstract-class>
<sbb-abstract-class-name>
- org.mobicents.media.demo.ivr.Invite
+ org.mobicents.media.demo.ivr.CallSbb
</sbb-abstract-class-name>
<!-- get-child-relation-method>
=======================================
---
/trunk/servers/media/examples/telephony/ivr/slee/sbb/src/test/java/org/mobicents/media/demo/fsm/FSMFactoryTest.java
Tue May 24 03:52:17 2011
+++
/trunk/servers/media/examples/telephony/ivr/slee/sbb/src/test/java/org/mobicents/media/demo/fsm/FSMFactoryTest.java
Wed May 25 04:01:26 2011
@@ -32,7 +32,6 @@
*/
public void testLoad() throws Exception {
InputStream stream =
this.getClass().getResourceAsStream("/call-fsm.xml");
- System.out.println("Stream=" + stream);
FSMFactory.load(stream);
}
=======================================
---
/trunk/servers/media/examples/telephony/ivr/slee/services-du/${env.JBOSS_HOME}/server/default/deploy/IVR-Demo-DU-2.1.0-SNAPSHOT.jar
Thu May 12 08:58:17 2011
+++
/trunk/servers/media/examples/telephony/ivr/slee/services-du/${env.JBOSS_HOME}/server/default/deploy/IVR-Demo-DU-2.1.0-SNAPSHOT.jar
Wed May 25 04:01:26 2011
Binary file, no diff available.
=======================================
---
/trunk/servers/media/examples/telephony/ivr/slee/services-du/src/main/resources/services/service.xml
Thu May 12 08:58:17 2011
+++
/trunk/servers/media/examples/telephony/ivr/slee/services-du/src/main/resources/services/service.xml
Wed May 25 04:01:26 2011
@@ -7,7 +7,7 @@
<service-vendor>org.mobicents</service-vendor>
<service-version>1.0</service-version>
<root-sbb>
- <sbb-name>InviteSbb</sbb-name>
+ <sbb-name>CallSbb</sbb-name>
<sbb-vendor>org.mobicents</sbb-vendor>
<sbb-version>1.0</sbb-version>
</root-sbb>