cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
946
Views
3
Helpful
4
Replies

Script action on SX-20

Has anyone ever been able to write a Python script that will connect and sumit an command over SSH?

4 Replies 4

Wayne DeNardi
VIP Alumni
VIP Alumni

I haven't done if via a Python script, but I have done some scripts over ssh before from a DOS command line using the PuTTY PLINK.EXE.  You can also use telnet, a serial connection or HTTP/HTTPS to pass the commands to the codec.

The commands (and connection methods) are all documented in the API Reference Guide.

Wayne
--
Please remember to rate responses and to mark your question as answered if appropriate.

Wayne

Please remember to mark helpful responses and to set your question as answered if appropriate.

Thank you for your response, but I the limitations that I am under require me to use Python for this.

The funny thing is that I do this via Python for other equipment, but it just does not seem to work with the CISCO endpoints for whatever reason.  I figure that there must be something different about the process when CISCO is involved...but I don't know what it is.

There really isn't any difference on the Cisco SX20 endpoints than any other equipment (they're effectively just a Linux device).

Have you checked that ssh is enabled on the SX20?

Are you using the correct username and password?

Can you manually ssh to the codec from the box you are trying to connect to via Python (or are there network connectivity issues)?

Are you able to try telnet rather than ssh?  (as a test).

Wayne
--
Please remember to rate responses and to mark your question as answered if appropriate.

Wayne

Please remember to mark helpful responses and to set your question as answered if appropriate.

Gabe Flores
Level 1
Level 1

Maybe I am a little late to this party here but I have something that can help you out. I was searching myself to find a way to get this to be easier to manage and found this method.

 

#!/usr/bin/env python

import pxssh
import getpass
try:
    s = pxssh.pxssh(timeout=1, maxread=2000000)
    s.force_password = True
    hostname = raw_input('hostname: ')
    username = raw_input('username: ')
    password = getpass.getpass('password: ')
    s.PROMPT= 'SSH> '
    s.login (hostname, username, password, auto_prompt_reset=False)
    s.prompt()
    s.sendline('xConfiguration Conference 1 AutoAnswer Mode: On')
    s.prompt()
    s.sendline('xConfiguration Conference 1 DefaultCall Rate: 2000')
    s.prompt()
    data = s.before
    print data
    s.sendline('bye')
except pxssh.ExceptionPxssh, e:
    print "pxssh failed on login."
    print str(e)

 

You can modify the "xConfiguration" part to your liking. You can probably even make it a variable. I have before but figured you probably at least understand the basics of python and could figure it out.

 

Goodluck!

Gabe

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: