Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am about to make some email to fax gateway --- some python program will make Asterisk call files and put them into some queue (files or db based).

Then another program should take "call tasks" from queue and "feed" them to asterisk (honoring some configured limit, because of res_fax_digium will drop over-limited tasks).

Next, let's suppose, everything is great and asterisk successfully sent some fax document. What could be a way to get the status of this operation?

If logfiles parsing is the best, I would, probably, assign some special accountcode (I can play with this field, probably) to drop CDRs into separate files, too.

Please, which other ways I should evaluate?

share|improve this question
add comment

1 Answer

So, I dropped this approach and will go another way --- AMI, Asterisk Management Interface API.

In a couple of words.

Having created dialplan like this one:

[01-sendfax]
exten => _X.,1,NoOp()
     same => n,SendFax(${faxfile},f)

I can originate calls with (using pyst):

res = mgr.originate(
    'SIP/m2000/1234567',
    '1234567',
    context='01-sendfax',
    priority='1',
    caller_id='7654321',
    async=True,
    variables={
        'TRUNK': 'SIP/m2000',
        'faxfile': '/tmp/file.tiff',
    }
)

And having set debug = on in manager.conf, I can listen to needed events:

# will catch a status of `originate` call
# (this does not require `debug = on` in `manager.conf`):
mgr.register_event('OriginateResponse', handle_response)

# will catch `SendFax` application's result:
mgr.register_event('FaxStatus', handle_response)

So, res_fax_digium fires FaxStatus event after SendFax is complete.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.