opensips-mi 0.0.10 → 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: 135298241a7da04c8011bdc51fd903c62b04dbfb05de49cce7610544fee9f274
4
- data.tar.gz: 25a7bede110b7b35b121baddb04c2da6588d6fb8de3d9914cc84f6fd79041ef2
3
+ metadata.gz: 4c1a5116b4c5981ca39236ffe7f8595e6d2b7c493c648fcaae5c05ba2f698e05
4
+ data.tar.gz: d2f9b66b04887bc02412e225b0119f7d437ffd875207eaefbad9b2446e304536
5
5
  SHA512:
6
- metadata.gz: 273474a444d49d471180eb7051cd57dc34e1c8c21146429cb649fab1134c5b4c6f604c0762a3a97005c4f340c7c4d379e95a0e89935d7511a1f5c1654c7edbc6
7
- data.tar.gz: 7aca0cdf36610f3f4db77864d215ec9b214acaebfcac25345e2f8042997614f62e44f47e8914f06717f0d1cb9186e62df391524a2ae5bcef7246f7c3adb278c4
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,15 +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
14
+
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
13
18
 
14
19
  ## Installation
15
20
 
@@ -30,142 +35,162 @@ Or install it yourself as:
30
35
  ### Generic function to connect mi
31
36
 
32
37
  Using generic function to connect management interface:
38
+
33
39
  ```ruby
34
40
  require 'opensips/mi'
35
41
  Opensips::MI.connect INTERFACE, PARAMS
36
42
  ```
43
+
37
44
  Parameters:
38
45
 
39
- *INTRFACE* - interface name. One of the following:
46
+ _INTRFACE_ - interface name. One of the following:
40
47
 
41
- * :fifo
42
- * :datagram
43
- * :xmlrpc
48
+ - :datagram
49
+ - :http
50
+ - :xmlrpc
44
51
 
45
- *PARAMS* - connection parameters. Depends on interface. See below.
52
+ _PARAMS_ - connection parameters. Depends on interface. See below.
46
53
 
47
54
  This function will raise exceptions if there are parameters' or environment errors.
48
55
  Function returns instance of one of the following classes:
49
56
 
50
- * Opensips::MI::Transport::Fifo
51
- * Opensips::MI::Transport::Datagram
52
- * Opensips::MI::Transport::Xmlrpc
57
+ - Opensips::MI::Transport::Datagram
58
+ - Opensips::MI::Transport::HTTP
59
+ - Opensips::MI::Transport::Xmlrpc
53
60
 
54
- ### FIFO
61
+ ### Datagram
55
62
 
56
63
  ```ruby
57
64
  require 'opensips/mi'
58
- opensips = Opensips::MI.connect :fifo,
59
- :fifo_name => '/tmp/opensips_fifo',
60
- :reply_fifo => 'opensips_reply' . $$,
61
- :reply_dir => '/tmp'
62
-
65
+ opensips = Opensips::MI.connect :datagram,
66
+ :host => "199.188.10.100",
67
+ :port => 8809,
68
+ :timeout => 3
63
69
  ```
64
70
 
65
- **Parameters hash:**
71
+ **Parameters hash:**
66
72
 
67
- * fifo_name: OpenSIPs fifo file. See mi_fifo module parameter: `modparam("mi_fifo", "fifo_name", "/tmp/opensips_fifo")`.
68
- * reply_fifo: (OPTIONAL) Name of the reply fifo file. If not used, will generate random file in *reply_dir* and delete after use.
69
- * 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
70
78
 
71
- ### Datagram
72
79
  ```ruby
73
80
  require 'opensips/mi'
74
- opensips = Opensips::MI.connect :datagram,
75
- :host => "sipproxy.com",
76
- :port => 8809,
81
+ opensips = Opensips::MI.connect :http,
82
+ :url => "http://192.168.0.1:8000/mi",
77
83
  :timeout => 5
78
84
  ```
85
+
79
86
  **Parameters hash:**
80
87
 
81
- * host: Hostname or IP address of OpenSIPs server
82
- * port: Datagram port. See mi_datagram module configuration parameter: `modparam("mi_datagram", "socket_name", "udp:192.168.2.133:8080")`
83
- * 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.
84
90
 
85
91
  ### XMLRPC
92
+
86
93
  ```ruby
87
94
  require 'opensips/mi'
88
- opensips = Opensips::MI.connect :xmlrpc,
89
- :host => "192.168.2.133",
90
- :port => 8080
95
+ opensips = Opensips::MI.connect :xmlrpc,
96
+ :url => "http://192.168.0.1/rpc",
97
+ :timeout => 5
91
98
  ```
99
+
92
100
  **Parameters hash:**
93
101
 
94
- * host: Hostname or IP address of OpenSIPs server
95
- * 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.
96
104
 
97
105
  ### Command function
98
106
 
99
- Function "*command*" expects fifo command as a first argument, followed by command parameters.
100
- Command parameters' description can be found in module documentation. For example: http://www.opensips.org/html/docs/modules/1.8.x/dialog.html#id295450
101
- 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:
102
109
 
103
110
  ```ruby
104
111
  require 'opensips/mi'
105
- opensips = Opensips::MI.connect :fifo,
106
- :fifo_name => '/tmp/opensips_fifo'
107
-
112
+ opensips = Opensips::MI.connect :http,
113
+ :url => 'http://10.0.0.1/mi'
114
+
108
115
  opensips.command('which')
109
116
  opensips.command('get_statistics', 'dialog','tm')
110
117
  ```
111
118
 
112
119
  ### Command method interface
113
120
 
114
- 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
+
115
124
  ```ruby
116
125
  require 'opensips/mi'
117
- opensips = Opensips::MI.connect :datagram,
118
- :host => "192.168.122.128",
126
+ opensips = Opensips::MI.connect :datagram,
127
+ :host => "192.168.122.128",
119
128
  :port => 8809
120
-
129
+
121
130
  opensips.which
122
131
  opensips.get_statistics('dialog','tm')
123
132
  opensips.uptime
124
133
  opensips.ul_show_contact('location', 'alice')
125
- ```
134
+ opensips.lb_status([1, 0])
126
135
 
127
- 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
+ ```
128
140
 
129
141
  ### Response
130
142
 
131
- 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:
147
+
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
+ ```
132
156
 
133
- * code: *Integer* Response code: 200, 404 etc
134
- * message: *String* Response messages: "OK", "Bad headers" etc.
135
- * rawdata: *Array* Raw response data as array
136
- * result: *Mixed* Struct/Hash/Array/Nil. This member is used by helper response methods for pretty formatted result. See below.
137
-
138
- ### Response helpers methods
157
+ Error response example:
139
158
 
140
- There are several helper methods which return conveniently formatted data:
141
- * ul_dump
142
- * uptime
143
- * cache_fetch
144
- * ul_show_contact
145
- * dlg_list
146
- * ps
159
+ ```ruby
160
+ {:error=>{
161
+ "code"=>-32602,
162
+ "message"=>"Invalid params",
163
+ "data"=>"Bad PID"
164
+ }
165
+ }
166
+ ```
147
167
 
148
- See example files for details.
168
+ ### Helper methods
149
169
 
150
170
  ## Dialog methods
151
171
 
152
- 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.
153
173
 
154
174
  ### Interface to t_uac_dlg function of transaction (tm) module
175
+
155
176
  Very cool method from OpenSIPs. Can generate and send SIP request method to a destination UAC.
156
177
  Example of usage:
157
- * Send NOTIFY with special Event header to force restart SIP phone (equivalent of Asterisk's "sip notify peer")
158
- * Send PUBLISH to trigger notification which changes device state
159
- * Send REFER to transfer call
160
- * 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.
161
183
 
162
184
  **Headers**
163
185
 
164
186
  Headers parameter "hf" is a hash of headers of format:
187
+
165
188
  ```
166
189
  header-name => header-value
167
190
  ```
191
+
168
192
  Example:
193
+
169
194
  ```
170
195
  hf["From"] => "Alice Liddell <sip:alice@wanderland.com>;tag=843887163"
171
196
  ```
@@ -176,29 +201,34 @@ because t_uac_dlg expects body parameter as an xml only.
176
201
 
177
202
  Thus, using multiple headers with same header-name is not possible.
178
203
  However, it is possible to use multiple header-values comma separated (rfc3261, section 7.3.1):
204
+
179
205
  ```
180
206
  hf["Route"] => "<sip:alice@atlanta.com>, <sip:bob@biloxi.com>"
181
207
  ```
208
+
182
209
  Which is equivalent to:
210
+
183
211
  ```
184
212
  Route: <sip:alice@atlanta.com>
185
213
  Route: <sip:bob@biloxi.com>
186
214
  ```
215
+
187
216
  If there are no To and From headers found, then exception ArgumentError is raised. Also when
188
217
  body part is present, Content-Type and Content-length fields are required.
189
218
 
190
219
  **Parameters**
191
220
 
192
- * method: SIP request method (NOTIFY, PUBLISH etc)
193
- * ruri: Request URI, ex.: sip:555@10.0.0.55:5060
194
- * hf: Headers array. Additional headers will be added to request. At least "From" and "To" headers must be present. Headers' names are case-insensitive.
195
- * nhop: Next hop SIP URI (OBP); use "." if no value.
196
- * socket: Local socket to be used for sending the request; use "." if no value. Ex.: udp:10.130.8.21:5060
197
- * 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)
198
227
 
199
228
  **Example of usage**
229
+
200
230
  ```ruby
201
- opensips.uac_dlg "NOTIFY", "sip:alice@127.0.0.1:5066",
231
+ opensips.uac_dlg "NOTIFY", "sip:alice@127.0.0.1:5066",
202
232
  {
203
233
  "From" => "<sip:alice@wanderland.com>;tag=8755a8d01a12f7e903a6f4ccaf393f04",
204
234
  "To" => "<sip:alice@wanderland.com>",
@@ -207,47 +237,50 @@ opensips.uac_dlg "NOTIFY", "sip:alice@127.0.0.1:5066",
207
237
  ```
208
238
 
209
239
  ### NOTIFY check-sync like event
210
- 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.
211
242
  Wrapper to `uac_dlg` function.
212
243
  The events list was taken from Asterisk configuration file (sip_notify.conf)
213
244
  Note that SIP IP phones usually should be configured to accept special notify
214
245
  event. For example, Polycom configuration option to enable special event would be:
215
- ```
246
+
247
+ ```
216
248
  voIpProt.SIP.specialEvent.checkSync.alwaysReboot="1"
217
249
  ```
218
250
 
219
- 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.
220
252
 
221
- *NOTE*: This function will not generate To header tag. This is not complying with
222
- 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
223
255
  dialog. However, it works for the most of the SIP IP phone models.
224
256
 
225
257
  **Parameters**
226
258
 
227
- * uri: Valid client contact URI (sip:alice@10.0.0.100:5060). To get client URI use *ul_show_contact => contact* function
228
- * event: One of the events from EVENTNOTIFY constant hash
229
- * 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>'`
230
262
 
231
263
  **Example of usage**
232
264
  Will reboot Polycom phone:
265
+
233
266
  ```ruby
234
267
  opensips.event_notify 'sip:alice@127.0.0.1:5060', :polycom_check_cfg
235
268
  ```
236
269
 
237
270
  **List of available events' keys:**
238
271
 
239
- * :astra_check_cfg
240
- * :aastra_xml
241
- * :digium_check_cfg
242
- * :linksys_cold_restart
243
- * :linksys_warm_restart
244
- * :polycom_check_cfg
245
- * :sipura_check_cfg
246
- * :sipura_get_report
247
- * :snom_check_cfg
248
- * :snom_reboot
249
- * :cisco_check_cfg
250
- * :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
251
284
 
252
285
  ### Presence MWI
253
286
 
@@ -255,32 +288,15 @@ Send message-summary NOTIFY Event to update phone voicemail status.
255
288
 
256
289
  **Parameters**
257
290
 
258
- * uri: Request URI (sip:alice@wanderland.com:5060). To get client URI use `ul_show_contact` function, *contact* value
259
- * vmaccount:Message Account value. Ex.: sip:*97@asterisk.com
260
- * new: Number of new messages. If more than 0 then Messages-Waiting header will be "yes". Set to 0 to clear phone MWI
261
- * old: (optional) Old messages
262
- * urg_new: (optional) New urgent messages
263
- * 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
264
297
 
265
298
  **Example of usage**
299
+
266
300
  ```ruby
267
301
  opensips.mwi_update 'sip:alice@wanderland.com:5060', 'sip:*97@voicemail.pbx.com', 5
268
302
  ```
269
-
270
- ## Examples
271
-
272
- There are some sample files in *examples* directory.
273
-
274
- ## TODO:
275
-
276
- Support for mi_xmlrpc_ng
277
-
278
- ----
279
- ## Contributing
280
-
281
- 1. Fork it
282
- 2. Create your feature branch (`git checkout -b my-new-feature`)
283
- 3. Commit your changes (`git commit -am 'Add some feature'`)
284
- 4. Push to the branch (`git push origin my-new-feature`)
285
- 5. Create new Pull Request
286
-
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]