Generating an SNMP Trap
In combination with the method shown in Example 16-2, Example 16-3 demonstrates how a SIP Servlet would use the MBean instance to generate an SNMP trap in response to a SIP INVITE.
Example 16-3 Generating a SNMP Trap
public class MyServlet extends SipServlet {
private SipServletSnmpTrapRuntimeMBean sipServletSnmpTrapMb = null;
public MyServlet () {
}
public void init (ServletConfig sc) throws ServletException {
super.init (sc);
sipServletSnmpTrapMb = getServletSnmpTrapRuntimeMBean();
}
protected void doInvite(SipServletRequest req) throws IOException {
sipServletSnmpTrapMb.sendInfoTrap("Rx Invite from " + req.getRemoteAddr() + "with call id" + req.getCallId());
}
}