
After creating the iOS SDK, we actively began working on the Android version, since
modern trends do not allow to doubt the need to support this platform. In addition, there are already companies that have integrated the functionality of calls into their mobile applications for iOS, and they actively hinted that it would be time for Android to issue tools. As a result, replenishment has occurred in the SDK family that can interact with the VoxImplant platform. About what opportunities are available to developers and what can be built with them, as well as our idea about the contest for VoxImplant developers can be found under the cut.
So, what do we need in order to create an Android application with the functionality of real-time communications from VoxImplant? Firstly, fantasy to think of what we are doing and, secondly, tools for implementing our idea. To get started, download the Eclipse build called ADT from
this link from developer.android.com (as an option, now there is also an Android Studio based on IntelliJ IDEA on the same site). Then we need to download the VoxImplant Android SDK from
this link . This archive is actually not just a library, but also an example of an application to make it easier to understand. Unpack the archive and import the project into ADT. You may have to fix some imports of the JRE and Android library, since the project may contain a different version. If everything is done correctly, then we get a live project that can be built and run. As a result, on the device or emulator we get the following result:

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

Now we need to do the following:
- Go to the Applications / Applications section and create an application, let's call it testapplication
- In the Users section, create a user and attach it to the application, the latter can be done both during the creation of the user, and after. Let's call the user testuser
- Write a call processing script 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 you call the engine, which we call VoxEngine. Of course, a number of classes are added to the standard features and capabilities of Javascript that allow you to manage calls, make HTTP requests, etc. More information about the classes and features of VoxEngine is available here
http://voximplant.com/docs/references/appengine/ . We now write a very simple script that will simply wrap the sound back, a sort of echo test often used in a number of IP-telephony systems. Go to the Scenarios / Scenarios 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 answering the 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, then we will hear back. Save the script and go back to the Applications / Applications section, select editing our testapplication and open the Rules section. Click Add Rule and define the rule, you can name it as you like, for example, EchoRule. In the Pattern field, write echo instead of. * To execute this script only if the number was echo and drag TestScenario from Available to Assigned. Click Add, then click Save. Everything, the mission is completed, now you can return to our Android application and see how it all works (or does not work if something was done wrong along the way :)
Enter the username in the form testuser @ full_name_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. We press Call and we receive our call with an echo.
Call script customization
The echo is, of course, great, but it is of little use for some real-world applications, except for the case of testing the operation of the microphone, so let's now make it so that calls to real numbers are made. Go to the scripts section and create the following script (let's call it PSTN):
VoxEngine.forwardCallToPSTN();
Then we edit our application by adding a new rule (Rule), in which the Pattern is made of the form [0-9] + and in the Assigned we drag our PSTN script. Save and go to the mobile application again. Now, if instead of echo you enter a phone number in the format of the country code, region code, number (for example, 79261002030) and call, the call will go to the real phone number.
')
Other scenarios
On the basis of VoxImplant, you can make different services and applications. For example, you can make an OMS call center operator 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 this functionality and built it in their applications). We
have already written about creating a cloud-based IP PBX based on VoxImplant, respectively, you can implement some mobile client to such PBX in addition to SIP devices or softphones, if you so desire. 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
Documentation for the Android SDK is available at
http://voximplant.com/docs/references/mobilesdk/android/ . We recognize the critical importance of documentation and work to improve it while it is far from ideal, but we try to answer the questions that the developers send us. If you have a question during the development, do not hesitate to write to us, we will be happy to help.
Competition
We have such an interesting desire - to hold a contest for developers for the best application / service using VoxImplant. As soon as we complete the development of a number of important platform functions (for example, conferences) that will allow us to realize more of your fantasies, and finally determine the prize pool, criteria and conditions, we will announce it. As they say, stay tuned!