FreeSWITCH提供了一个mod_java模块,用于使用JAVA语言来实现对FreeSWITCH的控制。最近正好接触了下,很是被里面的部分问题困扰过,现整理出来与大家共享下:
注:已提前将官方wiki中的demo(http://wiki.freeswitch.org/wiki/Java)做成jar包,名字是freeswitchJavaScript.jar
1、将文件freeswitchJavaScript.jar上传到linux目录,如下:
/usr/local/freeswitch/jar/freeswitchJavaScript.jar
2、将文件freeswitch.jar上传到该目录下,如下:
/usr/local/freeswitch/scripts/freeswitch.jar
3、将freeswitchJavaScript.jar引用的jar文件上传到/javapath目录
注:/javapath目录用于存放引用第三方的jar包
4、配置java模块
文件:/usr/local/freeswitch/conf/autoload_configs/java.conf.xml
主要配置下面两个内容
<javavm path="/usr/java/jdk1.6.0_16/jre/lib/i386/client/libjvm.so"/>
<option value="-Djava.class.path=/usr/local/freeswitch/scripts/freeswitch.jar:/javapath/axis.jar:/javapath/activation.jar:/javapath/axis-ant.jar:/javapath/commons-discovery-0.2.jar:/javapath/commons-logging-1.0.4.jar:/javapath/freeswitch.jar:/javapath/jaxrpc.jar:/javapath/log4j-1.2.8.jar:/javapath/log4j.properties:/javapath/mail.jar:/javapath/saaj.jar:/javapath/wsdl4j-1.5.1.jar:/javapath/jetty-6.1.9.jar:/javapath/jetty-util-6.1.9.jar:/javapath/servlet_jetty.jar"/>
注:classpath中指向的是第三步引用的jar文件
5、dialplan配置
文件:/usr/local/freeswitch/conf/dialplan/default.xml
拨号方案:
<extension name="java_demo">
<condition field="destination_number" expression="^(9000)$">
<action application="answer"/>
<action application="java" data="/usr/local/freeswitch/jar/freeswitchJavaScript.jar PhoneTest"/>
<action application="sleep" data="2000"/>
</condition>
注:已提前将官方wiki中的demo(http://wiki.freeswitch.org/wiki/Java)做成jar包,名字是freeswitchJavaScript.jar
1、将文件freeswitchJavaScript.jar上传到linux目录,如下:
/usr/local/freeswitch/jar/freeswitchJavaScript.jar
2、将文件freeswitch.jar上传到该目录下,如下:
/usr/local/freeswitch/scripts/freeswitch.jar
3、将freeswitchJavaScript.jar引用的jar文件上传到/javapath目录
注:/javapath目录用于存放引用第三方的jar包
4、配置java模块
文件:/usr/local/freeswitch/conf/autoload_configs/java.conf.xml
主要配置下面两个内容
<javavm path="/usr/java/jdk1.6.0_16/jre/lib/i386/client/libjvm.so"/>
<option value="-Djava.class.path=/usr/local/freeswitch/scripts/freeswitch.jar:/javapath/axis.jar:/javapath/activation.jar:/javapath/axis-ant.jar:/javapath/commons-discovery-0.2.jar:/javapath/commons-logging-1.0.4.jar:/javapath/freeswitch.jar:/javapath/jaxrpc.jar:/javapath/log4j-1.2.8.jar:/javapath/log4j.properties:/javapath/mail.jar:/javapath/saaj.jar:/javapath/wsdl4j-1.5.1.jar:/javapath/jetty-6.1.9.jar:/javapath/jetty-util-6.1.9.jar:/javapath/servlet_jetty.jar"/>
注:classpath中指向的是第三步引用的jar文件
5、dialplan配置
文件:/usr/local/freeswitch/conf/dialplan/default.xml
拨号方案:
<extension name="java_demo">
<condition field="destination_number" expression="^(9000)$">
<action application="answer"/>
<action application="java" data="/usr/local/freeswitch/jar/freeswitchJavaScript.jar PhoneTest"/>
<action application="sleep" data="2000"/>
</condition>
</extension>
官网java模块地址:http://wiki.freeswitch.org/wiki/Java
作者:jizha 发表于2013-2-22 0:14:24 原文链接
阅读:148 评论:0 查看评论