mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-29 18:19:30 +00:00
Add 486 message (SIP) to 17 cause (PRI) translation when you call Dial app and then Hangup:
exten => _X.,1,Dial(SIP/user) exten => _X.,2,Hangup() git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1596 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -229,6 +229,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, struct localu
|
||||
case AST_CONTROL_BUSY:
|
||||
if (option_verbose > 2)
|
||||
ast_verbose( VERBOSE_PREFIX_3 "%s is busy\n", o->chan->name);
|
||||
in->hangupcause = o->chan->hangupcause;
|
||||
ast_hangup(o->chan);
|
||||
o->chan = NULL;
|
||||
o->stillgoing = 0;
|
||||
@@ -239,6 +240,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, struct localu
|
||||
case AST_CONTROL_CONGESTION:
|
||||
if (option_verbose > 2)
|
||||
ast_verbose( VERBOSE_PREFIX_3 "%s is circuit-busy\n", o->chan->name);
|
||||
in->hangupcause = o->chan->hangupcause;
|
||||
ast_hangup(o->chan);
|
||||
o->chan = NULL;
|
||||
o->stillgoing = 0;
|
||||
@@ -282,6 +284,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, struct localu
|
||||
}
|
||||
ast_frfree(f);
|
||||
} else {
|
||||
in->hangupcause = o->chan->hangupcause;
|
||||
ast_hangup(o->chan);
|
||||
o->chan = NULL;
|
||||
o->stillgoing = 0;
|
||||
|
@@ -38,6 +38,7 @@
|
||||
#include <asterisk/acl.h>
|
||||
#include <asterisk/srv.h>
|
||||
#include <asterisk/astdb.h>
|
||||
#include <asterisk/causes.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <net/if.h>
|
||||
@@ -4426,6 +4427,19 @@ static void parse_moved_contact(struct sip_pvt *p, struct sip_request *req)
|
||||
strncpy(p->owner->call_forward, s, sizeof(p->owner->call_forward) - 1);
|
||||
}
|
||||
|
||||
static int hangup_sip2cause(int cause)
|
||||
{
|
||||
switch(cause)
|
||||
{
|
||||
case 486:
|
||||
return AST_CAUSE_BUSY;
|
||||
default:
|
||||
return AST_CAUSE_NORMAL;
|
||||
}
|
||||
/* Never reached */
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void handle_response(struct sip_pvt *p, int resp, char *rest, struct sip_request *req)
|
||||
{
|
||||
char *to;
|
||||
@@ -4442,6 +4456,8 @@ static void handle_response(struct sip_pvt *p, int resp, char *rest, struct sip_
|
||||
msg = strchr(c, ' ');
|
||||
if (!msg) msg = ""; else msg++;
|
||||
owner = p->owner;
|
||||
if (owner)
|
||||
owner->hangupcause = hangup_sip2cause(resp);
|
||||
/* Acknowledge whatever it is destined for */
|
||||
if ((resp >= 100) && (resp <= 199))
|
||||
__sip_semi_ack(p, seqno, 0);
|
||||
|
@@ -503,16 +503,15 @@ 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) */)
|
||||
|
||||
#ifdef ZAPATA_PRI
|
||||
/* translate between PRI causes and asterisk's */
|
||||
static 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;
|
||||
}
|
||||
@@ -520,6 +519,21 @@ static int hangup_pri2cause(int cause)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* translate between ast cause and PRI */
|
||||
static int hangup_cause2pri(int cause)
|
||||
{
|
||||
switch(cause) {
|
||||
case AST_CAUSE_BUSY:
|
||||
return PRI_CAUSE_USER_BUSY;
|
||||
case AST_CAUSE_NORMAL:
|
||||
default:
|
||||
return PRI_CAUSE_NORMAL_CLEARING;
|
||||
}
|
||||
/* never reached */
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int zt_get_index(struct ast_channel *ast, struct zt_pvt *p, int nullok)
|
||||
{
|
||||
int res;
|
||||
@@ -1753,7 +1767,7 @@ static int zt_hangup(struct ast_channel *ast)
|
||||
p->call = NULL;
|
||||
} else {
|
||||
p->alreadyhungup = 1;
|
||||
pri_hangup(p->pri->pri, p->call, -1);
|
||||
pri_hangup(p->pri->pri, p->call, ast->hangupcause ? hangup_cause2pri(ast->hangupcause) : -1);
|
||||
}
|
||||
#endif
|
||||
if (res < 0)
|
||||
|
Reference in New Issue
Block a user