Thanks for your answers, I haven't implemented a solution right now but I know how I could do that now...
Here a short summary of things I learned.
First, in short - the problems I had with twisted:
- I didn't understand the asynchronous basics of twisted. I used something like that in gui-frameworks but didn't see the benefit for a long time.
- Second, I tried to think of an synchronous call of the event loop multiple times. This was necessary in my mind because I may not use more than one outgoing fax line at a time. Because the event loop of twisted is not restartable this is no option. As I could read in the docs "deferToThread" could help me here, but I think it's not the best solution.
In my concept I solved these problems:
- Use of defer.DeferredSemaphore() which allows me to limit concurrency to 1.
I found an example here: http://oubiwann.blogspot.com/2008/06/async-batching-with-twisted-walkthrough.html
- calling twisted anynchronously and let the Defereds do the work (send a fax)
- Writing the fax status to the database and sending the receipt mail is called from the defereds
I needed a lot of re-thinking but as soon as you get it it looks really easy.
Thanks to iny and Jean-Paul Calderone for your help.