Last post I showed you how simple a Moho application looks like. Now let me explain a bit more how that simple Moho application works.

To develop a Moho application, you have to start with a Java class that implements Application interface. This class must be a public class with a public default constructor. The two abstract methods defined in Application are to notify the application about lifecycle changes. So a simplest do-nothing Moho application looks like the following.

public class HelloWorld implements Application { public void init(ApplicationContext context) { } public void destroy() { }
}

Next let’s add some code to accept an incoming call.

public class HelloWorld implements Application { ... @State public void onCall(Call call) { call.answer(); }
}

Now HelloWorld application can receive and answer an incoming call. The @State annotation has something to do with Moho’s state based event dispatching, which I will talk about in the future.

To make this application deployable to Voxeo PRISM, all you have to do is to pack this application into a WAR.

moho.2.war |--- WEB-INF |--- classes |--- HelloWorld.class

To run this application, simply copy the WAR to <prism>/apps directory. To test, simply use a softphone to dial something like sip:moho@localhost.

©2011 Voxeo Labs. All Rights Reserved.

.

Related posts:

  1. Introducing Moho Framework

Originally from All Voxeo Blogs Feed<