-
Notifications
You must be signed in to change notification settings - Fork 2
/
tropo.rb
45 lines (35 loc) · 1.18 KB
/
tropo.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
require 'rubygems'
require 'json'
require 'rest-client'
@username = $currentCall.getHeader("x-username")
@myusername = $currentCall.getHeader("x-myusername")
@myphoto = $currentCall.getHeader("x-myphoto")
@myjid = $currentCall.getHeader("x-myjid")
log "user=" + @username
log "myuser=" + @myusername
log "myphoto=" + @myphoto
log "myjid=" + @myjid
apiurl = "http://web1.tunnlr.com:11053"
# apiurl = "http://twelephone.com"
@getorg = RestClient.get apiurl + '/api/address/' + @username + '.json'
@getorgdata = JSON.parse(@getorg)
if @getorgdata["sip"]
log "jabber=" + @getorgdata["sip"]
end
message @myusername + '~' + @myphoto + '~' + @myjid + "~joined", {
:to => @getorgdata["sip"],
:network => "JABBER"}
if @username.nil?
@username = "anonymous_user"
end
@confid = "twele" + @username
say "connected to twelephone conference for " + @username
say "now tweet this link for others to join you. twelephone dot com slash " + @username
conference @confid , {
:playTones => true
}
if !$currentCall.isActive
message @myusername + '~' + @myphoto + '~' + @myjid + "~left", {
:to => @getorgdata["sip"],
:network => "JABBER"}
end