1

I have Asterisk 13.20 set up and running fine on Ubuntu 16.04,calls are going well through a Softphone(Zoiper), I came across a Library in Python "Pycall" which lets you make calls through a Python Script.So I tried testing a snippet from the site Pycall

The code that I used:

from pycall import CallFile, Call, Application
call = Call('SIP/flowroute/18882223333')
action = Application('Playback', 'hello-world')
c = CallFile(call, action)
c.spool()

Just made changes in the extension,wherein I used one from my server However I am getting the following error:

Traceback (most recent call last):
File "test.py", line 10, in <module>
c.spool()
File "/usr/local/lib/python2.7/dist-packages/pycall/callfile.py", line 131, in spool
self.writefile()
File "/usr/local/lib/python2.7/dist-packages/pycall/callfile.py", line 119, in writefile
f.write(self.contents)
File "/usr/local/lib/python2.7/dist-packages/pycall/callfile.py", line 114, in contents
return '\n'.join(self.buildfile())
File "/usr/local/lib/python2.7/dist-packages/pycall/callfile.py", line 96, in buildfile
raise ValidationError
pycall.errors.ValidationError

Tried searching online for the solution but coudnt find one,What am I doing wrong?

arheops
  • 15,544
  • 1
  • 21
  • 27
  • The default spool_dir is /var/spool/asterisk/outgoing. You need to create a user 'asterisk' and make sure that user is able to write files in this directory. – Babu Arunachalam Dec 05 '19 at 23:06

2 Answers2

0

This question not related to PBX, it is just incorrect use of LIB.

General instruction how to solve ANY issue with availible source code.

You have error

File "/usr/local/lib/python2.7/dist-packages/pycall/callfile.py", line 96, in buildfile

Go that file and line, check code, add more debug if needed, fix your app.

arheops
  • 15,544
  • 1
  • 21
  • 27
  • I haven't made changes to the code,so can't seem to understand the error,it does give a validation error as ":raises: `ValidationError` if this call file can not be validated" –  Apr 23 '18 at 04:47
0

Run as asterisk user.

sudo su asterisk -s /bin/bash

python

from pycall import CallFile, Call, Application
call = Call('SIP/flowroute/18882223333')
action = Application('Playback', 'hello-world')
c = CallFile(call, action)
c.spool()