From: Vladimir <v....@gm...> - 2012-11-23 10:02:09
|
Hi everyone Please show example FastAGI server on pyst. Regards, Vladimir |
From: Ralf S. <rs...@ru...> - 2012-11-24 09:02:04
|
On Fri, Nov 23, 2012 at 04:01:37PM +0600, Vladimir wrote: > Hi everyone > > Please show example FastAGI server on pyst. Since FastAGI simply forwards all the data from standard input and standard output via a TCP socket, you should be able to drop your Pyst Code into a call from inetd on the remote machine, e.g. in /etc/inetd.conf you'd write something like 4711 stream tcp nowait root /path/to/pyst/script and then call this from asterisk with somethink like exten => s,n,AGI(agi://192.168.0.2:4711) In this way you leave the FastAGI network-specific code to inetd and you should be able to use your local AGI Pyst code unmodified on the remote server. Ralf -- Dr. Ralf Schlatterbeck Tel: +43/2243/26465-16 Open Source Consulting www: http://www.runtux.com Reichergasse 131, A-3411 Weidling email: of...@ru... osAlliance member email: rs...@os... |
From: Vladimir <v....@gm...> - 2012-11-24 13:16:26
|
Thanks, the server works. But script doesn't work. I tested in telnet ## test_agi.py #!/home/tester/venv/aster/bin/python # -*- coding: utf-8 -*- import asterisk.agi VERBOSE_LEVEL = 1 if __name__ == '__main__': agi = asterisk.agi.AGI() agi.verbose(u'Test message from FastAGI', VERBOSE_LEVEL) agi.hangup() ###### % telnet 127.0.0.1 26000 Trying 127.0.0.1... Connected to 127.0.0.1. Escape character is '^]'. ARGS: ['/home/tester/venv/aster/opt/pyst_manager/myagi.py'] agi_network: yes agi_request: agi://127.0.0.1:26000 agi_channel: SIP/IPphone-test-00000312 agi_language: ru agi_type: SIP agi_uniqueid: 1353761065.856 agi_version: 10.3.1 agi_callerid: 100 agi_calleridname: IPphone-test agi_callingpres: 0 agi_callingani2: 0 agi_callington: 0 agi_callingtns: 0 agi_dnid: 1010 agi_rdnis: unknown agi_context: office agi_extension: 1010 agi_priority: 1 agi_enhanced: 0.0 agi_accountcode: agi_threadid: -1237062800 ENV LINE: agi_network: yes ENV LINE: agi_request: agi://127.0.0.1:26000 ENV LINE: agi_channel: SIP/IPphone-test-00000312 ENV LINE: agi_language: ru ENV LINE: agi_type: SIP ENV LINE: agi_uniqueid: 1353761065.856 ENV LINE: agi_version: 10.3.1 ENV LINE: agi_callerid: 100 ENV LINE: agi_calleridname: IPphone-test ENV LINE: agi_callingpres: 0 ENV LINE: agi_callingani2: 0 ENV LINE: agi_callington: 0 ENV LINE: agi_callingtns: 0 ENV LINE: agi_dnid: 1010 ENV LINE: agi_rdnis: unknown ENV LINE: agi_context: office ENV LINE: agi_extension: 1010 ENV LINE: agi_priority: 1 ENV LINE: agi_enhanced: 0.0 ENV LINE: agi_accountcode: ENV LINE: agi_threadid: -1237062800 ENV LINE: class AGI: self.env = {'agi_accountcode': '', 'agi_callerid': '100', 'agi_calleridname': 'IPphone-test', 'agi_callingani2': '0', 'agi_callingpres': '0', 'agi_callingtns': '0', 'agi_callington': '0', 'agi_channel': 'SIP/IPphone-test-00000312', 'agi_context': 'office', 'agi_dnid': '1010', 'agi_enhanced': '0.0', 'agi_extension': '1010', 'agi_language': 'ru', 'agi_network': 'yes', 'agi_priority': '1', 'agi_rdnis': 'unknown', 'agi_request': 'agi://127.0.0.1:26000', 'agi_threadid': '-1237062800', 'agi_type': 'SIP', 'agi_uniqueid': '1353761065.856', 'agi_version': '10.3.1'} COMMAND: VERBOSE "Test message from FastAGI" 1 VERBOSE "Test message from FastAGI" 1 RESULT_LINE: Traceback (most recent call last): File "/home/koqep/venv/aster/opt/pyst_manager/myagi.py", line 10, in <module> agi.verbose('Test message from FastAGI', verbose_level) File "/home/koqep/venv/aster/lib/python2.7/site-packages/pyst-0.4.38-py2.7.egg/asterisk/agi.py", line 566, in verbose self.execute('VERBOSE', self._quote(message), level) File "/home/koqep/venv/aster/lib/python2.7/site-packages/pyst-0.4.38-py2.7.egg/asterisk/agi.py", line 105, in execute return self.get_result() File "/home/koqep/venv/aster/lib/python2.7/site-packages/pyst-0.4.38-py2.7.egg/asterisk/agi.py", line 133, in get_result code = int(code) ValueError: invalid literal for int() with base 10: '' Connection closed by foreign host. 2012/11/24 Ralf Schlatterbeck <rs...@ru...> > On Fri, Nov 23, 2012 at 04:01:37PM +0600, Vladimir wrote: > > Hi everyone > > > > Please show example FastAGI server on pyst. > > Since FastAGI simply forwards all the data from standard input and > standard output via a TCP socket, you should be able to drop your Pyst > Code into a call from inetd on the remote machine, e.g. in > /etc/inetd.conf you'd write something like > > 4711 stream tcp nowait root /path/to/pyst/script > > and then call this from asterisk with somethink like > > exten => s,n,AGI(agi://192.168.0.2:4711) > > In this way you leave the FastAGI network-specific code to inetd and you > should be able to use your local AGI Pyst code unmodified on the remote > server. > > Ralf > -- > Dr. Ralf Schlatterbeck Tel: +43/2243/26465-16 > Open Source Consulting www: http://www.runtux.com > Reichergasse 131, A-3411 Weidling email: of...@ru... > osAlliance member email: rs...@os... > |
From: Vladimir <v....@gm...> - 2012-11-27 13:42:59
|
Script won't work Debug from asterisk CLI The problem in Pyst? *CLI> [Nov 27 13:32:47] AGI Tx >> agi_network: yes [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> agi_request: agi:// test.localnet.ru:26000 [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> agi_channel: SIP/voipster-0000001d [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> agi_language: ru [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> agi_type: SIP [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> agi_uniqueid: 1354001567.29 [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> agi_version: 10.10.0 [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> agi_callerid: 100 [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> agi_calleridname: voipster [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> agi_callingpres: 0 [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> agi_callingani2: 0 [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> agi_callington: 0 [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> agi_callingtns: 0 [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> agi_dnid: 100 [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> agi_rdnis: unknown [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> agi_context: office [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> agi_extension: 100 [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> agi_priority: 1 [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> agi_enhanced: 0.0 [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> agi_accountcode: [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> agi_threadid: -1235522704 [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Rx << ARGS: ['/home/voipster/venv/aster/opt/pyst_manager/myagi.py'] [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> 510 Invalid or unknown command [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Rx << ENV LINE: agi_network: yes [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> 510 Invalid or unknown command [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Rx << ENV LINE: agi_request: agi://test.localnet.ru:26000 [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> 510 Invalid or unknown command [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Rx << ENV LINE: agi_channel: SIP/voipster-0000001d [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> 510 Invalid or unknown command [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Rx << ENV LINE: agi_language: ru [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> 510 Invalid or unknown command [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Rx << ENV LINE: agi_type: SIP [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> 510 Invalid or unknown command [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Rx << ENV LINE: agi_uniqueid: 1354001567.29 [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> 510 Invalid or unknown command [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Rx << ENV LINE: agi_version: 10.10.0 [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> 510 Invalid or unknown command [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Rx << ENV LINE: agi_callerid: 100 [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> 510 Invalid or unknown command [Nov 27 13:32:47] ERROR[4007]: utils.c:1177 ast_carefulwrite: write() returned error: Connection reset by peer [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Rx << ENV LINE: agi_calleridname: voipster [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> 510 Invalid or unknown command [Nov 27 13:32:47] ERROR[4007]: utils.c:1177 ast_carefulwrite: write() returned error: Broken pipe [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Rx << ENV LINE: agi_callingpres: 0 [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> 510 Invalid or unknown command [Nov 27 13:32:47] ERROR[4007]: utils.c:1177 ast_carefulwrite: write() returned error: Broken pipe [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Rx << ENV LINE: agi_callingani2: 0 [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> 510 Invalid or unknown command [Nov 27 13:32:47] ERROR[4007]: utils.c:1177 ast_carefulwrite: write() returned error: Broken pipe [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Rx << ENV LINE: agi_callington: 0 [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> 510 Invalid or unknown command [Nov 27 13:32:47] ERROR[4007]: utils.c:1177 ast_carefulwrite: write() returned error: Broken pipe [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Rx << ENV LINE: agi_callingtns: 0 [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> 510 Invalid or unknown command [Nov 27 13:32:47] ERROR[4007]: utils.c:1177 ast_carefulwrite: write() returned error: Broken pipe [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Rx << ENV LINE: agi_dnid: 100 [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> 510 Invalid or unknown command [Nov 27 13:32:47] ERROR[4007]: utils.c:1177 ast_carefulwrite: write() returned error: Broken pipe [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Rx << ENV LINE: agi_rdnis: unknown [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> 510 Invalid or unknown command [Nov 27 13:32:47] ERROR[4007]: utils.c:1177 ast_carefulwrite: write() returned error: Broken pipe [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Rx << ENV LINE: agi_context: office [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> 510 Invalid or unknown command [Nov 27 13:32:47] ERROR[4007]: utils.c:1177 ast_carefulwrite: write() returned error: Broken pipe [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Rx << ENV LINE: agi_extension: 100 [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> 510 Invalid or unknown command [Nov 27 13:32:47] ERROR[4007]: utils.c:1177 ast_carefulwrite: write() returned error: Broken pipe [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Rx << ENV LINE: agi_priority: 1 [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> 510 Invalid or unknown command [Nov 27 13:32:47] ERROR[4007]: utils.c:1177 ast_carefulwrite: write() returned error: Broken pipe [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Rx << ENV LINE: agi_enhanced: 0.0 [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> 510 Invalid or unknown command [Nov 27 13:32:47] ERROR[4007]: utils.c:1177 ast_carefulwrite: write() returned error: Broken pipe [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Rx << ENV LINE: agi_accountcode: [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> 510 Invalid or unknown command [Nov 27 13:32:47] ERROR[4007]: utils.c:1177 ast_carefulwrite: write() returned error: Broken pipe [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Rx << ENV LINE: agi_threadid: -1235522704 [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> 510 Invalid or unknown command [Nov 27 13:32:47] ERROR[4007]: utils.c:1177 ast_carefulwrite: write() returned error: Broken pipe [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Rx << ENV LINE: [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> 510 Invalid or unknown command [Nov 27 13:32:47] ERROR[4007]: utils.c:1177 ast_carefulwrite: write() returned error: Broken pipe [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Rx << class AGI: self.env = {'agi_accountcode': '', [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> 510 Invalid or unknown command [Nov 27 13:32:47] ERROR[4007]: utils.c:1177 ast_carefulwrite: write() returned error: Broken pipe [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Rx << 'agi_callerid': '100', [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> 510 Invalid or unknown command [Nov 27 13:32:47] ERROR[4007]: utils.c:1177 ast_carefulwrite: write() returned error: Broken pipe [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Rx << 'agi_calleridname': 'voipster', [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> 510 Invalid or unknown command [Nov 27 13:32:47] ERROR[4007]: utils.c:1177 ast_carefulwrite: write() returned error: Broken pipe [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Rx << 'agi_callingani2': '0', [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> 510 Invalid or unknown command [Nov 27 13:32:47] ERROR[4007]: utils.c:1177 ast_carefulwrite: write() returned error: Broken pipe [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Rx << 'agi_callingpres': '0', [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> 510 Invalid or unknown command [Nov 27 13:32:47] ERROR[4007]: utils.c:1177 ast_carefulwrite: write() returned error: Broken pipe [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Rx << 'agi_callingtns': '0', [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> 510 Invalid or unknown command [Nov 27 13:32:47] ERROR[4007]: utils.c:1177 ast_carefulwrite: write() returned error: Broken pipe [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Rx << 'agi_callington': '0', [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> 510 Invalid or unknown command [Nov 27 13:32:47] ERROR[4007]: utils.c:1177 ast_carefulwrite: write() returned error: Broken pipe [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Rx << 'agi_channel': 'SIP/voipster-0000001d', [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> 510 Invalid or unknown command [Nov 27 13:32:47] ERROR[4007]: utils.c:1177 ast_carefulwrite: write() returned error: Broken pipe [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Rx << 'agi_context': 'office', [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> 510 Invalid or unknown command [Nov 27 13:32:47] ERROR[4007]: utils.c:1177 ast_carefulwrite: write() returned error: Broken pipe [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Rx << 'agi_dnid': '100', [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> 510 Invalid or unknown command [Nov 27 13:32:47] ERROR[4007]: utils.c:1177 ast_carefulwrite: write() returned error: Broken pipe [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Rx << 'agi_enhanced': '0.0', [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> 510 Invalid or unknown command [Nov 27 13:32:47] ERROR[4007]: utils.c:1177 ast_carefulwrite: write() returned error: Broken pipe [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Rx << 'agi_extension': '100', [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> 510 Invalid or unknown command [Nov 27 13:32:47] ERROR[4007]: utils.c:1177 ast_carefulwrite: write() returned error: Broken pipe [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Rx << 'agi_language': 'ru', [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> 510 Invalid or unknown command [Nov 27 13:32:47] ERROR[4007]: utils.c:1177 ast_carefulwrite: write() returned error: Broken pipe [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Rx << 'agi_network': 'yes', [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> 510 Invalid or unknown command [Nov 27 13:32:47] ERROR[4007]: utils.c:1177 ast_carefulwrite: write() returned error: Broken pipe [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Rx << 'agi_priority': '1', [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> 510 Invalid or unknown command [Nov 27 13:32:47] ERROR[4007]: utils.c:1177 ast_carefulwrite: write() returned error: Broken pipe [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Rx << 'agi_rdnis': 'unknown', [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> 510 Invalid or unknown command [Nov 27 13:32:47] ERROR[4007]: utils.c:1177 ast_carefulwrite: write() returned error: Broken pipe [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Rx << 'agi_request': 'agi:// test.localnet.ru:26000', [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> 510 Invalid or unknown command [Nov 27 13:32:47] ERROR[4007]: utils.c:1177 ast_carefulwrite: write() returned error: Broken pipe [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Rx << 'agi_threadid': '-1235522704', [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> 510 Invalid or unknown command [Nov 27 13:32:47] ERROR[4007]: utils.c:1177 ast_carefulwrite: write() returned error: Broken pipe [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Rx << 'agi_type': 'SIP', [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> 510 Invalid or unknown command [Nov 27 13:32:47] ERROR[4007]: utils.c:1177 ast_carefulwrite: write() returned error: Broken pipe [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Rx << 'agi_uniqueid': '1354001567.29', [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> 510 Invalid or unknown command [Nov 27 13:32:47] ERROR[4007]: utils.c:1177 ast_carefulwrite: write() returned error: Broken pipe [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Rx << 'agi_version': '10.10.0'} [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> 510 Invalid or unknown command [Nov 27 13:32:47] ERROR[4007]: utils.c:1177 ast_carefulwrite: write() returned error: Broken pipe [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Rx << COMMAND: VERBOSE "Test_message_from_FastAGI" 1 [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> 510 Invalid or unknown command [Nov 27 13:32:47] ERROR[4007]: utils.c:1177 ast_carefulwrite: write() returned error: Broken pipe [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Rx << VERBOSE "Test_message_from_FastAGI" 1 [Nov 27 13:32:47] agi://test.localnet.ru:26000: Test_message_from_FastAGI [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> 200 result=1 [Nov 27 13:32:47] ERROR[4007]: utils.c:1177 ast_carefulwrite: write() returned error: Broken pipe [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Rx << RESULT_LINE: 510 Invalid or unknown command [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> 510 Invalid or unknown command [Nov 27 13:32:47] ERROR[4007]: utils.c:1177 ast_carefulwrite: write() returned error: Broken pipe [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Rx << Traceback (most recent call last): [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> 510 Invalid or unknown command [Nov 27 13:32:47] ERROR[4007]: utils.c:1177 ast_carefulwrite: write() returned error: Broken pipe [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Rx << File "/home/voipster/venv/aster/opt/pyst_manager/myagi.py", line 11, in <module> [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> 510 Invalid or unknown command [Nov 27 13:32:47] ERROR[4007]: utils.c:1177 ast_carefulwrite: write() returned error: Broken pipe [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Rx << agi.verbose('Test_message_from_FastAGI', VERBOSE_LEVEL) [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> 510 Invalid or unknown command [Nov 27 13:32:47] ERROR[4007]: utils.c:1177 ast_carefulwrite: write() returned error: Broken pipe [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Rx << File "/home/voipster/venv/aster/lib/python2.7/site-packages/pyst-0.4.38-py2.7.egg/asterisk/agi.py", line 566, in verbose [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> 510 Invalid or unknown command [Nov 27 13:32:47] ERROR[4007]: utils.c:1177 ast_carefulwrite: write() returned error: Broken pipe [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Rx << self.execute('VERBOSE', self._quote(message), level) [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> 510 Invalid or unknown command [Nov 27 13:32:47] ERROR[4007]: utils.c:1177 ast_carefulwrite: write() returned error: Broken pipe [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Rx << File "/home/voipster/venv/aster/lib/python2.7/site-packages/pyst-0.4.38-py2.7.egg/asterisk/agi.py", line 105, in execute [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> 510 Invalid or unknown command [Nov 27 13:32:47] ERROR[4007]: utils.c:1177 ast_carefulwrite: write() returned error: Broken pipe [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Rx << return self.get_result() [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> 510 Invalid or unknown command [Nov 27 13:32:47] ERROR[4007]: utils.c:1177 ast_carefulwrite: write() returned error: Broken pipe [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Rx << File "/home/voipster/venv/aster/lib/python2.7/site-packages/pyst-0.4.38-py2.7.egg/asterisk/agi.py", line 149, in get_result [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> 510 Invalid or unknown command [Nov 27 13:32:47] ERROR[4007]: utils.c:1177 ast_carefulwrite: write() returned error: Broken pipe [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Rx << raise AGIInvalidCommand(response) [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> 510 Invalid or unknown command [Nov 27 13:32:47] ERROR[4007]: utils.c:1177 ast_carefulwrite: write() returned error: Broken pipe [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Rx << asterisk.agi.AGIInvalidCommand: Invalid or unknown command [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> 510 Invalid or unknown command [Nov 27 13:32:47] ERROR[4007]: utils.c:1177 ast_carefulwrite: write() returned error: Broken pipe [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> HANGUP [Nov 27 13:32:47] ERROR[4007]: utils.c:1177 ast_carefulwrite: write() returned error: Broken pipe 2012/11/24 Ralf Schlatterbeck <rs...@ru...> > On Fri, Nov 23, 2012 at 04:01:37PM +0600, Vladimir wrote: > > Hi everyone > > > > Please show example FastAGI server on pyst. > > Since FastAGI simply forwards all the data from standard input and > standard output via a TCP socket, you should be able to drop your Pyst > Code into a call from inetd on the remote machine, e.g. in > /etc/inetd.conf you'd write something like > > 4711 stream tcp nowait root /path/to/pyst/script > > and then call this from asterisk with somethink like > > exten => s,n,AGI(agi://192.168.0.2:4711) > > In this way you leave the FastAGI network-specific code to inetd and you > should be able to use your local AGI Pyst code unmodified on the remote > server. > > Ralf > -- > Dr. Ralf Schlatterbeck Tel: +43/2243/26465-16 > Open Source Consulting www: http://www.runtux.com > Reichergasse 131, A-3411 Weidling email: of...@ru... > osAlliance member email: rs...@os... > |
From: Ralf S. <rs...@ru...> - 2012-11-27 16:10:12
|
On Tue, Nov 27, 2012 at 07:42:27PM +0600, Vladimir wrote: > Script won't work > Debug from asterisk CLI > The problem in Pyst? > > *CLI> [Nov 27 13:32:47] AGI Tx >> agi_network: yes > [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> agi_request: agi:// > test.localnet.ru:26000 ... > [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Rx << ARGS: > ['/home/voipster/venv/aster/opt/pyst_manager/myagi.py'] > [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> 510 Invalid or unknown > command Interesting. I've never used FASTAGI myself, but thought that it is basically the same protocol. Hmm. http://www.asteriskdocs.org/en/3rd_Edition/asterisk-book-html-chunk/AGI-variants.html tells us that, yes, it basically is and http://www.asteriskdocs.org/en/3rd_Edition/asterisk-book-html-chunk/AGI-communication.html seems to confirm this (except on channel hangup) It looks to me like standard error is sent via the network connection. Can you try redirecting standard error to somewhere else, there was a recent patch that enabled this. You have to specify the stderr file that you want to use explicitly when calling the constructor of AGI. So in your AGI script instead of x = AGI () you specify something like error_file = open ("/path/to/stderr/log", "w") x = AGI (stderr = error_file) This should do the trick of not sending stderr back to the asterisk server. Ralf -- Dr. Ralf Schlatterbeck Tel: +43/2243/26465-16 Open Source Consulting www: http://www.runtux.com Reichergasse 131, A-3411 Weidling email: of...@ru... osAlliance member email: rs...@os... |
From: Vladimir <v....@gm...> - 2012-11-28 07:49:14
|
Thanks, Ralf. Running FastAGI in xinetd, set STDERR as file. And before running script need set in dialplan variable AGISIGHUP=no, if this doesn't set we have error in CLI [Nov 28 05:49:59] ERROR[6625]: utils.c:1177 ast_carefulwrite: write() returned error: Broken pipe But I think running script XInetd no different from running script in dialplan. This cloning the many similar processes. I think found the best solution for Fastagi. Thanks Max Nesterov for patch: https://sourceforge.net/tracker/index.php?func=detail&aid=3047290&group_id=76162&atid=546274 P.S: Sorry for my english Regards, Vladimir 2012/11/27 Ralf Schlatterbeck <rs...@ru...> > On Tue, Nov 27, 2012 at 07:42:27PM +0600, Vladimir wrote: > > Script won't work > > Debug from asterisk CLI > > The problem in Pyst? > > > > *CLI> [Nov 27 13:32:47] AGI Tx >> agi_network: yes > > [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> agi_request: agi:// > > test.localnet.ru:26000 > ... > > [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Rx << ARGS: > > ['/home/voipster/venv/aster/opt/pyst_manager/myagi.py'] > > [Nov 27 13:32:47] <SIP/voipster-0000001d>AGI Tx >> 510 Invalid or unknown > > command > > Interesting. I've never used FASTAGI myself, but thought that it is > basically the same protocol. > > Hmm. > > > http://www.asteriskdocs.org/en/3rd_Edition/asterisk-book-html-chunk/AGI-variants.html > tells us that, yes, it basically is > and > > http://www.asteriskdocs.org/en/3rd_Edition/asterisk-book-html-chunk/AGI-communication.html > seems to confirm this (except on channel hangup) > > It looks to me like standard error is sent via the network connection. > > Can you try redirecting standard error to somewhere else, there was a > recent patch that enabled this. You have to specify the stderr file that > you want to use explicitly when calling the constructor of AGI. > > So in your AGI script instead of > > x = AGI () > > you specify something like > > error_file = open ("/path/to/stderr/log", "w") > x = AGI (stderr = error_file) > > This should do the trick of not sending stderr back to the asterisk > server. > > Ralf > -- > Dr. Ralf Schlatterbeck Tel: +43/2243/26465-16 > Open Source Consulting www: http://www.runtux.com > Reichergasse 131, A-3411 Weidling email: of...@ru... > osAlliance member email: rs...@os... > |
From: Ralf S. <rs...@ru...> - 2012-11-28 09:53:55
|
On Wed, Nov 28, 2012 at 01:48:45PM +0600, Vladimir wrote: > Thanks, Ralf. > > Running FastAGI in xinetd, set STDERR as file. And before running script > need set in dialplan variable AGISIGHUP=no, if this doesn't set we have > error in CLI Ah, interesting detail, thanks. > I think found the best solution for Fastagi. Thanks Max Nesterov for patch: > https://sourceforge.net/tracker/index.php?func=detail&aid=3047290&group_id=76162&atid=546274 You know that the patch is already in the latest Release 0.4.36? Thanks for the feedback. Ralf -- Dr. Ralf Schlatterbeck Tel: +43/2243/26465-16 Open Source Consulting www: http://www.runtux.com Reichergasse 131, A-3411 Weidling email: of...@ru... osAlliance member email: rs...@os... |
From: Vladimir <v....@gm...> - 2012-11-28 10:43:21
|
2012/11/28 Ralf Schlatterbeck <rs...@ru...> > > I think found the best solution for Fastagi. Thanks Max Nesterov for > patch: > > > https://sourceforge.net/tracker/index.php?func=detail&aid=3047290&group_id=76162&atid=546274 > > You know that the patch is already in the latest Release 0.4.36? > > Yes, I knew. I use latest release 0.4.38 https://sourceforge.net/projects/pyst/files/pyst/0.4.38/ > Thanks for the feedback. > > Ralf > > -- > Dr. Ralf Schlatterbeck Tel: +43/2243/26465-16 > Open Source Consulting www: http://www.runtux.com > Reichergasse 131, A-3411 Weidling email: of...@ru... > osAlliance member email: rs...@os... > |