<< March 21, 2007 | Home | March 23, 2007 >>

Externalize your AGI Configuration

Using Spring Framework for AGI Mapping and Configuration

Using a dependency injection framework like the Spring Framework to exernalize your configuration is often a great enhancement for maintainance and deployment of your application.

If you are building an AGI application using Asterisk-Java the following code snippets will show you how do it.

<beans xmlns="...">

	<bean id="agiServer" class="org.asteriskjava.fastagi.DefaultAgiServer"
		init-method="startup" destroy-method="shutdown">
		<property name="mappingStrategy" ref="mappingStrategy" />
	</bean>

	<bean id="mappingStrategy" class="org.asteriskjava.fastagi.SimpleMappingStrategy">
		<property name="mappings">
			<map>
				<entry key="hello.agi" value-ref="helloAgi" />
			</map>
		</property>
	</bean>
	
	<bean id="helloAgi" class="HelloAgi">
		<property name="voicePrompt" value="tt-monkeys" />
	</bean>

</beans>

Read more...