Index: channels/chan_sip.c =================================================================== --- channels/chan_sip.c (revision 38417) +++ channels/chan_sip.c (working copy) @@ -3238,8 +3238,15 @@ update_call_counter(p, INC_CALL_LIMIT); } } else { /* Incoming call, not up */ + const char *cause = pbx_builtin_getvar_helper(ast,"PRI_CAUSE"); + int icause = ast->hangupcause ? ast->hangupcause : -1; + if (cause) { + if (atoi(cause)) + icause = atoi(cause); + } + const char *res; - if (ast->hangupcause && (res = hangup_cause2sip(ast->hangupcause))) + if ((res = hangup_cause2sip(icause))) transmit_response_reliable(p, res, &p->initreq); else transmit_response_reliable(p, "603 Declined", &p->initreq);