« Back to TCL-API

RE: Get current dialpeer connections

Combination View Flat View Tree View
Threads [ Previous | Next ]
Hello,
 
Is it possible with TCL to retrieve the amount of connections a dialpeer has?
 
When I issue the show dial-peer voice <tag> | include connections command, the output shows:
incoming called-number = `123456789', connections/maximum = 0/unlimited,
 
I guess I can read the output and find the digit which represents the current connections, but Im hoping there is a builtin command to just return the amount of connections for a specified dialpeer.
 
Thanks!
Grant
 


Here is a way to do it. This will do for me, but I don't know if it will do across multiple IOS versions.

set input [exec show dial-peer voice 1000 | section connections]
regexp {connections/maximum = ([0-9]*)} $input -> output
puts $output

Lets say I have the following string: incoming called-number = `123456789', connections/maximum = 0/unlimited,
When I execute the following command: regexp {incoming called-number = (`[0-9]*')} $input -> serviceNumber. The output is: `123456789'

When I execute the following command: regexp {incoming called-number = ([0-9]*)} $input -> serviceNumber. Notice the single quotes are gone. The output is: <EMPTY>, though the regexp returns 1.

Could someone help me with my regex pattern so it will just return 123456789, so without the quotes?

Thanks

% set st "incoming called-number = `123456789', connections/maximum = 0/unlimited,"
incoming called-number = `123456789', connections/maximum = 0/unlimited,
% regexp {[0-9]+} $st st
1
% puts $st
123456789
%

Thanks that works.

Could someone explain to me why the command: set input [exec show dial-peer voice | section incoming called-number `123456789'] works in #tclsh mode, but when I add this command to a script and place a call to the number which then executes the script, cisco tells me invallid command name "exec"?

Hi Grant,

Actually the TCL/VXML IVR API cannot execute IOS command inside the script.

Thanks,
Anusha

Alright. That's too bad.

Thanks!

Try Cisco EEM see if you can use it.
https://supportforums.cisco.com/community/netpro/private/pilot/eem

Thanks.