Add AGI script example.

develop
Ludovic Gasc 2013-12-03 11:40:03 +01:00
parent d496ad0831
commit 82cf4d022f
1 changed files with 22 additions and 0 deletions

View File

@ -0,0 +1,22 @@
#!/usr/bin/python
"""
Example to get and set variables via AGI.
You can call directly this script with AGI() in Asterisk dialplan.
"""
from asterisk.agi import *
agi = AGI()
agi.verbose("python agi started")
# Get variable environment
extension = agi.env['agi_extension']
# Get variable in dialplan
phone_exten = agi.get_variable('PHONE_EXTEN')
# Set variable, it will be available in dialplan
agi.set_variable('EXT_CALLERID', '1')