
VoxImplant Android SDK: telephony and voice real-time communications in your application

So, what do we need in order to create an Android application with real-time communications functionality from VoxImplant? Firstly, the fantasy is to come up with what and why we are doing, and secondly, the tools to implement our idea. To get started, download the Eclipse assembly called ADT from this link from developer.android.com (as an option, now there is also Android Studio based on IntelliJ IDEA on the same site). Then we need to download VoxImplant Android SDK from this link. This archive is actually not just libraries, but also an example application to make it easier to understand. Unpack the archive and import the project into ADT. You may have to fix some imports of JRE and Android libraries, as the project may have a different version specified. If everything is done correctly, then we get a living project that you can build and run. As a result, on the device or emulator we get the following result:

It is logical that without a VoxImplant account and some call processing scenario, the application is useless, so we need to create a VoxImplant developer account (if you don’t have one yet) and, after activation via SMS, go to control panel . Where we will see the following picture:

Now we need to perform the following actions:
- Go to the Applications section and create an application, call it testapplication
- In the Users section, create a user and attach it to the application, the latter can be done both during user creation and after. Call the user testuser
- Write a script for processing a call through the application (more on this below)
- Assign a call processing script, specifying the number pattern at which it should work
Call processing script
All scripts are written in Javascript and executed when called by the engine, which we call VoxEngine. Of course, a number of classes are added to the standard Javascript functions and capabilities that allow you to manage calls, make HTTP requests, etc. More information about VoxEngine classes and functions is available here http://voximplant.com/docs/references/appengine/ . We are now writing a very simple script that simply wraps the sound back, a kind of echo test often used in a number of IP-telephony systems. We go to the Scenarios / Scripts section, click to create a script, call it TestScenario and write the following code:
VoxEngine.addEventListener(AppEvents.CallAlerting, function(e) {
e.call.answer();
e.call.addEventListener(CallEvents.Connected, function(e) {
e.call.sendMediaTo(e.call);
});
});
In fact, we are here answering a call from the SDK on the platform side, and after connecting, we wrap the incoming sound back to the caller, we get an echo. What we say, we will hear back. We save the script and again go to the Applications section, select the editing of our testapplication and open the Rules section. Click Add Rule and define a rule, you can call it anything you like, for example, EchoRule. In the Pattern field, write echo instead of. * To execute this scenario only if the number was echo and drag TestScenario from Available to Assigned. Click Add, then click Save. That's it, the mission is complete, now you can return to our Android application and see how it all works (or doesn’t work if you did something wrong along the way :)
We enter the login in the form testuser @ full_name_of your_application (testapplication.kraken.voximplant.com in my case), password and echo as the phone number, click Connect, after that the message Connected to server should appear. Click Login and get Logged in successfully. Click Call and get our call with an echo.
Call script customization
Echo is, of course, great, but it’s of little use for some real applications, except for the case for testing the microphone’s performance, so let's now make calls to real numbers work. We go to the scripting section and create the following script (let's call it PSTN):
VoxEngine.forwardCallToPSTN();
Then we edit our application, adding a new rule (Rule), in which we make Pattern of the form [0-9] + and drag our PSTN script into Assigned. Save and go to the mobile application again. Now if instead of echo you enter a phone number in the format country code, region code, number (for example, 79261002030) and make a call, the call will go to the real phone number.
Other scenarios
Based on VoxImplant, you can make different services and applications. For example, you can make a call center operator's RMO based on some Android device or make a VoIP dialer a la Viber (despite the fact that we are still optimizing the platform for such scenarios, there are companies that have already made such functionality and built it to your applications). We already wrote about creating a cloud-based IP PBX based on VoxImplant, so you can implement some kind of mobile client for such a PBX in addition to SIP devices or softphones, if you wish. In the near future, we will add video call support to the Android SDK so that its functionality is fully consistent with the iOS version.
Documentation
The Android SDK documentation is available at http://voximplant.com/docs/references/mobilesdk/android/ . We recognize the critical importance of documentation and are working to improve it while it is far from ideal, but we try to answer the questions that developers send us. If you had a question during development, then do not hesitate to write to us, we will be happy to help.
Competition
We have such an interesting desire - to hold a competition for developers for the best application / service using VoxImplant. As soon as we complete the development of a number of important platform features (for example, conferences) that will allow you to realize more of your fantasies, and finally decide on the prize pool, criteria and conditions, we will announce this. As they say, stay tuned!
Only registered users can participate in the survey. Please come in.
Would you be interested in participating in the VoxImplant Developer Contest?
- 31.5% Yes 12
- 44.7% No 17
- 50% Depends on the prize :) 19