PHP Classes

File: E1loadd

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in Bookmark in
  Classes of Dmitry A. Kirilin  >  FSM Chat  >  E1loadd  >  Download  
File: E1loadd
Role: Example script
Content type: text/plain
Description: Cisco chatter
Class: FSM Chat
Automated dialog robot using finite state machines
Author: By
Last change: Minor bugfixes
Date: 9 years ago
Size: 1,722 bytes


Class file image Download

This script will continuously print active voice call table of Cisco gateway

//This function will print table entries
function myHandler($str){
preg_match("/(ANS)|(ORG)/",$str))echo $str."\n";


$chatter=new FSMChat();

//Now let's define FSM

//In ENABLE state, when cisco gives an enable command prompt, request active call table
//FSM State unchanged.
$chatter->FSM('/\#$/','sleep(1);return("show call active voice compact\n");',NULL,"ENABLE");

//Immediately continue output if there is more than 25 lines (only in ENABLE state)
//FSM State unchanged.
$chatter->FSM('/\s--More--/','return(" ");',NULL,"ENABLE");

//All other strings will be passed to my handler (only in ENABLE state)
//FSM State unchanged.

//Here we will log in and enter enable mode
//FSM State changes from LOGIN (initial) through LOGGEDIN to ENABLE during login process

//Ignore all other data from cisco

//Let's go!


//Telnet session, packet-oriented algorithm chosen.
echo "STOP:".$chatter->RunPacket($conn,"LOGIN",1)."\n";