Proper integration of a good database design to an existing project that itself needs some refactoring won’t be easy but let’s try. In order to test flavors of all kinds of fantasy, it will be good to support PostgreSQL, MongoDB and Redis. Abstract Factory will be used to prepare parts that will be responsible in changing somewhat already present ‘MessageType’ to database commands and use database manager in order to send this commands. Configuration class, ‘ConfigurationType’ of application will determine the family that will be used. Initial design will be as follows;

database - uml diagram for database integration

Families will possibly be implemented as Singleton.

The application (capturing part of SVR, Sistas Voice Recorder) is a cross software platform application and use of libpq in Linux is as described in part I. Windows case needs some more attention.

First get the source package from http://www.postgresql.org/ftp/source. In case of mine, this corresponded to version v9.1.14. Extracting the package will lead the sources. Documentation list instructions for Borland,  Visual C and Visual Studio compilation. For my case , Visual Studio Express 2010, I have to do a few modifications in order to succeed compilation. I intent to use static linking for Windows therefore, firstly I have to comment out ‘void _dosmaperr(unsigned long e)’ in ‘.\src\port\win32errror.c’ and secondly, I have to make the following modifications in ‘.\src\interfaces\libpq\win32.mak’.

database - postgresql modifications in make32

Compiling using ‘nmake’ will fail in building manifest but should generate libpq.lib. Copying ‘.\src\interfaces\libpq\Release\libpg.lib’ ‘.\src\include\postgres_ext.h’ and ‘.\src\interfaces\libpq\libpq-fe.h’ to 3rdParty part of repository is enough to take build for my specific needs.  This workaround is what I am able to find out as a working solution, and may contain some pitfalls that I am not able to see for now.

The running program will populate CallTable as VoIP calls are captured. CallDuration is updated when the call finishes (for example in case of SIP, BYE 200OK pair). At the figure AgentId 7900 corresponds to id of an multi-channel automatic call agent.

database - postgresql calltable populated by capturer

Real Id’s are hidden to keep privacy.