By the way, in Portuguese is Ol=E1 not Hola. ;) Cheers, On Mon, Oct 29, 2012 at 3:21 PM, Joshua Colp <jcolp at digium.com> wrote:> Alexandre Rodrigues wrote: >> >> Hello all, > > > Hola, > > >> I have the following challenge: I have to add a variable to the >> destination channel with the following conditions: >> >> 1) It has to be set in the dialplan, in runtime. >> 2) The source channel can't have the same variable has the >> destination. >> >> >> I had two ideas so far, but they seem complicated: >> >> 1) Add a local channel in the middle of the source and destination >> channel. With that I can use the >> dialplan application SET(__VAR=3D'XXX') in the local and it will >> be inherited by the destination channel. >> 2) Call a macro or a gosub in the DIAL. With that macro or gosub I >> can add a variable in the destination channel. > > > This is a perfect application for pre-dial handlers available in Asterisk > 11. You can specify a GoSub routine to execute before dialing and in that > routine you can set the variable you need. > > More information is available at > https://wiki.asterisk.org/wiki/display/AST/Pre-Dial+Handlers > > If you are going to use an earlier version you can use the 'U' option to > execute a GoSub routine before the calling channel and answered channel are > connected. The caveat with this is that your routine won't be executed > before dialing actually occurs. > > Both of these may seem "complicated" to you because they don't expose a > single option that just does exactly what you want. This is on purpose, we > provide many tools to accomplish many different things as what people want > to do varies greatly. > > I hope this helps! > > Cheers, > > -- > Joshua Colp > Digium, Inc. | Senior Software Developer > 445 Jan Davis Drive NW - Huntsville, AL 35806 - USA > Check us out at: www.digium.com & www.asterisk.org > > -- > _____________________________________________________________________ > -- Bandwidth and Colocation Provided by http://www.api-digital.com -- > New to Asterisk? Join us for a live introductory webinar every Thurs: > http://www.asterisk.org/hello > > asterisk-users mailing list > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users