예제 #1
0
 string eventCallback(Native.switch_event swevt)
 {
     using (var evt = new FreeSWITCH.Native.Event(swevt, 0)) {
         var f = EventReceivedFunction;
         return(f == null ? ""
             : f(evt));
     }
 }
예제 #2
0
        string inputCallback(IntPtr input, Native.switch_input_type_t inputType)
        {
            try {
                switch (inputType)
                {
                case FreeSWITCH.Native.switch_input_type_t.SWITCH_INPUT_TYPE_DTMF:
                    using (var dtmf = new Native.switch_dtmf_t(input, false)) {
                        return(dtmfCallback(dtmf));
                    }

                case FreeSWITCH.Native.switch_input_type_t.SWITCH_INPUT_TYPE_EVENT:
                    using (var swevt = new Native.switch_event(input, false)) {
                        return(eventCallback(swevt));
                    }

                default:
                    return("");
                }
            } catch (Exception ex) {
                Log.WriteLine(LogLevel.Error, "InputCallback threw exception: " + ex.ToString());
                return("-ERR InputCallback Exception: " + ex.Message);
            }
        }
예제 #3
0
 string inputCallback(IntPtr input, Native.switch_input_type_t inputType)
 {
     try {
         switch (inputType) {
             case FreeSWITCH.Native.switch_input_type_t.SWITCH_INPUT_TYPE_DTMF:
                 using (var dtmf = new Native.switch_dtmf_t(input, false)) {
                     return dtmfCallback(dtmf);
                 }
             case FreeSWITCH.Native.switch_input_type_t.SWITCH_INPUT_TYPE_EVENT:
                 using (var swevt = new Native.switch_event(input, false)) {
                     return eventCallback(swevt);
                 }
             default:
                 return "";
         }
     } catch (Exception ex) {
         Log.WriteLine(LogLevel.Error, "InputCallback threw exception: " + ex.ToString());
         return "-ERR InputCallback Exception: " + ex.Message;
     }
 }