How to call a number from command-line with Skype?
I've seen several links suggesting it is possible to make a call from the command-line with skype. The instructions suggest something along the lines of:
skype --callto:+14445551234
However, this gets me an error message, "skype: unrecognized option '--callto:+14445551234".
Is this possible?
Use case scenario:
I want to call a particular number frequently.
- assuming skype client is already running and logged in.
- I create a shortcut on my desktop, which runs
skype --callto:+14445551234
or something similar. - Double-click the shortcut.
- skype window pops up, immediately calling this number
Can this be done?
I know there is a Skype API. Can this be done from a normal skype installation on Ubuntu, without installing any developer tools?
EDIT: I am considering this question to be still open, because I would like to know if this is possible from a default installation of skype without any additional functionality.
However, the answer below regarding "Skype4Py" does answer the desired outcome, albeit with an additional tool. I will mark this as the answer if another is not forthcoming in a few weeks.
Solution 1:
Very simple:
$> skype --help
Skype 4.3.0.37
Usage: skype [options]
Options:
--dbpath=<path> Specify an alternative path to store Skype data files.
Default: ~/.Skype
--resources=<path> Specify a path where Skype can find its resource files.
Default: /usr/share/skype
--secondary Start a secondary instance of Skype.
--disable-api Disable Skype Public API.
--callto <nick>
skype:<nick>?<action>
[...]
Tested. It works. Not just with nicknames. Also with direct phone numbers:
$> skype --callto +494030001234
( this means: OPs main mistake was a colon instead of a space... )
Solution 2:
Yes, if you use Skype4Py.
I've created a simple callto.py script based on examples/callfriend.py from Skype4Py. It takes a phone number or a friend name from the skype roster as an argument. It's only working if skype is already launched.
Skype will ask you if you want to give API permission to Skype4Py.
Code follows:
#!python
# ---------------------------------------------------------------------------------------------
# Python / Skype4Py example that takes a skypename or number from the commandline
# and calls it.
#
import sys
import Skype4Py
# This variable will get its actual value in OnCall handler
CallStatus = 0
# Here we define a set of call statuses that indicate a call has been either aborted or finished
CallIsFinished = set ([Skype4Py.clsFailed, Skype4Py.clsFinished, Skype4Py.clsMissed, Skype4Py.clsRefused, Skype4Py.clsBusy, Skype4Py.clsCancelled]);
def AttachmentStatusText(status):
return skype.Convert.AttachmentStatusToText(status)
def CallStatusText(status):
return skype.Convert.CallStatusToText(status)
# This handler is fired when status of Call object has changed
def OnCall(call, status):
global CallStatus
CallStatus = status
print 'Call status: ' + CallStatusText(status)
# This handler is fired when Skype attatchment status changes
def OnAttach(status):
print 'API attachment status: ' + AttachmentStatusText(status)
if status == Skype4Py.apiAttachAvailable:
skype.Attach()
# Let's see if we were started with a command line parameter..
try:
CmdLine = sys.argv[1]
except:
print 'Missing command line parameter'
sys.exit()
# Creating Skype object and assigning event handlers..
skype = Skype4Py.Skype()
skype.OnAttachmentStatus = OnAttach
skype.OnCallStatus = OnCall
# Starting Skype if it's not running already..
if not skype.Client.IsRunning:
print 'Starting Skype..'
skype.Client.Start()
# Attatching to Skype..
print 'Connecting to Skype..'
skype.Attach()
# Make the call
print 'Calling ' + CmdLine + '..'
skype.PlaceCall(CmdLine)
# Loop until CallStatus gets one of "call terminated" values in OnCall handler
while not CallStatus in CallIsFinished:
pass
Solution 3:
You can write a bash script without using any API. Your usage is wrong. The correct way is:
skype --callto +14445551234
You can view more options by typing the following command in the terminal
skype --help