Code Monkey home page Code Monkey logo

polycom's Introduction

Polycom

This gem is used for communicating with IP Polycom phones using their XML application interface. It was tested with the following phones:

  • Polycom VVX 410

However, this gem should work with other phones as well.

Installation

Add this line to your application's Gemfile:

gem 'polycom'

And then execute:

$ bundle

Or install it yourself as:

$ gem install polycom

Using in ruby code

There are two classes available for you to query information and push data to your phone:

Poller

This class implements three methods for fetching various pieces of information:

  poller = Polycom::Poller.new (
			:username => 'admin',
			:password => '456',
			:ip_address => '10.0.5.7' )

  puts poller.device_information
  puts poller.network_information
  puts poller.call_line_info

Pusher

This class is used for pushing HTML data or URL to the phone.

  pusher = Polycom::Pusher.new (
			:username => 'admin', 
			:password => '456', 
			:ip_address => '10.0.5.7' )

  pusher.send(:priority => :important, :data => "Hello NSA!")
  pusher.send(:priority => :important, :url => "/index.html")

Command Line Usage

This gem is bundled with an executable called polycom. Simplest usage is the following:

% polycom admin:[email protected] -i

Device Information
--------------------
  mac_address         :	 0004fa839af9
  phone_dn            :	 Line1:3000
  app_load_id         :	 4.1.4.7430 20-Mar-13 14:12
  updater_id          :	 5.1.4.0844
  model_number        :	 VVX 410
  timestamp           :	 2013-10-21T14:24:38-05:00


Network Information
--------------------
  dhcp_server         :	 10.0.5.1
  mac_address         :	 0004fa839af9
  dns_suffix          :	 example.com
  ip_address          :	 10.0.5.7
  subnet_mask         :	 255.255.0.0
  provisioning_server :	 10.0.5.2037
  default_router      :	 10.0.5.7
  dns_server1         :	 8.8.4.4
  dns_server2         :	 0.0.0.0
  vlan_id             :	 
  dhcp_enabled        :	 Yes


Call Line Information
-----------------------
  -
  line_key_num        :	 1
  line_dir_num        :	 3000
  line_state          :	 Inactive
  -

Displaying a message on the phones browser

% polycom admin:[email protected] -data critical "<h1>Hello World</h1>"

Pushing a URL to be displayed on the phone

You must set the apps.push.serverRootURL value in the phone's configuration. The URL you send will be appended to this value.

% polycom admin:[email protected] -url important "/index.html"

Receiving notifications from the phone

This requires you to configure apps.telNotification.URL in the phones configuration to send notification to your computer. The polycom utility comes with a built-in web server (sinatra) to receive and pretty-print notifications from your phone.

% polycom admin:[email protected] -n


IMPORTANT:
Set up your Polycom phone to send 'Telephony Event Notification' to http://1.2.3.4:4567.
Please CRTL-C to end this script.

[2013-10-23 13:48:19] INFO  WEBrick 1.3.1
[2013-10-23 13:48:19] INFO  ruby 2.0.0 (2013-05-14) [x86_64-linux]
== Sinatra/1.4.3 has taken the stage on 4567 for development with backup from WEBrick
[2013-10-23 13:48:19] INFO  WEBrick::HTTPServer#start: pid=32608 port=4567
---
PolycomIPPhone:
  CallStateChangeEvent:
    CallReference: 41aa9c00
    CallState: Dialtone
    PhoneIP: 10.0.5.7
    MACAddress: 0004f2839af9
    TimeStamp: '2013-10-23T13:50:56-05:00'
    CallLineInfo:
      LineKeyNum: '1'
      LineDirNum: '1006'
      LineState: Active
      CallInfo:
        CallReference: 41aa9c00
        CallState: Dialtone
        CallType: Outgoing
        UIAppearanceIndex: 1*
        CalledPartyName: 
        CalledPartyDirNum: 
        CallingPartyName: '1006'
        CallingPartyDirNum: sip:[email protected]
        CallDuration: '0'

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

polycom's People

Contributors

sumitbirla avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.