cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1788
Views
5
Helpful
6
Replies

EMM Script to monitor voice calls longer than 100 seconds.

levpham
Cisco Employee
Cisco Employee

Hi Team,

Customer would like to be notified when calls are longer than 100 seconds.  The 2 scripts below aren't working.  The email notification part is working fine.  It is the "if" statement that isn't.  Please help.  Thanks in advance.

event manager applet Long_Call
event none
action 1.1 cli command "enable"
action 1.2 cli command "show isdn active"
action 1.3 regexp "Seconds" "$_cli_result"
action 1.4 if $_regexp_result gt "100"
action 2.0 mail server.......

...

event manager applet Long_Call
 event timer watchdog name Timer time 60
 action 1.0 cli pattern "show isdn active" sync yes
 action 1.2 cli command "enable"
 action 1.3 cli command "show isdn active"
 action 1.4 if ^SecondsUsed gt "100" goto 2.0 
 action 1.5 end
action 2.0 mail server .......

1 Accepted Solution

Accepted Solutions

Try this one.

event manager applet Long_Call
event none
action 010 cli command "enable"
action 020 cli command "show isdn active"

action 030 foreach result $_cli_result

action 040 regexp "[A-Za-z]+\s+[0-9]+\s+[0-9]+\s+([0-9]+)\s+" "$result" match seconds

action 050 if $seconds gt "100"

action 060 mail server "

action 070 end

action 080 end

View solution in original post

6 Replies 6

Dan Frey
Cisco Employee
Cisco Employee

What does "show isdn active" show when there are calls established?   Do you want an email for each call that is over 100 seconds or,    one email if one of XX number of calls goes over 100s?

Here is the output:

lsf5-vrt01#show isdn active
--------------------------------------------------------------------------------
                                ISDN ACTIVE CALLS
--------------------------------------------------------------------------------
Call    Calling      Called       Remote  Seconds Seconds Seconds Charges
Type    Number       Number       Name    Used    Left    Idle    Units/Currency
--------------------------------------------------------------------------------
In   6504293300  4155008968                  2944       0       0              
In   2126159369  4155008626                  2243       0       0              
In   4155008737  4155009214                  1942       0       0              
In   6504503257  4155008365                  1867       0       0              
In   5187961200  4155008661                   257       0       0              
In   4155247877  4155009179                   229       0       0              
In   7342051000  4155008410                   203       0       0              
In   6504293300  4155009001                   137       0       0              
In   5599302412  4155008432                    98       0       0              
In  +4165456436  4155008963                    96       0       0              
In   6504293300  4155009499                    59       0       0              
In   3023513839  4155008980                    53       0       0              
In   8187076859  4155008651                    40       0       0              
In   8014779800  4155009289                     1       0       0              
--------------------------------------------------------------------------------

lsf5-vrt01#

-- Under seconds used, we would like an email if any ONE call went over 100 seconds. Of course the 100 seconds is just a test - the production value will be much higher. Maybe like anything over 6 hours = 21600 seconds.

Thank you Daniel,

Try this one.

event manager applet Long_Call
event none
action 010 cli command "enable"
action 020 cli command "show isdn active"

action 030 foreach result $_cli_result

action 040 regexp "[A-Za-z]+\s+[0-9]+\s+[0-9]+\s+([0-9]+)\s+" "$result" match seconds

action 050 if $seconds gt "100"

action 060 mail server "

action 070 end

action 080 end

Hi Daniel,

Customer tried yours and another one but still didn't work.  Also customer turned on debug during the test.

event manager applet Long_Call
event none
action 010 cli command "enable"
action 020 cli command "show isdn active"
action 030 foreach result $_cli_result
action 040 regexp "[A-Za-z]+\s+[0-9]+\s+[0-9]+\s+([0-9]+)\s+" "$result" match seconds
action 050 if $seconds gt "100"
action 060 mail server "mail.corp....."
action 070 end

-----

event manager applet Long_Call
event none
action 010 cli command "enable"
action 020 cli command "show isdn active"
action 030 foreach result $_cli_result
action 040 regexp "[A-Za-z]+\s+[0-9]+\s+[0-9]+\s+([0-9]+)\s+" "$_cli_result" match seconds
action 050 if $seconds gt "100"
action 060 mail server "mail.corp...."
action 070 end


-----

Nov 16 18:15:00.009: fh_fd_timer_process_async
Nov 16 18:15:00.881: cli_history_entry_add: free_hist_list size=0, hist_list size=7
Nov 16 18:15:00.881: check_eem_cli_policy_handler: command_string=event manager run Long_Call
Nov 16 18:15:00.881: check_eem_cli_policy_handler: num_matches = 0, response_code = 1
Nov 16 18:15:00.881: fh_fd_match_event: re=0x26A0CCBC, policyname=Long_Call, parameters=,

Thank you,

Le,

I updated the line 030 with \n which is needed as well.   Also please include line 080 so there are two end statements (on lines 070 and 080).  

event manager applet Long_Call
event none
action 010 cli command "enable"
action 020 cli command "show isdn active"

action 030 foreach result $_cli_result \n

action 040 regexp "[A-Za-z]+\s+[0-9]+\s+[0-9]+\s+([0-9]+)\s+" "$result" match seconds

action 050 if $seconds gt "100"

action 060 mail server "

action 070 end

action 080 end

Hi Daniel,

Thank you for your support!  By the way, can you remove customer's email information?

Thank you again.

Le,

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: