PhoneUser user = getByUsername(username);  ManagerConnection con = null;  try { con = getManagerConnectionPool().getConnection();  PhoneDevice primaryDevice = user.getPrimaryDevice();  OriginateAction action = new OriginateAction(); action.setChannel(primaryDevice.getDevice()); action.setCallerId(primaryDevice.getCallerId() != null ? primaryDevice.getCallerId() : getProperty(Properties.DEFAULT_CALLER_ID)); action.setExten(extension); String context = getProperty(Properties.CONTEXT, DEFAULT_CONTEXT); if ("".equals(context)) { context = DEFAULT_CONTEXT; }  action.setContext(context); action.setPriority(1);  ManagerResponse managerResponse = con.sendAction(action, 5 * JiveConstants.SECOND);  if (managerResponse instanceof ManagerError) { log.warning(managerResponse.getMessage()); throw new PhoneException(managerResponse.getMessage()); }  } catch (PhoneException pe) { throw pe; } catch (Exception e) { log.log(Level.SEVERE, e.getMessage(), e); throw new PhoneException("Unabled to dial extention " + extension, e); } finally { close(con); }
dial(username, extension, null);
    public void dial(String username, String extension) throws PhoneException {        //acquire the jidUser object        PhoneUser user = getByUsername(username);        ManagerConnection con = null;        try {            con = getManagerConnectionPool().getConnection();            PhoneDevice primaryDevice = user.getPrimaryDevice();            OriginateAction action = new OriginateAction();            action.setChannel(primaryDevice.getDevice());            action.setCallerId(primaryDevice.getCallerId() != null ? primaryDevice.getCallerId() :                    getProperty(Properties.DEFAULT_CALLER_ID));            action.setExten(extension);            String context = getProperty(Properties.CONTEXT, DEFAULT_CONTEXT);            if ("".equals(context)) {                context = DEFAULT_CONTEXT;            }            action.setContext(context);            action.setPriority(1);            ManagerResponse managerResponse = con.sendAction(action, 5 * JiveConstants.SECOND);            if (managerResponse instanceof ManagerError) {                log.warning(managerResponse.getMessage());                throw new PhoneException(managerResponse.getMessage());            }        }        catch (PhoneException pe) {            throw pe;        }        catch (Exception e) {            log.log(Level.SEVERE, e.getMessage(), e);            throw new PhoneException("Unabled to dial extention " + extension, e);        }        finally {            close(con);        }    }