如何使用 Skype 从命令行拨打号码?

emf*_*emf 6 python command-line voip skype phone

我已经看到几个链接表明可以使用 Skype 从命令行进行调用。说明建议如下:

skype --callto:+14445551234
Run Code Online (Sandbox Code Playgroud)

但是,这会给我一条错误消息,“Skype:无法识别的选项'--callto:+14445551234”。

这可能吗?

用例场景:

我想经常拨打特定号码。

  • 假设Skype客户端已经在运行并登录。
  • 我在桌面上创建了一个快捷方式,它可以运行skype --callto:+14445551234或类似的东西。
  • 双击快捷方式。
  • 弹出skype窗口,立即拨打这个号码

这能做到吗?

我知道有一个 Skype API。这可以通过 Ubuntu 上的普通 Skype 安装完成,而无需安装任何开发人员工具吗?

编辑:我正在考虑这个问题仍然悬而未决,因为我想知道这是否可以从没有任何附加功能的Skype的默认安装中实现。

然而,下面关于“ Skype4Py ”的答案确实回答了预期的结果,尽管有一个额外的工具。如果几周后没有另一个答案,我会将其标记为答案。

Fra*_*cke 7

很简单:

$> 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>
    [...]
Run Code Online (Sandbox Code Playgroud)

测试。有用。不仅仅是昵称。还有直接电话号码:

$> skype --callto +494030001234
Run Code Online (Sandbox Code Playgroud)

(这意味着:OP 的主要错误是冒号而不是空格...)


jne*_*ves 5

是的,如果您使用 Skype4Py。

我已经基于 Skype4Py 的 examples/callfriend.py 创建了一个简单的 callto.py 脚本。它以电话号码或 Skype 名册中的朋友姓名作为参数。仅当 Skype 已启动时才有效。

Skype 会询问您是否要向 Skype4Py 授予 API 权限。

代码如下:

#!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
Run Code Online (Sandbox Code Playgroud)