sipfsm 0.1.2 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/sipfsm.rb +30 -0
  2. metadata +13 -7
  3. checksums.yaml +0 -15
data/lib/sipfsm.rb CHANGED
@@ -146,9 +146,15 @@ module SipFSM
146
146
  args[0].create_response($1.to_i).send
147
147
  elsif name.to_s =~ /is_(.*)_request?/
148
148
  args[0].get_method == $1
149
+ else
150
+ super
149
151
  end
150
152
  end
151
153
 
154
+ def sip_factory
155
+ $servlet_context.get_attribute('javax.servlet.sip.SipFactory')
156
+ end
157
+
152
158
  # proxy request to given URI
153
159
  def proxy_to_helper(request, touri, recroute=false)
154
160
  l_proxy = request.get_proxy
@@ -169,6 +175,16 @@ module SipFSM
169
175
  end
170
176
  end
171
177
 
178
+ def get_from_user_address_port(msg)
179
+ [ msg.from.uri.user,
180
+ msg.remote_addr,
181
+ msg.remote_port ]
182
+ end
183
+
184
+ def get_from_uri(msg)
185
+ u, a, p = get_from_user_address_port(msg)
186
+ "sip:#{u}@#{a}:#{p}"
187
+ end
172
188
 
173
189
  # copies content (SDP) from message m1 to message m2
174
190
  def copy_msg_content(m1, m2)
@@ -203,6 +219,20 @@ module SipFSM
203
219
  # meaning the first in the argument array is request and
204
220
  # the second is response.
205
221
 
222
+ def is_UNREGISTER?(args)
223
+ request = args[0]
224
+ return false unless is_REGISTER_request?(args)
225
+
226
+ exp = request.get_header('Expires')
227
+ if !exp
228
+ c = request.get_header('Contact')
229
+ c.grep(/expires=(\d+)/)
230
+ exp = $1
231
+ end
232
+
233
+ 0 == exp.to_i
234
+ end
235
+
206
236
  def invalidate_session msgs
207
237
  msg = msgs[0] || msgs[1]
208
238
  msg.get_session.invalidate
metadata CHANGED
@@ -1,7 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sipfsm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.4
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Edin Pjanic
@@ -9,7 +10,7 @@ authors:
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2013-02-15 00:00:00.000000000 Z
13
+ date: 2013-03-25 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: simplefsm
@@ -18,11 +19,13 @@ dependencies:
18
19
  - - "~>"
19
20
  - !ruby/object:Gem::Version
20
21
  version: '0.1'
22
+ none: false
21
23
  requirement: !ruby/object:Gem::Requirement
22
24
  requirements:
23
25
  - - "~>"
24
26
  - !ruby/object:Gem::Version
25
27
  version: '0.1'
28
+ none: false
26
29
  prerelease: false
27
30
  type: :runtime
28
31
  description: SIP application development in Ruby using SimpleFSM, a simple and lightweight domain specific language (DSL).
@@ -36,7 +39,6 @@ files:
36
39
  - lib/sipfsm.rb
37
40
  homepage: http://github.com/edictlab/SipFSM
38
41
  licenses: []
39
- metadata: {}
40
42
  post_install_message:
41
43
  rdoc_options: []
42
44
  require_paths:
@@ -45,16 +47,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
45
47
  requirements:
46
48
  - - ">="
47
49
  - !ruby/object:Gem::Version
48
- version: '0'
50
+ version: !binary |-
51
+ MA==
52
+ none: false
49
53
  required_rubygems_version: !ruby/object:Gem::Requirement
50
54
  requirements:
51
55
  - - ">="
52
56
  - !ruby/object:Gem::Version
53
- version: '0'
57
+ version: !binary |-
58
+ MA==
59
+ none: false
54
60
  requirements: []
55
61
  rubyforge_project:
56
- rubygems_version: 2.0.3
62
+ rubygems_version: 1.8.24
57
63
  signing_key:
58
- specification_version: 4
64
+ specification_version: 3
59
65
  summary: SipFSM - SIP application development in Ruby
60
66
  test_files: []
checksums.yaml DELETED
@@ -1,15 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: !binary |-
4
- ZmNhMzE5N2M0NTc1YWE1NzMwY2YzYTcwOGIyMTU4YjViOTg2ZWQ1ZA==
5
- data.tar.gz: !binary |-
6
- ZTkxYzE1NmJkN2JjNTJlZTNiMjRkZmMxZTk3NGQ2MWJiNDhjZmJiMQ==
7
- SHA512:
8
- metadata.gz: !binary |-
9
- MWZjNmQ3MzA3ZDVmNjE5MjM1ODU2MjU3OTM0M2UxMmM4NmMxYmNmMjJlNzZh
10
- NGExYjQ3YzlhNTg3MDFiNWQ4MmVkNzE5ZWY4MTZjMzcxYWM5ZGMzYTBhNjNh
11
- MzU5MDljYWQ2NGViMzg4ZGExYTBmNTBkYzliNmVjZTMxOTQ1NjU=
12
- data.tar.gz: !binary |-
13
- YjNiMDhkMTU0NTVhZTRjZjdiZDAxZjdmODgxOGM0ZTg0ZTcyMDI0Yjk2NDE3
14
- Y2YzMDgwNTliMzk1NmVhOWZlZDA1NDU4YmM3ZjI2ZDY5Y2IzZjRkOTgzOGM4
15
- ZGE2NTQzMGQyZTdiZGU3MWJhMGRhYTk3NTg5MDYzMTc1ZDUzZGI=