Наследование: IDisposable
Пример #1
0
 protected int originate(CoreSession a_leg_session, string dest, int timeout, switch_state_handler_table handlers)
 {
     int ret = freeswitchPINVOKE.CoreSession_originate(swigCPtr, CoreSession.getCPtr(a_leg_session), dest, timeout, switch_state_handler_table.getCPtr(handlers));
     return ret;
 }
Пример #2
0
 public void waitForAnswer(CoreSession calling_session)
 {
     freeswitchPINVOKE.CoreSession_waitForAnswer(swigCPtr, CoreSession.getCPtr(calling_session));
 }
Пример #3
0
 internal static HandleRef getCPtr(CoreSession obj)
 {
     return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
 }
Пример #4
0
 public void Execute(CoreSession session, string name)
 {
     freeswitchPINVOKE.IvrMenu_Execute(swigCPtr, CoreSession.getCPtr(session), name);
 }
Пример #5
0
 public static void bridge(CoreSession session_a, CoreSession session_b)
 {
     freeswitchPINVOKE.bridge(CoreSession.getCPtr(session_a), CoreSession.getCPtr(session_b));
     if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
 }
Пример #6
0
 public Api(CoreSession s) : this(freeswitchPINVOKE.new_Api(CoreSession.getCPtr(s)), true) {
 }
Пример #7
0
        /// <summary>
        /// Performs originate. Returns ManagedSession on success, null on failure.
        /// onHangup is called as a state handler, after the channel is truly hungup (CS_REPORTING).
        /// </summary>
        public static ManagedSession OriginateHandleHangup(CoreSession aLegSession, string destination, TimeSpan timeout, Action<ManagedSession> onHangup) {
            var bleg = new ManagedSession();

            bleg.originate_ondestroy_delegate = bleg.originate_ondestroy_method;
            bleg.originate_onhangup_delegate = CreateStateHandlerDelegate(sess_b => {
                if (onHangup != null) {
                    onHangup(sess_b);
                }
            });
            bleg.originate_table = new switch_state_handler_table();
            bleg.originate_table.on_reporting = WrapStateHandlerDelegate(bleg.originate_onhangup_delegate);
            bleg.originate_table.on_destroy = WrapStateHandlerDelegate(bleg.originate_ondestroy_delegate);
            bleg.originate_table.flags = (int)switch_state_handler_flag_t.SSH_FLAG_STICKY;
            var res = 0 == bleg.originate(aLegSession, destination, (int)timeout.TotalSeconds, bleg.originate_table);
            bleg.originate_keepalive_handle = GCHandle.Alloc(bleg, GCHandleType.Normal); // Prevent GC from eating the bleg
            if (res) {
                bleg.Initialize();
                return bleg;
            } else {
                // Dispose to free the lock
                // The bleg lives on with its unmanaged memory freed 
                // Until CS_DESTROY gets called
                bleg.Dispose(); 
                return null;
            }
        }
Пример #8
0
 public bool Originate(CoreSession aLegSession, string destination, TimeSpan timeout) {
     var res = 0 == this.originate(aLegSession, destination, (int)timeout.TotalMilliseconds, null);
     if (res) {
         this.Initialize();
     }
     return res;
 }