2 lvl autoattendant DID tcl script

Version 1
    This document was generated from CDN thread

    Created by: lisandroq (simulated) on 30-05-2011 11:17:46 AM
    Hi i am Lisandro from Argentina i junior and is my first time working on a tcl.. i was given an script that is workin on a location  and  i modified to work in other location..the script works as autoattendant its has 2 levels.. It works great.... so when it starts has 
    a prompt and you could enter a valid number to connect directly or just the option that you heard in the prompt.. then in depending of the number of the option you chose you could enter in the second level where you here more options and its has a new collectdigit..
     
    in the proc act_Setup { }
    the script has this:
     
     leg setupack leg_incoming
      leg proceeding leg_incoming
      set callingnumber [infotag get leg_ani]
      if { [string len $callingnumber] == "3" || [string len $callingnumber] == "4" || [string len $callingnumber] == "5" || [string len $callingnumber] == "7"} {
        leg connect leg_incoming
     
    i really couldn't figure out what is this.. if someone could tell me how its works and what is does it do i would really appreciate that...
     
    the else of the if { [string len  play the prompt and collect the digit..
     
    I get my doubt on this because i want to add direct inward dial (did) on the script i have the code for this i got it from other tcl that work in other location:
     
    if { [infotag get leg_isdid] } {
            set dest [infotag get leg_dnis]
            leg proceeding leg_incoming
            leg setup $dest callInfo leg_incoming
            fsm setstate PLACECALL
     
     
     
    so i want to now is the infotag get leg_ will bother me or not or what does it do..
     
    i post you the entire proc act_Setup
     
     
    proc act_Setup { } {
      global param
      global source
      global header
      global a
      global dest
      global callingnumber
     
      set a(0) "*110"
      set a(1) "*111"
      set a(21) "*112"
      set a(22) "*113"
      set a(23) "*114"
      set a(31) "*115"
      set a(32) "*116"
      set a(33) "*117"
      set a(4) "*118"
      set a(9) "*119"
      set a(10) "*120"
      set a(11) "*121"
      set a(12) "*122"
      set a(13) "*123"
    puts "\n entro primero aca"
      set header "01"
      leg setupack leg_incoming
      leg proceeding leg_incoming
      set callingnumber [infotag get leg_ani]
      if { [string len $callingnumber] == "3" || [string len $callingnumber] == "4" || [string len $callingnumber] == "5" || [string len $callingnumber] == "7"} {
        leg connect leg_incoming
      }
    puts "\n header:"
    puts $header
      media play leg_incoming "$source$header.au"
      leg collectdigits leg_incoming param
    }
     
     
    could i just add :
     
    if { [infotag get leg_isdid] } {
            set dest [infotag get leg_dnis]
            leg proceeding leg_incoming
            leg setup $dest callInfo leg_incoming
            fsm setstate PLACECALL
     
    on the 
    proc act_Setup { } {
     
    and it should work?
     
     
    the fsm state:
     
    set fsm(PLACECALL,ev_setup_done)         "act_CallSetupDone, CALLACTIVE"
     
     
    thanks..

    Subject: RE: 2 lvl autoattendant DID tcl script
    Replied by: Raghavendra Gutty Veeranagappa on 31-05-2011 12:34:22 AM
    Hi Lisandro,

    If the call is Direct Inward Dial (DID), the destination is set to the Dialed Number Information Service (DNIS), and the system responds with a proceeding message on the incoming leg and tries to set up the outbound leg with the leg setup command.

    infotag get leg_isdid

    Returns the DID field of CallInfo. This is a Boolean field (1 = true; 0 = false),for more information please refer TCL-IVR programming guide in below link.

    http://developer.cisco.com/web/vgapi/home

    Thanks,
    Raghavendra