[Asterisk-java-users] AGI Mapping Strategies in Asterisk-Java 0.3
Brought to you by:
srt
From: Stefan R. <sr...@re...> - 2006-07-12 19:21:45
|
Hi, let's sched some light on the mapping strategis for FastAGI scripts in the upcoming Asterisk-Java 0.3 release: As Tony pointed out Asterisk-Java 0.3 by default uses a CompositeMappingStrategy to determine which script class to use for an incoming AGI request. The default is to try the ResourceBundleStrategy (the one already used by 0.2) first and then fall back to the ClassNameMappingStrategy. ResourceBundleStrategy looks for fastagi-mapping.properties on the classpath. To map a call to "agi://localhost/my-script.agi" to your AGI script MyScript in com.example.agi you would place a line like this in the properties file: my-script.agi com.example.agi.MyScript If there is no fastagi-mapping.properties file on the classpath or the properties file does not a mapping that matches the request the ClassNameMappingStrategy is used: It looks for a Java class with a default (i.e. public and without arguments) constructor that implements AgiScript and has a full name corresponding to your request. So to call your script using the ClassNameMappingStrategy you would place something like exten =3D> 123,1,AGI(agi://localhost/com.example.agi.MyScript) in your dialplan. The main purpose of the ClassNameMappingStrategy is to make easy things easy. So in a simple case you dont need any mapping properties files and just call your script class directly. Hope that explanation helps and you like the idea. =3DStefan --=20 reuter network consulting Neusser Str. 110 50760 Koeln Germany Telefon: +49 221 1305699-0 Telefax: +49 221 1305699-90 E-Mail: sr...@re... Jabber: sr...@ja... |