@@ -0,0 +1,1121 @@
+@SuppressWarnings(%22serial%22)%0A@WebServlet(%22/voice%22)%0Apublic class IncomingCallServlet extends HttpServlet %7B%0A  %0A  // Update with your own phone number in E.164 format%0A  public static final String MODERATOR = %22+15558675309%22;%0A%0A  // Handle HTTP POST to /voice%0A  protected void doPost(HttpServletRequest request, HttpServletResponse response)%0A      throws ServletException, IOException %7B%0A    // Create a TwiML builder object%0A    TwiMLResponse twiml = new TwiMLResponse();%0A    %0A    // Get the number of the incoming caller%0A    String fromNumber = request.getParameter(%22From%22);%0A    %0A    try %7B%0A      Dial dial = new Dial();%0A      Conference conf = new Conference(%22My Conference%22);%0A      if (MODERATOR.equalsIgnoreCase(fromNumber)) %7B%0A        conf.setStartConferenceOnEnter(true);%0A        conf.setEndConferenceOnExit(true);%0A      %7D else %7B%0A        conf.setEndConferenceOnExit(false);%0A      %7D%0A      dial.append(conf);%0A      twiml.append(dial);%0A    %7D catch (TwiMLException e) %7B%0A      e.printStackTrace();%0A    %7D%0A    %0A    // Render TwiML as XML%0A    response.setContentType(%22text/xml%22);%0A    response.getWriter().print(twiml.toXML());%0A  %7D%0A%7D%0A

add java example for conferences