string eventCallback(Native.switch_event swevt) { using (var evt = new FreeSWITCH.Native.Event(swevt, 0)) { var f = EventReceivedFunction; return(f == null ? "" : f(evt)); } }
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); } }
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; } }