warst
July 7, 2006, 7:38pm
1
Hi All,
I am facing a problem while transferring control back and forth from AGI scripts to Asterisk. or Lets say the control is not being transferred to AGI scripts only.
The command I am using to transfer to the AGI is:
exten => s,2,agi,filename.py
or
exten => s,2,AGI(filename.py )
or
exten => s,2,AGI(filename.agi)
None of them seems to work.
Any help in this regard would be appreciated.
-Thanks
is the file in /var/lib/asterisk/agi-bin (or your designated agi directory), is it executable, and owned/accessible by the user that Asterisk runs as ?
warst
July 7, 2006, 7:53pm
3
Yes, it is located in the var/lib/asterisk/agi-bin directory and i am working as a root user.
The agi file is as follows:
import sys
import time
def getEnv():
env = ""
rtn = []
while (env != “\n”):
env = sys.stdin.readline()
rtn.append(env)
return rtn
def sendAgi(str):
sys.stdout.write(str)
sys.stdout.flush()
var = sys.stdin.readline()
return var
sys.stderr.write(“filename.py is starting…\n”)
Read and ignore AGI environment
agi = getEnv()
TEST
var = sendAgi(“STREAM FILE gsmfile “”\n”)
TEST
var = sendAgi("SET VARIABLE P " + str(time.time()) + “\n”)
-Thanks
On the asterisk CLI type
agi debug
This will turn AGI debugging on.
Run the dialplan and show the CLI output when the AGi script is run.
warst
July 7, 2006, 8:11pm
5
I get this error message when i do agi debug
bash: agi: command not found
at the CLI CLI > agi debug
warst
July 7, 2006, 8:25pm
7
at the CLI :
CLI> agi debug
No Such Command ‘agi’ (type ‘help’ for help)
Hi aman,
Start asterisk using the command asterisk -cvvvvv
You get some messages and then you get a CLI (Command Line Interface) like this :
CLI>
Now type agi debug at the CLI
If you are still getting the same error then maybe you are using an ancient
version of asterisk.
warst
July 8, 2006, 3:55pm
9
Hi All,
It still gives me the error message:
CLI> agi debug
No such command ‘agi’ (type ‘help’ for help)
Please help me to figure out this issue.
-Thanks