cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
622
Views
0
Helpful
0
Comments
cdnadmin
Level 11
Level 11
This document was generated from CDN thread

Created by: Alexander Pluzhnikov on 06-06-2012 05:57:09 AM
Hello. Can somebody help me?
I have some tcl ivr script and I need to change it but I don’t know how. I have script which play menu message (tree items) during incoming calls and offer to choose one item. Now script work so if user choose item 1 script connect him to operator 1, if the user choose item 2 script connect him to operator 2 and if user choose item 3 script connect him to operator 3. I need make so then user choose item 1 script play message “please enter extension number” and offer user to enter extension number after that script connect user to this extension number. Item 2 and item 3 need to work as before.
This is my script:
#------------------------------------------------------------------
#
#
#-------------------------------------------------------------------
#
proc init { } {
global param1
global selectCnt
global callInfo
global legConnected
global maxExtensionLen
set param1(interruptPrompt) true
set param1(maxDigits) 1
set param1(abortKey) *
set param1(terminationKey) #
set selectCnt 0
set legConnected false
}
proc init_ConfigVars { } {
global destination
global aaPilot
global oprtr
global menu1
global menu2
global menu3
global maxExtensionLen
# aa-pilot is the IVR number configured on the gateway to be used by the customer
# operator is the operator number for assisted calling
if [infotag get cfg_avpair_exists aa-pilot] {
set aaPilot [string trim [infotag get cfg_avpair aa-pilot]]
} else {
set aaPilot "NONE"
}
if [infotag get cfg_avpair_exists operator] {
set oprtr [string trim [infotag get cfg_avpair operator]]
} else {
set oprtr "NONE"
}
if [infotag get cfg_avpair_exists line1] {
set menu1 [string trim [infotag get cfg_avpair line1]]
} else {
set menu1 "NONE"
}
if [infotag get cfg_avpair_exists line2] {
set menu2 [string trim [infotag get cfg_avpair line2]]
} else {
set menu2 "NONE"
}
if [infotag get cfg_avpair_exists line3] {
set menu3 [string trim [infotag get cfg_avpair line3]]
} else {
set menu3 "NONE"
}

if [infotag get cfg_avpair_exists max-extension-length] {
set maxExtensionLen [string trim [infotag get cfg_avpair max-extension-length]]
if { $maxExtensionLen < 0 } {
call close
}
} else {
set maxExtensionLen 4
}
}
proc init_perCallVars { } {
puts "\nproc init_perCallvars"
global ani
global digit_enabled
global fcnt
global retrycnt
global dnis
set fcnt 0
set retrycnt 2
set ani ""
set dnis ""
set digit_enabled "FALSE"
set ani [infotag get leg_ani]
puts "\nANI $ani"
set dnis [infotag get leg_dnis]
puts "\nDNIS $dnis"
}
proc act_Setup { } {
global param1
global selectCnt
global dest
global beep
global callInfo
global dnis
global fcnt
global aaPilot
global oprtr
global menu1
global menu2
global menu3
global busyPrompt
global legConnected
puts "proc act_Setup"
set busyPrompt _dest_unreachable.au
set beep 0
init_perCallVars
infotag set med_language 1
if { ($dnis == "") || ($dnis == $aaPilot) } {
leg setupack leg_incoming
leg proceeding leg_incoming
leg connect leg_incoming
set legConnected true
puts "\nNo DNIS\n"
set param1(dialPlan) true
leg collectdigits leg_incoming param1
media play leg_incoming _welcome.au %s1000 _enter_dest.au
} else {
set fcnt 6
leg setupack leg_incoming
#handoff callappl leg_incoming default "DESTINATION=$dnis"
set callInfo(alertTime) 30
leg setup $dnis callInfo leg_incoming
fsm setstate HANDOFF
}

}
proc act_GotDest { } {
global dest
global maxExtensionLen
global destExtLen
global callInfo
global oprtr
global menu1
global menu2
global menu3
global busyPrompt
puts "\n proc act_GotDest"
set status [infotag get evt_status]
set callInfo(alertTime) 30
if { ($status == "cd_004") } {
set dest [infotag get evt_dcdigits]
if { $dest == "0" } {
set dest $oprtr
}
#handoff callappl leg_incoming default "DESTINATION=$dest"
leg setup $dest callInfo leg_incoming
} elseif { ($status == "cd_001") || ($status == "cd_002") } {
set dest $oprtr
#handoff callappl leg_incoming default "DESTINATION=$dest"
leg setup $dest callInfo leg_incoming
} else {
if { $status == "cd_006" } {
set busyPrompt _dest_unreachable.au
}
puts "\nCall [infotag get con_all] got event $status collecting destination"
set dest [infotag get evt_dcdigits]
if { $dest == "0" } {
set dest $oprtr
#handoff callappl leg_incoming default "DESTINATION=$dest"
leg setup $dest callInfo leg_incoming
} elseif { $dest == "1" } {
#set dest $oprtr
set dest $menu1
#handoff callappl leg_incoming default "DESTINATION=$dest"
leg setup $dest callInfo leg_incoming
} elseif { $dest == "2" } {
set dest $menu2
#handoff callappl leg_incoming default "DESTINATION=$dest"
leg setup $dest callInfo leg_incoming
} elseif { $dest == "3" } {
set dest $menu3
#handoff callappl leg_incoming default "DESTINATION=$dest"
leg setup $dest callInfo leg_incoming
} else {
act_Select
}
}
}
proc act_CallSetupDone { } {
global busyPrompt
global legConnected
set status [infotag get evt_status]
if { $status == "ls_000" } {
puts "\n Connection success"
handoff appl leg_all default
act_Cleanup
} else {
if { $legConnected == "false" } {
leg proceeding leg_incoming
leg connect leg_incoming
set legConnected true
}
puts "\n Call failed. Play prompt and collect digit"
if { ($status == "ls_007") } {
set busyPrompt _dest_busy.au
}
act_Select
}
}
proc act_Select { } {
global destination
global promptFlag2
global destBusy
global param1
global fcnt
global retrycnt
global busyPrompt

puts "\n proc act_Select"
set promptFlag2 0
set param1(interruptPrompt) true
set param1(abortKey) *
set param1(terminationKey) #
set param1(dialPlan) true
set param1(dialPlanTerm) true
leg collectdigits leg_incoming param1
if { $fcnt < $retrycnt } {
media play leg_incoming $busyPrompt %s500 _reenter_dest.au
incr fcnt
fsm setstate GETDEST
} else {
act_DestBusy
}
}
proc act_DestBusy { } {
puts "\n proc act_DestBusy"
media play leg_incoming _disconnect.au
fsm setstate CALLDISCONNECT
}
proc act_Cleanup { } {
call close
}
requiredversion 2.0
init
init_ConfigVars
#----------------------------------
# State Machine
#----------------------------------
set fsm(any_state,ev_disconnected) "act_Cleanup same_state"
set fsm(any_state,ev_disconnect_done) "act_Cleanup same_state"

set fsm(CALL_INIT,ev_setup_indication) "act_Setup GETDEST"
set fsm(GETDEST,ev_collectdigits_done) "act_GotDest HANDOFF"
#set fsm(HANDOFF,ev_returned) "act_CallSetupDone CONTINUE"

set fsm(HANDOFF,ev_setup_done) "act_CallSetupDone CONTINUE"
set fsm(CALLDISCONNECT,ev_media_done) "act_Cleanup same_state"

fsm define fsm CALL_INIT

Subject: RE: I need help with TCL IVR script
Replied by: Anusha Kannappan on 06-06-2012 06:38:59 AM
Hi Alexander,

You could download and refer the its-CISCO.2.0.3.0.zip from the following location

http://developer.cisco.com/web/vgapi/docs/-/document_library/view/1399664

Thanks,
Anusha

Subject: RE: I need help with TCL IVR script
Replied by: Alexander Pluzhnikov on 06-06-2012 10:21:23 AM
Thank you for your help Anusha. I downloaded this script and made some changes. And now I have a question about new script. Can you advice me how I can fix a problem with the new my script. When a user call to IVR and press "9" IVR make transfer the call to fax extension but not immediately yet after some pause (inter-digit timeout). I need to make transfer the call to fax extension immediate without pause. Can you advise me how I can fix this pause.

Subject: RE: I need help with TCL IVR script
Replied by: Alexander Pluzhnikov on 06-06-2012 10:31:01 AM
this is my new script:
#        


proc init { } {
    global param1
    global selectCnt
    global callInfo
    global legConnected
    global maxExtensionLen
global greetingClose

    set param1(interruptPrompt) true
    set param1(abortKey) *
    set param1(terminationKey) #
set param1(interDigitTimeout) 4

    set selectCnt 0
    set legConnected false
}

proc init_ConfigVars { } {
    global destination
    global aaPilot
    global oprtr
    global fax
    global maxExtensionLen

# aa-pilot is the IVR number configured on the gateway to be used by the customer
# operator is the operator number for assisted calling

    if [infotag get cfg_avpair_exists aa-pilot] {
        set aaPilot [string trim [infotag get cfg_avpair aa-pilot]]
    } else {
        set aaPilot "NONE"
    }
    if [infotag get cfg_avpair_exists operator] {
        set oprtr [string trim [infotag get cfg_avpair operator]]
    } else {
        set oprtr "NONE"
    }
if [infotag get cfg_avpair_exists faxnumber] {
        set fax [string trim [infotag get cfg_avpair faxnumber]]
    } else {
        set fax "NONE"
}
    if [infotag get cfg_avpair_exists max-extension-length] {
   set maxExtensionLen [string trim [infotag get cfg_avpair max-extension-length]]
   if { $maxExtensionLen < 0 } {
    call close
      }
    } else {
        set maxExtensionLen 4
    }
}

proc init_perCallVars { } {
    puts "\nproc init_perCallvars"
    global ani
    global digit_enabled
    global fcnt
    global retrycnt
    global dnis

    set fcnt 0
    set retrycnt 2
    set ani ""
    set dnis ""

    set digit_enabled "FALSE"
    set ani [infotag get leg_ani]
    puts "\nANI $ani"
    set dnis [infotag get leg_dnis]
    puts "\nDNIS $dnis"
}

proc act_Setup { } {
    global param1
    global selectCnt
    global dest
    global beep
    global callInfo
    global dnis
    global fcnt
    global aaPilot
    global oprtr
    global fax
    global busyPrompt
    global legConnected
global greetingClose

    puts "proc act_Setup"
    set busyPrompt _dest_unreachable.au
    set beep 0
set nowHour [clock format [clock seconds] -format %R]
    init_perCallVars
    infotag set med_language 1

    if {[infotag get cfg_avpair_exists outworkhour]} {
        set owHour [infotag get cfg_avpair outworkhour]
   } else {
        set owHour "18:00 09:00"
   }

    if { ($dnis == "") || ($dnis == $aaPilot) } {
        leg setupack leg_incoming
        leg proceeding leg_incoming
        leg connect leg_incoming
        set legConnected true

        puts "\nNo DNIS\n"
        set param1(dialPlan) true
        leg collectdigits leg_incoming param1

        media play leg_incoming _welcome.au %s1000 _enter_dest.au
    } else {
        set fcnt 6
        leg setupack leg_incoming
        #handoff callappl leg_incoming default "DESTINATION=$dnis"
        set callInfo(alertTime) 30
        leg setup $dnis callInfo leg_incoming
        fsm setstate HANDOFF
    }

set start [lindex $owHour 0]
   set end [lindex $owHour 1]
    puts "\n--- SUNRISE Start is $start End is $end NowHour is $nowHour"
   set owYes 0
set cc [string compare $start $end]
    puts "\n--- SUNRISE cc is $cc"
     
if { $cc } {
     if { $cc == 1 } {
       puts "\n--- SUNRISE start > end"         
       set cc1 [string compare $nowHour $start]
       set cc2 [string compare $nowHour $end]
       puts "\n--- SUNRISE cc1 $cc1 cc2 $cc2"
       if { $cc1 == 1 || $cc2 == -1 } {
         puts "\n--- SUNRISE match"
   set owYes 1
        }
       } else {
          puts "\n--- SUNRISE start < end"
          set cc1 [string compare $nowHour $start]
          set cc2 [string compare $nowHour $end]
          puts "\n--- SUNRISE cc1 $cc1 cc2 $cc2"
          if { $cc1 == 1 && $cc2 == -1 } {
            puts "\n--- SUNRISE match"
         set owYes 1
          }
        }
      } else {
        puts "\n--- SUNRISE start = end"       
      }
if { $owYes == 1 } {
      set greetingClose [ infotag get cfg_avpair outworkgreeting ]
   media play leg_incoming $greetingClose
   fsm setstate CALLDISCONNECT
}
}


proc act_GotDest { } {
    global dest
    global maxExtensionLen
    global destExtLen
    global callInfo
    global oprtr
    global fax
    global busyPrompt
    puts "\n proc act_GotDest"
    set status [infotag get evt_status]
    set callInfo(alertTime) 30
puts "\n STATUS: $status"
puts "\n MAXEXTENSION: $maxExtensionLen"
    if {  ($status == "cd_004") } {
        set dest [infotag get evt_dcdigits]

        set destExtLen [string length $dest]
puts "\n DESTLEN: $destExtLen"
   set extLength [expr $maxExtensionLen - $destExtLen]
        if { $dest == "0" } {
                set dest $oprtr
  }
  if { $dest == "9" } {
    set dest $fax
  }
puts "\n extLength: $extLength"

        #handoff callappl leg_incoming default "DESTINATION=$dest"
        if {($maxExtensionLen > 0) && ($extLength >= 0)} {
            leg setup $dest callInfo leg_incoming
        } else {
            set busyPrompt _bacd_invalidoption.au
            act_Select
        }
    } elseif { ($status == "cd_001") || ($status == "cd_002") } {
        set dest $oprtr
        #handoff callappl leg_incoming default "DESTINATION=$dest"
        leg setup $dest callInfo leg_incoming
    }   else {
        if { $status == "cd_006" } {
                set busyPrompt _dest_unreachable.au
        }
        puts "\nCall [infotag get con_all] got event $status collecting destination"
        set dest [infotag get evt_dcdigits]
        if { $dest == "0" } {
                set dest $oprtr
                #handoff callappl leg_incoming default "DESTINATION=$dest"
                leg setup $dest callInfo leg_incoming
    } elseif { $dest == "9" } {
                set dest $fax
                #handoff callappl leg_incoming default "DESTINATION=$dest"
                leg setup $dest callInfo leg_incoming
         } else {
                act_Select
        }
    }
}

proc act_CallSetupDone { } {
    global busyPrompt
    global legConnected

    set status [infotag get evt_status]
    if { $status == "ls_000" } {
        puts "\n Connection success"
        handoff appl leg_all default
        act_Cleanup
    } else {
        if { $legConnected == "false" } {
            leg proceeding leg_incoming 
            leg connect leg_incoming 
            set legConnected true
        }
        puts "\n Call failed.  Play prompt and collect digit"
        if { ($status == "ls_007") } {
            set busyPrompt _dest_busy.au
        }
        act_Select
   }
}

proc act_Select { } {
    global destination
    global promptFlag2
    global destBusy
    global param1
    global fcnt
    global retrycnt
    global busyPrompt
   
    puts "\n proc act_Select"

    set promptFlag2 0
    set param1(interruptPrompt) true
    set param1(abortKey) *
    set param1(terminationKey) #
    set param1(dialPlan) true
    set param1(dialPlanTerm) true

    leg collectdigits leg_incoming param1
    if { $fcnt < $retrycnt } {
        media play leg_incoming $busyPrompt %s500 _reenter_dest.au
        incr fcnt
        fsm setstate GETDEST
    } else {
        act_DestBusy
    }
}

proc act_DestBusy { } {
    puts "\n proc act_DestBusy"
    media play leg_incoming _disconnect.au
    fsm setstate CALLDISCONNECT
}

proc act_Cleanup { } {
    call close
}

requiredversion 2.0
init

init_ConfigVars
#----------------------------------
#   State Machine
#----------------------------------
  set fsm(any_state,ev_disconnected)   "act_Cleanup  same_state"

  set fsm(any_state,ev_disconnect_done)   "act_Cleanup  same_state"
 
  set fsm(CALL_INIT,ev_setup_indication) "act_Setup  GETDEST"

  set fsm(GETDEST,ev_collectdigits_done) "act_GotDest HANDOFF"

  #set fsm(HANDOFF,ev_returned)   "act_CallSetupDone  CONTINUE"

  set fsm(HANDOFF,ev_setup_done)   "act_CallSetupDone  CONTINUE"

  set fsm(CALLDISCONNECT,ev_media_done) "act_Cleanup  same_state"
 
  fsm define fsm CALL_INIT
# Script Approval Signature: C/775c

Subject: Thread Splitted
Replied by: Anusha Kannappan on 07-06-2012 05:13:32 AM
The new thread can be found at http://developer.cisco.com/web/vgapi/forums/-/message_boards/view_message/5830264.

Subject: RE: I need help with TCL IVR script
Replied by: Anusha Kannappan on 07-06-2012 05:41:26 AM
Hi Alexander,

As it is clearly stated in the script it has to wait for interDigitTimeout and then only do a leg setup. Please  try changing the time less than the specified in the script.

Thanks,
Anusha
Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Quick Links