Установка необходимых библиотек
На данный момент проект поддерживает работу только с Python версии 2.5. Приложение не тестировалось с Python 2.4.
Также нам понадобится установить каркас TwistedCore-2.5.Последняя версия Twisted из SVN репозитория:
User terminal:
$ svn co svn://svn.twistedmatrix.com/svn/Twisted/trunk twisted-trunk $ su Password: # ln -s `pwd`/twisted-trunk/twisted /usr/lib/python2.5/site-packages/twistedНе забудьте установить исполняемые файлы Twisted (twistd, trial etc...) в /usr/bin/
Или из предлагаемых тарбаллов:
Root terminal:
$ tar -xf Twisted-2.5.0.tar.bz2 $ cd Twisted-2.5.0 $ cd zope.interface-3.3.0 # su Password: # python setup.py install # cd ../TwistedCore-2.5.0 # python setup.py install
Установка из Tarball архивов
Скачиваем последнюю версию в tarball архиве
Download Fats
.User terminal:
$ tar -xf TwistedFats-0.5.0.tar.bz2 $ cd TwistedFats-0.5.0 $ su Password: # python setup.py install
Установка из SVN
Качаем последнюю версию FATS из trunk репозитория:
User terminal:
$ svn co http://fats.svn.sourceforge.net/svnroot/fats/trunk fats-trunk $ ln -s `pwd`/fats-trunk/fats ~/src/twistd/twisted/fats
Проверка и тестовый запуск
Проверяем нашу установку, запуская все тесты:
User terminal:
$ trial twisted.fats
twisted.fats.examples.test.test_hello_agi
HelloFastAGIExampleTest
test_callScriptAndAsteriskCollaboration ... [OK]
...
...
-------------------------------------------------------------------------------
Ran 105 tests in 0.456s
PASSED (skips=2, successes=103)
Запуск приложения Hello World:
Asterisk extensions.conf:
[fats-test] exten => 222,n,AGI(agi://localhost:9000)
User terminal:
$ twistd -ny fats-trunk/fats/examples/hello_agi.py [-] Log opened. [-] twistd 2.5.0+rUnknown (/usr/bin/python 2.5.1) starting up [-] reactor class:Теперь осталось позвонить на номер 222![-] __builtin__.HelloFastAGIFactoryFromService starting on 9000 [-] Starting factory <__builtin__.HelloFastAGIFactoryFromService instance at 0xb780580c> [FastAGIProtocol,0,127.0.0.1] Hello FastAGI logging system. [FastAGIProtocol,0,127.0.0.1] Send Command: 'ANSWER' [FastAGIProtocol,0,127.0.0.1] Send Command: "SAY NUMBER 666 ''" [FastAGIProtocol,0,127.0.0.1] SAY NUMBER:[0( ), None( ), None( )] [FastAGIProtocol,0,127.0.0.1] Call handler result: SAY NUMBER:[0( ), None( ), None( )] [FastAGIProtocol,0,127.0.0.1] Connection terminated to the FastAGI server 3077895596

![[Logo: FATS is a Twisted & Fast Asterisk's Telephony Services]](/shared/img/logo_fats.png)