diff options
author | martinp <martinp@f38db490-d61c-443f-a65b-d21fe96a405b> | 2003-10-01 16:05:40 +0000 |
---|---|---|
committer | martinp <martinp@f38db490-d61c-443f-a65b-d21fe96a405b> | 2003-10-01 16:05:40 +0000 |
commit | 143f06cec4526c4f8f9dadb3d3533b9c77ac250c (patch) | |
tree | fb29cc6d88c7be55350958128b2304f13d96df62 /channels/chan_zap.c | |
parent | cfa5d5657f6986b9a231c2bd016ab60e52186f52 (diff) |
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: http://svn.digium.com/svn/asterisk/trunk@1596 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_zap.c')
-rwxr-xr-x | channels/chan_zap.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/channels/chan_zap.c b/channels/chan_zap.c index ac9515238..4d47aee7a 100755 --- a/channels/chan_zap.c +++ b/channels/chan_zap.c @@ -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) |