本文整理汇总了Python中pycall.CallFile.spool方法的典型用法代码示例。如果您正苦于以下问题:Python CallFile.spool方法的具体用法?Python CallFile.spool怎么用?Python CallFile.spool使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pycall.CallFile
的用法示例。
在下文中一共展示了CallFile.spool方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_spool_no_time_no_user_error
# 需要导入模块: from pycall import CallFile [as 别名]
# 或者: from pycall.CallFile import spool [as 别名]
def test_spool_no_time_no_user_error(self):
"""Ensure that `spool` raises `NoUserError` if the user attribute is
not a real system user.
"""
c = CallFile(self.call, self.action, spool_dir=self.spool_dir,
user='asjdfgkhkgaskqtjwhkjwetghqekjtbkwthbjkltwhwklt')
c.spool()
示例2: test_spool_no_time_no_user_permission_error
# 需要导入模块: from pycall import CallFile [as 别名]
# 或者: from pycall.CallFile import spool [as 别名]
def test_spool_no_time_no_user_permission_error(self):
"""Ensure that `spool` raises `NoUserPermissionError` if the user
specified does not have permissions to write to the Asterisk spooling
directory.
"""
c = CallFile(self.call, self.action, spool_dir='/', user='root')
c.spool()
示例3: test_spool_no_time_no_user
# 需要导入模块: from pycall import CallFile [as 别名]
# 或者: from pycall.CallFile import spool [as 别名]
def test_spool_no_time_no_user(self):
"""Ensure `spool` works when no `time` attribute is supplied, and no
`user` attribute exists.
"""
c = CallFile(self.call, self.action, spool_dir=self.spool_dir)
c.spool()
ok_((path(c.spool_dir) / path(c.filename)).abspath().exists())
示例4: test_spool_no_time_user
# 需要导入模块: from pycall import CallFile [as 别名]
# 或者: from pycall.CallFile import spool [as 别名]
def test_spool_no_time_user(self):
"""Ensure that `spool` works when no `time` attribute is specified, and
a valid `user` attribute exists.
"""
c = CallFile(self.call, self.action, spool_dir=self.spool_dir,
user=getuser())
c.spool()
示例5: test_spool_no_time_no_spool_permission_error
# 需要导入模块: from pycall import CallFile [as 别名]
# 或者: from pycall.CallFile import spool [as 别名]
def test_spool_no_time_no_spool_permission_error(self):
"""Ensure that `spool` raises `NoSpoolPermissionError` if the user
doesn't have permissions to write to `spool_dir`.
NOTE: This test WILL fail if the user account you run this test under
has write access to the / directory on your local filesystem.
"""
c = CallFile(self.call, self.action, spool_dir='/')
c.spool()
示例6: dialout
# 需要导入模块: from pycall import CallFile [as 别名]
# 或者: from pycall.CallFile import spool [as 别名]
def dialout():
call_from = request.args.get('from', '')
call_to = request.args.get('to', '')
cfrom = 'SIP/{}@hotvoip'.format(call_from)
cto = 'SIP/{}@hotvoip'.format(call_to)
c = Call(cfrom)
a = Application('Dial', cto)
cf = CallFile(c, a)
cf.spool()
return 'dialed'
示例7: localcall
# 需要导入模块: from pycall import CallFile [as 别名]
# 或者: from pycall.CallFile import spool [as 别名]
def localcall():
call_from = request.args.get('from', '')
call_to = request.args.get('to', '')
if call_from and call_to:
cfrom = 'SIP/{}'.format(call_from)
logging.debug(cfrom)
cto = 'SIP/{}'.format(call_to)
logging.debug(cto)
c = Call(cfrom)
a = Application('Dial', cto)
cf = CallFile(c, a)
cf.spool()
else:
return "no call made"
return "call made"
示例8: test_spool_time_no_user
# 需要导入模块: from pycall import CallFile [as 别名]
# 或者: from pycall.CallFile import spool [as 别名]
def test_spool_time_no_user(self):
"""Ensure that `spool` works when given a valid `time` parameter."""
c = CallFile(self.call, self.action, spool_dir=self.spool_dir)
d = datetime.now()
c.spool(d)
eq_((path(c.tempdir) / path(c.filename)).abspath().atime, mktime(d.timetuple()))
示例9: Call
# 需要导入模块: from pycall import CallFile [as 别名]
# 或者: from pycall.CallFile import spool [as 别名]
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: Joshua
# @E-Mail: [email protected]
# @Date: 2015-04-29 17:52:36
# @About test.py
from pycall import CallFile, Call, Application
call = Call('SIP/flowroute/13694182569')
action = Application('Playback', 'hello-world')
c = CallFile(call, action)
c.spool()