opensips-mi 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MjczNzYxY2E2ZWRkNjEwOWFiYThmNmQ2YTU1YTA2MzBlMjZlZDYzNg==
4
+ ZmZiZDk4M2Y0ZTUyZmE5ZTkxYjI4ZWJjMDM4ZGYzNDlmYjk1M2RmZg==
5
5
  data.tar.gz: !binary |-
6
- MjIwNDQwZTk0NTY4NDVmNmJjODM0ZjBiYTRiNDVmNzExODVhNGY1MQ==
6
+ NTFhNTVjYWYzZGUyMmEyMDM2ZTk3OGJiYzUwY2EwMDU4ZTYzZDE2MQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- YThmNzdmNzRkNmZiOTdlMWE2NDJkZWZhMTU4MTEzNGU1MDMzNjlmNGVkMmY3
10
- ZGEyZTJjYWQyOTg0OTA4YTIyYTg1OTczNTI4MzExNTNlYWM5NzRiMTkwOTQz
11
- Mzg1ZjM1ODYyZTdiZDcwMmM0NmUxMzgxNWI2OTAyNDMxOWY1Y2Y=
9
+ ZTQ0YWQwNWUyZjQ3MTJhNDUxNmE3NDBiOTg3M2IyZDc0NzZiYTQ3ZDU1OTQx
10
+ ODQ5OTJkNDQxZjE5OGFhZGJjYWI1MGFhYmFmYjU5NmVjYTIwZTg5ZGE5N2E0
11
+ OWE0NTVmYTQ1ZjNkOGE0ODQ1N2MwNGM1NWZlZTVmMTI5OWFlZDU=
12
12
  data.tar.gz: !binary |-
13
- YzMwZTc1OWNjM2FkYTZmY2ZhOTk0YmQzNDJlN2JjNzI0OGU0YTcyMjE5ZTBj
14
- ZmFiYmU1ZmRhMTRkODg5NjhmM2MzNTMyNmJiMDk1MTJhNjM5OWI5MjMwZDdh
15
- NmJhYWNiODBkZTZlYzdmNzYyYTBhNzI3ZWI0YTE5YmY4YTRmNjQ=
13
+ ZWM5YjZjYTkzZDRlZGFlOWYzOWI1ODFjYTk2ZDQyNzhjOThlYjUzNzVhM2Q3
14
+ YzRhNTUyZTQ2YzkzMTUzNjc1MjI0MDU3ZGJhMmI3NmM2NzUyMzEwYTYyOWMw
15
+ NDk4MDUyMjU1ZTZhZmViYWVlYTdkMzA2N2M0M2RjMzQxYzAyNDA=
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Opensips::Mi
2
2
 
3
- OpenSIPs management interface API.
4
- This library support following management interface OpenSIPs modules:
3
+ OpenSIPs management interface library.
4
+ This library supports following management interfaces OpenSIPs modules:
5
5
 
6
6
  * mi_fifo
7
7
  * mi_datagram
@@ -32,7 +32,7 @@ Opensips::MI.connect INTERFACE, PARAMS
32
32
  ```
33
33
  Parameters:
34
34
 
35
- *INTRFACE* - interface key. One of the following:
35
+ *INTRFACE* - interface name. One of the following:
36
36
 
37
37
  * :fifo
38
38
  * :datagram
@@ -40,7 +40,7 @@ Parameters:
40
40
 
41
41
  *PARAMS* - connection parameters. Depends on interface. See below.
42
42
 
43
- This function will raise exceptions if there are parameters or environment errors.
43
+ This function will raise exceptions if there are parameters' or environment errors.
44
44
  Function returns instance of one of the following classes:
45
45
 
46
46
  * Opensips::MI::Transport::Fifo
@@ -61,7 +61,7 @@ opensips = Opensips::MI.connect :fifo,
61
61
  **Parameters hash:**
62
62
 
63
63
  * fifo_name: OpenSIPs fifo file. See mi_fifo module parameter: `modparam("mi_fifo", "fifo_name", "/tmp/opensips_fifo")`.
64
- * reply_fifo: (OPTIONAL) Name of the reply fifo file. If not used will generate random file in *reply_dir* and delete after use.
64
+ * reply_fifo: (OPTIONAL) Name of the reply fifo file. If not used, will generate random file in *reply_dir* and delete after use.
65
65
  * reply_dir: (OPTIONAL) Path to directory of reply fifo file.
66
66
 
67
67
  ### Datagram
@@ -74,13 +74,13 @@ opensips = Opensips::MI.connect :datagram,
74
74
  **Parameters hash:**
75
75
 
76
76
  * host: Hostname or IP address of OpenSIPs server
77
- * port: Datagram port. See mi_datagram module configuration parameter: `modparam("mi_datagram", "socket_name", "udp:192.168.2.133:8809")`
77
+ * port: Datagram port. See mi_datagram module configuration parameter: `modparam("mi_datagram", "socket_name", "udp:192.168.2.133:8080")`
78
78
 
79
79
  ### XMLRPC
80
80
  ```ruby
81
81
  require 'opensips-mi'
82
82
  opensips = Opensips::MI.connect :xmlrpc,
83
- :host => "192.168.122.128",
83
+ :host => "192.168.2.133",
84
84
  :port => 8080
85
85
  ```
86
86
  **Parameters hash:**
@@ -90,8 +90,9 @@ opensips = Opensips::MI.connect :xmlrpc,
90
90
 
91
91
  ### Command function
92
92
 
93
- Function "*command*" expects fifo command as first argument following by command parameters.
94
- For example:
93
+ Function "*command*" expects fifo command as a first argument, followed by command parameters.
94
+ Command parameters' description can be found in module documentation. For example: http://www.opensips.org/html/docs/modules/1.8.x/dialog.html#id295450
95
+ Usage example:
95
96
 
96
97
  ```ruby
97
98
  require 'opensips-mi'
@@ -117,16 +118,16 @@ opensips.uptime
117
118
  opensips.ul_show_contact('location', 'alice')
118
119
  ```
119
120
 
120
- Such methods first check if fifo function exists against `which` fifo command.
121
+ Those methods first of all verify if mi function exists using `which` mi command.
121
122
 
122
123
  ### Response
123
124
 
124
125
  Command function returns `Opensips::MI::Response` class. This class containe following class members which can be used to process responses:
125
126
 
126
127
  * code: *Integer* Response code: 200, 404 etc
127
- * message: *String* Response messages: "OK", "Bad headers"
128
+ * message: *String* Response messages: "OK", "Bad headers" etc.
128
129
  * rawdata: *Array* Raw response data as array
129
- * result: *Mixed* Struct/Hash/Array/Nil. This is member used by helper response methods for pretty formated result. See below.
130
+ * result: *Mixed* Struct/Hash/Array/Nil. This member is used by helper response methods for pretty formatted result. See below.
130
131
 
131
132
  ### Response helpers methods
132
133
 
@@ -142,17 +143,17 @@ See example files for details.
142
143
  ## Dialog methods
143
144
 
144
145
  Dialog methods are interface to `t_uac_dlg` function of OpenSIPs' *tm* (transactions) module.
145
- Module generates and sends a local SIP request.
146
146
 
147
147
  ### Interface to t_uac_dlg function of transaction (tm) module
148
- Very cool method from OpenSIPs. Can generate and send SIP request method to destination.
148
+ Very cool method from OpenSIPs. Can generate and send SIP request method to a destination UAC.
149
149
  Example of usage:
150
- * Send NOTIFY with special Event header to force restart SIP phone (equivalent of ASterisk's "sip notify peer")
151
- * Send PUBLISH to trigger device state change notification
150
+ * Send NOTIFY with special Event header to force restart SIP phone (equivalent of Asterisk's "sip notify peer")
151
+ * Send PUBLISH to trigger notification which changes device state
152
152
  * Send REFER to transfer call
153
153
  * etc., etc., etc.
154
154
 
155
- **Headers***
155
+ **Headers**
156
+
156
157
  Headers parameter "hf" is a hash of headers of format:
157
158
  ```
158
159
  header-name => header-value
@@ -163,26 +164,27 @@ hf["From"] => "Alice Liddell <sip:alice@wanderland.com>;tag=843887163"
163
164
  ```
164
165
 
165
166
  Special "nl" header with any value is used to input additional "\r\n". This is
166
- useful, for example, for message-summary event to separate application body. This is
167
- because t_uac_dlg expect body parameter as xml only.
167
+ useful, for example, in message-summary event to separate application body. This is
168
+ because t_uac_dlg expects body parameter as an xml only.
168
169
 
169
- Thus, using multiple headers with same header-name is not possible with header hash.
170
+ Thus, using multiple headers with same header-name is not possible.
170
171
  However, it is possible to use multiple header-values comma separated (rfc3261, section 7.3.1):
171
172
  ```
172
173
  hf["Route"] => "<sip:alice@atlanta.com>, <sip:bob@biloxi.com>"
173
174
  ```
174
- Is equivalent to:
175
+ Which is equivalent to:
175
176
  ```
176
177
  Route: <sip:alice@atlanta.com>
177
178
  Route: <sip:bob@biloxi.com>
178
179
  ```
179
- If there is headers To and From not found, then exception ArgumentError is raised. Also if
180
- body part present, Content-Type and Content-length are also mandatory and exception is raised.
180
+ If there are no To and From headers found, then exception ArgumentError is raised. Also when
181
+ body part is present, Content-Type and Content-length fields are required.
181
182
 
182
183
  **Parameters**
184
+
183
185
  * method: SIP request method (NOTIFY, PUBLISH etc)
184
186
  * ruri: Request URI, ex.: sip:555@10.0.0.55:5060
185
- * hf: Headers array. Additional headers will be added to request. At least "From" and "To" headers must be specify.
187
+ * hf: Headers array. Additional headers will be added to request. At least "From" and "To" headers must be present. Headers' names are case-insensitive.
186
188
  * nhop: Next hop SIP URI (OBP); use "." if no value.
187
189
  * socket: Local socket to be used for sending the request; use "." if no value. Ex.: udp:10.130.8.21:5060
188
190
  * body: (optional, may not be present) request body (if present, requires the "Content-Type" and "Content-length" headers)
@@ -198,21 +200,23 @@ opensips.uac_dlg "NOTIFY", "sip:alice@127.0.0.1:5066",
198
200
  ```
199
201
 
200
202
  ### NOTIFY check-sync like event
201
- NOTIFY Events to restart phone, force configuration reload or
202
- report for some SIP IP phone models.
203
+ NOTIFY Events to restart phone, force configuration reload or report for some SIP IP phone models.
204
+ Wrapper to `uac_dlg` function.
203
205
  The events list was taken from Asterisk configuration file (sip_notify.conf)
204
206
  Note that SIP IP phones usually should be configured to accept special notify
205
- event to reboot. For example, Polycom configuration option to enable special
206
- event would be:
207
+ event. For example, Polycom configuration option to enable special event would be:
207
208
  ```
208
209
  voIpProt.SIP.specialEvent.checkSync.alwaysReboot="1"
209
210
  ```
210
- This function will generate To/From/Event headers. Will use random tag for
211
- From header.
211
+
212
+ This function will generate To/From/Event headers. Will use random tag for From header.
213
+
212
214
  *NOTE*: This function will not generate To header tag. This is not complying with
213
215
  SIP protocol specification (rfc3265). NOTIFY must be part of a subscription
214
216
  dialog. However, it works for the most of the SIP IP phone models.
217
+
215
218
  **Parameters**
219
+
216
220
  * uri: Valid client contact URI (sip:alice@10.0.0.100:5060). To get client URI use *ul_show_contact => contact* function
217
221
  * event: One of the events from EVENTNOTIFY constant hash
218
222
  * hf: Header fields. Add To/From header fields here if you do not want them to be auto-generated. Header field example: `hf['To'] => '<sip:alice@wanderland.com>'`
@@ -244,7 +248,7 @@ Send message-summary NOTIFY Event to update phone voicemail status.
244
248
 
245
249
  **Parameters**
246
250
 
247
- * uri: Request URI (sip:alice@wanderland.com:5060). To get client URI use *ul_show_contact => contact* function
251
+ * uri: Request URI (sip:alice@wanderland.com:5060). To get client URI use `ul_show_contact` function, *contact* value
248
252
  * vmaccount:Message Account value. Ex.: sip:*97@asterisk.com
249
253
  * new: Number of new messages. If more than 0 then Messages-Waiting header will be "yes". Set to 0 to clear phone MWI
250
254
  * old: (optional) Old messages
@@ -17,7 +17,7 @@ module Opensips
17
17
  def initialize(params)
18
18
  # set default values
19
19
  @reply_fifo = if params[:reply_fifo].nil?
20
- "opensips_reply_" << Digest::MD5.hexdigest(rand.to_s)[0,8]
20
+ "opensips_reply_" << SecureRandom.hex[0,8]
21
21
  else
22
22
  @reply_fifo = params[:reply_fifo]
23
23
  end
@@ -1,5 +1,5 @@
1
1
  module Opensips
2
2
  module MI
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opensips-mi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stas Kobzar
@@ -114,7 +114,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
114
114
  version: '0'
115
115
  requirements: []
116
116
  rubyforge_project:
117
- rubygems_version: 2.0.2
117
+ rubygems_version: 2.0.3
118
118
  signing_key:
119
119
  specification_version: 4
120
120
  summary: OpenSIPs management interface