<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>TCL-API</title>
  <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_category?p_l_id=&amp;mbCategoryId=1063409" />
  <subtitle />
  <id>http://developer.cisco.com/c/message_boards/find_category?p_l_id=&amp;mbCategoryId=1063409</id>
  <updated>2013-06-20T12:43:25Z</updated>
  <dc:date>2013-06-20T12:43:25Z</dc:date>
  <entry>
    <title>RE: Possible to use wildcards in param clid under service ani_filter?</title>
    <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=16351168" />
    <author>
      <name>Lisandro Quinteros</name>
    </author>
    <id>http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=16351168</id>
    <updated>2013-06-19T15:11:24Z</updated>
    <published>2013-06-19T15:11:24Z</published>
    <summary type="html">I think nop.. You have 2 ways or get all that logic under [font=monospace]proc act_Setup { } {  or call [/font][font=monospace]proc fixnum  procedure inside proc act_Setup {} refer to Tcl ivr guide to acomplish that..

[/font]</summary>
    <dc:creator>Lisandro Quinteros</dc:creator>
    <dc:date>2013-06-19T15:11:24Z</dc:date>
  </entry>
  <entry>
    <title>RE: Possible to use wildcards in param clid under service ani_filter?</title>
    <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=16350909" />
    <author>
      <name>Chris Bomba</name>
    </author>
    <id>http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=16350909</id>
    <updated>2013-06-19T15:02:02Z</updated>
    <published>2013-06-19T15:02:02Z</published>
    <summary type="html">Does this script make sense?

[code]# ani_filter.tcl
# Script Version 1.0(1)
#------------------------------------------------------------------
# October 2002, Niels Brunsgaard
#
# Copyright (c) 1998-2002 by cisco Systems, Inc.
# All rights reserved.
#------------------------------------------------------------------
#
# This tcl script filters calls based on ANI. If there is a match # against a pe-configured list of numbers it changes the DNIS # to a configurable value #
#

proc init { } {
    global param
}

proc act_Setup { } {
    
    leg setupack leg_incoming

    set num [infotag get leg_dnis]
    set new_dnis ""
    }

    # fixnum num
# num - the phone number you want to fix
# takes num, decides if it's local or long distance and adds/removes a leading 1 as required
# returns the new phone number with or without the 1
proc fixnum {num} {

# a list of all local prefixes
# if a match isn't found in this list it is assumed the number is long distance
# these must all be 6 characters long or you will need to change the code
set local [list \
281208 \
832922 \
832964 \
832967 \
832969 \
              ];


# if the number is &lt; 10 digits don't change it
if { [ string length $num ] &lt; 10 } {
    return $num;
}

# get the first two digits
set ftd [ string range $num 0 1 ];

#if the first two digits are 90 don't change it (meant for international 011 calls)
if { $ftd == 90 } {
    return $num;
}

# if first two digits are 91 we drop the 1 regardless, we want to work the first 6 digits, starting with the area code
if { $ftd == 91 } {
    set num [ string range $num 2 [ string length $num ] ];
}

# get first 6 digits, and see if they're in the list of local numbers
set snum [ string range $num 0 5 ];
set islocal [ lsearch $local $snum ];

# if they're not local add the 91 at the start
if { $islocal == -1 } {
    set num "91$num";
}

# return the number with the 1 added/removed as required
return $num;

}
    puts "Final dnis $num"
    leg proceeding leg_incoming
    leg setup $num callInfo leg_incoming
}

proc act_CallSetupDone { } {
    global beep
 
    set status [infotag get evt_status]
 
    puts "Entering act_CallSetupDone"
    if { $status != "ls_000"} {
        puts "Call [infotag get con_all] got event $status while placing an outgoing call"
        call close
    }
}

proc act_Cleanup { } {
    puts "Entering act_Cleanup"
    call close
}

proc act_Abort { } {
    puts "Unexpected event - entering act_Abort"
    call close
}

init
 
#----------------------------------
#   State Machine
#----------------------------------
  set TopFSM(any_state,ev_disconnected) "act_Abort,same_state"
  set TopFSM(CALL_INIT,ev_setup_indication) "act_Setup,PLACECALL"
  set TopFSM(PLACECALL,ev_setup_done)  "act_CallSetupDone,CALLACTIVE"
  set TopFSM(CALLACTIVE,ev_disconnected)   "act_Cleanup,CALLDISCONNECTED"
  set TopFSM(CALLDISCONNECTED,ev_disconnect_done) "act_Cleanup,same_state"

  fsm define TopFSM  CALL_INIT[/code]</summary>
    <dc:creator>Chris Bomba</dc:creator>
    <dc:date>2013-06-19T15:02:02Z</dc:date>
  </entry>
  <entry>
    <title>RE: change number on out-bound</title>
    <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=16350050" />
    <author>
      <name>Lisandro Quinteros</name>
    </author>
    <id>http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=16350050</id>
    <updated>2013-06-19T14:40:06Z</updated>
    <published>2013-06-19T14:40:06Z</published>
    <summary type="html">Chris, I haven't read your complete script, but you could put that logic after you got the dialed number on a variable and before leg setup..


  set dnis [infotag get evt_handoff dnis]
# I think you  could put that logic between this lines

  leg setup $dnis callInfo leg_incoming

Take care about variables becouse  [b][center]Jonathan Smith [/center][/b]is using $num and you are using $dnis</summary>
    <dc:creator>Lisandro Quinteros</dc:creator>
    <dc:date>2013-06-19T14:40:06Z</dc:date>
  </entry>
  <entry>
    <title>RE: change number on out-bound</title>
    <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=16346788" />
    <author>
      <name>Chris Bomba</name>
    </author>
    <id>http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=16346788</id>
    <updated>2013-06-19T13:56:25Z</updated>
    <published>2013-06-19T13:56:25Z</published>
    <summary type="html">Does this logic go under proc do_setup?</summary>
    <dc:creator>Chris Bomba</dc:creator>
    <dc:date>2013-06-19T13:56:25Z</dc:date>
  </entry>
  <entry>
    <title>RE: change number on out-bound</title>
    <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=16278028" />
    <author>
      <name>Chris Bomba</name>
    </author>
    <id>http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=16278028</id>
    <updated>2013-06-17T19:49:50Z</updated>
    <published>2013-06-17T19:49:50Z</published>
    <summary type="html">I am trying to accomplish the exact same thing.  What else do I need to finish the script?  I am sending the 9 to the gateway so I made some adjustments, do they look right?
[code]# if the number is &lt; 10 digits don't change it
if { [ string length $num ] &lt; 10 } {
    return $num;
}

# get the first two digits
set ftd [ string range $num 0 1 ];

#if the first two digits are 90 don't change it (meant for international 011 calls)
if { $ftd == 90 } {
    return $num;
}

# if first two digits are 91 we drop the 1 regardless, we want to work the first 6 digits, starting with the area code
if { $ftd == 91 } {
    set num [ string range $num 2 [ string length $num ] ];
}

# get first 6 digits, and see if they're in the list of local numbers
set snum [ string range $num 0 5 ];
set islocal [ lsearch $local $snum ];

# if they're not local add the 91 at the start
if { $islocal == -1 } {
    set num "91$num";
}

# return the number with the 1 added/removed as required
return $num;[/code]</summary>
    <dc:creator>Chris Bomba</dc:creator>
    <dc:date>2013-06-17T19:49:50Z</dc:date>
  </entry>
  <entry>
    <title>RE: change number on out-bound</title>
    <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=16273783" />
    <author>
      <name>Jonathan Smith</name>
    </author>
    <id>http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=16273783</id>
    <updated>2013-06-17T18:50:58Z</updated>
    <published>2013-06-17T18:50:58Z</published>
    <summary type="html">[quote=Chris Bomba][quote=Jonathan Smith]Raghavendra,

Yes the script is dialing out the same dial-peer as it is on.  I thought that was the problem but I was hoping I was missing something.  I have moved the script to the inbound side now.  This will cause complications for me in the future, but it is working now and I'll worry about this again then.

Thanks for your help.[/quote]
I was hoping to do the same thing you are doing but I want to put my matching pairs in a flat file because there are 1100 entries.  How would I call the file from the tcl script?[/quote]
Hi Chris,

I never read the pairs from a file so I can't help with that.  I did have ~1600 entries in my TCL script though so your 1100 shouldn't be any worse.

Here was what I did in my script.  It worked for us, but this was the first thing I ever wrote in TLC so there's probably a better way to do it.

[code]
# fixnum num
# num - the phone number you want to fix
# takes num, decides if it's local or long distance and adds/removes a leading 1 as required
# returns the new phone number with or without the 1
proc fixnum {num} {

# a list of all local prefixes
# if a match isn't found in this list it is assumed the number is long distance
# these must all be 6 characters long or you will need to change the code
set local [list \
 289200 \
 289202 \
 289206 \
# removed lots of numbers
 905998 \
 905999 \
              ];


# if the number is &lt; 10 digits don't change it
if { [ string length $num ] &lt; 10 } {
    return $num;
}

# get the first digit
set fd [ string index $num 0 ];

#if the first digit is 0 don't change it (meant for international 011 calls)
if { $fd == 0 } {
    return $num;
}

# if first digit is 1 we drop the 1 regardless, we want to work the first 6 digits, starting with the area code
if { $fd == 1 } {
    set num [ string range $num 1 [ string length $num ] ];
}

# get first 6 digits, and see if they're in the list of local numbers
set snum [ string range $num 0 5 ];
set islocal [ lsearch $local $snum ];

# if they're not local add the 1 at the start
if { $islocal == -1 } {
    set num "1$num";
}

# return the number with the 1 added/removed as required
return $num;

}

[/code]</summary>
    <dc:creator>Jonathan Smith</dc:creator>
    <dc:date>2013-06-17T18:50:58Z</dc:date>
  </entry>
  <entry>
    <title>RE: Possible to use wildcards in param clid under service ani_filter?</title>
    <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=16272040" />
    <author>
      <name>Yaw-Ming Chen</name>
    </author>
    <id>http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=16272040</id>
    <updated>2013-06-17T17:27:57Z</updated>
    <published>2013-06-17T17:27:57Z</published>
    <summary type="html">use " 91281       9281" format maybe easier

Anyway if you can find a pattern you can utilize regular expression</summary>
    <dc:creator>Yaw-Ming Chen</dc:creator>
    <dc:date>2013-06-17T17:27:57Z</dc:date>
  </entry>
  <entry>
    <title>RE: Possible to use wildcards in param clid under service ani_filter?</title>
    <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=16271005" />
    <author>
      <name>Chris Bomba</name>
    </author>
    <id>http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=16271005</id>
    <updated>2013-06-17T17:15:04Z</updated>
    <published>2013-06-17T17:15:04Z</published>
    <summary type="html">[quote=Yaw-Ming Chen]Yes you can use that concept,  or if you can find a pattern you can just use tcl string command to manipulate it. 
for example if you just need to remove every second digit then use some string commands is enough, [b]91281208 [/b][b]--&gt; 9281208 [/b]

Thanks,[/quote]
I think they are going to have to be in a file because 91282 might have to proceed while 91281 will have to be changed to 9281.  What should my text file look like?  

91281,9281

or 

91281       9281</summary>
    <dc:creator>Chris Bomba</dc:creator>
    <dc:date>2013-06-17T17:15:04Z</dc:date>
  </entry>
  <entry>
    <title>RE: Possible to use wildcards in param clid under service ani_filter?</title>
    <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=16269722" />
    <author>
      <name>Yaw-Ming Chen</name>
    </author>
    <id>http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=16269722</id>
    <updated>2013-06-17T17:12:43Z</updated>
    <published>2013-06-17T17:12:43Z</published>
    <summary type="html">Yes you can use that concept,  or if you can find a pattern you can just use tcl string command to manipulate it. 
for example if you just need to remove every second digit then use some string commands is enough, [b]91281208 [/b][b]--&gt; 9281208 [/b]

Thanks,</summary>
    <dc:creator>Yaw-Ming Chen</dc:creator>
    <dc:date>2013-06-17T17:12:43Z</dc:date>
  </entry>
  <entry>
    <title>RE: change number on out-bound</title>
    <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=16270932" />
    <author>
      <name>Chris Bomba</name>
    </author>
    <id>http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=16270932</id>
    <updated>2013-06-17T17:10:11Z</updated>
    <published>2013-06-17T17:10:11Z</published>
    <summary type="html">[quote=Jonathan Smith]Raghavendra,

Yes the script is dialing out the same dial-peer as it is on.  I thought that was the problem but I was hoping I was missing something.  I have moved the script to the inbound side now.  This will cause complications for me in the future, but it is working now and I'll worry about this again then.

Thanks for your help.[/quote]
I was hoping to do the same thing you are doing but I want to put my matching pairs in a flat file because there are 1100 entries.  How would I call the file from the tcl script?</summary>
    <dc:creator>Chris Bomba</dc:creator>
    <dc:date>2013-06-17T17:10:11Z</dc:date>
  </entry>
  <entry>
    <title>RE: Possible to use wildcards in param clid under service ani_filter?</title>
    <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=16270698" />
    <author>
      <name>Chris Bomba</name>
    </author>
    <id>http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=16270698</id>
    <updated>2013-06-17T16:54:18Z</updated>
    <published>2013-06-17T16:54:18Z</published>
    <summary type="html">[quote=Yaw-Ming Chen]It really depends on the pattern of your mapping.
 
If the rule is just like you decribed then it's easy. We jsut get the ANI the make DNIS +1 
 
set ani [infotag get leg_ani]
set dnis [expr $ani + 1] 
 
If rule is not this but there is a rule that we can apply regular expression then use regular expression 
 
If ther is no rule then 
1. use the existing script 
or 
2. create a flat text file, example (personally I think this is neater. )
 
5551212 5552001
5551213 5552012
5551214 5552135
....
 
then read the file in when initialize the script.
 
Thanks !
 
 [/quote]
You mention that I can use a flat file that probably gets loaded to in flash to search and alter the number in the above reply.  I have a customer that wants to alter numbers being called from the CallManager through the gateway on certain area codes.  I have the file that show an example as 91281208 being translated to 9281208.  Can I alter the anifiltering.tcl script to look at DNIS instead and load a file int memory to search?

Chris</summary>
    <dc:creator>Chris Bomba</dc:creator>
    <dc:date>2013-06-17T16:54:18Z</dc:date>
  </entry>
  <entry>
    <title>RE: Can't hear ringing</title>
    <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=15757065" />
    <author>
      <name>Mark Alliban</name>
    </author>
    <id>http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=15757065</id>
    <updated>2013-05-31T12:42:42Z</updated>
    <published>2013-05-31T12:42:42Z</published>
    <summary type="html">Nope, doesn't work, even when I remove the TCL completely:
 
dial-peer voice 20 voip
 description Inbound
 voice cut-through alert
 tone ringback alert-no-PI
 session target ras
 incoming called-number .T
 codec g711ulaw
 no vad
dial-peer voice 21 pots
 description Outbound
 voice cut-through alert
 tone ringback alert-no-PI
 destination-pattern .T
 progress_ind alert enable 8
 no digit-strip
 port 2/0:D
 forward-digits all
 </summary>
    <dc:creator>Mark Alliban</dc:creator>
    <dc:date>2013-05-31T12:42:42Z</dc:date>
  </entry>
  <entry>
    <title>RE: Can't hear ringing</title>
    <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=15719665" />
    <author>
      <name>Geevarghese Cheria</name>
    </author>
    <id>http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=15719665</id>
    <updated>2013-05-30T12:32:50Z</updated>
    <published>2013-05-30T12:32:50Z</published>
    <summary type="html">Hi Mark,

  As the Issue is not with the TCL Script, would request to you try out this configuration.

dial-peer voice 18 voip
[b]voice cut-through alert[/b]
[b]tone ringback alert-no-PI[/b]
service testcall
voice-class codec 1
session target ras
[b]incoming called-number .[/b]
dtmf-relay rtp-nte
no vad


Thanks and Regards,
Geevarghese</summary>
    <dc:creator>Geevarghese Cheria</dc:creator>
    <dc:date>2013-05-30T12:32:50Z</dc:date>
  </entry>
  <entry>
    <title>RE: leg setup and dial-peer</title>
    <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=15696472" />
    <author>
      <name>Mark Alliban</name>
    </author>
    <id>http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=15696472</id>
    <updated>2013-05-29T15:58:50Z</updated>
    <published>2013-05-29T15:58:50Z</published>
    <summary type="html">Wow that's a complicated solution! Should work I think, but for this project it's a bit too much. I think it will be easier to find a workaround that does not involve the TCL knowing the dial-peer.
 </summary>
    <dc:creator>Mark Alliban</dc:creator>
    <dc:date>2013-05-29T15:58:50Z</dc:date>
  </entry>
  <entry>
    <title>RE: leg setup and dial-peer</title>
    <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=15692509" />
    <author>
      <name>Yaw-Ming Chen</name>
    </author>
    <id>http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=15692509</id>
    <updated>2013-05-29T14:27:13Z</updated>
    <published>2013-05-29T14:27:13Z</published>
    <summary type="html">You have a Tcl script running on an incoming dialpeer, when setup a outgoing leg it could go to different dialpeer even with the the same number because of load balance right ?
I haven't try the namespace in outbound but it might work, If it works then you might be able to make this to work but it's complicated.
So you will have two scripts, new one will sit on outbound, gathering the dialpeep info, callid,..etc using namespace config. When call comes in, it will send these message to the first script that sent call to here using "sendmsg" command, also get handoff DNIS to make the call out.
 </summary>
    <dc:creator>Yaw-Ming Chen</dc:creator>
    <dc:date>2013-05-29T14:27:13Z</dc:date>
  </entry>
  <entry>
    <title>RE: Can't hear ringing</title>
    <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=15684776" />
    <author>
      <name>Mark Alliban</name>
    </author>
    <id>http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=15684776</id>
    <updated>2013-05-29T10:06:35Z</updated>
    <published>2013-05-29T10:06:35Z</published>
    <summary type="html">No, I don't see 180, whether I use TCL or not.</summary>
    <dc:creator>Mark Alliban</dc:creator>
    <dc:date>2013-05-29T10:06:35Z</dc:date>
  </entry>
  <entry>
    <title>RE: leg setup and dial-peer</title>
    <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=15684638" />
    <author>
      <name>Mark Alliban</name>
    </author>
    <id>http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=15684638</id>
    <updated>2013-05-29T09:52:52Z</updated>
    <published>2013-05-29T09:52:52Z</published>
    <summary type="html">Thanks for the try, but it is the outbound dial-peer that I need to know. The inbound is always the same.
 </summary>
    <dc:creator>Mark Alliban</dc:creator>
    <dc:date>2013-05-29T09:52:52Z</dc:date>
  </entry>
  <entry>
    <title>RE: httpios vs leg vxmldialog</title>
    <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=15676571" />
    <author>
      <name>Yaw-Ming Chen</name>
    </author>
    <id>http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=15676571</id>
    <updated>2013-05-29T03:29:00Z</updated>
    <published>2013-05-29T03:24:15Z</published>
    <summary type="html">It's a typo in that part.  
page 4-9 -- "evt_handoff argstring" has right info
 </summary>
    <dc:creator>Yaw-Ming Chen</dc:creator>
    <dc:date>2013-05-29T03:24:15Z</dc:date>
  </entry>
  <entry>
    <title>RE: httpios vs leg vxmldialog</title>
    <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=15676537" />
    <author>
      <name>Lisandro Quinteros</name>
    </author>
    <id>http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=15676537</id>
    <updated>2013-05-29T03:15:03Z</updated>
    <published>2013-05-29T03:15:03Z</published>
    <summary type="html">It's programmers guido wrong? • The application instance that receives the call leg can retrieve the argument string by using the evt_handoff_argstring information tag.

I was trying with "_" 
thanks for your help.</summary>
    <dc:creator>Lisandro Quinteros</dc:creator>
    <dc:date>2013-05-29T03:15:03Z</dc:date>
  </entry>
  <entry>
    <title>RE: httpios vs leg vxmldialog</title>
    <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=15663511" />
    <author>
      <name>Yaw-Ming Chen</name>
    </author>
    <id>http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=15663511</id>
    <updated>2013-05-28T21:11:41Z</updated>
    <published>2013-05-28T21:11:41Z</published>
    <summary type="html">use 

[infotag get evt_handoff_string]
or 
[infotag get evt_handoff argstring]  &lt;--- space not "_"</summary>
    <dc:creator>Yaw-Ming Chen</dc:creator>
    <dc:date>2013-05-28T21:11:41Z</dc:date>
  </entry>
</feed>

