opensips-mi 0.0.11 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0fc7093889a67efa9694b4fbd1617044d7fab88d876e7aba8ba20b5385ba67f5
4
- data.tar.gz: a03613f39146e109c1de1949b48802fdcf84b2a73ae41247858dcab5429b38b6
3
+ metadata.gz: 4c1a5116b4c5981ca39236ffe7f8595e6d2b7c493c648fcaae5c05ba2f698e05
4
+ data.tar.gz: d2f9b66b04887bc02412e225b0119f7d437ffd875207eaefbad9b2446e304536
5
5
  SHA512:
6
- metadata.gz: 955848e500a74ebe27065494ad83353ae04c8c0710f824242d02195b3dfdffefb0a2a8d984b73dd7b4bb578bcf26dcf7f799e79d31e54d10598657fb70ffdc3f
7
- data.tar.gz: b24b7f8e3f27c9b9bc4f544bd0f60c63da346cbd759a61e2be5628907d671782e564fa013ba930465f3ebb23b27313c8fb55588d4e10920c05f494c856a4aa28
6
+ metadata.gz: 037cdb3d26bfb7b85424f352330c8660723f09f4af1cb9f6a3e880a71ca6383c62643ce89eddbda15a598649432a73324f2ee9ab8ee7cd13b640f874956f385e
7
+ data.tar.gz: 673d02eb93d30b4b43eeaa9ce19b1204ec0dc09efd1362e2cc1d24cb6a76e438240a58ca0161f4542116b298a2d2a8ff92261ec11f9d7d3761ae3c6d3359e3fc
@@ -0,0 +1,128 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, religion, or sexual identity
10
+ and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ * Demonstrating empathy and kindness toward other people
21
+ * Being respectful of differing opinions, viewpoints, and experiences
22
+ * Giving and gracefully accepting constructive feedback
23
+ * Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ * Focusing on what is best not just for us as individuals, but for the
26
+ overall community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ * The use of sexualized language or imagery, and sexual attention or
31
+ advances of any kind
32
+ * Trolling, insulting or derogatory comments, and personal or political attacks
33
+ * Public or private harassment
34
+ * Publishing others' private information, such as a physical or email
35
+ address, without their explicit permission
36
+ * Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
45
+
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
50
+
51
+ ## Scope
52
+
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+ Examples of representing our community include using an official e-mail address,
56
+ posting via an official social media account, or acting as an appointed
57
+ representative at an online or offline event.
58
+
59
+ ## Enforcement
60
+
61
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
+ reported to the community leaders responsible for enforcement at
63
+ staskobzar@gmail.com.
64
+ All complaints will be reviewed and investigated promptly and fairly.
65
+
66
+ All community leaders are obligated to respect the privacy and security of the
67
+ reporter of any incident.
68
+
69
+ ## Enforcement Guidelines
70
+
71
+ Community leaders will follow these Community Impact Guidelines in determining
72
+ the consequences for any action they deem in violation of this Code of Conduct:
73
+
74
+ ### 1. Correction
75
+
76
+ **Community Impact**: Use of inappropriate language or other behavior deemed
77
+ unprofessional or unwelcome in the community.
78
+
79
+ **Consequence**: A private, written warning from community leaders, providing
80
+ clarity around the nature of the violation and an explanation of why the
81
+ behavior was inappropriate. A public apology may be requested.
82
+
83
+ ### 2. Warning
84
+
85
+ **Community Impact**: A violation through a single incident or series
86
+ of actions.
87
+
88
+ **Consequence**: A warning with consequences for continued behavior. No
89
+ interaction with the people involved, including unsolicited interaction with
90
+ those enforcing the Code of Conduct, for a specified period of time. This
91
+ includes avoiding interactions in community spaces as well as external channels
92
+ like social media. Violating these terms may lead to a temporary or
93
+ permanent ban.
94
+
95
+ ### 3. Temporary Ban
96
+
97
+ **Community Impact**: A serious violation of community standards, including
98
+ sustained inappropriate behavior.
99
+
100
+ **Consequence**: A temporary ban from any sort of interaction or public
101
+ communication with the community for a specified period of time. No public or
102
+ private interaction with the people involved, including unsolicited interaction
103
+ with those enforcing the Code of Conduct, is allowed during this period.
104
+ Violating these terms may lead to a permanent ban.
105
+
106
+ ### 4. Permanent Ban
107
+
108
+ **Community Impact**: Demonstrating a pattern of violation of community
109
+ standards, including sustained inappropriate behavior, harassment of an
110
+ individual, or aggression toward or disparagement of classes of individuals.
111
+
112
+ **Consequence**: A permanent ban from any sort of public interaction within
113
+ the community.
114
+
115
+ ## Attribution
116
+
117
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
+ version 2.0, available at
119
+ https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
120
+
121
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct
122
+ enforcement ladder](https://github.com/mozilla/diversity).
123
+
124
+ [homepage]: https://www.contributor-covenant.org
125
+
126
+ For answers to common questions about this code of conduct, see the FAQ at
127
+ https://www.contributor-covenant.org/faq. Translations are available at
128
+ https://www.contributor-covenant.org/translations.
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,7 @@
1
+ ## Contributing
2
+
3
+ 1. Fork it
4
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
5
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
6
+ 4. Push to the branch (`git push origin my-new-feature`)
7
+ 5. Create new Pull Request
data/Gemfile CHANGED
@@ -1,7 +1,12 @@
1
- source "https://rubygems.org"
2
-
3
- git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
1
+ # frozen_string_literal: true
4
2
 
5
- gem 'simplecov', require: false, group: :test
3
+ source "https://rubygems.org"
6
4
 
5
+ # Specify your gem's dependencies in opensips-mi.gemspec
7
6
  gemspec
7
+
8
+ gem "rake", "~> 13.0", group: :development
9
+ gem "rspec", "~> 3.0", group: :development
10
+ gem "rubocop", "~> 1.21", group: :development
11
+ gem "simplecov", require: false, group: :test
12
+ gem "webmock", group: :test
data/README.md CHANGED
@@ -1,18 +1,20 @@
1
1
  # Opensips::Mi
2
- [![Build Status](https://travis-ci.org/staskobzar/opensips-mi.png?branch=master)](https://travis-ci.org/staskobzar/opensips-mi)
2
+
3
+ [![Ruby Build](https://github.com/staskobzar/opensips-mi/actions/workflows/main.yml/badge.svg)](https://github.com/staskobzar/opensips-mi/actions/workflows/main.yml)
3
4
  [![Code Climate](https://codeclimate.com/github/staskobzar/opensips-mi.png)](https://codeclimate.com/github/staskobzar/opensips-mi)
4
5
  [![Gem Version](https://badge.fury.io/rb/opensips-mi.png)](http://badge.fury.io/rb/opensips-mi)
5
6
  [![Coverage Status](https://coveralls.io/repos/staskobzar/opensips-mi/badge.png?branch=master)](https://coveralls.io/r/staskobzar/opensips-mi)
6
7
 
7
- OpenSIPs management interface library.
8
+ OpenSIPs management interface library.
8
9
  This library supports following management interfaces OpenSIPs modules:
9
10
 
10
- * mi_fifo
11
- * mi_datagram
12
- * mi_xmlrpc
11
+ - mi_datagram
12
+ - mi_http
13
+ - mi_xmlrpc
13
14
 
14
- ## Disclamer
15
- This is old version and works only with olde openisips versions (older then v3)
15
+ > version 1+ supports only new MI jsonrpc used by opensips v3+.
16
+ > if you need older version with a plain text MI protocol install
17
+ > this library version 0.0.11
16
18
 
17
19
  ## Installation
18
20
 
@@ -33,142 +35,162 @@ Or install it yourself as:
33
35
  ### Generic function to connect mi
34
36
 
35
37
  Using generic function to connect management interface:
38
+
36
39
  ```ruby
37
40
  require 'opensips/mi'
38
41
  Opensips::MI.connect INTERFACE, PARAMS
39
42
  ```
43
+
40
44
  Parameters:
41
45
 
42
- *INTRFACE* - interface name. One of the following:
46
+ _INTRFACE_ - interface name. One of the following:
43
47
 
44
- * :fifo
45
- * :datagram
46
- * :xmlrpc
48
+ - :datagram
49
+ - :http
50
+ - :xmlrpc
47
51
 
48
- *PARAMS* - connection parameters. Depends on interface. See below.
52
+ _PARAMS_ - connection parameters. Depends on interface. See below.
49
53
 
50
54
  This function will raise exceptions if there are parameters' or environment errors.
51
55
  Function returns instance of one of the following classes:
52
56
 
53
- * Opensips::MI::Transport::Fifo
54
- * Opensips::MI::Transport::Datagram
55
- * Opensips::MI::Transport::Xmlrpc
57
+ - Opensips::MI::Transport::Datagram
58
+ - Opensips::MI::Transport::HTTP
59
+ - Opensips::MI::Transport::Xmlrpc
56
60
 
57
- ### FIFO
61
+ ### Datagram
58
62
 
59
63
  ```ruby
60
64
  require 'opensips/mi'
61
- opensips = Opensips::MI.connect :fifo,
62
- :fifo_name => '/tmp/opensips_fifo',
63
- :reply_fifo => 'opensips_reply' . $$,
64
- :reply_dir => '/tmp'
65
-
65
+ opensips = Opensips::MI.connect :datagram,
66
+ :host => "199.188.10.100",
67
+ :port => 8809,
68
+ :timeout => 3
66
69
  ```
67
70
 
68
- **Parameters hash:**
71
+ **Parameters hash:**
69
72
 
70
- * fifo_name: OpenSIPs fifo file. See mi_fifo module parameter: `modparam("mi_fifo", "fifo_name", "/tmp/opensips_fifo")`.
71
- * reply_fifo: (OPTIONAL) Name of the reply fifo file. If not used, will generate random file in *reply_dir* and delete after use.
72
- * reply_dir: (OPTIONAL) Path to directory of reply fifo file.
73
+ - host: Hostname or IP address of OpenSIPs server
74
+ - port: Datagram port. See mi_datagram module configuration parameter: `modparam("mi_datagram", "socket_name", "udp:192.168.2.133:8080")`
75
+ - timeout: Timeout in seconds to wait send/recv commands. Optional. Default 5 seconds.
76
+
77
+ ### HTTP
73
78
 
74
- ### Datagram
75
79
  ```ruby
76
80
  require 'opensips/mi'
77
- opensips = Opensips::MI.connect :datagram,
78
- :host => "sipproxy.com",
79
- :port => 8809,
81
+ opensips = Opensips::MI.connect :http,
82
+ :url => "http://192.168.0.1:8000/mi",
80
83
  :timeout => 5
81
84
  ```
85
+
82
86
  **Parameters hash:**
83
87
 
84
- * host: Hostname or IP address of OpenSIPs server
85
- * port: Datagram port. See mi_datagram module configuration parameter: `modparam("mi_datagram", "socket_name", "udp:192.168.2.133:8080")`
86
- * timeout: Timeout in seconds to wait send/recv commands. Optional. Default 3 seconds.
88
+ - url: HTTP MI url. Check OpenSIPS module mi_http for setting of IP, port and root path.
89
+ - timeout: Timeout in seconds to wait send/recv commands. Optional. Default 5 seconds.
87
90
 
88
91
  ### XMLRPC
92
+
89
93
  ```ruby
90
94
  require 'opensips/mi'
91
- opensips = Opensips::MI.connect :xmlrpc,
92
- :host => "192.168.2.133",
93
- :port => 8080
95
+ opensips = Opensips::MI.connect :xmlrpc,
96
+ :url => "http://192.168.0.1/rpc",
97
+ :timeout => 5
94
98
  ```
99
+
95
100
  **Parameters hash:**
96
101
 
97
- * host: Hostname or IP address of OpenSIPs server
98
- * port: Datagram port. See mi_xmlrpc module configuration parameter: `modparam("mi_xmlrpc", "port", 8080)`
102
+ - url: HTTP MI url. Check OpenSIPS module mi_http for setting of IP, port and root path.
103
+ - timeout: Timeout in seconds to wait send/recv commands. Optional. Default 5 seconds.
99
104
 
100
105
  ### Command function
101
106
 
102
- Function "*command*" expects fifo command as a first argument, followed by command parameters.
103
- Command parameters' description can be found in module documentation. For example: http://www.opensips.org/html/docs/modules/1.8.x/dialog.html#id295450
104
- Usage example:
107
+ Function "_command_" expects fifo command as a first argument, followed by command parameters.
108
+ Command parameters' description can be found in module documentation. For example:
105
109
 
106
110
  ```ruby
107
111
  require 'opensips/mi'
108
- opensips = Opensips::MI.connect :fifo,
109
- :fifo_name => '/tmp/opensips_fifo'
110
-
112
+ opensips = Opensips::MI.connect :http,
113
+ :url => 'http://10.0.0.1/mi'
114
+
111
115
  opensips.command('which')
112
116
  opensips.command('get_statistics', 'dialog','tm')
113
117
  ```
114
118
 
115
119
  ### Command method interface
116
120
 
117
- It is also possible to use command names as a method interface:
121
+ It is also possible to use command names as a method interface. Parameters can be passed as array or hash too.
122
+ Library will automatically fit it to defined protocol.
123
+
118
124
  ```ruby
119
125
  require 'opensips/mi'
120
- opensips = Opensips::MI.connect :datagram,
121
- :host => "192.168.122.128",
126
+ opensips = Opensips::MI.connect :datagram,
127
+ :host => "192.168.122.128",
122
128
  :port => 8809
123
-
129
+
124
130
  opensips.which
125
131
  opensips.get_statistics('dialog','tm')
126
132
  opensips.uptime
127
133
  opensips.ul_show_contact('location', 'alice')
128
- ```
134
+ opensips.lb_status([1, 0])
129
135
 
130
- Those methods first of all verify if mi function exists using `which` mi command.
136
+ # NOTE: named parametters can be used in hash.
137
+ # Make sure you are using correct names
138
+ opensips.log_level({level: 3, pid: 1})
139
+ ```
131
140
 
132
141
  ### Response
133
142
 
134
- Command function returns `Opensips::MI::Response` class. This class containe following class members which can be used to process responses:
143
+ Command function returns hash with root key `:result` and hash/array of respons data
144
+ or root key `:error` with message or more data.
145
+
146
+ Example of response of "uptime" command:
135
147
 
136
- * code: *Integer* Response code: 200, 404 etc
137
- * message: *String* Response messages: "OK", "Bad headers" etc.
138
- * rawdata: *Array* Raw response data as array
139
- * result: *Mixed* Struct/Hash/Array/Nil. This member is used by helper response methods for pretty formatted result. See below.
140
-
141
- ### Response helpers methods
148
+ ```ruby
149
+ {:result=>{
150
+ "Now"=>"Wed Aug 9 19:41:28 2023",
151
+ "Up since"=>"Wed Aug 9 18:44:18 2023",
152
+ "Up time"=>"3430 [sec]"
153
+ }
154
+ }
155
+ ```
142
156
 
143
- There are several helper methods which return conveniently formatted data:
144
- * ul_dump
145
- * uptime
146
- * cache_fetch
147
- * ul_show_contact
148
- * dlg_list
149
- * ps
157
+ Error response example:
150
158
 
151
- See example files for details.
159
+ ```ruby
160
+ {:error=>{
161
+ "code"=>-32602,
162
+ "message"=>"Invalid params",
163
+ "data"=>"Bad PID"
164
+ }
165
+ }
166
+ ```
167
+
168
+ ### Helper methods
152
169
 
153
170
  ## Dialog methods
154
171
 
155
- Dialog methods are interface to `t_uac_dlg` function of OpenSIPs' *tm* (transactions) module.
172
+ Dialog methods are interface to `t_uac_dlg` function of OpenSIPs' _tm_ (transactions) module.
156
173
 
157
174
  ### Interface to t_uac_dlg function of transaction (tm) module
175
+
158
176
  Very cool method from OpenSIPs. Can generate and send SIP request method to a destination UAC.
159
177
  Example of usage:
160
- * Send NOTIFY with special Event header to force restart SIP phone (equivalent of Asterisk's "sip notify peer")
161
- * Send PUBLISH to trigger notification which changes device state
162
- * Send REFER to transfer call
163
- * etc., etc., etc.
178
+
179
+ - Send NOTIFY with special Event header to force restart SIP phone (equivalent of Asterisk's "sip notify peer")
180
+ - Send PUBLISH to trigger notification which changes device state
181
+ - Send REFER to transfer call
182
+ - etc., etc., etc.
164
183
 
165
184
  **Headers**
166
185
 
167
186
  Headers parameter "hf" is a hash of headers of format:
187
+
168
188
  ```
169
189
  header-name => header-value
170
190
  ```
191
+
171
192
  Example:
193
+
172
194
  ```
173
195
  hf["From"] => "Alice Liddell <sip:alice@wanderland.com>;tag=843887163"
174
196
  ```
@@ -179,29 +201,34 @@ because t_uac_dlg expects body parameter as an xml only.
179
201
 
180
202
  Thus, using multiple headers with same header-name is not possible.
181
203
  However, it is possible to use multiple header-values comma separated (rfc3261, section 7.3.1):
204
+
182
205
  ```
183
206
  hf["Route"] => "<sip:alice@atlanta.com>, <sip:bob@biloxi.com>"
184
207
  ```
208
+
185
209
  Which is equivalent to:
210
+
186
211
  ```
187
212
  Route: <sip:alice@atlanta.com>
188
213
  Route: <sip:bob@biloxi.com>
189
214
  ```
215
+
190
216
  If there are no To and From headers found, then exception ArgumentError is raised. Also when
191
217
  body part is present, Content-Type and Content-length fields are required.
192
218
 
193
219
  **Parameters**
194
220
 
195
- * method: SIP request method (NOTIFY, PUBLISH etc)
196
- * ruri: Request URI, ex.: sip:555@10.0.0.55:5060
197
- * hf: Headers array. Additional headers will be added to request. At least "From" and "To" headers must be present. Headers' names are case-insensitive.
198
- * nhop: Next hop SIP URI (OBP); use "." if no value.
199
- * socket: Local socket to be used for sending the request; use "." if no value. Ex.: udp:10.130.8.21:5060
200
- * body: (optional, may not be present) request body (if present, requires the "Content-Type" and "Content-length" headers)
221
+ - method: SIP request method (NOTIFY, PUBLISH etc)
222
+ - ruri: Request URI, ex.: sip:555@10.0.0.55:5060
223
+ - hf: Headers array. Additional headers will be added to request. At least "From" and "To" headers must be present. Headers' names are case-insensitive.
224
+ - nhop: Next hop SIP URI (OBP); use "." if no value.
225
+ - socket: Local socket to be used for sending the request; use "." if no value. Ex.: udp:10.130.8.21:5060
226
+ - body: (optional, may not be present) request body (if present, requires the "Content-Type" and "Content-length" headers)
201
227
 
202
228
  **Example of usage**
229
+
203
230
  ```ruby
204
- opensips.uac_dlg "NOTIFY", "sip:alice@127.0.0.1:5066",
231
+ opensips.uac_dlg "NOTIFY", "sip:alice@127.0.0.1:5066",
205
232
  {
206
233
  "From" => "<sip:alice@wanderland.com>;tag=8755a8d01a12f7e903a6f4ccaf393f04",
207
234
  "To" => "<sip:alice@wanderland.com>",
@@ -210,47 +237,50 @@ opensips.uac_dlg "NOTIFY", "sip:alice@127.0.0.1:5066",
210
237
  ```
211
238
 
212
239
  ### NOTIFY check-sync like event
213
- NOTIFY Events to restart phone, force configuration reload or report for some SIP IP phone models.
240
+
241
+ NOTIFY Events to restart phone, force configuration reload or report for some SIP IP phone models.
214
242
  Wrapper to `uac_dlg` function.
215
243
  The events list was taken from Asterisk configuration file (sip_notify.conf)
216
244
  Note that SIP IP phones usually should be configured to accept special notify
217
245
  event. For example, Polycom configuration option to enable special event would be:
218
- ```
246
+
247
+ ```
219
248
  voIpProt.SIP.specialEvent.checkSync.alwaysReboot="1"
220
249
  ```
221
250
 
222
- This function will generate To/From/Event headers. Will use random tag for From header.
251
+ This function will generate To/From/Event headers. Will use random tag for From header.
223
252
 
224
- *NOTE*: This function will not generate To header tag. This is not complying with
225
- SIP protocol specification (rfc3265). NOTIFY must be part of a subscription
253
+ _NOTE_: This function will not generate To header tag. This is not complying with
254
+ SIP protocol specification (rfc3265). NOTIFY must be part of a subscription
226
255
  dialog. However, it works for the most of the SIP IP phone models.
227
256
 
228
257
  **Parameters**
229
258
 
230
- * uri: Valid client contact URI (sip:alice@10.0.0.100:5060). To get client URI use *ul_show_contact => contact* function
231
- * event: One of the events from EVENTNOTIFY constant hash
232
- * 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>'`
259
+ - uri: Valid client contact URI (sip:alice@10.0.0.100:5060). To get client URI use _ul_show_contact => contact_ function
260
+ - event: One of the events from EVENTNOTIFY constant hash
261
+ - 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>'`
233
262
 
234
263
  **Example of usage**
235
264
  Will reboot Polycom phone:
265
+
236
266
  ```ruby
237
267
  opensips.event_notify 'sip:alice@127.0.0.1:5060', :polycom_check_cfg
238
268
  ```
239
269
 
240
270
  **List of available events' keys:**
241
271
 
242
- * :astra_check_cfg
243
- * :aastra_xml
244
- * :digium_check_cfg
245
- * :linksys_cold_restart
246
- * :linksys_warm_restart
247
- * :polycom_check_cfg
248
- * :sipura_check_cfg
249
- * :sipura_get_report
250
- * :snom_check_cfg
251
- * :snom_reboot
252
- * :cisco_check_cfg
253
- * :avaya_check_cfg
272
+ - :astra_check_cfg
273
+ - :aastra_xml
274
+ - :digium_check_cfg
275
+ - :linksys_cold_restart
276
+ - :linksys_warm_restart
277
+ - :polycom_check_cfg
278
+ - :sipura_check_cfg
279
+ - :sipura_get_report
280
+ - :snom_check_cfg
281
+ - :snom_reboot
282
+ - :cisco_check_cfg
283
+ - :avaya_check_cfg
254
284
 
255
285
  ### Presence MWI
256
286
 
@@ -258,32 +288,15 @@ Send message-summary NOTIFY Event to update phone voicemail status.
258
288
 
259
289
  **Parameters**
260
290
 
261
- * uri: Request URI (sip:alice@wanderland.com:5060). To get client URI use `ul_show_contact` function, *contact* value
262
- * vmaccount:Message Account value. Ex.: sip:*97@asterisk.com
263
- * new: Number of new messages. If more than 0 then Messages-Waiting header will be "yes". Set to 0 to clear phone MWI
264
- * old: (optional) Old messages
265
- * urg_new: (optional) New urgent messages
266
- * urg_old: (optional) Old urgent messages
291
+ - uri: Request URI (sip:alice@wanderland.com:5060). To get client URI use `ul_show_contact` function, _contact_ value
292
+ - vmaccount:Message Account value. Ex.: sip:\*97@asterisk.com
293
+ - new: Number of new messages. If more than 0 then Messages-Waiting header will be "yes". Set to 0 to clear phone MWI
294
+ - old: (optional) Old messages
295
+ - urg_new: (optional) New urgent messages
296
+ - urg_old: (optional) Old urgent messages
267
297
 
268
298
  **Example of usage**
299
+
269
300
  ```ruby
270
301
  opensips.mwi_update 'sip:alice@wanderland.com:5060', 'sip:*97@voicemail.pbx.com', 5
271
302
  ```
272
-
273
- ## Examples
274
-
275
- There are some sample files in *examples* directory.
276
-
277
- ## TODO:
278
-
279
- Support for mi_xmlrpc_ng
280
-
281
- ----
282
- ## Contributing
283
-
284
- 1. Fork it
285
- 2. Create your feature branch (`git checkout -b my-new-feature`)
286
- 3. Commit your changes (`git commit -am 'Add some feature'`)
287
- 4. Push to the branch (`git push origin my-new-feature`)
288
- 5. Create new Pull Request
289
-
data/Rakefile CHANGED
@@ -1,16 +1,12 @@
1
- require "bundler/gem_tasks"
2
- require "rake/clean"
3
- require 'opensips/mi/version'
4
- require 'rspec/core/rake_task'
1
+ # frozen_string_literal: true
5
2
 
6
- require "rdoc/task"
7
- Rake::RDocTask.new do |rd|
8
- rd.rdoc_dir = 'rdoc'
9
- rd.main = "README.md"
10
- rd.rdoc_files.include("README.md","lib/**/*.rb")
11
- rd.title = "OpenSIPs management interface " << Opensips::MI::VERSION
12
- end
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
13
5
 
14
6
  RSpec::Core::RakeTask.new(:spec)
15
7
 
16
- task :default => :spec
8
+ require "rubocop/rake_task"
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[spec rubocop]