Module: Opensips::Pi
- Defined in:
- lib/opensips-pi.rb,
lib/opensips-pi/version.rb
Constant Summary collapse
- VERSION =
"0.0.5"
- @@logger =
nil
- @@bin =
nil
Class Method Summary collapse
-
.add(user, pass, domain = nil) ⇒ Object
Add a new OpenSIPS user.
-
.bin ⇒ String
Returns the OpenSIPS control tool, that is “opensipsctl” by default.
-
.bin=(cmd) ⇒ Object
Customize the OpenSIPS control tool.
-
.logger ⇒ Logger
Returns an instance of Ruby’s Logger (by default) or a logger set with Pi.logger=.
-
.logger=(klass) ⇒ Object
Customize the logger.
-
.password(user, pass, domain = nil) ⇒ Object
Change user’s password.
-
.remove(user, domain = nil) ⇒ Object
Remove an user from OpenSIPS.
Class Method Details
.add(user, pass, domain = nil) ⇒ Object
Add a new OpenSIPS user.
51 52 53 |
# File 'lib/opensips-pi.rb', line 51 def self.add(user, pass, domain=nil) call("#{bin} add #{identifier(user,domain).shellescape} #{pass.shellescape}") end |
.bin ⇒ String
Returns the OpenSIPS control tool, that is “opensipsctl” by default. You can customize this with bin=.
15 16 17 |
# File 'lib/opensips-pi.rb', line 15 def self.bin @@bin || "opensipsctl" end |
.bin=(cmd) ⇒ Object
Customize the OpenSIPS control tool. See bin for more information.
25 26 27 |
# File 'lib/opensips-pi.rb', line 25 def self.bin=(cmd) @@bin = cmd end |
.logger ⇒ Logger
33 34 35 |
# File 'lib/opensips-pi.rb', line 33 def self.logger @@logger ||= Logger.new(STDOUT) end |
.logger=(klass) ⇒ Object
Customize the logger. See logger for more information.
42 43 44 |
# File 'lib/opensips-pi.rb', line 42 def self.logger=(klass) @@logger = klass end |
.password(user, pass, domain = nil) ⇒ Object
Change user’s password.
68 69 70 |
# File 'lib/opensips-pi.rb', line 68 def self.password(user, pass, domain=nil) call("#{bin} passwd #{identifier(user,domain).shellescape} #{pass.shellescape}") end |
.remove(user, domain = nil) ⇒ Object
Remove an user from OpenSIPS.
59 60 61 |
# File 'lib/opensips-pi.rb', line 59 def self.remove(user, domain=nil) call("#{bin} rm #{identifier(user,domain).shellescape}") end |