SDK Guide

  1. Usefull links and tips
    1. Developer (you!)
    2. Projects
    3. Database
    4. API (nursery)
  2. Emerginov Architecture
  3. Emerginov PHP built-in functions
    1. Emerginov class
      1. Constructor
      2. Call
      3. ConfigureSMSReceiver
      4. GetTextToSpeechVoices
      5. ManageGroups
      6. SendSMS
      7. TextToSpeech
    2. EmerginovResult class
      1. Success
      2. Result
    3. Specificities for PHP callback file
      1. Answer
      2. Ask
      3. AskWithSpeechReco
      4. Call
      5. Hangup
      6. Play
      7. PlayAndAsk
      8. Record
      9. Say
  4. Micro Service Sample
    1. Simple Web Hosting
    2. Web Hosting and Database
    3. Send SMS from Web Pages
    4. Manage SMS Receiver API from Web Pages
    5. Receive SMS on Web Pages
    6. Make Outgoing Call
    7. Manage Groups
    8. Create a Vocal Kiosk in PHP
    9. Create a Vocal Kiosk in VXML

Usefull links and tips

Developer (you!)

  • Main web page: <YourEmerginov> .
  • Selfcare: <YourEmerginov>/main_authen/selfcare.php
  • Selfcare login and password: You may have received your login & password in your mailbox
  • Developers wiki main web page: <YourEmerginov>/

Projects

  • Your project sources: <YourEmerginov>/
  • Your project website:  <YourEmerginov>/projectname/  (replace projectname by your project name).
  • All project on Emerginov platform: <YourEmerginov>/projects-list.php

Database

  • PHPMyAdmin: <YourEmerginov>/
  • MySQL Server: ''db.emerginov.local'' (Remember that this is only an internal domain name).
  • MySQL login: your project name (e.g. language_api).
  • MySQL password: if you are the creator of the project, you received it in your mailbox. If you are not, please ask the creator.
  • MySQL database name: your project name (e.g. language_api).

API (nursery)

  • Your projects subscription on Nursery: <YourEmerginov>/OrangeNursery/ .
  • Your login and password on Nursery: the same login & password that you use for selfcare
  • Nursery presentation: ###

Emerginov Architecture

Archidevsimple.png

Emerginov PHP built-in functions

Emerginov class

This class can be used by including ''Emerginov.php'' file in your project:
 include("Emerginov.php");

Class constructor:

  • new Emerginov($NurseryLogin, $NurseryPWD)

Methods available:

  • Emerginov->Call($number)
  • Emerginov->GetTextToSpeechVoices()
  • Emerginov->SendSMS($number,$content)
  • Emerginov->TextToSpeech($text, $filename, $voice='Philippe', $input_encoding = "utf8", $parsing = "all", $frequency = "8000", $header = "wav-header", $coding = "lin")

Constructor

Description
 Return a new Emerginov object

Parameters
 $NurseryLogin: this is your project Nursery login (the one that ends with -INT)
 $NurseryPWD: this is your project Nursery password

Return
 A new Emerginov Object

Call

Description
 Make a call between your project and a number. Before using this method,
 you must subscribe the Outgoing-Call API on Nursery subscription website for your project.

Parameters (''italics'' are optionals)
 $number: the number to call. On USBKey, for test purpose, this number must be one of Alice, Bob or Carol.
$callback: the callback file that must be used by media server. This parameter is optional as a callback file might already be specified on your project configuration with your personal account web page. You can override the default callback by specifying a php file here.
$timeout: the number of millisecond to wait for answering. Default is 70000 (70 seconds).

Return
 A new EmerginovResult (see EmerginovResult class for details)

ConfigureSMSReceiver

Description
 Configure the XMSMO API for this project. Before using this method, you must subscribe the XMS-MO API on Nursery subscription website for your project.

Parameters (''italics'' are optionals)
$callback: the php callback file that must be called when a SMS is incoming to your application.
 $keywords: this is an array containing all keywords your application must listen on. Every SMS the Emerginov platform receives starting with one of these keywords will be routed to your application.
$msisdns: this is an array containing all MSISDN (phone numbers) your application must listen on.
   All SMS coming from those MSISDN will directly be routed to your application.

 If no parameters are defined, the configuration will be deleted!

Return
 If no parameters are defined, then the method return an new EmerginovResult class (see EmerginovResult class for details)

 If the $callback parameter is not null, then the method return an new XmsmoService. (see below)

 On Error, it will return an new EmerginovResult class

XmsmoService

Description
 This class is used to manipulate your project XMS-MO API settings. It has many methods:

addKeyword

Description
 This method is used to add a keyword your application must listen on. Every SMS the Emerginov platform receives starting with this keyword will be routed to your application.

Parameter
 $keyword: The keyword to add.

Return
 A new EmerginovResult to tell you if everything went fine (an error might occur if this keyword is already used).

addMsisdn

Description
 This method is used to add a MSISDN your application must listen on. Every SMS the Emerginov platform receives from this phone number will be routed to your application.

Parameter
 $msisdn: The MSISDN (phone number) to add.

Return
 A new EmerginovResult to tell you if everything went fine (an error might occur if this MSISDN is already used).

getService

Description
 This method is used to get your project current configuration.

Parameter
 none

Return
 A new Service object representing your configuration (informative).

removeKeyword

Description
 This method is used to remove a keyword your application must listen on.

Parameter
 $keyword: The keyword to remove.

Return
 A new EmerginovResult to tell you if everything went fine. See EmerginovResult class for more details.

removeMsisdn

Description
 This method is used to remove a MSISDN your application must listen on.

Parameter
 $msisdn: The MSISDN (phone number) to remove.

Return
 A new EmerginovResult to tell you if everything went fine. See EmerginovResult class for more details.

GetTextToSpeechVoices

Description
 This method let you ask for available voices on Emerginov platform

Parameters
 None

Return
 A new EmerginovResult (see EmerginovResult class for details)

ManageGroups

Description
 This method let you manage the Groups API. See  for more info on this API.

Parameters
 $action is the action you want to invoke (see all $action available below)
$parameters is an associative array with all parameters needed for this $action (see below for parameters for each action)

Return
 A new EmerginovResult (see EmerginovResult class for details) including an array

Actions

For example on how to use such $action, please refer to the sample section ###

createUser

Description
 This $action will let you create a new user in the Groups database

Parameters
 $number is the number of the user to create
 $name is the name (can be empty)
 $pwd is the password for this user

Return
 The EmerginovResult object includes an array with the following values:
 array[0] is a string status information. One of ''ok'', ''failed''
 array[1] is an HTTP status code. One of ''200'', ''400'', ''401'', etc.
 array[2] is an string info about the result

deleteUser

Description
 This $action will let you delete a user from the Groups database. Please, remember that if the user is a group owner, it can not be deleted. You must update the owner of the group before deleting this user.

Parameters 
 $number is the number of the user to delete
 $pwd is the password for this user

Return
 The EmerginovResult object includes an array with the following values:
 array[0] is a string status information. One of ''ok'', ''failed''
 array[1] is an HTTP status code. One of ''200'', ''400'', ''401'', etc.
 array[2] is an string info about the result

updateUser

Description
 This $action will let you update an user information.

Parameters
 $number is the current number of the user
 $pwd is the current password of the user
 $name is the new name to set for this user. Leave if empty if you dont want to update it
 $newpwd is the new password to set for this user. Leave if empty if you dont want to update it
 $newnumber is the new number to set for this user. Leave if empty if you dont want to update it

Return
 The EmerginovResult object includes an array with the following values:
 array[0] is a string status information. One of ''ok'', ''failed''
 array[1] is an HTTP status code. One of ''200'', ''400'', ''401'', etc.
 array[2] is an string info about the result

getUserInfo

Description
 Get all information about an user

Parameters
 $number is the number of the user to retrieve information from

Return
 The EmerginovResult object includes an array with the following values:
 array[0] is a string status information. One of ''ok'', ''failed''
 array[1] is an HTTP status code. One of ''200'', ''400'', ''401'', etc.
 array[2] is an string info about the result

createGroup

Description
 This method will let you create a new group in the Groups database

Parameters 
 $group is the name of the group to create (max 50 char)
 $number is the owner of the group. A group must always have an owner
 $pwd is the user (owner) password. If the password is not provided the group will not be created.
 $gpwd is the group password. If not provided, the password will randomly
  be generated
 $desc is the description of this group

Return
 The EmerginovResult object includes an array with the following values:
 array[0] is a string status information. One of ''ok'', ''failed''
 array[1] is an HTTP status code. One of ''200'', ''400'', ''401'', etc.
 array[2] is an string info about the result

deleteGroup

Description
 This method let you delete an existing group from Groups database. Please remember that the group will be deleted even if it is not empty.
 (all users will be deleted from the group)

Parameters
 $group is the group name to delete
 $gpwd is the group password

Return
 The EmerginovResult object includes an array with the following values:
 array[0] is a string status information. One of ''ok'', ''failed''
 array[1] is an HTTP status code. One of ''200'', ''400'', ''401'', etc.
 array[2] is an string info about the result

updateGroup

Description
 This method let you update the group info.

Parameters
 $group is the group name to update
 $gpwd is the password of the group
 $desc is the new description of the group. Leave it empty to not update
 $owner is the new owner of the group. Leave it empty to not update

Return
 The EmerginovResult object includes an array with the following values:
 array[0] is a string status information. One of ''ok'', ''failed''
 array[1] is an HTTP status code. One of ''200'', ''400'', ''401'', etc.
 array[2] is an string info about the result

getGroupInfo

Description
 This method return information about a group

Parameters
 $group is the name of the group to retrieve information from

Return
 The EmerginovResult object includes an array with the following values:
 array[0] is a string status information. One of ''ok'', ''failed''
 array[1] is an HTTP status code. One of ''200'', ''400'', ''401'', etc.
 array[2] is an string info about the result

addUserInGroup

Description
 This method let you add an user in a group.
 Remember that the group and user must exist.

Parameters
 $group is the group where to add the user
 $gpwd is the group password
 $number is the user to add

Return
 The EmerginovResult object includes an array with the following values:
 array[0] is a string status information. One of ''ok'', ''failed''
 array[1] is an HTTP status code. One of ''200'', ''400'', ''401'', etc.
 array[2] is an string info about the result

deleteUserFromGroup

Description
 This method let you delete the user from a group. Remember that the group and user must exist. The user must also be member of
 this group. Also remember that to delete the owner of the group. The group must be empty
 (no other users in the group).

Parameters
 $group is the group where to delete the user
 $gpwd is the group password
 $number is the number of the user to delete

Return
 The EmerginovResult object includes an array with the following values:
 array[0] is a string status information. One of ''ok'', ''failed''
 array[1] is an HTTP status code. One of ''200'', ''400'', ''401'', etc.
 array[2] is an string info about the result

SendSMS

Description
 This method let you send SMS. Before using this method, you must subscribe the SMSSender-REST API on Nursery subscription website for your project.

Parameters
 $number: the number to send to
 $content: the SMS content. If content is over 160 characters, more than one SMS may be sent,
   please take care of this when you provide SMS quotas on Nursery subscription mechanism.

Return
 A new EmerginovResult (see EmerginovResult class for details)

TextToSpeech

Description
 This method let you create audio file (wav, mp3, gsm, etc.) and save it to your project web space.
   Before using this method, you must subscribe the Baratinoo API on Nursery subscription website for your project.

Parameters (''italics'' are optionals)
 $text: The text that must be vocalized
 $filename: The file where will be saved your spoken text
$voice: The voice that must be used. Default is ''Philippe'' (French male)
$input_encoding: see  for more information
$parsing: see ### for more information
 $frequency: see ### for more information
$header: see #### for more information
$coding: see ### for more information

Return
 A new EmerginovResult (see EmerginovResult class for details)

EmerginovResult class

This class is automatically included by ''Emerginov.php'' file. It is used to structure the return from Emerginov methods

Class constructor:

  • None available for developers as only used by Emerginov class

Methods available:

  • None

Public variables:

  • EmerginovResult->Success
  • EmerginovResult->Result

Success

The Success variable is boolean (True, False). It contains the result of an Emerginov method call. If the call has been done successfully, then Success is True, else, Success if False.

Result

The Result variable can contain any value return by Nursery mechanism. This is often an array containing information or result from the requested method (e.g. voice list from GetTextToSpeechVoices method). Il can also contain an error array if Success if false.

Specificities for PHP callback file

Your callback file is the file that will control the media server to build vocal kiosk.
Of course, in the callback file, you can use the Emerginov.php class.

When developing this callback file in PHP, here are the other methods available:

  • $call->Answer()
  • $call->Ask($text, $login, $password, $voice='Philippe', $timeout=NULL, $max_digits=NULL)
  • $call->Call($number, $timeout=NULL, $options=NULL)
  • $call->Hangup()
  • $call->Play($filename, $escape_digits="", $offset=0)
  • $call->PlayAndAsk($filename, $timeout=NULL, $max_digits=NULL)
  • $call->Record($file, $format, $escape_digits='#', $timeout=-1, $offset=NULL, $beep=true, $silence=NULL)
  • $call->Say($text, $login, $password, $voice='Philippe', $escape_digits="", $delete=true)

Answer

Description
 Just answer the line!

Parameters
 None

Result
 Return an Array ('code'=>$code, 'result'=>$result, 'data'=>$data). Result=0 on success, -1 on failure

If you want to get the phone number of the caller, use the variable: $number = $call->request['agi_callerid'];

Ask

Description
 The user has the opportunity to press a key at any time during the message or the 6 seconds post-message silence.
 If the user presses a key while the message is playing, the message stops playing.
 If no digits are pressed then 6 seconds of silence follow the message.
 Pressing the # key ends the command. When ended this way, the command ends successfully with any previously keyed digits in the result. A side effect of this is that there is no easy way to read a # key using this command.
 However, it is possible to read a single # key, as the result will be empty, but the timeout attribute will not be present.
 Before using this method, you must subscribe the Baratinoo API on Nursery subscription website for your project.

Parameters (''italics'' are optionals)
 $text: this is the text to say while user can press a button
 $login: this is your Nursery project login.
 $password: this is the Nursery password.
$voice: The voice to use, default is ''Philippe'' (French male)
$timeout: When the first key is pressed a timer starts counting for $timeout milliseconds.
  Every time the user presses another key the timer is restarted.
   The command ends when the counter goes to zero or $max_digits are entered, whichever happens first.
  If no $timeout is specified, default is 2000 milliseconds.
$max_digits: If you don't specify $max_digits, then the user can enter as many digits as he wants.

Result
 Return an Array ('code'=>$code, 'result'=>$result, 'data'=>$data).
 result=DTMF entered by user data holds the timeout if present

AskWithSpeechReco

Description
 The user will hear a message (and eventually a BEEP sound) asking him to say something. The speech will then be translated to text thanks to a Google Speech Recognition API. The speech detection ends after 2 seconds silence. Also, pressing the # key ends the command.
 Before using this method, you must subscribe the Baratinoo API on Nursery subscription website for your project.
 Record sound to a file until an acceptable DTMF digit is received or a specified amount of time has passed. Optionally a BEEP is played before recording begins.

Parameters 

 $text: this is the text to say for asking the user to speak.
 $format: format of the file. ''gsm'' and ''wav'' are commonly used formats. ''mp3'' is read-only and thus cannot be used.
 $login: this is your Nursery project login.
 $password: this is the Nursery password.
$lang: this is the lang to use to try translating speech to text (fr for french or en for english). Default is fr (french)
$voice: The voice to use, default is ''Philippe'' (French male)
$escape_digits: Default is '#'
$timeout: is the maximum record time in milliseconds, or -1 for no timeout. Default is 30000ms.
$beep: Boolean (true, false) that determine if BEEP must be played before recording begins, default is true
 $silence: is the number of seconds of silence allowed before the function returns despite the lack of dtmf digits or reaching timeout. Silence value is optional.

Result
 Return an Array ('detected_speech'=>"the text said bu user", 'confidence'=>float_number).
 The confidence float number may vary between 0 and 1. A value close to 1 means a better confidence of the detected_speech.

Call

Description
 This method can be used to make a call between a phone number and your vocal kiosk (your callback file).
 Before using this method, you must subscribe the Outgoing-Call API on Nursery subscription website for your project.

Parameters
 $number: this is the number to connect with your vocal kiosk
$timeout: The timeout parameter is optional. If not specifed, the Dial command will wait indefinitely, exiting only
   when the originating channel hangs up, or all the dialed channel return a busy or error condition. Otherwise it
   specifies a maximum time, in seconds, that the Dial command is to wait for a channel to answer.
$options: See http://www.voip-info.org/wiki/view/Asterisk+cmd+Dial#Options

Result
 Return an Array ('code'=>$code, 'result'=>$result, 'data'=>$data). For now, the result will let you know if the command had been queued successfully but you can't know if the called party has answered (this is like an asynchronous mechanism).
 This behavior will be improved in a near future.

Hangup

Description
 This will hangup the line. If you forgot to do it at the end of your PHP file, we will do it for you.

Parameters
 None

Result
 Return an Array ('code'=>$code, 'result'=>$result, 'data'=>$data).
 Result=1 on success, -1 on failure

Play

Description
 This method is useful to play an audio file

Parameters
 $filename: The file that will be played. The file must be located under your project media folder!
   Also, you must not provide the file extension. E.g.: let's say that you want to play the following
   file: ''media/audiofile.wav'', then, you should use play as follow: $call->Play("audiofile");
$escape_digits: If provided, allowing playback to be interrupted by the given digits
$offset: If provided then the audio will seek to sample offset before play starts

Result
 Return an Array ('code'=>$code, 'result'=>$result, 'data'=>$data).
 result is -1 on hangup or error, 0 if playback completes with no digit received,
 otherwise a decimal value of the DTMF tone.

PlayAndAsk

Description
 This method is useful to play an audio file and ask the user to press a digit on his phone

Parameters
 $filename: The file that will be played. The file must be located under your project ''media'' folder!
   Also, you must not provide the file extension. E.g.: let's say that you want to play the following file: ''media/audiofile.wav'', then, you should use play as follow: $call->Play("audiofile");
 $timeout: When the first key is pressed a timer starts counting for $timeout milliseconds.
   Every time the user presses another key the timer is restarted.
   The command ends when the counter goes to zero or $max_digits are entered, whichever happens first.
   If no $timeout is specified, default is 2000 milliseconds.
$max_digits: If you don't specify $max_digits, then the user can enter as many digits as he wants.

Result
 Return an Array ('code'=>$code, 'result'=>$result, 'data'=>$data).
 result=DTMF entered by user data holds the timeout if present

Record

Description
 Record sound to a file until an acceptable DTMF digit is received or a specified amount of time has passed. Optionally a BEEP is played before recording begins.

Parameters
 $file: The file to record, without extension. The file will be created in project ''media'' folder
 $format: format of the file. ''gsm'' and ''wav'' are commonly used formats. ''mp3'' is read-only and thus cannot be used.
$escape_digits: Default is '#'
$timeout:  is the maximum record time in milliseconds, or -1 for no timeout. Default is -1
$offset: offset to seek to without exceeding the end of the file. Default is null
$beep: Boolean (true, false) that determine if BEEP must be played before recording begins, default is true
$silence: is the number of seconds of silence allowed before the function returns despite the lack of dtmf digits or reaching timeout.
   Silence value is optional.

Result
 Return an Array ('code'=>$code, 'result'=>$result, 'data'=>$data).
 result is -1 on error, 0 on hangup, otherwise a decimal value of the DTMF tone.

Say

Description
 This method is used to say a text with Baratinoo.
 Before using this method, you must subscribe the Baratinoo API on Nursery subscription website for your project.

Parameters
 $text: The text that must be vocalized
 $login: this is your Nursery project login.
 $password: this is the Nursery password.
$voice: The voice that must be used. Default is Philippe (French male)
$escape_digits: Default is '#'
$delete: Say will create a wav file under your project ''media'' folder before playing it. After the play, the file will be deleted by default.
   Turning $delete to True will keep this file in your ''media'' folder.

Result
 Return an Array ('code'=>$code, 'result'=>$result, 'data'=>$data).
 result is -1 on hangup or error, 0 if playback completes,
 data is a small text describing result

Micro Service Sample

Simple Web Hosting

Get back your project subversion repository:
 svn checkout <YourEmerginov>/projects/projectname projectname

Add a index.php in the trunk/web/ folder:
 cd projectname/trunk/web/
 vim index.php

Insert the following text in this file:
 <span style="color: #000000; font-weight: bold;">&lt;?php</span><br /><span style="color: #000066;">echo </span><span style="color: #ff0000;">"Hello world!"</span>;<br /><span style="color: #000000; font-weight: bold;">?&gt;</span>

Add the file to your local repository:
 svn add index.php

Commit changes to server:
 svn commit

Now deploy your page from the subversion repository to your web space:
 see ###

Browse your website:
http://project.<YourEmerginov>/projectname/

You should see:
 Hello World!

Web Hosting and Database

Edit the passwords.php file:

<?php
 //PLEASE READ THIS, VERY IMPORTANT
 //This is a sample passwords.php file
 //This file is readable only by members of this project. Remember that other files are readable by everybody
 //This file must contain all passwords needed for your project
 //Passwords MUST be ONLY in this file
 
 $mysql_hostname = 'db.emerginov.local';
 $mysql_login ='projectname';
 $mysql_pwd ='secretpassword';
 $mysql_db = 'proj_projectname_abcdefg';
 
?>

Edit the index.php file:
 

<?php
 // Include passwords.php to get back MySQL passwords
 require_once("passwords.php");
 
 // Connect to MySQL
 $dbHandle = mysql_connect($mysql_hostname, $mysql_login, $mysql_pwd);
 $db = mysql_select_db($mysql_db) or die("Cannot select database");
 
 // SQL query
 mysql_query("INSERT INTO table1 VALUES('value1','value2')", $dbHandle);
 
 // Close MySQL connection
 mysql_close();
 
 echo "The request has been done!";
?>

Send SMS from Web Pages

Edit passwords.php:
 

<?php
 //PLEASE READ THIS, VERY IMPORTANT
 //This is a sample passwords.php file
 //This file is readable only by members of this project. Remember that other files are readable by everybody
 //This file must contain all passwords needed for your project
 //Passwords MUST be ONLY in this file
 
 $mysql_hostname = 'db.emerginov.local';
 $mysql_login ='projectname';
 $mysql_pwd ='secretpassword';
 $mysql_db = 'proj_projectname_abcdefg';
 
 $api_login = 'PROJECTNAME123456789-INT';
 $api_password = 'a1b2c3D';
?>

Edit index.php:

<?php
  // Include passwords.php to get back Nusery password & login
  require_once("passwords.php");
  // Include Emerginov.php library
  require_once("Emerginov.php");
 
  // Set number & text
  $text = "Hello world! This is a SMS!";
  $number = "+33786023023";
 
  // Get a new Emerginov object
  $Emerginov = new Emerginov($api_login, $api_password);
 
  // Send the SMS
  $res = $Emerginov->SendSMS($number, $text);
  
  // If success
  if ($res->Success == True){
      echo "The request has been done!";
      }
  else{
      echo $res->Result;
      }
 ?>

Manage SMS Receiver API from Web Pages

Edit passwords.php:

<?php
 //PLEASE READ THIS, VERY IMPORTANT
 //This is a sample passwords.php file
 //This file is readable only by members of this project. Remember that other files are readable by everybody
 //This file must contain all passwords needed for your project
 //Passwords MUST be ONLY in this file
 
 $mysql_hostname = 'db.emerginov.local';
 $mysql_login ='projectname';
 $mysql_pwd ='secretpassword';
 $mysql_db = 'proj_projectname_abcdefg';
 
 $api_login = 'PROJECTNAME123456789-INT';
 $api_password = 'a1b2c3D';
?>

Edit configureSMSReceiver.php:

<?php
 // Include passwords.php to get back Nursery passwords
 require_once("passwords.php");
 
 // Include Emerginov Class
 require_once("Emerginov.php");
 
 $Emerginov = new Emerginov($api_login, $api_password);
 
 // Reset the previous configuration
 $Emerginov->ConfigureSMSReceiver();
 
 // Now create a new one
 // SMSReceiver.php is the file that will be exectued when receiving a SMS
 // See Receiving SMS sample for more info
 $SMSReceiver = $Emerginov->ConfigureSMSReceiver("SMSReceiver.php");
 
 // Add a keyword
 $res = $SMSReceiver->addKeyword("MyService");
 echo ($res->Success) ? "Ok!" : $res->Result;
 
 // Add a MSISDN
 $res = $SMSReceiver->addMsisdn("+33123456789");
 echo ($res->Success) ? "Ok!" : $res->Result;
 ?>

Receive SMS on Web Pages

Edit passwords.php:

<?php
 //PLEASE READ THIS, VERY IMPORTANT
 //This is a sample passwords.php file
 //This file is readable only by members of this project. Remember that other files are readable by everybody
 //This file must contain all passwords needed for your project
 //Passwords MUST be ONLY in this file
 
 $mysql_hostname = 'db.emerginov.local';
 $mysql_login ='projectname';
 $mysql_pwd ='secretpassword';
 $mysql_db = 'proj_projectname_abcdefg';
 
?>

Edit SMSReceiver.php:
 

<?php
 // Include passwords.php to get back Mysql passwords
 require_once("passwords.php");
 
 // Get text and number received by SMS
 $text = $_REQUEST['Content'];
 $number = $_REQUEST['SOA'];
 
 // Connect to MySQL
 $dbHandle = mysql_connect($mysql_hostname, $mysql_login, $mysql_pwd);
 $db = mysql_select_db($mysql_db) or die("Cannot select database");
 
 // SQL query to store SMS in DB
 mysql_query("INSERT INTO table1 VALUES('$text','$number')", $dbHandle);
 
 // Close MySQL connection
 mysql_close();
?>

Make Outgoing Call

Edit passwords.php:

<?php
 //PLEASE READ THIS, VERY IMPORTANT
 //This is a sample passwords.php file
 //This file is readable only by members of this project. Remember that other files are readable by everybody
 //This file must contain all passwords needed for your project
 //Passwords MUST be ONLY in this file
 
 $mysql_hostname = 'db.emerginov.local';
 $mysql_login ='projectname';
 $mysql_pwd ='secretpassword';
 $mysql_db = 'proj_projectname_abcdefg';
 
 $api_login = 'PROJECTNAME123456789-INT';
 $api_password = 'a1b2c3D';
?>

Edit index.php

<?php
 require_once ("passwords.php");
 require_once ("Emerginov.php");
 
 $Emerginov = new Emerginov($api_login, $api_password);
 
 $ret = $Emerginov->Call("+33123456789", "incoming.php?arg1=test&arg2=truc")
?>

Manage Groups

Edit passwords.php:

<?php
 //PLEASE READ THIS, VERY IMPORTANT
 //This is a sample passwords.php file
 //This file is readable only by members of this project. Remember that other files are readable by everybody
 //This file must contain all passwords needed for your project
 //Passwords MUST be ONLY in this file
 
 $mysql_hostname = 'db.emerginov.local';
 $mysql_login ='projectname';
 $mysql_pwd ='secretpassword';
 $mysql_db = 'proj_projectname_abcdefg';
 
 $api_login = 'PROJECTNAME123456789-INT';
 $api_password = 'a1b2c3D';
?>

Edit index.php
 

<?php
 require_once ('Emerginov.php');
 require_once ('passwords.php');
 
 $Emerginov = new Emerginov($api_login, $api_password);
 
 // Create a new User
 $parameters = array('number' => '+33123456789', 
                     'name' => 'Arnaud',
                     'pwd' => 'bipbip',
                     );
 $Emerginov->ManageGroups("createUser", $parameters);
 
 // Create a new Group
 $parameters = array('number' => '+33123456789', 
                     'pwd' => 'bipbip',
                     'group' => 'Animaniacs Team',
                     'gpwd' => 'hiphop',
                     'desc' => 'here are all guys that love eating fresh dogs',
                     );
 $Emerginov->ManageGroups("createGroup", $parameters);
 
 // Get group info
 $parameters = array('group' => 'Animaniacs Team',
                     );
 $Emerginov->ManageGroups("getGroupInfo", $parameters);
 
 ?>

Create a Vocal Kiosk in PHP

Edit passwords.php:

<?php
 //PLEASE READ THIS, VERY IMPORTANT
 //This is a sample passwords.php file
 //This file is readable only by members of this project. Remember that other files are readable by everybody
 //This file must contain all passwords needed for your project
 //Passwords MUST be ONLY in this file
 
 $mysql_hostname = 'db.emerginov.local';
 $mysql_login ='projectname';
 $mysql_pwd ='secretpassword';
 $mysql_db = 'proj_projectname_abcdefg';
 
 $api_login = 'PROJECTNAME123456789-INT';
 $api_password = 'a1b2c3D';
?>

Edit incoming.php:
 

<?php
 // Include passwords.php to get back Nusery password & login
 require_once ("passwords.php");
 
 // Answer the call
 $call->Answer();
 
 // Say something in French (Agnes is french)
 $call->Say("Coucou Maurice comment que ça va bien ! Ceci est un test de micro service avec Baratinoo !",$api_login,$api_password,"Agnes");
 
 // Hangup the line
 $call->Hangup();
 
?>

Check that your callback file is well configured for your project. Edit it if needed in your selfcare page, '''configuration''' tab:

Callbackfile.png

You may test your service using a VoIP client registered on the emerginov domain. Just call your project name in capital letters, you shall be connected to your PHP kiosk!

Create a Vocal Kiosk in VXML

Edit incoming.php:

<?php
 echo '<?xml version="1.0" encoding="UTF-8"?>  <!-- -*-SGML-*- -->
 <vxml version = "2.0" xmlns=""; xml:lang="fr-FR">
 <form>
 <block>
      Coucou Maurice comment que ça va bien ! Ceci est un test de micro service avec Baratinoo !
  </block>
  </form>
  </vxml>';
?>

Check that your callback file is well configured for your project. Edit it if needed:
Callbackfilevxml.png

Partners

Orange

VOICES

EU - FP7

OW2

© Emerginov
Site maintained by OW2