Add distinguishing between BUSY and FAILURE for outgoing spool calls. Always save CDR record (even if the call fails). If the call fails try to see if there is

"failed" extension in the specified context (only if you use context,extension,priority syntax) and execute it.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1499 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Martin Pycko
2003-09-12 16:51:35 +00:00
parent 3672619e13
commit 4828759ab8
6 changed files with 130 additions and 14 deletions

View File

@@ -36,6 +36,7 @@
#include <asterisk/dsp.h>
#include <asterisk/astdb.h>
#include <asterisk/manager.h>
#include <asterisk/causes.h>
#include <sys/signal.h>
#include <sys/select.h>
#include <errno.h>
@@ -498,6 +499,23 @@ static int cidrings[] = {
#define CANBUSYDETECT(p) (ISTRUNK(p) || (p->sig & (SIG_EM | SIG_SF)) /* || (p->sig & __ZT_SIG_FXO) */)
#define CANPROGRESSDETECT(p) (ISTRUNK(p) || (p->sig & (SIG_EM | SIG_SF)) /* || (p->sig & __ZT_SIG_FXO) */)
/* translate between PRI causes and asterisk's */
int hangup_pri2cause(int cause)
{
switch(cause) {
#ifdef ZAPATA_PRI
case PRI_CAUSE_USER_BUSY:
return AST_CAUSE_BUSY;
case PRI_CAUSE_NORMAL_CLEARING:
return AST_CAUSE_NORMAL;
#endif
default:
return AST_CAUSE_FAILURE;
}
/* never reached */
return 0;
}
static int zt_get_index(struct ast_channel *ast, struct zt_pvt *p, int nullok)
{
int res;
@@ -6049,6 +6067,7 @@ static void *pri_dchannel(void *vpri)
if (chan) {
ast_mutex_lock(&pri->pvt[chan]->lock);
if (pri->pvt[chan]->owner) {
pri->pvt[chan]->owner->hangupcause = hangup_pri2cause(e->hangup.cause);
pri->pvt[chan]->owner->_softhangup |= AST_SOFTHANGUP_DEV;
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Channel %d, span %d got hangup\n", chan, pri->span);