Difference between revisions of "Telephony Application Using Tapi 2.1"

From PresenceWiki
Jump to: navigation, search
 
(76 intermediate revisions by the same user not shown)
Line 6: Line 6:
 
This document describes the processes needed to interact with a telephony system that uses Tapi 2.1.
 
This document describes the processes needed to interact with a telephony system that uses Tapi 2.1.
  
In the case of a system using Tapi 3.0 we can uses the JTAPI solution that is built into Presence.
+
The aim is to be able to make calls from a user's phone via a click on a form.
  
For Tapi 2.1, we need to call programs written in c++ to make and query calls.
+
We also need to be able to monitor the call length, drop the call and record its current status.
  
In this solution we have 2 servers.
+
For Tapi 2.1, we need to call programs written in c++ to make and query calls, Namely <b>Caller.exe</b> and <b>Status.exe</b>.
  
One server that runs the main Presence installation and makes socket requests via the socket node to the Tapi Server.
+
In this solution there are 2 Presence Servers that communicate via the Presence Socket Node:-
  
The Tapi server is in this case an NT machine, that is running a telephony service. Presence is running on this machine with
+
One server that is the <b>Main Presence Server</b> and makes socket requests via the socket node to the <b>Tapi Presence Server</b>.
socket nodes listening for requests that then make calls to the Caller.exe and Status.exe via the Call Native Program Node.
+
  
<h2>Importing</h2>
+
The <b>Tapi Presence Server</b> is an NT machine, that is running a Telephony service along with Presence.
  
You can download the tasks for this example from:-
+
Tasks running on the <b>Tapi Presence Server</b> have socket nodes listening for requests that then make calls to the two exes via the Call Native Program Node.
http://www.international-presence.com/wikidocs/samples/On_Demand_Windows_Login.xml
+
  
Once imported they should look like:-
+
The <b>Main Presence Server</b> makes requests over sockets to the <b>Tapi Presence Server</b>.
  
http://www.international-presence.com/images/docs/userlogin/tasks.png
+
A Caller Program is then run on the NT Server for each Call request.
 +
When the Call is terminated (user hung up/call dropped), a file is in the com directory populated with the call duration.  
 +
This file is then picked up by the <b>Tapi Presence Server</b>, which then populates the Timers table in a sqlserver database.
  
To embed the task, we just place the <b>Check Login Sub Task</b> before our normal OnDemand task page as you can see below in <b>Simple Task To Confirm Action</b>.
+
A Status Program can also be run on the NT Server, to either drop or return the status of a call.
  
It might be that all OnDemand pages start from one single task, in which case we would place the <b>Check Login Sub Task</b> at the start of that task.
+
Note In the case of a system using Tapi 3.0 we can use the JTAPI solution that is built into Presence.
  
http://www.international-presence.com/images/docs/userlogin/embedded.png
+
<h2>TAPI Provider</h2>
  
If the username and password are valid, or if the httpsession already exists in the table, then the <b>Check Login Sub Task</b> task will return null, and so the calling task will continue.  
+
For the system to work Tapi has to first be configured on the <b>Tapi Presence Server</b>.
  
We can see here (in the yellow box), the embedded <b>Check Login Sub Task</b> and a switch to continue if the ${response} variable is null.
+
This solution uses the Norstar TSP, which once installed, can be accessed through Control Panel - Phone And Mode Options.
  
 +
http://www.international-presence.com/images/docs/tapi2/norstar.png
  
<h2>Description of Tasks</h2>
+
Press configure for more details.
  
<b>Simple Task To Confirm Action</b> is the example task that shows you how to use <b>Check Login Sub Task</b> in your OnDemand tasks.
+
http://www.international-presence.com/images/docs/tapi2/norstarcontrolpanel.png
  
This task is our OnDemand task, that contains the <b>Check Login Sub Task</b>. As such it must be added to the OnDemand Queue:-
+
For each physical device we need to add an extra station first acquiring an additional license.
  
http://www.international-presence.com/images/docs/userlogin/ondemand.png
+
http://www.international-presence.com/images/docs/tapi2/norstarconfig.png
  
<b>Instructions</b> task explains how to configure the tasks.
+
You can test that the TSP is working by running the Norstar Personal Call Manager which enables you to make calls on a device.
  
The instructions task must be run once to create the DEMO.UserLogin table:-
+
<h2>Caller.exe</h2>
  
http://www.international-presence.com/images/docs/userlogin/userlogin.png
+
Caller.exe runs on the <b>Tapi Presence Server</b> and is located in the c:\Presence\Caller
  
It is this table that the other tasks use to store and retrieve data about who is logged in.
+
The sub directories of this are:-
  
<b>Session Expiry</b> is a queued task that querys the Demo.UserLogin table effectively expiring sessions unused for 20 minutes.  
+
Log - which contains individual logs for each device.
  
This task must be added to the Task Queue.
+
Com - This contains a file for each call denoting the call details and length.
  
http://www.international-presence.com/images/docs/userlogin/queued.png
+
Parameters passed are <b>"EventName","UserID","CaseID","From","To"</b> eg <b>"pcpgrtest","22","433765" ,"3719","9011442089721390"</b>
  
<b>Check Login Sub Task</b> calls Login and updates the users details in the Demo.USerLogin table.
+
Note, only one Caller.exe can be run at any one time for a device.  
  
<b>Login</b> querys the username and password against the system and either returns a null response or a login panel.
+
So if a Caller.exe runs for device 3719 say when a Caller.exe is already running for that device
 +
then the currently running Caller.exe will be terminated to allow for the new Caller.exe.
  
<b>Check User Exists in LDAP</b> performs an LDAP Query against your active directory to Query if the username exists.
+
<h2>Status.exe</h2>
  
<h2>In Use</h2>
+
Status.exe runs on the <b>Tapi Presence Server</b> and is located in the c:\Presence\Status
  
Start the httpserver and go to http://localhost/task/newconfirmtask
+
The sub directories of this are:-
  
The first time you should see the following:-
+
Log - which contains individual logs for each device.
  
http://www.international-presence.com/images/docs/userlogin/pleaseenterausername.png
+
Com - This contains a file for each device denoting the last updated Status.
  
This will require a valid windows username and password combination:-
+
Parameters passed are <b>"Device","Action"</b> where action can be "drop" or "status" eg <b>"3719","drop"</b>
  
http://www.international-presence.com/images/docs/userlogin/pleaseenterapassword.png
+
Note, only one Status.exe can be run at any one time for a device.  
  
If the password is incorrect then you will get the following:-
+
So if a Status.exe runs for device 3719 say when a Status.exe is already running for that device
 +
then the currently running Status.exe will be terminated to allow for the new Status.exe.
 +
 
 +
<h2>Description of Tasks on the Tapi Presence Server</h2>
 +
 
 +
<b>Insert Into Timers Table</b> - Scans files in the Caller com folders and inserts their values into the sql table.
 +
 
 +
<b>Run Caller Program</b> - Socket listen for request to run Caller Program.
 +
 
 +
<b>Run Status Program</b> - Socket listen for request to run Status Program.
 +
 
 +
<b>Test Caller Program</b> - Allows simple testing of Caller Program.
 +
 
 +
<b>Test Status Program</b> - Allows simple testing of Status Program.
 +
 
 +
http://www.international-presence.com/images/docs/tapi2/tapiservertasks.png
 +
 
 +
The Status program contains a socket node to listen on a port for status request from the other server:-
 +
 
 +
http://www.international-presence.com/images/docs/tapi2/socketreceive.png
 +
 
 +
<h2>Description of Tasks on the Main Presence Server</h2>
 +
 
 +
<b>Select From Timers Table</b> - Simple Query to get the call info from Timers table from sqlserver database.
 +
 
 +
<b>Make A Call</b> - Task to launch caller program via socket request.
 +
 
 +
<b>Query A Status</b> - Task to launch Status program with “Status” Parameter via socket request.
 +
 
 +
<b>Drop A Call</b> - Task to launch Status program with “Drop” Parameter via socket request.
 +
 
 +
<b>Example Call Form</b> – On Demand Task that calls Make/Query/Drop tasks and displays results.
 +
 
 +
http://www.international-presence.com/images/docs/tapi2/presenceservertasks.png
 +
 
 +
<b>The Query A Status</b> contains a socket node to make requests to the other server:-
 +
 
 +
http://www.international-presence.com/images/docs/tapi2/socketsend.png
 +
 
 +
The <b>Example Call Form</b> task looks like this:-
 +
 
 +
This is an on-demand task that retrieves the call state and the latest records from the Timers table as well as performing the Call/Drop/Status actions.
 +
 
 +
http://www.international-presence.com/images/docs/tapi2/examplecallformtask.png
 +
 
 +
<h2>In Use</h2>
  
http://www.international-presence.com/images/docs/userlogin/usernamepasswordincorrect.png
+
Go to http://localhost/task/examplecallform on the <b>Main Presence Server</b> to see the solution in action.
  
The username is looked up via an LDAP Query, so if it does not exist you will see:-
+
Each refresh will bring retrieve the call status and last 10 results from the Timers table.
  
http://www.international-presence.com/images/docs/userlogin/usernamenotfound.png
+
Press <b>Call</b> to make a Call, which will launch Caller.exe on the <b>Tapi Presence Server</b>.
  
As the task validates that the http session is logged in, Once the user is logged in they will stay logged in.
+
Press <b>Drop</b> or <b>Status</b> to Drop a Call or Update the Status which will launch Status.exe on the <b>Tapi Presence Server</b>.
  
This means that once the username and password have been successfully entered, subsequent visits to http://localhost/task/newconfirmtask will pass straight through to the rest of the OnDemand page.
+
http://www.international-presence.com/images/docs/tapi2/form.png

Latest revision as of 15:15, 4 August 2011

Tutorial Pages > Telephony Application Using Tapi 2.1


Overview

This document describes the processes needed to interact with a telephony system that uses Tapi 2.1.

The aim is to be able to make calls from a user's phone via a click on a form.

We also need to be able to monitor the call length, drop the call and record its current status.

For Tapi 2.1, we need to call programs written in c++ to make and query calls, Namely Caller.exe and Status.exe.

In this solution there are 2 Presence Servers that communicate via the Presence Socket Node:-

One server that is the Main Presence Server and makes socket requests via the socket node to the Tapi Presence Server.

The Tapi Presence Server is an NT machine, that is running a Telephony service along with Presence.

Tasks running on the Tapi Presence Server have socket nodes listening for requests that then make calls to the two exes via the Call Native Program Node.

The Main Presence Server makes requests over sockets to the Tapi Presence Server.

A Caller Program is then run on the NT Server for each Call request. When the Call is terminated (user hung up/call dropped), a file is in the com directory populated with the call duration. This file is then picked up by the Tapi Presence Server, which then populates the Timers table in a sqlserver database.

A Status Program can also be run on the NT Server, to either drop or return the status of a call.

Note In the case of a system using Tapi 3.0 we can use the JTAPI solution that is built into Presence.

TAPI Provider

For the system to work Tapi has to first be configured on the Tapi Presence Server.

This solution uses the Norstar TSP, which once installed, can be accessed through Control Panel - Phone And Mode Options.

http://www.international-presence.com/images/docs/tapi2/norstar.png

Press configure for more details.

http://www.international-presence.com/images/docs/tapi2/norstarcontrolpanel.png

For each physical device we need to add an extra station first acquiring an additional license.

http://www.international-presence.com/images/docs/tapi2/norstarconfig.png

You can test that the TSP is working by running the Norstar Personal Call Manager which enables you to make calls on a device.

Caller.exe

Caller.exe runs on the Tapi Presence Server and is located in the c:\Presence\Caller

The sub directories of this are:-

Log - which contains individual logs for each device.

Com - This contains a file for each call denoting the call details and length.

Parameters passed are "EventName","UserID","CaseID","From","To" eg "pcpgrtest","22","433765" ,"3719","9011442089721390"

Note, only one Caller.exe can be run at any one time for a device.

So if a Caller.exe runs for device 3719 say when a Caller.exe is already running for that device then the currently running Caller.exe will be terminated to allow for the new Caller.exe.

Status.exe

Status.exe runs on the Tapi Presence Server and is located in the c:\Presence\Status

The sub directories of this are:-

Log - which contains individual logs for each device.

Com - This contains a file for each device denoting the last updated Status.

Parameters passed are "Device","Action" where action can be "drop" or "status" eg "3719","drop"

Note, only one Status.exe can be run at any one time for a device.

So if a Status.exe runs for device 3719 say when a Status.exe is already running for that device then the currently running Status.exe will be terminated to allow for the new Status.exe.

Description of Tasks on the Tapi Presence Server

Insert Into Timers Table - Scans files in the Caller com folders and inserts their values into the sql table.

Run Caller Program - Socket listen for request to run Caller Program.

Run Status Program - Socket listen for request to run Status Program.

Test Caller Program - Allows simple testing of Caller Program.

Test Status Program - Allows simple testing of Status Program.

http://www.international-presence.com/images/docs/tapi2/tapiservertasks.png

The Status program contains a socket node to listen on a port for status request from the other server:-

http://www.international-presence.com/images/docs/tapi2/socketreceive.png

Description of Tasks on the Main Presence Server

Select From Timers Table - Simple Query to get the call info from Timers table from sqlserver database.

Make A Call - Task to launch caller program via socket request.

Query A Status - Task to launch Status program with “Status” Parameter via socket request.

Drop A Call - Task to launch Status program with “Drop” Parameter via socket request.

Example Call Form – On Demand Task that calls Make/Query/Drop tasks and displays results.

http://www.international-presence.com/images/docs/tapi2/presenceservertasks.png

The Query A Status contains a socket node to make requests to the other server:-

http://www.international-presence.com/images/docs/tapi2/socketsend.png

The Example Call Form task looks like this:-

This is an on-demand task that retrieves the call state and the latest records from the Timers table as well as performing the Call/Drop/Status actions.

http://www.international-presence.com/images/docs/tapi2/examplecallformtask.png

In Use

Go to http://localhost/task/examplecallform on the Main Presence Server to see the solution in action.

Each refresh will bring retrieve the call status and last 10 results from the Timers table.

Press Call to make a Call, which will launch Caller.exe on the Tapi Presence Server.

Press Drop or Status to Drop a Call or Update the Status which will launch Status.exe on the Tapi Presence Server.

http://www.international-presence.com/images/docs/tapi2/form.png