Trying to use AMI to send a fax


#1

I have a call file which works fine for sending faxes but i would like to convert it to an AMI call to be more flexible. Here is what the content of my file looks like and i need help on passing Filename etc via AMI

Channel: Local/213XXXXXXX@from-inside
MaxRetries: 12
RetryTime: 300
WaitTime: 60
Context: tl-faxsend
Extension: SendFax
Priority: 1
Set: FILENAME=/tmp/localhost-1546395489.347.tif
Set: STATIONID=1234567890ID
Set: CONFSUCCESS=1
Set: EMAILADDR=tom@acme.com
Set: REMOTENUMBER=213XXXXXXX
Set: TENANT=
Set: MYEXTEN=2500

To make it work i changed the Extension to Exten: and when i call it via my AMI i se the call beeing fired off but it fails. It complains that it is missing the stuff like FILENAME etc. How can i set those in the AMI to be avail ?

Here is my LOG

-- Local/213XXXXXXX@from-inside-00000026;1 answered
    -- Executing [SendFax@tl-faxsend:1] Answer("Local/213XXXXXXX@from-inside-00000026;1", "") in new stack
    -- Executing [SendFax@tl-faxsend:2] Set("Local/213XXXXXXX@from-inside-00000026;1", "FAXOPT(localstationid)=213XXXXXXX") in new stack
    -- Channel SIP/Vodex-2WAY-000000ff joined 'simple_bridge' basic-bridge <516519e5-21f4-48fb-94e8-fb2fe3e9b469>
    -- Channel Local/213XXXXXXX@from-inside-00000026;2 joined 'simple_bridge' basic-bridge <516519e5-21f4-48fb-94e8-fb2fe3e9b469>
    -- Executing [SendFax@tl-faxsend:3] Set("Local/213XXXXXXX@from-inside-00000026;1", "FAXOPT(ecm)=yes") in new stack
    -- Executing [SendFax@tl-faxsend:4] Set("Local/213XXXXXXX@from-inside-00000026;1", "OPTIONS=df") in new stack
    -- Executing [SendFax@tl-faxsend:5] Set("Local/213XXXXXXX@from-inside-00000026;1", "CALLERID(number)=") in new stack
    -- Executing [SendFax@tl-faxsend:6] SendFAX("Local/213XXXXXXX@from-inside-00000026;1", ",df") in new stack
[2019-01-02 19:41:44] WARNING[14995][C-0000023e]: res_fax.c:2677 sendfax_exec: SendFAX requires an argument (filename[&filename[&filename]],options])
  == Spawn extension (tl-faxsend, SendFax, 6) exited non-zero on 'Local/213XXXXXXX@from-inside-00000026;1'
    -- Executing [h@tl-faxsend:1] NoOp("Local/213XXXXXXX@from-inside-00000026;1", "SendFax ended") in new stack
    -- Executing [h@tl-faxsend:2] GotoIf("Local/213XXXXXXX@from-inside-00000026;1", "0?hangup") in new stack
    -- Executing [h@tl-faxsend:3] GotoIf("Local/213XXXXXXX@from-inside-00000026;1", "1?error") in new stack
    -- Goto (tl-faxsend,h,5)
    -- Executing [h@tl-faxsend:5] Set("Local/213XXXXXXX@from-inside-00000026;1", "FAXERROR=INVALID_ARGUMENTS") in new stack

#2

Look at https://wiki.asterisk.org/wiki/display/AST/Asterisk+11+ManagerAction_Originate and you will find that Exten is not the only difference.


#3

Figured out the problem which was due to setting the Variables. I would just wish for simplicity that the syntax from call script would be same as for AMI that way you dont have to check forth and back. In anycase here is the working script should anyone want it

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,EMAILADDR=tom@acme.com,STATIONID=213XXXXXXX,REMOTENUMBER=213XXXXXXX,MYEXTEN=3444',