[asterisk-users] Waiting for a call to complete with AMI Originate
Scott Gifford
sgifford at suspectclass.com
Wed Jul 22 02:24:54 CDT 2009
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.
More information about the asterisk-users
mailing list