Index: channels/sig_pri.c =================================================================== --- channels/sig_pri.c (revision 299572) +++ channels/sig_pri.c (working copy) @@ -6446,10 +6446,11 @@ chan->_softhangup |= AST_SOFTHANGUP_DEV; res = 0; } else if (!p->progress && p->pri && !p->outgoing) { + chan->hangupcause = AST_CAUSE_USER_BUSY; if (p->pri->pri) { if (!pri_grab(p, p->pri)) { #ifdef HAVE_PRI_PROG_W_CAUSE - pri_progress_with_cause(p->pri->pri,p->call, PVT_TO_CHANNEL(p), 1, PRI_CAUSE_USER_BUSY); /* cause = 17 */ + pri_progress_with_cause(p->pri->pri, p->call, PVT_TO_CHANNEL(p), 1, chan->hangupcause); #else pri_progress(p->pri->pri,p->call, PVT_TO_CHANNEL(p), 1); #endif @@ -6523,16 +6524,36 @@ res = 0; break; case AST_CONTROL_CONGESTION: - chan->hangupcause = AST_CAUSE_CONGESTION; if (p->priindication_oob || p->no_b_channel) { - chan->hangupcause = AST_CAUSE_SWITCH_CONGESTION; + /* There are many cause codes that generate an AST_CONTROL_CONGESTION. */ + switch (chan->hangupcause) { + case AST_CAUSE_USER_BUSY: + case AST_CAUSE_NORMAL_CLEARING: + case 0:/* Cause has not been set. */ + /* Supply a more appropriate cause. */ + chan->hangupcause = AST_CAUSE_SWITCH_CONGESTION; + break; + default: + break; + } chan->_softhangup |= AST_SOFTHANGUP_DEV; res = 0; } else if (!p->progress && p->pri && !p->outgoing) { + /* There are many cause codes that generate an AST_CONTROL_CONGESTION. */ + switch (chan->hangupcause) { + case AST_CAUSE_USER_BUSY: + case AST_CAUSE_NORMAL_CLEARING: + case 0:/* Cause has not been set. */ + /* Supply a more appropriate cause. */ + chan->hangupcause = AST_CAUSE_SWITCH_CONGESTION; + break; + default: + break; + } if (p->pri->pri) { if (!pri_grab(p, p->pri)) { #ifdef HAVE_PRI_PROG_W_CAUSE - pri_progress_with_cause(p->pri->pri,p->call, PVT_TO_CHANNEL(p), 1, PRI_CAUSE_SWITCH_CONGESTION); /* cause = 42 */ + pri_progress_with_cause(p->pri->pri, p->call, PVT_TO_CHANNEL(p), 1, chan->hangupcause); #else pri_progress(p->pri->pri,p->call, PVT_TO_CHANNEL(p), 1); #endif