Redirect a call

Very simple example, which shows you how to redirect a call. Checks if the mode is ok and then tries to redirect the call. Watch out: That also works, if you do not have any rights to redirect a call .. i do not know why 🙂 but it does. (Means: if your client is not able to do a forwarding to external numbers, you are able to do a redirect to them .. nearly the same i guess)

 

Written by Jörg Wiesmann 
Saturday, 05 August 2006

/**
   @param ciscoConnection
   @param callControlConnection
   @param numberToRedirectTo
   */
  public void setRedirectCall(CiscoConnection ciscoConnection, 
      CallControlConnection callControlConnection, 
      String numberToRedirectTo) {
    if (ciscoConnection != null && callControlConnection != null) {
      try {
        if (ciscoConnection.getCallControlState() == CallControlConnection.OFFERING
            || ciscoConnection.getCallControlState() == CallControlConnection.ALERTING
            || ciscoConnection.getCallControlState() == CallControlConnection.ESTABLISHED) {
          ciscoConnection.redirect(numberToRedirectTo, 
              CiscoConnection.REDIRECT_NORMAL, 
              CiscoConnection.ADDRESS_SEARCH_SPACE);
        else {
        }
      catch (InvalidStateException e) {
        Logger.getLogger(this.getClass()).warn(e);
      catch (InvalidPartyException e) {
        Logger.getLogger(this.getClass()).warn(e);
      catch (MethodNotSupportedException e) {
        Logger.getLogger(this.getClass()).warn(e);
      catch (PrivilegeViolationException e) {
        Logger.getLogger(this.getClass()).warn(e);
      catch (ResourceUnavailableException e) {
        Logger.getLogger(this.getClass()).warn(e);
      }
    }
  }

Leave a Reply

Your email address will not be published. Required fields are marked *