public static void SendDTMF(string dtmf) { char[] chars = dtmf.ToCharArray(); foreach (char c in chars) { Utils.bgapi_exec("pa", "dtmf " + c); } }
public void SetOurAudioLevel(int level) { if (level > 4 || level < -4) { return; } our_audio_level = level; Utils.bgapi_exec("uuid_audio", leg_b_uuid + " start write level " + level); }
public void SetOtherPartyAudioLevel(int level) { if (level > 4 || level < -4) { return; } other_audio_level = level; Utils.bgapi_exec("uuid_audio", leg_b_uuid + " start read level " + level); }
public static void set_mute(bool muted) { if (muted) { Utils.bgapi_exec("pa", "flags off mouth"); } else { Utils.bgapi_exec("pa", "flags on mouth"); } }
public static void PlayDTMF(char dtmf, string uuid, bool no_close = false) { if (uuid == null) { Utils.bgapi_exec("pa", "play tone_stream://d=150;v=-5;" + dtmf + (no_close ? " -1 no_close" : "")); } else { PlayInUUID(uuid, "tone_stream://d=150;v=-5;" + dtmf); } }
public void Transfer(String number) { if (String.IsNullOrEmpty(number) || call_ended) { return; } if (is_conference_call) { MessageBox.Show("Cannot transfer the conference"); return; } if (String.IsNullOrEmpty(note)) { note = "Call transferred to: " + number; } Utils.bgapi_exec("uuid_deflect", leg_b_uuid + " " + number); }
private void RecordCall() { String full_path = broker.recordings_folder.Replace('/', '\\'); if (!full_path.Contains(":\\")) { full_path = Path.Combine(Directory.GetCurrentDirectory(), full_path); //freeswitch is not happy with relative paths when using quotes } full_path = Path.Combine(full_path, "rec_" + other_party_number + "_" + DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss")); int num = 1; String orig_full_path = full_path; while (File.Exists(full_path + ".wav")) { full_path = orig_full_path + "." + num++; } full_path = full_path.Replace('\\', '/'); //seems freeswitch will selectively escape what it cant otherwise am_recording_file = full_path + ".wav"; Utils.bgapi_exec("uuid_setvar", leg_b_uuid + " record_stereo true"); Utils.bgapi_exec("uuid_record", leg_b_uuid + " start '" + am_recording_file + "'"); }
public static void Call(string dest) { Utils.bgapi_exec("pa", "call " + dest); }
private void ConferenceAdd() { Conference.instance.join_conference(); Utils.bgapi_exec("uuid_transfer", leg_b_uuid + " fsc_conference xml default"); }
private void StopRecordCall() { Utils.bgapi_exec("uuid_record", leg_b_uuid + " stop '" + am_recording_file + "'"); am_recording_file = null; }
private static void SetRingDev(int guid) { Utils.bgapi_exec("pa", "ringdev #" + guid_to_id(guid)); }
private static void SetInAndOutDev(int indev_guid, int outdev_guid) { Utils.bgapi_exec("pa", "switchstream #" + guid_to_id(indev_guid) + " #" + guid_to_id(outdev_guid)); }
private static void SetOutDev(int guid) { Utils.bgapi_exec("pa", "outdev #" + guid_to_id(guid)); }
public static void ClearRingDev() { Utils.bgapi_exec("pa", "ringdev #" + -1); }
public void reload_config() { Utils.bgapi_exec("reload", "mod_conference"); }
public static void PrepareStream(AudioDevice indev, AudioDevice outdev) { Utils.bgapi_exec("pa", "preparestream #" + guid_to_id(indev.guid) + " #" + guid_to_id(outdev.guid)); }
public void Drop() { Utils.bgapi_exec("uuid_kill", uuid + " NORMAL_CLEARING"); }
public static void CloseStreams() { Utils.bgapi_exec("pa", "closestreams"); }
public static void Hangup(int call_id) { Utils.bgapi_exec("pa", "hangup " + call_id); }
internal static void Answer(int call_id) { Utils.bgapi_exec("pa", "answer " + call_id); }
public static void PlayInUUID(string uuid, string to_play) { Utils.bgapi_exec("uuid_displace", uuid + " start " + to_play + " 0 mux"); }
public static void HoldAll() { Utils.bgapi_exec("pa", "switch none"); }
public static void SwitchTo(int call_id) { Utils.bgapi_exec("pa", "switch " + call_id); }
public void Split() { Utils.bgapi_exec("uuid_transfer", uuid + " auto_answer xml public"); }
private static void SetInDev(int guid) { Utils.bgapi_exec("pa", "indev #" + guid_to_id(guid)); }
public static void ConferenceAction(String action) { Utils.bgapi_exec("conference", "fsc_conference " + action); }
public void reload_config() { Utils.bgapi_exec("reload", "mod_event_socket"); }