Scott Gifford
2009-Jul-22 07:24 UTC
[asterisk-users] Waiting for a call to complete with AMI Originate
Hello, I'm using an AMI Originate command to send a fax. The fax is sent by a script, and I'd like my script to send the fax, wait until it has succeeded or failed, then exit with an appropriate error code (it is driven by a mail system, so the exit code will tell the mail system whether to retry the fax later). The script works great if the fax succeeds, or if the line is busy or doesn't pick up. The problem I'm having is that when a fax is sent and the line picks up but doesn't accept the fax (for example if I call a voice line). In this case, I don't seem to have enough information to tell when the call has failed and I should give up. I do get a Hangup event, but I don't see a way to distinguish it from other hang-up events from other calls. Here is an example of a recent fax I sent (the format of the request/ response lines is a dump of the variables in Perl, hopefully it makes sense): REQUEST: { 'MaxRetries' => 0, 'Channel' => 'Zap/g0/91234567, 'WaitTime' => 20, 'Action' => 'Originate', 'Application' => 'txfax', 'ActionID' => '1248244247.1814', 'Priority' => 1, 'Data' => '/home/sgifford/prog/faxscripts/testfax4.tif', 'Variable' => '' }; RESPONSE: { 'Message' => 'Originate successfully queued', 'ActionID' => '1248244247.1814', 'Response' => 'Success' }; EVENT: { 'CallerIDName' => '<unknown>', 'Event' => 'Newchannel', 'Uniqueid' => '1248244247.11', 'Privilege' => 'call,all', 'Channel' => 'Zap/1-1', 'CallerIDNum' => '<unknown>', 'State' => 'Rsrvd' }; ... EVENT: { 'Event' => 'Hangup', 'Uniqueid' => '1248244250.12', 'Privilege' => 'call,all', 'Channel' => 'Zap/2-1', 'Cause-txt' => 'Unknown', 'Cause' => '' }; ... EVENT: { 'Event' => 'Hangup', 'Uniqueid' => '1248244247.11', 'Privilege' => 'call,all', 'Channel' => 'Zap/1-1', 'Cause-txt' => 'Unknown', 'Cause' => '' }; I see the same behavior in Asterisk 1.4.18 and 1.4.26. Any suggestions? Thanks, ----Scott.
Matt Riddell
2009-Jul-22 09:25 UTC
[asterisk-users] Waiting for a call to complete with AMI Originate
On 22/7/09 7:24 PM, Scott Gifford wrote:> Hello, > > I'm using an AMI Originate command to send a fax. The fax is sent by > a script, and I'd like my script to send the fax, wait until it has > succeeded or failed, then exit with an appropriate error code (it is > driven by a mail system, so the exit code will tell the mail system > whether to retry the fax later). > > The script works great if the fax succeeds, or if the line is busy or > doesn't pick up. The problem I'm having is that when a fax is sent > and the line picks up but doesn't accept the fax (for example if I > call a voice line). > > In this case, I don't seem to have enough information to tell when the > call has failed and I should give up. I do get a Hangup event, but I > don't see a way to distinguish it from other hang-up events from other > calls.For doing fax broadcasting we use the UserEvent function. exten => h,n,UserEvent(SmoothTorque|SmoothTorqueFax:${PHASEESTATUS}-${campaignid}-${phonenumber}) Then in the back end we parse the results. -- Cheers, Matt Riddell Director _______________________________________________ http://www.venturevoip.com/news.php (Daily Asterisk News) http://www.venturevoip.com/st.php (SmoothTorque Predictive Dialer) http://www.venturevoip.com/c3.php (ConduIT3 PABX Systems)
Philipp Kempgen
2009-Jul-22 11:06 UTC
[asterisk-users] Waiting for a call to complete with AMI Originate
Scott Gifford schrieb:> I'm using an AMI Originate command to send a fax. The fax is sent by > a script, and I'd like my script to send the fax, wait until it has > succeeded or failed, then exit with an appropriate error code (it is > driven by a mail system, so the exit code will tell the mail system > whether to retry the fax later). > > The script works great if the fax succeeds, or if the line is busy or > doesn't pick up. The problem I'm having is that when a fax is sent > and the line picks up but doesn't accept the fax (for example if I > call a voice line). > > In this case, I don't seem to have enough information to tell when the > call has failed and I should give up. I do get a Hangup event, but I > don't see a way to distinguish it from other hang-up events from other > calls. > > Here is an example of a recent fax I sent (the format of the request/ > response lines is a dump of the variables in Perl, hopefully it makes > sense): >> 'Application' => 'txfax',> Any suggestions?Probably not what you are looking for but you could use Iaxmodem + HylaFax. Alternatively have a look at the SendFax() application in Asterisk 1.6. ------ -= Info about application 'SendFAX' =- [Synopsis] Send a FAX [Description] SendFAX(filename[|options]): Send a given TIFF file to the channel as a FAX. ... This application sets the following channel variables upon completion: FAXSTATUS - status of operation: SUCCESS | FAILED FAXERROR - Error when FAILED ------ Philipp Kempgen -- AMOOMA GmbH - Bachstr. 126 - 56566 Neuwied -> http://www.amooma.de Gesch?ftsf?hrer: Stefan Wintermeyer, Handelsregister: Neuwied B14998 Asterisk: http://the-asterisk-book.com - http://das-asterisk-buch.de Videos of the AMOOCON VoIP conference 2009 -> http://www.amoocon.de --