Merge pull request #5 from Eyepea/master
Add AGI script example + README rename
This commit is contained in:
		
						commit
						630fc7b102
					
				
							
								
								
									
										22
									
								
								examples/agi_script.py
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										22
									
								
								examples/agi_script.py
									
									
									
									
									
										Executable 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')
 | 
				
			||||||
							
								
								
									
										4
									
								
								setup.py
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										4
									
								
								setup.py
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							@ -6,7 +6,7 @@ from asterisk import __version__ as version
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
description = []
 | 
					description = []
 | 
				
			||||||
f = open('README')
 | 
					f = open('README.rst')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
logo_stripped = False
 | 
					logo_stripped = False
 | 
				
			||||||
for line in f:
 | 
					for line in f:
 | 
				
			||||||
@ -26,7 +26,7 @@ setup(
 | 
				
			|||||||
    author_email='kputland@users.sourceforge.net',
 | 
					    author_email='kputland@users.sourceforge.net',
 | 
				
			||||||
    maintainer='Randall Degges',
 | 
					    maintainer='Randall Degges',
 | 
				
			||||||
    maintainer_email='rdegges@gmail.com',
 | 
					    maintainer_email='rdegges@gmail.com',
 | 
				
			||||||
    url='http://www.sourceforge.net/projects/pyst/',
 | 
					    url='https://github.com/rdegges/pyst2',
 | 
				
			||||||
    packages=['asterisk'],
 | 
					    packages=['asterisk'],
 | 
				
			||||||
    license=', '.join(licenses),
 | 
					    license=', '.join(licenses),
 | 
				
			||||||
    platforms='Any',
 | 
					    platforms='Any',
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user