Skip to content

Automatically exported from code.google.com/p/asterisk-cti

License

Notifications You must be signed in to change notification settings

happy-star/asterisk-cti

Repository files navigation

{\rtf1\ansi\ansicpg1252\deff0{\fonttbl{\f0\fswiss\fcharset0 Arial;}{\f1\fmodern\fprq1\fcharset0 Courier New;}{\f2\fnil\fcharset2 Symbol;}}
{\*\generator Msftedit 5.41.15.1507;}\viewkind4\uc1\pard\lang1040\b\f0\fs20 1) SETUP YOUR DATABASE\b0\par
First of all, you need a working MySQL. In my tests, I've used mysql 5.0.x. You may need to setup a database before load the Sql needed. For my tests, I use the predefined 'test' database. Within your database, You've to create a table called 'cti'.\par
\par
Here is the Sql syntax (check also the file Docs\\cti.sql):\par
\par
\f1 CREATE TABLE `cti` (\par
  `USERNAME` varchar(255) default NULL,\par
  `SECRET` varchar(255) default NULL,\par
  `HOST` varchar(255) default NULL,\par
  `EXT` varchar(255) default NULL,\par
  UNIQUE KEY `USERNAME` (`USERNAME`),\par
  UNIQUE KEY `EXT` (`EXT`)\par
) ENGINE=MyISAM DEFAULT CHARSET=utf8;\f0\par
\par
This table will contains credential used by the AstCTIServer to authenticate the clients. The passwords are stored as MD5 hash. After creating the cti table, you need to create almost one user. Sorry, but there's no configuration panel yet, so you've to do this job by hand using sql syntax like the following:\par
\par
\f1 INSERT INTO cti VALUES('test',MD5('test'),'0.0.0.0','');\f0\par
\par
The AstCTIClient will update the database with the informations required by the AstCTIServer during logon.\par
\par
Once the database and the cti table are ready, you'll need to write down mysql user and passsword to setup the server and the clients. I suggest you to create two different mysql acconts, one for the server and the other one for the clients. This document doesn't cover mysql user creation.\par
\par
\b 2) SETUP AstCTIServer\par
\b0 The AstCTIServer requires a .NET 2.0 enabled platform to run. I've tested the server on the following configurations:\par
\par
\pard{\pntext\f2\'B7\tab}{\*\pn\pnlvlblt\pnf2\pnindent0{\pntxtb\'B7}}\fi-284\li710 Microsoft Windows XP SP 2, Microsoft .NET Framework 2.0\par
\pard{\pntext\f2\'B7\tab}{\*\pn\pnlvlblt\pnf2\pnindent0{\pntxtb\'B7}}\fi-294\li720 Linux Fedora Core 7, Kernel 2.6.22, Mono 1.2.5\par
{\pntext\f2\'B7\tab}Gentoo Linux, Kernel 2.6.22, Mono 1.2.4\par
\pard\par
Before to start the AstCTIServer, you need to configure some parameters from the XML configuration file.\par
The configuration file is splitted in four main sections: database, logging, manager, ctiserver.\par
\par
\i database \i0 - contains MySQL database configuration\par
\i logging \i0 - contains the settings for file logging\par
\i manager \i0 - configuration for asterisk manager interface (AMI) connection. (check the manager.conf file in asterisk: you should have configured an account for AstCTIServer connection)\par
\i ctiserver \i0 - server socket configuration parameters.\par
\par
Change the values to match your needs.\par
\par
The AstCTIServer is not yet a Windows Service or a Unix Daemon. So the main application thread will not release the console where it runs. To start AstCTIServer, you can:\par
\pard{\pntext\f2\'B7\tab}{\*\pn\pnlvlblt\pnf2\pnindent0{\pntxtb\'B7}}\fi-294\li720 (on Windows) do a double-click on the AstCTIServer or open a console and issue the AstCTIServer.exe command from the path where the exe is. Or you can do a batch file to start the program\par
{\pntext\f2\'B7\tab}(on Linux) open a console, cd to the AstCTIServer.exe directory and give the following command: mono AstCTIServer.exe \par
\pard\par
If all is right configured, the server should start (check the logs in the logs/ directory) and you should see a manager connection on your asterisk console.\par
\par
\b 3) ASTERISK DIALPLAN\b0\par
In order to get the AstCTIClient work, we can do a basic dialplan configuration.\par
In the directory Docs/Demo you'll find the following files:\par
\par
asterisk/extensions.conf\par
asterisk/sip.conf\par
asterisk/queues.conf\par
asterisk/sounds/astctidemo/enter_five_digits.wav\par
\par
You can copy dialplan demo from the file extension.conf and paste it into your asterisk dialplan. Then you've to copy sip agents from sip.conf to your asterisk sip.conf file and the same for the queues.conf. Adjust all the parameters to match your needs.\par
\par
After this, copy the folder asterisk/sounds/astctidemo to your /var/lib/asterisk/sounds directory.\par
\par
Restart your asterisk dialplan (asterisk -rx "extensions reload").\par
\par
The demo consists of two things:\par
1) Demo at extension "100":\par
The IVR asks for 5 digits. The 5 digits are stored in a variabile called "calldata" and then the call is sent to SIP/201.\par
\par
2) Demo at extension "101":\par
The same as extension 100, but the call is sent to a queue (with only one agent, SIP/201).\par
\par
In both demo, the important part is the function:\par
\f1\par
exten => 101,3,Set(calldata=$\{cdata\})\f0\par
\par
This function is read from AstCTIServer and the value of the calldata variable is then sent to the AstCTIClient once the Link event occurs. So you've to always set a variable called "calldata" before send the call to the clients.\par
\par
\b 4) SETUP AstCTIClient\b0\par
AstCTIClient is a Win32 application written in C# for .NET 2.0. I think that the application can be easly ported to mono with GTK. I'm searching for volunteers...\par
\par
The application User Interface is quite easy. Once started, the client needs to be configured. To do so, click the small Settings button on top of the window: should appear an "Application Settings" window.\par
The Application Settings are divided in Five Categories:\par
\par
\b 1) CTI APPLICATION\par
\b0 a) \b CalleridFadeSpeed \b0 - The speed of fadein effect of the callerid form\par
b) \b CalleridTimeout \b0 - How many seconds the callerid form should be shown before disappear\par
c) \b TriggerCallerid \b0 - Show the callerid form?\par
d) \b CTIContextes \b0 - Inbound calls contextes to match\par
e) \b CTIOutboundContextes \b0 - Contextes for outbound calls (with originate)\par
\par
\b 2) CTI SERVER\par
\b0 a) \b Host \b0 - hostname or ip of the AstCTIServer\par
b) \b Port \b0 - port where the AstCTIServer is bound\par
c) \b Username\b0 , \b Password \b0 - Credential as configured in the "cti" table of the database\par
d) \b PhoneExt \b0 - Phone extension to match (ex. SIP/201)\par
e) \b SocketTimeout \b0 - Timeout of client socket\par
\par
\b 3) DATABASE\par
\b0 a) \b MySQLHost \b0 - the hostname or ip of MySQL Database\par
b) \b MySQLUsername \b0 - Username for MySQL Database\par
c) \b MySQLPassword \b0 - Password for MySQL Database\par
d) \b MySQLDatabase \b0 - the database to access\par
\par
\b 4) INTERFACE\par
MinimizeOnStart \b0 - When true, once the AstCTIClient have done a succesful login, it minimize automatically on tray area\par
\par
\b 5) MISC\par
SaveOnClose \b0 - Save all settings done when the "Application Settings" window is closed.\par
\par
CTIContextes are inbound calls contextes to match. For each context we can start a different application (with different parameters). For our example, add a context called "astctidemo" like the context of asterisk demo dialplan. Set it to enable, give it a name in the "DisplayName" field, and finally add your Application. In the example, you can choose "Internet Explorer" from the directory "c:\\program files\\Internet Explorer\\iexplorer.exe". Add some Parameters like this: "http://centralino-voip.brunosalzano.com/demo_page.php?callerid=\{CALLERID\}&calldata=\{CALLDATA\}&channel=\{CHANNEL\}&uniqueid=\{UNIQUEID\}"\par
\par
When a calls arrive in the astctidemo context for the extension configured on "CTI SERVER/PhoneExt", Internet explorer will be started when the SIP/201 answers the call.\par
\par
CTIOutboundContextes are contextes where we can originate outbound calls. In the example, you can configure an "astctidemo" outbound context to make calls to all extension between 200 and 299 directly from AstCTIClient.\par
\par
Once all the parameters are well setup, make sure that AstCTIServer is running and that it's connected to asterisk. Then make a login with the right credential.\par
\par
Now you can make some test calls from another phone to the extension 100 or 101... Good Luck!\par
\par
\par
\par
}

About

Automatically exported from code.google.com/p/asterisk-cti

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages