st ack = resp.createAck();
//Check if pending SDP to include in ACK
Object content = resp.getSession().getAttribute("SDP");
if( content != null ) {
ack.setContent(content,"application/sdp");
}
ack.send();
}
}
使用SIP Servlet为Java EE添加语音功能(7)
时间:2011-07-18 Prasad Subramanian
sip.xml
sip.xml 文件定义 SIP servlet 并指定它们的映射。SIP servlet 的映射使用 equal、and、or 和 not 运算符来定义调用 servlet 的条 件。在本例中,与此条件匹配的请求方法为 REGISTER、INVITE、OPTIONS 或 MESSAGE。
<sip-app>
<display-name>SIP Registrar</display-name>
<description>SIP Registrar application</description>
<servlet>
<servlet-name>registrar</servlet-name>
<description>Registrar SIP servlet</description>
<servlet-class>com.ericsson.sip.RegistrarServlet</servlet-class>
<init-param>
<param-name>Registrar_Domain</param-name>
<param-value>ericsson.com</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>b2b</servlet-name>
<servlet-class>com.ericsson.sip.B2BCallServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>registrar</servlet-name>
<pattern>
<and>
<equal>
<var ignore-case="false">request.uri.host</var>
<value>test.com</value>
</equal>
<or>
<equal>
<var ignore-case="false">request.method</var>
<value>REGISTER</value>
</equal>
<equal>
<var ignore-case="false">request.method</var>
<value>INVITE</value>
</equal>
<equal>
<var ignore-case="false">request.method</var>
<value>OPTIONS</value>
</equal>
<equal>
<var ignore-case="false">request.method</var>
<value>MESSAGE</value>
</equal>
</or>
</and>
</pattern>
</servlet-mapping>
</sip-app>
persistence.xml
persistence.xml 文件定义持久单元 EricssonSipPU,后者用于在数据库中持久化注册数据。应用程序使用 Sailfi |