05-02-2016 05:37 PM
Hi, i want to 1. make a EEM script that triggers a TCL script when it receives a specific debug message.
1. i want the TCL thats triggered to grab the Debug message.
so for example, trigger TCL script when you get a debuge message that conatins STATE_ACTIVE:
Apr 28 21:25:06.399: //56112/80E6F81480EC/SIP/Call/sipSPICallInfo:
The Call Setup Information is:
Call Control Block (CCB) : 0x0x3D8D7CD8
State of The Call : STATE_ACTIVE
TCP Sockets Used : NO
Calling Number : 201
Called Number : 401
Source IP Address (Sig ): 192.168.6.11
Destn SIP Req Addr:Port : 192.168.6.35:2059
Destn SIP Resp Addr:Port : 192.168.6.35:2059
Destination Name : 192.168.6.35
then in my TCL script i want to retrieve only calling number and called number and put those in to 2 variables.
any ideas how i could achieve this?
the trigger for TCL could probably look something like this:
event manager applet TCL
event syslog pattern "State of The Call STATE_ACTIVE"
trigger occurs 1 period 0.1
action 1.0 "START TCL..."
Thanks in advance!
05-03-2016 08:11 AM
First, there is no reason to call a tclsh script out of EEM. If you need to use Tcl, use EEM Tcl natively. But in this case, I don't know why you would need to use Tcl.
Typically, EEM can intercept debug messages without a problem. However, in your case, it may be that the trigger message is different than the content message. If that is the case, then what you want will not work. You'd have to use polling and parse the output of "show log". But that is problematic if multiple messages interweave.
Assuming the lines are part of one message, you could do:
event manager applet call-state
event syslog pattern "State of The Call: STATE_ACTIVE"
action 001 regexp "Calling Number: ([0-9]+).*Called Number: ([0-9]+)" "$_syslog_msg" match calling called
action 002 puts "Calling number is $calling and called number is $called"
05-03-2016 10:28 PM
i didnt know you could do it that way!
anyways i get error when i try the script:
%HA_EM-3-FMPD_UNKNOWN_ENV: fh_parse_var: could not find environment variable: calling
EDIT: after i added correct spacing in calling and called number it worked perfect :)
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide