--- asterisk-1.0.9/apps/app_dial.c 2005-05-11 20:43:36.000000000 -0500 +++ asterisk-1.0.9.modified/apps/app_dial.c 2005-11-08 11:46:11.000000000 -0600 @@ -59,6 +59,7 @@ " This application returns -1 if the originating channel hangs up, or if the\n" "call is bridged and either of the parties in the bridge terminate the call.\n" "The option string may contain zero or more of the following characters:\n" +" 'i' -- Asterisk will ignore any 302 REDIRECT it gets from the phone.\n" " 't' -- allow the called user transfer the calling user by hitting #.\n" " 'T' -- allow the calling user to transfer the call by hitting #.\n" " 'f' -- Forces callerid to be set as the extension of the line \n" @@ -106,6 +107,7 @@ struct localuser { struct ast_channel *chan; int stillgoing; + int allowforward; int allowredirect_in; int allowredirect_out; int ringbackonly; @@ -228,8 +230,13 @@ /* Before processing channel, go ahead and check for forwarding */ if (option_verbose > 2) ast_verbose(VERBOSE_PREFIX_3 "Now forwarding %s to '%s/%s' (thanks to %s)\n", in->name, tech, stuff, o->chan->name); - /* Setup parameters */ - o->chan = ast_request(tech, in->nativeformats, stuff); + if (!o->allowforward) { + ast_verbose(VERBOSE_PREFIX_3 "Forwarding %s to '%s/%s' prevented by dial option 'i'\n", in->name, tech, stuff); + o->chan = NULL; + } else { + /* Setup parameters */ + o->chan = ast_request(tech, in->nativeformats, stuff); + } if (!o->chan) { ast_log(LOG_NOTICE, "Unable to create local channel for call forward to '%s/%s'\n", tech, stuff); o->stillgoing = 0; @@ -440,6 +447,7 @@ int allowdisconnect_in=0; int allowdisconnect_out=0; int noforwardhtml=0; + int allowforward=1; int hasmacro = 0; int privacy=0; int announce=0; @@ -722,6 +730,15 @@ } memset(tmp, 0, sizeof(struct localuser)); if (transfer) { + if (strchr(transfer, 'i')) { + allowforward = tmp->allowforward = 0; + if (option_verbose > 5) + ast_verbose(VERBOSE_PREFIX_3 "Dial option prevent forwarding set 'On'\n"); + } else { + allowforward = tmp->allowforward = 1; + if (option_verbose > 5) + ast_verbose(VERBOSE_PREFIX_3 "Dial option prevent forwarding set 'Off'\n"); + } if (strchr(transfer, 't')) tmp->allowredirect_in = 1; else tmp->allowredirect_in = 0; @@ -788,7 +805,11 @@ ast_verbose(VERBOSE_PREFIX_3 "Forwarding %s to '%s/%s' (thanks to %s)\n", chan->name, tech, stuff, tmp->chan->name); /* Setup parameters */ ast_hangup(tmp->chan); - tmp->chan = ast_request(tech, chan->nativeformats, stuff); + if (!tmp->allowforward) { + ast_verbose(VERBOSE_PREFIX_3 "Forwarding %s to '%s/%s' prevented by dial option 'i'\n", chan->name, tech, stuff); + } else { + tmp->chan = ast_request(tech, chan->nativeformats, stuff); + } if (!tmp->chan) { ast_log(LOG_NOTICE, "Unable to create local channel for call forward to '%s/%s'\n", tech, stuff); free(tmp);