From b80bd744ad873f6fc43018bc4bfb90677de167bd Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Mon, 17 Dec 2012 12:01:45 +0100 Subject: Start of GS5. --- lib/uacsta.rb | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 lib/uacsta.rb (limited to 'lib/uacsta.rb') diff --git a/lib/uacsta.rb b/lib/uacsta.rb new file mode 100644 index 0000000..9303092 --- /dev/null +++ b/lib/uacsta.rb @@ -0,0 +1,83 @@ +class Uacsta + + def send(sip_account, domain, body) + require 'freeswitch_event' + + event = FreeswitchEvent.new("NOTIFY") + event.add_header("profile", "gemeinschaft") + event.add_header("event-string", "uaCSTA") + event.add_header("user", sip_account) + event.add_header("host", domain) + event.add_header("content-type", "application/csta+xml") + event.add_body(body); + + return event.fire(); + end + + def make_call(sip_account, domain, number) + body = ' + + ' + sip_account.to_s + ' + ' + number.to_s + ' + doNotPrompt + ' + + self.send(sip_account, domain, body); + end + + def answer_call(sip_account, domain) + body = ' + + + ' + sip_account + ' + + ' + + self.send(sip_account, domain, body) + end + + def set_microphone_mute(sip_account, domain, value) + body = ' + + ' + sip_account + ' + 1 + ' + value.to_s + ' + ' + + self.send(sip_account, domain, body) + end + + def set_speaker_volume(sip_account, domain, value) + body = ' + + ' + sip_account + ' + 1 + ' + value.to_s + ' + ' + + self.send(sip_account, domain, body) + end + + def set_do_not_disturb(sip_account, domain, value) + body = ' + + ' + sip_account + ' + ' + value.to_s + ' + ' + + self.send(sip_account, domain, body) + end + + def set_forwarding(sip_account, domain, forwarding_type, number, activate) + forwarding_types = [ "forwardImmediate", "forwardBusy", "forwardNoAns" ] + body = ' + + ' + sip_account + ' + ' + forwarding_types[forwarding_type.to_i] + ' + ' + number.to_s + ' + ' + activate.to_s + ' + ' + + self.send(sip_account, domain, body) + end +end -- cgit v1.2.3