Search code examples
asteriskasteriskami

Using AMI to send Fax


I am wondering if it is possible to create a AMI based script which will send a fax. My Asterisk currently creates a file in the /var/spool/asterisk/outgoing which has the following content

Channel: Local/2135552222@from-inside/n
MaxRetries: 12
RetryTime: 300
WaitTime: 60
Context: tl-faxsend
Extension: SendFax
Priority: 1
Set: FILENAME=/tmp/3444-2019-01-1-19-42-13.tiff
Set: STATIONID=1234567890ID
Set: CONFSUCCESS=1
Set: [email protected]
Set: REMOTENUMBER=2135552222
Set: MYEXTEN=3444

using that file the fax send fine, but if i use Action: Originate in the AMI and pass this info i get the error that Message: Extension does not exist.

What am i missing here ?


Solution

  • After some more reading up on this and debug i found the source of my problem. For one as Marcos pointed out, the call file uses Extension vs the AMI expects Exten. After that change i was able to call the script but i was missing the set variables. So to make this whole thing work the AMI call looks like this

    Action: 'Originate',
             ActionID: '9CF82D29-C0CD-43A7-8622-18D5FD7F6A59',
             Channel: 'Local/213XXXXXXX@from-inside',
             MaxRetries: 12 ,
             RetryTime: 300 ,
             WaitTime: 60 ,
             Context: 'tl-faxsend',
             Exten: 'SendFax',
             Priority: 1,
             Async: 'true',
             Variable: 'FILENAME=/var/spool/asterisk/fax/localhost-1546479385.466.tif,[email protected],STATIONID=213XXXXXXX,REMOTENUMBER=213XXXXXXX,MYEXTEN=3444',