Difference between revisions of "Telephony Application Using Tapi 2.1"

From PresenceWiki
Jump to: navigation, search
 
(45 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.
  
The aim is to be able to make calls from a users phone via a click on a form.
+
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 it's current status.
+
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.
+
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>.
  
In this solution we have 2 servers.
+
In this solution there are 2 Presence Servers that communicate via the Presence Socket Node:-
  
One server that runs the main Presence installation and makes socket requests via the socket node to the Tapi Server.
+
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>.
  
The Tapi Server is in this case an NT machine, that is running a telephony service along with Presence.
+
The <b>Tapi Presence Server</b> is an NT machine, that is running a Telephony service along with Presence.
  
Tasks running on the Tapi Server have socket nodes listening for requests that then make calls to the two exes via the Call Native Program Node.
+
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.
  
The main presence server makes requests over sockets to a presence tapi server located on an NT machine.
+
The <b>Main Presence Server</b> makes requests over sockets to the <b>Tapi Presence Server</b>.
  
 
A Caller Program is then run on the NT Server for each Call request.
 
A Caller Program is then run on the NT Server for each Call request.
When the Call is terminated (eg user hungup), a file is populated with the call duration.  
+
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 Presence on the NT Server, which then populates the timers table in sqlserver.
+
This file is then picked up by the <b>Tapi Presence Server</b>, 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.
 
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 uses the JTAPI solution that is built into Presence.
+
  Note In the case of a system using Tapi 3.0 we can use the JTAPI solution that is built into Presence.
  
 
<h2>TAPI Provider</h2>
 
<h2>TAPI Provider</h2>
  
This document describes the processes needed to interact with a telephony system that uses Tapi 2.1.
+
For the system to work Tapi has to first be configured on the <b>Tapi Presence Server</b>.
  
The aim is to be able to make calls from a users phone via a click on a form.
+
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
 
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
 
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
 
http://www.international-presence.com/images/docs/tapi2/norstarconfig.png
  
We also need to be able to monitor the call length, drop the call and record it's status.
+
You can test that the TSP is working by running the Norstar Personal Call Manager which enables you to make calls on a device.
 
+
In the case of a system using Tapi 3.0 we can uses the JTAPI solution that is built into Presence.
+
 
+
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 we have 2 servers.
+
 
+
One server that runs the main Presence installation and makes socket requests via the socket node to the Tapi Server.
+
 
+
The Tapi Server is in this case an NT machine, that is running a telephony service along with Presence.
+
 
+
Tasks running on the Tapi Server have socket nodes listening for requests that then make calls to the two exes via the Call Native Program Node.
+
 
+
  
 
<h2>Caller.exe</h2>
 
<h2>Caller.exe</h2>
  
Caller.exe runs on the Tapi Server and is located in the c:\Presence\Caller
+
Caller.exe runs on the <b>Tapi Presence Server</b> and is located in the c:\Presence\Caller
  
 
The sub directories of this are:-
 
The sub directories of this are:-
Line 67: Line 58:
 
Com - This contains a file for each call denoting the call details and length.
 
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","213443","3719","9011442089721390"
+
Parameters passed are <b>"EventName","UserID","CaseID","From","To"</b> eg <b>"pcpgrtest","22","433765" ,"3719","9011442089721390"</b>
  
Note, Only one Caller.exe can be run at any one time for a device.  
+
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  
 
So if a Caller.exe runs for device 3719 say when a Caller.exe is already running for that device  
Line 76: Line 67:
 
<h2>Status.exe</h2>
 
<h2>Status.exe</h2>
  
Status.exe runs on the Tapi Server and is located in the c:\Presence\Status
+
Status.exe runs on the <b>Tapi Presence Server</b> and is located in the c:\Presence\Status
  
 
The sub directories of this are:-
 
The sub directories of this are:-
Line 82: Line 73:
 
Log - which contains individual logs for each device.
 
Log - which contains individual logs for each device.
  
Com - This contains a file for each call denoting the last updated Status.
+
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"  
+
Parameters passed are <b>"Device","Action"</b> where action can be "drop" or "status" eg <b>"3719","drop"</b>
  
Note, Only one Status.exe can be run at any one time for a device.  
+
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  
 
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.
 
then the currently running Status.exe will be terminated to allow for the new Status.exe.
  
<h2>Description of Tasks On Tapi Server</h2>
+
<h2>Description of Tasks on the Tapi Presence Server</h2>
  
<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.
+
<b>Insert Into Timers Table</b> - Scans files in the Caller com folders and inserts their values into the sql table.
  
“Tapi - Live - Insert Into Timers Table” 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.
“Tapi - Live - Run Caller Program” Socket listen for request to run Caller Program  
+
“Tapi - Live - Run Status Program” Socket listen for request to run Status Program
+
  
“Tapi - Test - Test Caller Program” Allows simple testing of Caller Program
+
<b>Run Status Program</b> - Socket listen for request to run Status Program.
“Tapi - Test - Test Status Program” Allows simple testing of Status Program
+
  
 +
<b>Test Caller Program</b> - Allows simple testing of Caller Program.
  
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:-
+
<b>Test Status Program</b> - Allows simple testing of Status Program.
  
 
http://www.international-presence.com/images/docs/tapi2/tapiservertasks.png
 
http://www.international-presence.com/images/docs/tapi2/tapiservertasks.png
  
<b>Instructions</b> task explains how to configure the tasks.
+
The Status program contains a socket node to listen on a port for status request from the other server:-
 
+
The instructions task must be run once to create the DEMO.UserLogin table:-
+
  
 
http://www.international-presence.com/images/docs/tapi2/socketreceive.png
 
http://www.international-presence.com/images/docs/tapi2/socketreceive.png
  
It is this table that the other tasks use to store and retrieve data about who is logged in.
+
<h2>Description of Tasks on the Main Presence Server</h2>
  
<b>Session Expiry</b> is a queued task that querys the Demo.UserLogin table effectively expiring sessions unused for 20 minutes.  
+
<b>Select From Timers Table</b> - Simple Query to get the call info from Timers table from sqlserver database.
  
This task must be added to the Task Queue.
+
<b>Make A Call</b> - Task to launch caller program via socket request.
  
http://www.international-presence.com/images/docs/userlogin/queued.png
+
<b>Query A Status</b> - Task to launch Status program with “Status” Parameter via socket request.
  
<b>Check Login Sub Task</b> calls Login and updates the users details in the Demo.USerLogin table.
+
<b>Drop A Call</b> - Task to launch Status program with “Drop” Parameter via socket request.
  
<b>Login</b> querys the username and password against the system and either returns a null response or a login panel.
+
<b>Example Call Form</b> – On Demand Task that calls Make/Query/Drop tasks and displays results.
 
+
<b>Check User Exists in LDAP</b> performs an LDAP Query against your active directory to Query if the username exists.
+
 
+
<h2>Description of Tasks On Presence Server</h2>
+
 
+
“Tapi - Select From Timers Table” - Query to get the call info
+
“Tapi - Make A Call” - Task to launch caller program via socket request.
+
“Tapi - Query A Status” - Task to launch Status program with “Status” Parameter via socket request.
+
“Tapi - Drop A Call” - Task to launch Status program with “Drop” Parameter via socket request.
+
“Tapi - Example Call Form” – On Demand Task that calls Make/Query/Drop tasks and displays results.
+
 
+
 
+
<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.
+
 
+
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:-
+
  
 
http://www.international-presence.com/images/docs/tapi2/presenceservertasks.png
 
http://www.international-presence.com/images/docs/tapi2/presenceservertasks.png
  
<b>Instructions</b> task explains how to configure the tasks.
+
<b>The Query A Status</b> contains a socket node to make requests to the other server:-  
 
+
The instructions task must be run once to create the DEMO.UserLogin table:-
+
  
 
http://www.international-presence.com/images/docs/tapi2/socketsend.png
 
http://www.international-presence.com/images/docs/tapi2/socketsend.png
  
It is this table that the other tasks use to store and retrieve data about who is logged in.
+
The <b>Example Call Form</b> task looks like this:-
  
<b>Session Expiry</b> is a queued task that querys the Demo.UserLogin table effectively expiring sessions unused for 20 minutes.  
+
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.
  
This task must be added to the Task Queue.
+
http://www.international-presence.com/images/docs/tapi2/examplecallformtask.png
 
+
http://www.international-presence.com/images/docs/userlogin/queued.png
+
 
+
<b>Check Login Sub Task</b> calls Login and updates the users details in the Demo.USerLogin table.
+
 
+
<b>Login</b> querys the username and password against the system and either returns a null response or a login panel.
+
 
+
<b>Check User Exists in LDAP</b> performs an LDAP Query against your active directory to Query if the username exists.
+
  
 
<h2>In Use</h2>
 
<h2>In Use</h2>
  
Start the httpserver and go to http://localhost/task/newconfirmtask
+
Go to http://localhost/task/examplecallform on the <b>Main Presence Server</b> to see the solution in action.
  
The first time you should see the following:-
+
Each refresh will bring retrieve the call status and last 10 results from the Timers table.
  
http://www.international-presence.com/images/docs/tapi2/examplecallformtask.png
+
Press <b>Call</b> to make a Call, which will launch Caller.exe on the <b>Tapi Presence Server</b>.
  
This will require a valid windows username and password combination:-
+
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>.
 
+
http://www.international-presence.com/images/docs/userlogin/pleaseenterapassword.png
+
 
+
If the password is incorrect then you will get the following:-
+
 
+
http://www.international-presence.com/images/docs/userlogin/usernamepasswordincorrect.png
+
 
+
The username is looked up via an LDAP Query, so if it does not exist you will see:-
+
  
 
http://www.international-presence.com/images/docs/tapi2/form.png
 
http://www.international-presence.com/images/docs/tapi2/form.png
 
As the task validates that the http session is logged in, Once the user is logged in they will stay logged in.
 
 
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.
 

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