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 +4 -4
- data/CODE_OF_CONDUCT.md +128 -0
- data/CONTRIBUTING.md +7 -0
- data/Gemfile +9 -4
- data/README.md +134 -118
- data/Rakefile +8 -12
- data/lib/opensips/mi/command.rb +85 -92
- data/lib/opensips/mi/transport/abstract.rb +64 -0
- data/lib/opensips/mi/transport/datagram.rb +41 -28
- data/lib/opensips/mi/transport/http.rb +40 -0
- data/lib/opensips/mi/transport/xmlrpc.rb +36 -22
- data/lib/opensips/mi/transport.rb +4 -1
- data/lib/opensips/mi/version.rb +3 -1
- data/lib/opensips/mi.rb +17 -12
- data/lib/opensips.rb +4 -0
- data/sig/opensips/mi.rbs +6 -0
- metadata +20 -69
- data/.gitignore +0 -30
- data/.rspec +0 -1
- data/.travis.yml +0 -3
- data/lib/opensips/mi/response.rb +0 -176
- data/lib/opensips/mi/transport/fifo.rb +0 -90
- data/opensips-mi.gemspec +0 -25
- data/spec/command_spec.rb +0 -4
- data/spec/fixtures/dlg_list +0 -20
- data/spec/fixtures/ul_dump +0 -168
- data/spec/response_spec.rb +0 -117
- data/spec/spec_helper.rb +0 -112
- data/spec/transport_spec.rb +0 -119
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c1a5116b4c5981ca39236ffe7f8595e6d2b7c493c648fcaae5c05ba2f698e05
|
4
|
+
data.tar.gz: d2f9b66b04887bc02412e225b0119f7d437ffd875207eaefbad9b2446e304536
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 037cdb3d26bfb7b85424f352330c8660723f09f4af1cb9f6a3e880a71ca6383c62643ce89eddbda15a598649432a73324f2ee9ab8ee7cd13b640f874956f385e
|
7
|
+
data.tar.gz: 673d02eb93d30b4b43eeaa9ce19b1204ec0dc09efd1362e2cc1d24cb6a76e438240a58ca0161f4542116b298a2d2a8ff92261ec11f9d7d3761ae3c6d3359e3fc
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -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
data/Gemfile
CHANGED
@@ -1,7 +1,12 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
|
1
|
+
# frozen_string_literal: true
|
4
2
|
|
5
|
-
|
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
|
-
|
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
|
-
|
11
|
-
|
12
|
-
|
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
|
-
|
46
|
+
_INTRFACE_ - interface name. One of the following:
|
40
47
|
|
41
|
-
|
42
|
-
|
43
|
-
|
48
|
+
- :datagram
|
49
|
+
- :http
|
50
|
+
- :xmlrpc
|
44
51
|
|
45
|
-
|
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
|
-
|
51
|
-
|
52
|
-
|
57
|
+
- Opensips::MI::Transport::Datagram
|
58
|
+
- Opensips::MI::Transport::HTTP
|
59
|
+
- Opensips::MI::Transport::Xmlrpc
|
53
60
|
|
54
|
-
###
|
61
|
+
### Datagram
|
55
62
|
|
56
63
|
```ruby
|
57
64
|
require 'opensips/mi'
|
58
|
-
opensips = Opensips::MI.connect :
|
59
|
-
:
|
60
|
-
:
|
61
|
-
:
|
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
|
-
|
68
|
-
|
69
|
-
|
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 :
|
75
|
-
:
|
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
|
-
|
82
|
-
|
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
|
-
:
|
90
|
-
:
|
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
|
-
|
95
|
-
|
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 "
|
100
|
-
Command parameters' description can be found in module documentation. For example:
|
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 :
|
106
|
-
:
|
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
|
-
|
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
|
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
|
-
|
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
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
159
|
+
```ruby
|
160
|
+
{:error=>{
|
161
|
+
"code"=>-32602,
|
162
|
+
"message"=>"Invalid params",
|
163
|
+
"data"=>"Bad PID"
|
164
|
+
}
|
165
|
+
}
|
166
|
+
```
|
147
167
|
|
148
|
-
|
168
|
+
### Helper methods
|
149
169
|
|
150
170
|
## Dialog methods
|
151
171
|
|
152
|
-
Dialog methods are interface to `t_uac_dlg` function of OpenSIPs'
|
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
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
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
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
228
|
-
|
229
|
-
|
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
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
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
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
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
|
-
|
2
|
-
require "rake/clean"
|
3
|
-
require 'opensips/mi/version'
|
4
|
-
require 'rspec/core/rake_task'
|
1
|
+
# frozen_string_literal: true
|
5
2
|
|
6
|
-
require "
|
7
|
-
|
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
|
-
|
8
|
+
require "rubocop/rake_task"
|
9
|
+
|
10
|
+
RuboCop::RakeTask.new
|
11
|
+
|
12
|
+
task default: %i[spec rubocop]
|