pythonasteriskvoippython-sippycall

Pycall throws ValidationError


I'm trying to run these lines of code in atom and python3.6 :

from pycall import CallFile, Call, Application
import sys


def call():
        c = Call('SIP/200')
        a = Application('Playback', 'hello-world')
        cf = CallFile(c, a)
        cf.spool()

if __name__ == '__main__':
        call()

But I receive this error:

Traceback (most recent call last):
  File "/home/pd/gits/voiphone/main.py", line 12, in <module>
    call()
  File "/home/pd/gits/voiphone/main.py", line 9, in call
    cf.spool()
  File "/home/pd/telephonerelayEnv/lib/python3.6/site-packages/pycall/callfile.py", line 135, in spool
    self.writefile()
  File "/home/pd/telephonerelayEnv/lib/python3.6/site-packages/pycall/callfile.py", line 123, in writefile
    f.write(self.contents)
  File "/home/pd/telephonerelayEnv/lib/python3.6/site-packages/pycall/callfile.py", line 118, in contents
    return '\n'.join(self.buildfile())
  File "/home/pd/telephonerelayEnv/lib/python3.6/site-packages/pycall/callfile.py", line 100, in buildfile
    raise ValidationError
pycall.errors.ValidationError

I would appreciate if you help me solving my problem. thank you in advance


Solution

  • Looking at the source code for the validity check, it appears like the only check that could be catching you out is the one that verifies the spool directory. By default this is set to /var/spool/asterisk/outgoing but can be changed when you create the callfile:

    cf = CallFile(c, a, spool_dir='/my/asterisk/spool/outgoing')