I had some problems using SOAP interface over HTTPs with Ruby client.
(see here: http://sipx-wiki.calivia.com/index.php/SipX_ConfigServer_SOAP_API)

If you change http to https and change the port name you SOAP client will 
complain with a cryptic 
message:

/usr/lib/ruby/site_ruby/1.8/http-access2.rb:1001:in `connect': certificate 
verify failed 
(OpenSSL::SSL::SSLError)

It just means that it cannot verify server certificate sent by sipXconfig. It 
will certainly happen 
if you use self signed certificate. You need to find Certificate authority cert 
(they are kept in 
/etc/sipxpbx/cert/authorities), copy this on client machine and show ruby path 
to it by setting 
'protocol.http.ssl_config.ca_file' option on the SOAP service.

See how it's done in the example below (it dumps the users in CSV format - you 
may actually find it 
useful)

Run it by typing:

   ruby -I /path/to/build/web/dist/ruby_bindings dump_users.rb


dump_users.rb:

require 'ConfigServiceDriver.rb'  # you can find it by

HOST='sipxpbx.example.com' # sipXconfig host name goes here
USER='superadmin'
PWD=''  # superadmin password goes here

SERVICE_ROOT = "https://#{HOST}:8443/sipxconfig/services/";

# path certificate authority cert - usually can be found in 
/etc/sipxpbx/ssl/authorities
CA_CERT = 'ca.crt'


service_url = SERVICE_ROOT + UserService.name
user_service = UserService.new(service_url)
$stderr.puts "connecting to #{service_url}..."
user_service.options['protocol.http.basic_auth'] << [service_url, USER, PWD]
user_service.options['protocol.http.ssl_config.ca_file'] = CA_CERT

users = user_service.findUser(FindUser.new(nil)).users
puts "Username,First Name,Last Name,Aliases"
for user in users do
   puts "#{user.userName},#{user.firstName},#{user.lastName},#{user.aliases}"
end

_______________________________________________
sipxtapi-dev mailing list
[email protected]
List Archive: http://list.sipfoundry.org/archive/sipxtapi-dev/

Reply via email to