Voice Broadcast
An outbound application that handles answered outbound calls that have been classified.
Live speakers are played a notification message and then asked to press a digit to confirm they have received and understood the message. Answering machines are played a different notification message.
{
"actions" :
[
{
"play" :
{
"play_list" :
[
{
"text_to_say" : "Hello"
}
]
}
},
{
"play" :
{
"play_list" :
[
{
"text_to_say" : "This is a recorded notification message to let you know that Saint
Custards Preparatory School will open for the spring term on 5th
September next year. Please call
<say-as interpret-as='vxml:digits'>441908273800</say-as>
to let us know that you have received this message."
}
]
}
}
],
"token" : "my voice broadcast instance id"
}
{
"actions" :
[
{
"play" :
{
"play_list" :
[
{
"text_to_say" : "Hello"
}
]
}
},
{
"play" :
{
"play_list" :
[
{
"text_to_say" : "This is a notification to let you know that Saint Custards Preparatory
School will open for the spring term on 5th September next year."
}
]
},
"run_menu" :
{
"prompt" :
{
"play" :
{
"play_list" :
[
{
"text_to_say" : "Please press 1 to confirm that you have
received and understood this message,
or press 2 to hear the message again"
}
]
}
},
"menu_options" :
[
{
"digit" : "1",
"next_page" :
{
"url" : "ConfirmMessage"
}
},
{
"digit" : "2",
"next_page" :
{
"url" : "VoiceBroadcast"
}
}
}
"on_digit_timeout_messages":
[
{
"play" :
{
"play_list" :
[
{
"text_to_say" : "I didn't catch your entry."
}
]
}
}
],
"on_invalid_digit_messages" :
[
{
"play" :
{
"play_list" :
[
{
"text_to_say" : "That wasn't one of the options. Please try again."
}
]
}
}
]
}
}
],
"token" : "my voice broadcast instance id"
}
{
"actions" :
[
{
"play" :
{
"play_list" :
[
{
"text_to_say" : "Thanks for your confirmation. Goodbye."
}
]
}
}
],
"token" : "my voice broadcast instance id"
}
{
[
],
"token" : "Error for Action: xxxx ActionIndex: xxxx Result: xxxx"
}
{
}
Implemented as ASP.Net Web Forms:
using System;
using System.Collections.Generic;
using RestAPIWrapper;
public partial class VoiceBroadcast : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
// Unpack the request
TelephonyRequest ourRequest = new TelephonyRequest(Request);
if (!ourRequest.IsValid)
{
return;
}
String farEndType = ourRequest.InstanceInfo.ThisCall.FarEndType;
// Setup the actions
List<TelephonyAction> actions = new List<TelephonyAction>();
actions.Add(Play.SayText("Hello."));
if (farEndType.CompareTo("machine") == 0)
{
// Simply leave a message on the answering machine
actions.Add(Play.SayText("This is a recorded notification message to let you know that Saint " +
"Custards Preparatory School will open for the spring term on 5th " +
"September next year. Please call " +
"<say-as interpret-as='vxml:digits'>441908273800</say-as> " +
"to let us know that you have received this message."));
}
else
{
// Play the notification message
actions.Add(Play.SayText("This is a notification to let you know that Saint Custards Preparatory " +
"School will open for the spring term on 5th September next year."));
// Set up a run menu action to obtain an acknowledgement or repeat the notification message
Play prompt = Play.SayText("Please press 1 to confirm that you have received and understood " +
"this message, or press 2 to hear this message again.");
List<MenuOption> menuOptions = new List<MenuOption>();
menuOptions.Add(new MenuOption('1', new WebPageRequest("ConfirmMessage.aspx")));
menuOptions.Add(new MenuOption('2', new WebPageRequest("VoiceBroadcast.aspx")));
RunMenu runMenuAction = new RunMenu(prompt, menuOptions);
runMenuAction.OnDigitTimeoutMessages.Add(Play.SayText("I didn't catch your entry."));
runMenuAction.OnInvalidDigitMessages.Add(Play.SayText("That wasn't one of the options. " +
"Please try again."));
actions.Add(runMenuAction);
}
// Respond
TelephonyResponse ourResponse = new TelephonyResponse(actions, "my voice broadcast instance id");
ourResponse.ToHttpResponse(Response);
}
}
using System;
using System.Collections.Generic;
using RestAPIWrapper;
public partial class ConfirmMessage : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
// Unpack the request
TelephonyRequest ourRequest = new TelephonyRequest(Request);
if (!ourRequest.IsValid)
{
return;
}
String token = ourRequest.InstanceInfo.Token;
// Setup the actions
List<TelephonyAction> actions = new List<TelephonyAction>();
actions.Add(Play.SayText("Thanks for your confirmation. Goodbye."));
// Respond
TelephonyResponse ourResponse = new TelephonyResponse(actions, token);
ourResponse.ToHttpResponse(Response);
}
}
using System;
using System.Collections.Generic;
using RestAPIWrapper;
public partial class ErrorPage : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
// Unpack the request
TelephonyRequest ourRequest = new TelephonyRequest(Request);
if (!ourRequest.IsValid)
{
return;
}
ErrorResult result = ourRequest.InstanceInfo.ErrorResult;
String token = String.Format("Action: {0}\nActionIndex: {1}\nResult: {2}",
result.Action, result.ActionIndex, result.Result);
// Respond
TelephonyResponse ourResponse = new TelephonyResponse(null, token);
ourResponse.ToHttpResponse(Response);
}
}
using System;
using System.Collections.Generic;
using RestAPIWrapper;
public partial class FinalPage : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
// Unpack the request
TelephonyRequest ourRequest = new TelephonyRequest(Request);
if (!ourRequest.IsValid)
{
return;
}
}
}
Implemented as ASP.Net Web Forms:
Imports System
Imports System.Collections.Generic
Imports RestAPIWrapper
Partial Class VoiceBroadcast
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
' Unpack the request
Dim ourRequest As TelephonyRequest = New TelephonyRequest(Request)
If Not ourRequest.IsValid Then
Return
End If
Dim farEndType As String = ourRequest.InstanceInfo.ThisCall.FarEndType
' Setup the actions
Dim actions As List(Of TelephonyAction) = New List(Of TelephonyAction)
actions.Add(Play.SayText("Hello."))
If farEndType.CompareTo("machine") = 0 Then
' Simply leave a message on the answering machine
actions.Add(Play.SayText("This is a recorded notification message to let you know that Saint " + _
"Custards Preparatory School will open for the spring term on 5th " + _
"September next year. Please call " + _
"<say-as interpret-as="vxml:digits">441908273800 " + _
"to let us know that you have received this message."))
Else
' Play the notification message
actions.Add(Play.SayText("This is a notification to let you know that Saint Custards Preparatory " + _
"School will open for the spring term on 5th September next year."))
' Set up a run menu action to obtain an acknowledgement or repeat the notification message
Dim prompt As Play = Play.SayText("Please press 1 to confirm that you have received and understood " + _
"this message, or press 2 to hear this message again.")
Dim menuOptions As List(Of MenuOption) = New List(Of MenuOption)
menuOptions.Add(New MenuOption("1", New WebPageRequest("ConfirmMessage.aspx")))
menuOptions.Add(New MenuOption("2", New WebPageRequest("VoiceBroadcast.aspx")))
Dim runMenuAction As RunMenu = New RunMenu(prompt, menuOptions)
runMenuAction.OnDigitTimeoutMessages = New List(Of Play)
runMenuAction.OnDigitTimeoutMessages.Add(Play.SayText("I didn't catch your entry."))
runMenuAction.OnInvalidDigitMessages = New List(Of Play)
runMenuAction.OnInvalidDigitMessages.Add(Play.SayText("That wasn't one of the options. " + _
"Please try again."))
actions.Add(runMenuAction)
End If
' Respond
Dim ourResponse As TelephonyResponse = New TelephonyResponse(actions, "my voice broadcast instance id")
ourResponse.ToHttpResponse(Response)
End Sub
End Class
Imports System
Imports System.Collections.Generic
Imports RestAPIWrapper
Partial Class ConfirmMessage
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
' Unpack the request
Dim ourRequest As TelephonyRequest = New TelephonyRequest(Request)
If Not ourRequest.IsValid Then
Return
End If
Dim token As String = ourRequest.InstanceInfo.Token
' Setup the actions
Dim actions As List(Of TelephonyAction) = New List(Of TelephonyAction)
actions.Add(Play.SayText("Thanks for your confirmation. Goodbye."))
' Respond
Dim ourResponse As TelephonyResponse = New TelephonyResponse(actions, token)
ourResponse.ToHttpResponse(Response)
End Sub
End Class
Imports System
Imports System.Collections.Generic
Imports RestAPIWrapper
Partial Class ErrorPage
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
' Unpack the request
Dim ourRequest As TelephonyRequest = New TelephonyRequest(Request)
If Not ourRequest.IsValid Then
Return
End If
Dim result As ErrorResult = ourRequest.InstanceInfo.ErrorResult
Dim token As String = String.Format("Action: {0}\nActionIndex: {1}\nResult: {2}", _
result.Action, result.ActionIndex, result.Result)
' Respond
Dim ourResponse As TelephonyResponse = New TelephonyResponse(token)
ourResponse.ToHttpResponse(Response)
End Sub
End Class
Imports System
Imports System.Collections.Generic
Imports RestAPIWrapper
Partial Class FinalPage
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
' Unpack the request
Dim ourRequest As TelephonyRequest = New TelephonyRequest(Request)
If Not ourRequest.IsValid Then
Return
End If
End Sub
End Class
Implemented as Java Servlets:
package com.aculab.telephonyrestapi.samples;
import javax.servlet.http.*;
import javax.servlet.ServletException;
import java.io.IOException;
import com.aculab.telephonyrestapi.*;
public class VoiceBroadcast extends HttpServlet
{
@Override
public void doPost(HttpServletRequest request,
HttpServletResponse response) throws IOException, ServletException
{
handleRequest(request, response);
}
@Override
public void doGet(HttpServletRequest request,
HttpServletResponse response) throws IOException, ServletException
{
handleRequest(request, response);
}
private void handleRequest(HttpServletRequest request,
HttpServletResponse response) throws IOException
{
// Unpack the request
TelephonyRequest ourRequest = new TelephonyRequest(request);
if (!ourRequest.isValid())
{
return;
}
String farEndType = ourRequest.getInstanceInfo().getThisCall().getFarEndType();
// Set up the actions
List<TelephonyAction> actions = new ArrayList<TelephonyAction>();
actions.add(Play.sayText("Hello."));
if (farEndType.compareTo("machine") == 0)
{
// Simply leave a message on the answering machine
actions.add(Play.sayText("This is a recorded notification message to let you know that Saint " +
"Custards Preparatory School will open for the spring term on 5th " +
"September next year. Please call " +
"<say-as interpret-as='vxml:digits'>441908273800</say-as> " +
"to let us know that you have received this message."));
}
else
{
// Play the notification message
actions.add(Play.sayText("This is a notification to let you know that Saint Custards Preparatory " +
"School will open for the spring term on 5th September next year."));
// Set up a run menu action to obtain an acknoledgement or repeat the notification message
Play prompt = Play.sayText("Please press 1 to confirm that you have received and understood " +
"this message, or press 2 to hear this message again.");
List<MenuOption> menuOptions = new ArrayList<MenuOption>();
menuOptions.add('1', new WebPageRequest("ConfirmMessage"));
menuOptions.add('2', new WebPageRequest("VoiceBroadcast"));
RunMenu runMenuAction = new RunMenu(prompt, menuOptions);
List<Play> onDigitTimeoutMessages = new ArrayList<Play>();
onDigitTimeoutMessages.add(Play.sayText("I didn't catch your entry."));
runMenuAction.setOnDigitTimeoutMessages(onDigitTimeoutMessages);
List<Play> onInvalidDigitMessages = new ArrayList<Play>();
onInvalidDigitMessages.add(Play.sayText("That wasn't one of the options. Please try again."));
runMenuAction.setOnInvalidDigitMessages(onInvalidDigitMessages);
actions.add(runMenuAction);
}
// Respond
TelephonyResponse ourResponse = new TelephonyResponse(actions, "my voice broadcast instance id");
ourResponse.setHttpServletResponse(response);
}
}
package com.aculab.telephonyrestapi.samples;
import javax.servlet.http.*;
import javax.servlet.ServletException;
import java.io.IOException;
import com.aculab.telephonyrestapi.*;
public class ConfirmMessage extends HttpServlet
{
@Override
public void doPost(HttpServletRequest request,
HttpServletResponse response) throws IOException, ServletException
{
handleRequest(request, response);
}
@Override
public void doGet(HttpServletRequest request,
HttpServletResponse response) throws IOException, ServletException
{
handleRequest(request, response);
}
private void handleRequest(HttpServletRequest request,
HttpServletResponse response) throws IOException
{
// Unpack the request
TelephonyRequest ourRequest = new TelephonyRequest(request);
if (!ourRequest.isValid())
{
return;
}
String token = ourRequest.getInstanceInfo().getToken();
// Set up the actions
List<TelephonyAction> actions = new ArrayList<TelephonyAction>();
actions.add(Play.sayText("Thanks for your confirmation. Goodbye."));
// Respond
TelephonyResponse ourResponse = new TelephonyResponse(actions, token);
ourResponse.setHttpServletResponse(response);
}
}
package com.aculab.telephonyrestapi.samples;
import javax.servlet.http.*;
import javax.servlet.ServletException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import com.aculab.telephonyrestapi.*;
public class ErrorPage extends HttpServlet
{
private static final long serialVersionUID = -4842873371047361437L;
@Override
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException
{
handleRequest(request, response);
}
@Override
public void doPost(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException
{
handleRequest(request, response);
}
private void handleRequest(HttpServletRequest request,
HttpServletResponse response) throws IOException
{
// Unpack the request
TelephonyRequest ourRequest = new TelephonyRequest(request);
if (!ourRequest.isValid())
{
return;
}
ErrorResult result = ourRequest.getInstanceInfo().getErrorResult();
String token = String.format("Action: %s\nActionIndex: %d\nResult: %s", result.getAction(), result.getActionIndex(), result.getResult());
// Respond
List<TelephonyAction> actions = new ArrayList<TelephonyAction>();
TelephonyResponse ourResponse = new TelephonyResponse(actions, token);
ourResponse.setHttpServletResponse(response);
}
}
package com.aculab.telephonyrestapi.samples;
import javax.servlet.http.*;
import javax.servlet.ServletException;
import java.io.IOException;
import com.aculab.telephonyrestapi.*;
public class FinalPage extends HttpServlet
{
private static final long serialVersionUID = 5940620014313056844L;
@Override
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException
{
handleRequest(request, response);
}
@Override
public void doPost(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException
{
handleRequest(request, response);
}
private void handleRequest(HttpServletRequest request,
HttpServletResponse response) throws IOException
{
// Unpack the request
TelephonyRequest ourRequest = new TelephonyRequest(request);
if (!ourRequest.isValid())
{
return;
}
}
}
Implemented using a wrapper for Python's wsgiref.simple_server.
For the purposes of this sample, the first page is first_page, the final page is final_page and the error page is error_page.
The application base class.
from aculab.telephony_rest_api import Play
class ApplicationBase:
def __init__(self, exit=None):
self.exit = exit or [self.exit]
def exit(self):
pass
def error_page(self, my_actions, query_info):
try:
error_result = query_info.ErrorResult
action = error_result.get('action', 'none')
print("\nError {0} : {1}\n".format(action, error_result['result']))
my_actions.add(Play(text_to_say='I encountered an error.'))
except Exception as exc:
print("Error page exception: {0}".format(exc))
return True
def final_page(self, my_actions, query_info):
try:
tcall = query_info.ThisCall
if tcall:
print("This call ID : {0}".format(tcall.get('call_id')))
print("This call duration : {0}".format(tcall.get('seconds_call_duration')))
self.exit[0]()
except Exception as exc:
print("Final page exception: {0}".format(exc))
return True
def unknown_page(self, my_actions, query_info):
try:
my_actions.add(Play(text_to_say='I find myself on an unknown page.'))
except Exception as exc:
print("Unknown page exception: {0}".format(exc))
return True
The application code.
# This is an outbound application and, as such, needs to be invoked by the web services API.
# It uses a Python wrapper for the web services API to invoke this sample.
# Before running this sample you will need to configure an outbound service that points to it.
import sys, os
from threading import Thread
from getpass import getpass
sys.path.append(os.path.abspath('../..'))
from aculab.telephony_rest_api import *
from aculab.simple_server import *
from aculab.base_application import ApplicationBase
from aculab.web_services import invoke_outbound_service
if sys.version > '3':
def raw_input(text):
return input(text)
class MyThread(Thread):
def __init__(self, function):
Thread.__init__(self)
self._function = function
self.return_code = 0
def run(self):
self.return_code = self._function()
class Application(ApplicationBase):
def __init__(self):
ApplicationBase.__init__(self)
def responder(self, query, start_response):
query_info = RESTQuery(query)
page = query_info.Page
my_actions = Actions(token='voice broadcast sample')
# on your inbound service, set the first page entry to point to this page
# e.g., http://<ip address>:<port>/first_page
if 'first_page' == page:
# get the call classification (machine / non-machine)
this_call = query_info.ThisCall
# the far end type will only be available if classify is enabled
far_end_type = this_call.get('far_end_type', 'unknown')
play_action = Play(text_to_say="Hello.")
if 'far_end_type' == 'answering_machine':
play_action.add_text(text_to_say=("This is a recorded notification message to let you know that Saint "
"Custards Preparatory School will open for the spring term on 5th "
"September next year. Please call "
"<say-as interpret-as='vxml:digits'>441908273800</say-as> "
"to let us know that you have received this message."),
tts_voice='English US Male Polly Joey')
my_actions.add(play_action)
else:
play_action.add_text(text_to_say=("This is a notification to let you know that Saint Custards Preparatory "
"School will open for the spring term on 5th September next year."),
tts_voice='English US Male Polly Joey')
my_actions.add(play_action)
# set up a run menu action to obtain an acknowledgement or repeat the notification message
my_menu = RunMenu()
my_menu.on_prompt_play(Play(text_to_say=("Please press 1 to confirm that you have received and understood "
"this message, or press 2 to hear this message again.")))
my_menu.append_menu_option('1', WebPage(url='confirm_message'))
my_menu.append_menu_option('2', WebPage(url='first_page'))
my_menu.append_on_digit_timeout_message(Play(text_to_say="I didn't catch your entry."))
my_menu.append_on_invalid_digit_message(Play(text_to_say="That wasn't one of the options. Please try again."))
my_actions.add(my_menu);
elif 'confirm_message' == page:
my_actions.add(Play(text_to_say="Thanks for your confirmation. Goodbye."))
elif 'final_page' == page:
if self.final_page(my_actions, query_info) is False:
return None
elif 'error_page' == page:
if self.error_page(my_actions, query_info) is False:
return None
else:
if self.unknown_page(my_actions, query_info) is False:
return None
response_body = my_actions.get_json()
response_headers = [('Content-Type', 'application/json; charset=utf-8'), ('Content-Length', str(len(response_body)))]
start_response('200 OK', response_headers)
return [response_body]
def test_main():
application = Application()
# Set the host and port you want to use in the rest_simple_server.py file.
# To use SSL also set the key and certificate file.
ss = SimpleServer(application, simple_server_host, simple_server_port, simple_server_keyfile, simple_server_certfile)
ss.start()
if __name__ == "__main__":
test_thread = MyThread(test_main)
test_thread.start()
service_name = raw_input('the outbound service to invoke:')
service_password = getpass('your outbound service password:')
call_to = raw_input('call to:')
call_from = raw_input('call from:')
token = raw_input('token:')
outbound_parameters = raw_input('the outbound service parameters:')
target = raw_input('the cloud region or Rapide IP address:')
username = raw_input('your cloud or Rapide username:')
outbound_calls = invoke_outbound_service.OutboundCalls(call_to=call_to.strip(),
call_from=call_from.strip(),
token=token.strip(),
outbound_parameters=outbound_parameters.strip())
application_instance_ids = invoke_outbound_service.invoke_outbound_service(target=target.strip(),
username=username.strip(),
service_name=service_name.strip(),
service_password=service_password.strip(),
outbound_calls=outbound_calls)
test_thread.join()
declare(encoding='UTF-8');
spl_autoload_register();
// set headers to prevent the page being cached by intermediaries
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header("Content-Type: application/json; charset=UTF-8");
use \Aculab\TelephonyRestAPI\InstanceInfo;
use \Aculab\TelephonyRestAPI\Actions;
use \Aculab\TelephonyRestAPI\Play;
use \Aculab\TelephonyRestAPI\RunMenu;
use \Aculab\TelephonyRestAPI\MessageList;
$info = InstanceInfo::getInstanceInfo();
$endType = '';
$response = new Actions();
if ($info != null) {
$response->setToken($info->getToken());
$callInfo = $info->getThisCallInfo();
if ($callInfo != null) {
$endType = $callInfo->getFarEndType();
}
}
if ($endType == 'human') {
$response->add(
Play::sayText(
"This is a notification to let you know that Saint Custards Preparatory " .
"School will open for the spring term on 5th September next year."
)
);
// Create the menu action
$menuPrompt = Play::sayText(
"Please press 1 to confirm that you have " .
"received and understood this message, " .
"or press 2 to hear the message again"
);
$menu = new RunMenu($menuPrompt);
$menu->addMenuOption('1', 'ConfirmMessage.php');
$menu->addMenuOption('2', 'First.php');
// Set up some new info messages for digit timeout and invalid digit
$onDigitTimeoutMessages = new MessageList();
$onDigitTimeoutMessages->addMessage(
Play::sayText(
"I didn't catch your entry."
)
);
$menu->setOnDigitTimeoutMessages($onDigitTimeoutMessages);
$onInvalidDigitMessages = new MessageList();
$onInvalidDigitMessages->addMessage(
Play::sayText(
"That wasn't one of the options. Please try again."
)
);
$menu->setOnInvalidDigitMessages($onInvalidDigitMessages);
$response->add($menu);
} elseif ($endType == 'answering_machine') {
$response->add(
Play::sayText(
"This is a recorded notification message to let you know that Saint " .
"Custards Preparatory School will open for the spring term on 5th " .
"September next year. Please call 01234 567890 to let us know that " .
"you have received this message."
)
);
} // else no actions, so the call will be disconnected
print $response;
declare(encoding='UTF-8');
spl_autoload_register();
header("Content-Type: application/json; charset=UTF-8");
$info = \Aculab\TelephonyRestAPI\InstanceInfo::getInstanceInfo();
$response = new \Aculab\TelephonyRestAPI\Actions();
$response->setToken($info->getToken());
$play = new \Aculab\TelephonyRestAPI\Play();
$play->addText('Thanks for your confirmation. Goodbye.');
$response->add($play);
print $response;
declare(encoding='UTF-8');
spl_autoload_register();
header("Content-Type: application/json; charset=UTF-8");
$info = \Aculab\TelephonyRestAPI\InstanceInfo::getInstanceInfo();
$error = $info->getErrorResult();
$action = $error->getAction();
$desc = $error->getResult();
if (!is_null($action)) {
error_log("Error from action \"$action\" with result:\n$desc\n");
} else {
error_log("Error result:\n$desc\n");
}
$response = new \Aculab\TelephonyRestAPI\Actions();
$response->setToken('Error');
$play = new \Aculab\TelephonyRestAPI\Play();
$play->addText('An error has occurred.');
$response->add($play);
print $response;
declare(encoding='UTF-8');
spl_autoload_register();
header("Content-Type: application/json; charset=UTF-8");
$info = \Aculab\TelephonyRestAPI\InstanceInfo::getInstanceInfo();
$call = $info->getThisCallInfo();
$callid = $call->getCallId();
$duration = $call->getSecondsCallDuration();
error_log("This all id: $callid\nThis call duration: $duration\n");
print '';