Post on 29-Jan-2016
transcript
PIKA Technologies Inc.CAS Logger Application Sample
August 2014
What is it?
• Sample Application developed in C++ • Can be used to passively record calls from Digital CAS
T1 E&M spans• Works on HMP 3.0+ platforms (Windows, Linux) with
PIKA Digital PCIe Boards• Files can be saved in .wav or raw formats
Overall Architecture Description
• At start-up the main thread will create all the required instances. It will therefore create the digital board instance and its associated members.
• Each instance will communicate with the PIKA Driver (PKH_XXX) to configure and start it’s associated objects.
• The main thread will then spawn the event thread.
• The event thread is used to handle asynchronous events from the PIKA driver.
• For debugging purposes an event message logger (not to be confused with the digital logger) has been included to show events on the console and can also be injected to the PIKA Driver logs.
• The DigitalBoard instance contains 4 span instances and up to 2*24 calls. A particular call is associated to 1 channel for each of 2 spans. Each Span instance contains 1 cas instance handling the 24 channels.
Getting Started
• Install the PIKA Low Level HMP API on a PC ( 3.0.x or newer ) as described in the Getting Started Guide
• Remove the line jumpers on the PIKA HMP PCIe digital board.
• Install the board in the PC• Cabling - requires some specific wiring• Download, Compile, and run the Digital Logger
application
Sample Code - Overall Architecture
• At start-up, the sample application will statically create all of the resources needed to Passively Record on all channels and spans
• The event thread handles asynchronous events from the PIKA driver.
• For debugging purposes an event message logger (not to be confused with the digital logger) has been included to show events on the console and can also be injected to the PIKA Driver logs. There are multiple debug levels that can be controlled via a compile flag.
• A 4 span board can log 2 T1 CAS (Wink or Double Wink) connections
• Each Span monitors the ABCD bit signalling via the PIKA Low Level API, these signals get process and sent to the application as logging events.
Overall Architecture Description
• The Cas instance is used to handle the incoming ABCD bit channel signals, once detected the associated channel shall setup a logging call.
• The call will then start listening to the conference between the 2 previously associated channels and output the conversation to a file. The filename will have the following format:
• Board_#_Call_#_$date$.extension
• When a CAS onhook is detected, the audio file will be saved and closed.
• It is also possible to copy the audio buffers to the application. This can then be used to listen to the conversation in a live session.
Digital
Logger API
Application thread Diagram
Main
Application
Digital Logger
Event Thread
PIKA DriverSpawn
Thread
PKH_BOARD_XXX
PKH_SPAN_XXX
PKH_CHANNEL_XXX
Application
Event Thread
DL_Initialize
DL_SetCallAudioBufferCB
Spawn
Thread
DL_SetCallAudioBufferCB
DL_WaitOnEvent
DL_WaitOnEventSerialized
Audio function CB
DL_Start
DL_Stop
DL_Cleanup
PKH_ Wait On
Event
Using the Digital Logger API
There are different APIs available (for windows)
1) Compile all source into an application• DL_XXX : include digitallogger.h
2) Compile application with DLL• PKDL_XXX : include DigitalLoggingDll.h
API call scenario
• Main Application thread• DL_Initialize(tApplicationConfiguration config) // Initialize system• DL_SetCallAudioBufferCB(Pf_callAudioBufferCB func) // Set callback if you want to listen to live audio• Create an event thread and call DL_WaitOnEvent(PK_UINT timeout, tApplicationEvent *event) • DL_Start() // Start the system
• A Call is triggered from the CO
• Application Event Thread• DL_WaitOnEvent returns EVENT_CALLSETUP, SpanId1 specifies the span origin• DL_WaitOnEvent returns EVENT_CALLCONNECT
• Digital Application Wrapper• The call will be recorded in an audio file• The Audio Buffer Call Back will the called with the audio buffer
• The Call is hung up
• Application Event Thread• DL_WaitOnEvent returns EVENT_CALLRELEASE
• Digital Application Wrapper• The recorded file is closed
• Main Application thread• DL_Stop() // Stop the system• Stop Application thread• DL_Cleanup // Cleanup the system
DigitalBoard
Class Hierarchy and containment
Span
Channel
Cas
Call
BaseEntity
LogClient Logger (singleton)
1
4
1
1
24
2*24
System
1
n
Passive Logging
1
0
2
3
CAS
CAS
CAS
CAS
MediaProcessing
Passive Logging – ApplicationCall Logs
AudioFiles
ProcessCAS ABCD Bit SignalsPKH_SPAN_GetABCDSignal Audio
Record
HMP Digital Board - PCIe
CO
PBX
T1/E1Span
RX- Tip/Ring
RX- Tip/Ring
TX RX
TXRX
Jumpers
Passive Logging Architecture
COTX
RXPBX TX
RX
RX RX
CAS CASAudioAudio
M M
Conf
M
Record
File
CAS
Signals
CAS
Signals
Tip / Ring Tip / Ring
Passive Logging – Cabling
PBX
Telco
TX Tip
TX Ring
TX Tip
TX Ring
RX Tip
RX Ring
RX Tip
RX Ring
RX
TIP
RX
RING
TX
TIP
TX
RING
RX
TIP
RX
RING
TX
TIP
TX
RING
Span 0Span 1
Do No
Connection
Do No
Connection
PIKA Digital T1/E1 HMP Board - PCIe
Call/Span/Channel allocation
0 1 2 3 2
0
2
1
2
2
2
3
Span 1
0 1 2 3 2
0
2
1
2
2
2
3
Span 2
0 1 2 3 2
0
2
1
2
2
2
3
Span 3
0 1 2 3 2
0
2
1
2
2
2
3
Span 4
0
24Call Ids
1
25
2
26
3
27
20
44
21
45
22
46
23
47
Where can I find it?
• The Source code is located under:• http://svn.pikatech.com/customercare/trunk/samples/DigitalCasLogger/