Get current dialpeer connections

Version 1
    This document was generated from CDN thread

    Created by: Grant Bagdasarian on 08-03-2012 08:35:17 AM
    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
     



    Subject: RE: Get current dialpeer connections
    Replied by: Grant Bagdasarian on 08-03-2012 08:49:57 AM
    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

    Subject: RE: Get current dialpeer connections
    Replied by: Grant Bagdasarian on 08-03-2012 10:17:01 AM
    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

    Subject: RE: Get current dialpeer connections
    Replied by: Yaw-Ming Chen on 08-03-2012 01:23:30 PM
    % 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
    %

    Subject: RE: Get current dialpeer connections
    Replied by: Anusha Kannappan on 09-03-2012 06:13:25 AM
    Hi Grant,

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

    Thanks,
    Anusha

    Subject: RE: Get current dialpeer connections
    Replied by: Grant Bagdasarian on 09-03-2012 04:49:44 AM
    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"?

    Subject: RE: Get current dialpeer connections
    Replied by: Grant Bagdasarian on 09-03-2012 08:36:11 AM
    Alright. That's too bad.

    Thanks!

    Subject: RE: Get current dialpeer connections
    Replied by: Yaw-Ming Chen on 09-03-2012 10:29:57 AM
    Try Cisco EEM see if you can use it.
    https://supportforums.cisco.com/community/netpro/private/pilot/eem

    Subject: RE: Get current dialpeer connections
    Replied by: Grant Bagdasarian on 13-03-2012 10:38:10 AM
    Thanks.