/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 3.0.10
 *
 * Do not make changes to this file unless you know what you are doing--modify
 * the SWIG interface file instead.
 * ----------------------------------------------------------------------------- */

package org.freeswitch.swig;

public class JavaSession extends CoreSession {
  private transient long swigCPtr;

  protected JavaSession(long cPtr, boolean cMemoryOwn) {
    super(freeswitchJNI.JavaSession_SWIGUpcast(cPtr), cMemoryOwn);
    swigCPtr = cPtr;
  }

  protected static long getCPtr(JavaSession obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        freeswitchJNI.delete_JavaSession(swigCPtr);
      }
      swigCPtr = 0;
    }
    super.delete();
  }

  public JavaSession() {
    this(freeswitchJNI.new_JavaSession__SWIG_0(), true);
  }

  public JavaSession(String uuid) {
    this(freeswitchJNI.new_JavaSession__SWIG_1(uuid), true);
  }

  public JavaSession(SWIGTYPE_p_switch_core_session_t session) {
    this(freeswitchJNI.new_JavaSession__SWIG_2(SWIGTYPE_p_switch_core_session_t.getCPtr(session)), true);
  }

  public boolean begin_allow_threads() {
    return freeswitchJNI.JavaSession_begin_allow_threads(swigCPtr, this);
  }

  public boolean end_allow_threads() {
    return freeswitchJNI.JavaSession_end_allow_threads(swigCPtr, this);
  }

  public void setDTMFCallback(org.freeswitch.DTMFCallback dtmfCallback, String funcargs) {
    freeswitchJNI.JavaSession_setDTMFCallback(swigCPtr, this, dtmfCallback, funcargs);
  }

  public void setHangupHook(org.freeswitch.HangupHook hangupHook) {
    freeswitchJNI.JavaSession_setHangupHook(swigCPtr, this, hangupHook);
  }

  public void check_hangup_hook() {
    freeswitchJNI.JavaSession_check_hangup_hook(swigCPtr, this);
  }

  public SWIGTYPE_p_switch_status_t run_dtmf_callback(SWIGTYPE_p_void input, SWIGTYPE_p_switch_input_type_t itype) {
    return new SWIGTYPE_p_switch_status_t(freeswitchJNI.JavaSession_run_dtmf_callback(swigCPtr, this, SWIGTYPE_p_void.getCPtr(input), SWIGTYPE_p_switch_input_type_t.getCPtr(itype)), true);
  }

  public int originate(JavaSession aleg, String destination, int timeout) {
    return freeswitchJNI.JavaSession_originate(swigCPtr, this, JavaSession.getCPtr(aleg), aleg, destination, timeout);
  }

}
