Index: channels/chan_zap.c
===================================================================
--- channels/chan_zap.c (revision 334)
+++ channels/chan_zap.c (working copy)
@@ -2029,6 +2029,8 @@
int prilocaldialplan;
int ldp_strip;
int exclusive;
+ const char *rr_str;
+ int redirect_reason;
c = strchr(dest, '/');
if (c)
@@ -2135,8 +2137,26 @@
}
pri_sr_set_caller(sr, l ? (l + ldp_strip) : NULL, n, prilocaldialplan,
p->use_callingpres ? ast->cid.cid_pres : (l ? PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN : PRES_NUMBER_NOT_AVAILABLE));
- pri_sr_set_redirecting(sr, ast->cid.cid_rdnis, p->pri->localdialplan - 1, PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN, PRI_REDIR_UNCONDITIONAL);
+ redirect_reason = PRI_REDIR_UNCONDITIONAL;
+ if ((rr_str = pbx_builtin_getvar_helper(ast, "PRIREDIRECTREASON"))) {
+ if (!strcasecmp(rr_str, "UNKNOWN"))
+ redirect_reason = PRI_REDIR_UNKNOWN;
+ else if (!strcasecmp(rr_str, "BUSY"))
+ redirect_reason = PRI_REDIR_FORWARD_ON_BUSY;
+ else if (!strcasecmp(rr_str, "NO_REPLY"))
+ redirect_reason = PRI_REDIR_FORWARD_ON_NO_REPLY;
+ else if (!strcasecmp(rr_str, "DEFLECTION"))
+ redirect_reason = PRI_REDIR_DEFLECTION;
+ else if (!strcasecmp(rr_str, "DTE_OUT_OF_ORDER"))
+ redirect_reason = PRI_REDIR_DTE_OUT_OF_ORDER;
+ else if (!strcasecmp(rr_str, "FORWARDED_BY_DTE"))
+ redirect_reason = PRI_REDIR_FORWARDED_BY_DTE;
+ ast_log(LOG_WARNING, "DEBUG: PRIREDIRECTREASON is set to '%s'\n", rr_str);
+ } else
+ ast_log(LOG_WARNING, "DEBUG: PRIREDIRECTREASON is not set\n");
+ pri_sr_set_redirecting(sr, ast->cid.cid_rdnis, p->pri->localdialplan - 1, PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN, redirect_reason);
+
#ifdef SUPPORT_USERUSER
/* User-user info */
useruser = pbx_builtin_getvar_helper(p->owner, "USERUSERINFO");