US 20130138593A1 (19) United States (12) Patent Application Publication (10) Pub. No.: US 2013/0138593 A1 Miller et al. (43) Pub. Date: May 30, 2013
(54) METHOD AND APPARATUS FOR Publication Classi?cation OPERATINGA FINITE STATE MACHINE (51) Int. Cl. (71) Applicant: METASWITCH NETWORKS LTD., G06N 5/02 (2006.01) En?eld (GB) (52) US. Cl. CPC ...... G06N 5/02 (2013.01) (72) Inventorsl Craig Miller, Richardson, TX (US); USPC ...... 706/46 Doug Theobald, Richardson, TX (US) (73) Assignee: METASWITCH NETWORKS LTD., (57) ABSTRACT En?eld (GB) A ?nite state machine is provided. The ?nite state machine causes a function to be carried out in dependence on at least an (21) Appl' N05 13/688,981 event input to the ?nite state machine and the current state of _ the ?nite state machine. Associations between the functions (22) Flled: NOV‘ 29’ 2012 that are to be carried out and combinations of the states and . . the events are identi?ed using an associative array. The asso Related U's' Apphcatlon Data ciations identi?ed using the associative array are amended (60) Provisional application No. 61/565,154, ?led on Nov. While the ?nite state machine is operating to dynamically 30, 2011. recon?gure the operation of the ?nite state machine.
800
810 \~{:| /~s02 5, L1\ 811 812, l 813 803
812 812 f 810 m M 813 a“???
1:] __/ 804 \811 811 / KB 813 810 Patent Application Publication May 30, 2013 Sheet 1 0f 7 US 2013/0138593 A1
100
STATE MACHIQE 101 STATES: (AéB) EVENTS: (£2)
FIG. 1 Patent Application Publication May 30, 2013 Sheet 2 0f 7 US 2013/0138593 A1
\\EVENTS 1 2 3 4 \ sTATEs\ A
B
c
D
FIG. 2 (PRIOR ART)
[ 130
NEVENTS 1 2 5 STATES‘\ \\ A
B
E
FIG. 3 (PRIOR ART) Patent Application Publication May 30, 2013 Sheet 3 0f 7 US 2013/0138593 A1
400 Patent Application Publication May 30, 2013 Sheet 4 0f 7 US 2013/0138593 A1
STATE MACHINE 1m STATES: (AB) EVENTS:
STATE MACHINE 104
EVENTS:STATES: () I
FIG. 5 Patent Application Publication May 30, 2013 Sheet 5 0f 7 US 2013/0138593 A1
FIG. 6 Patent Application Publication May 30, 2013 Sheet 6 0f 7 US 2013/0138593 A1
FIG. 7 Patent Application Publication May 30, 2013 Sheet 7 0f 7 US 2013/0138593 A1
800
/~ 802
812, 813
810
804 Kf? \811 813
FIG. 8 US 2013/0138593 A1 May 30,2013
METHOD AND APPARATUS FOR drive certain ?nite state machines to behave differently. More OPERATINGA FINITE STATE MACHINE possible states and an ever evolving set of input stimulus have added to this complexity. Increasingly, service providers are CROSS-REFERENCE TO RELATED trying to leverage services that Were built on one netWork APPLICATIONS technology by applying them to users in so-called next gen [0001] This application is a Nonprovisional of US. Provi eration netWorks. This activity involves deriving complex ?nite state machines to handle interaction betWeen different sional Patent Application Ser. No. 61/565,154, ?led on Nov. 30, 2011, the disclosure of Which is incorporated herein by netWorks that each have their oWn set of states and input reference in its entirety. stimulus. [0007] In most implementations, ?nite state machines are TECHNICAL FIELD statically de?ned using a “jump table”. In the simplest case, conceptually a 2 dimensional array is organiZed such that [0002] The present invention relates to a method of operat input stimulus or event and current state are mapped to a ing a ?nite state machine, a computer apparatus for operating particular function. Once the function is performed, the state a ?nite state machine, and a non-transitory computer-read may change in preparation for the next event. In a ?nite state able storage medium. machine implemented in softWare, these jump tables are con ventionally usually compiled into the binary source code and BACKGROUND cannot be changed Without rebuilding and reinstalling the [0003] A ?nite state machine is operated on a computer computer program. HoWever, this is very limiting, since each apparatus and can be regarded as a process that can be in one application is different, requiring a different set of states, of a ?nite number of states at any particular time, that state inputs, and functions, and prevents or hinders easy, rapid typically being called the current state. The ?nite state development of complex and evolving softWare systems. machine can transition to another state and/or cause an action SUMMARY or output to take place When initiated by a triggering event. The state to Which the ?nite state machine moves (the “next [0008] According to a ?rst aspect of the present invention, state”) or the action/output that takes place depends on the there is provided, a computer-implemented method compris current state of the machine and the event that triggered the ing: operating a ?nite state machine Which causes a function transition. Thus, the ?nite state machine design technique to be carried out in dependence on at least an event input to the alloWs input stimuli to be handled differently based on the ?nite state machine and the current state of the ?nite state (current) state of a device. A particular ?nite state machine is machine; identifying associations betWeen the functions that de?ned by a set of the possible states it can transition to from are to be carried out and combinations of the states and the each state, and the triggering condition for each transition. In events using an associative array; and amending the associa general, a ?nite state machine can be implemented in hard tions identi?ed using the associative array While the ?nite Ware or softWare or a combination of the tWo. state machine is operating to dynamically recon?gure the [0004] Finite state machines are used in many applications operation of the ?nite state machine. and ?elds, including by Way of example only communication [0009] By virtue of the associations betWeen the functions protocol design, parsing and other engineering applications, that are to be carried out and combinations of the states and in biology and arti?cial intelligence research, and in linguis the events being stored in an associative array and those tics to describe the grammars of natural languages. The use of associations being amendable, operation of the ?nite state ?nite state machines in telecommunications softWare in par machine can be dynamically recon?gured “on-the-?y”, even ticular is universal, as a telecommunications system needs to Whilst the system is running. It is for example not necessary to react differently to a given input stimulus depending on past recompile or reinstall the program that constructs and oper events (i.e. typically, its current state). ates the ?nite state machine. Operation of the ?nite state [0005] A simple example of use of a ?nite state machine in machine can therefore be updated and amended rapidly as a telecommunications scenario Would be to consider What necessary. States can be added or removed, and functions or happens When a land-line telephone goes “off hook” (i.e. the “event handlers” can be added, removed, or replaced, on-the handset is lifted). The system that controls the telephone ?y if necessary or desirable. The restrictions of the static jump behaves differently depending on Whether the telephone is tables of the prior art, including the inability to change the siZe ringing or not. If the telephone is ringing, the off-hook input of the jump table (to add or remove states and events and their stimulus causes ringing to stop, a voice path to be established corresponding event handlers) and to amend the Way states With the calling party and a billing cycle to begin (because an and events are handled, are obviated. incoming call is being received). If the telephone is not [0010] In an embodiment, the ?nite state machine is con already ringing, a dial tone is played and digit collection structed using State Chart eXtensible Markup Language, the begins (because the user has lifted the handset to initiate a associations identi?ed using the associative array being call). Thus, the same event (in this simple example, lifting the amended by receiving input of an eXtensible Markup Lan handset) results in a different action being taken depending on guage ?le and parsing the XML ?le. This provides users or the current state of the device (here, Whether the telephone is operators With a relatively easy and familiar Way to amend the ringing or not). A ?nite state machine is typically used to ?nite state machine. The XML ?le can be generated remote provide this behavior. Finite state machines are used in many from the actual apparatus and transmitted to it over a netWork, other, typically (much) more complex, situations. Which alloWs the ?nite state machine running on the appara [0006] As telecommunications systems have evolved, state tus to be amended and updated remotely. machines have become increasingly complex. As a particular [0011] In an embodiment, at least some of the associations example, mobile netWorks have a concept of “presence” (is identi?ed using the associative array are indexed in the asso the phone on) and “location” (Where is the phone) Which can ciative array by use of keys, the keys being a function of the US 2013/0138593 A1 May 30,2013
corresponding current state and event for said function. This least an event input to the ?nite state machine and the current provides a straightforward mechanism that enables the ?nite state of the ?nite state machine, Wherein associations betWeen state machine to “locate” the function relating or correspond the functions that are to be carried out and combinations of the ing to the current state of the ?nite state machine and the event states and the events are identi?ed using an associative array, that is input to the ?nite state machine. the associations identi?ed using the associative array being [0012] In an embodiment, at least some of the associations amendable While the ?nite state machine is operating to alloW identi?ed using the associative array are indexed in the asso the operation of the ?nite state machine to be dynamically ciative array by use of keys, the keys being non-sequential. In recon?gured. an embodiment, the keys are randomly or pseudorandomly [0018] According to a fourth aspect of the present inven generated. Having keys that are non-sequential, and prefer tion, there is provided a non-transitory computer-readable ably that are randomly or pseudorandomly generated, greatly storage medium comprising a set of computer-readable facilitates the dynamic updating of the data and associations instructions stored thereon, Which, When executed by a pro relating to the functions that are to be carried out as and When cessing system, cause the processing system to carry out a that is needed and helps avoid the jump tables being static as method comprising: operating a ?nite state machine Which in the prior art discussed above. causes a function to be carried out in dependence on at least an [0013] In an embodiment, Wherein at least some of the event input to the ?nite state machine and the current state of associations identi?ed using the associative array are stored the ?nite state machine; identifying associations betWeen the in a hash table, the index of the location of the data of each of functions that are to be carried out and combinations of the said functions in the hash table being obtained as a hash of states and the events using an associative array; and amending identi?ers of the corresponding current state and event for the associations identi?ed using the associative array While said function. The use of hash tables in embodiments dis the ?nite state machine is operating to dynamically recon?g cussed further beloW provides identi?ers of the states and ure the operation of the ?nite state machine. events that are unique. The key or index of location is ran [0019] According to a ?fth aspect of the present invention, domly or pseudorandomly generated, and is not for example there is provided a non-transitory computer-readable storage sequential as in the prior art discussed above. medium comprising a set of computer-readable instructions [0014] In an embodiment, at least some of the associations stored thereon, Which, When executed by a processing sys identi?ed using the associative array are accessed using tem, cause the processing system to carry out a method com nested hash tables in Which at least a ?rst hash table has a prising: operating a ?nite state machine Which causes a func second hash table nested therein, one of said hash tables tion to be carried out in dependence on at least an event input storing identi?ers of states of the ?nite state machine and the to the ?nite state machine and the current state of the ?nite other of said hash tables storing identi?ers of events. state machine; identifying associations betWeen the functions [0015] In an embodiment, the computing apparatus is tele that are to be carried out and combinations of the states and communications apparatus. State machines can be de?ned in the events using an associative array, at least some of the a telecommunications apparatus such as a netWork element to associations identi?ed using the associative array being manage call legs and perform various translations and call accessed using nested hash tables in Which at least a ?rst hash ?oW modi?cation services. These state machines can for table has a second hash table nested therein, one of said hash example be used to bridge different netWork technologies, tables storing identi?ers of states of the ?nite state machine alloWing one netWork to provide services to users on a differ and the other of said hash tables storing identi?ers of events, ent netWork. the data relating to the functions that are to be carried out [0016] According to a second aspect of the present inven being indexed by use of keys that are a hash function of the tion, there is provided, a computer-implemented method corresponding current state and event for said function; and comprising: operating a ?nite state machine Which causes a amending the associations identi?ed using the associative function to be carried out in dependence on at least an event array While the state machine is running by receiving an input to the ?nite state machine and the current state of the eXtensible Markup Language ?le and parsing the XML ?le. ?nite state machine; identifying associations betWeen the [0020] Further features and advantages of the invention functions that are to be carried out and combinations of the Will become apparent from the folloWing description of pre states and the events using an associative array, at least some ferred embodiments of the invention, given by Way of of the associations identi?ed using the associative array being example only, Which is made With reference to the accompa accessed using nested hash tables in Which at least a ?rst hash nying draWings. table has a second hash table nested therein, one of said hash tables storing identi?ers of states of the ?nite state machine BRIEF DESCRIPTION OF THE DRAWINGS and the other of said hash tables storing identi?ers of events, the data relating to the functions that are to be carried out [0021] FIG. 1 shoWs schematically an example of a hierar being indexed by use of keys that are a hash function of the chical state machine design having a common base class state corresponding current state and event for said function; and machine and tWo subclass state machines; amending the associations identi?ed using the associative [0022] FIG. 2 shoWs a representation of a prior art static array While the state machine is running by receiving an eXtensible Markup Language ?le and parsing the XML ?le. jump table for one of the subclass state machines of FIG. 1; [0017] According to a third aspect of the present invention, [0023] FIG. 3 shoWs a representation of a prior art static there is provided computing apparatus, the apparatus com jump table for the other of the subclass state machines of FIG. prising: at least one processor; and at least one memory; the at 1; least one processor and the at least one memory being con [0024] FIG. 4 shoWs a representation of a dynamic state ?gured to cause the apparatus to operate a ?nite state machine machine jump table for an example of a state machine accord Which causes a function to be carried out in dependence on at ing to an embodiment of the present invention; US 2013/0138593 A1 May 30,2013
[0025] FIG. 5 shows the syntax of an example of an
here is that With associative arrays in general, including hash [0040] In a particular example, State Chart XML: State tables in particular, data can be retrieved using a random key, Machine Notation for Control Abstraction (or “SCXML”) is and these keys do not have to be sequential in nature, and are used to generate and operate the state machine. SCXML is an not necessarily even numeric. In the example implementation XML (eXtensible Markup Language) based language Which as a binary tree shoWn in FIG. 4, the outermost nodes are provides a generic state machine based execution environ shoWn by the larger circles and use the state’s key to reach ment. SCXML builds on and extends Call Control eXtensible another particular node. The inner nodes are shoWn by the Markup Language (CCXML), Which is an event-based state smaller circles and are keyed by the event in order to reach the machine language designed to support call control features in corresponding function, Which can then be executed. The voice applications. The baseline system supports the concept table is organiZed for fast access by virtue of the tree structure of metadata, Whereby the methods, attributes, and class hier and can be rebalanced as neW nodes are added. archy are knoWn to the program at runtime. With this knoWl [0036] In this particular implementation of an associative edge, the system supports a scripting language that can invoke array as a binary tree 400, in general a node has a data payload methods Written in the native compiled language and, con and tWo child nodes, a left child, and a right child. Thus, for versely, mechanisms exist in the native compiled language to example, the node 401 represented by state “B” is called the invoke methods de?ned in the scripted language. As an object root node and has tWo child nodes 402,403. Nodes With a state oriented system, methods and attributes de?ned in the script Whose key is less than “B” (in this case node 402 With state ing language can be added to existing objects de?ned in the “A”) are arranged on the left side, and nodes With a state native language, and neW objects can be de?ned that exist greater than “B” (in this case node 403 With state “F”) are Within the scripting language and Which can inherit from arranged on the right. The data payload for any particular classes de?ned in the native language. The methods de?ned in node in the case of an outermost node is another node, nested the scripted language are represented in the compiled lan Within that outer node and indicated by the smaller circles in guage as “code block” objects. FIG. 4. As mentioned, the key used for the inner nodes is [0041] In SCXML, each SCXML
designed to inherit from the predecessor state machine 103. -continued However, until any
able telecommunications apparatus and devices may include (key, value/function) pairs may be used. For example, asso Wired and Wireless telephones, satellite telephones, other per ciative arrays may be implemented in other embodiments in sonal communication devices, electronic gaming devices, the form of so-called B-Trees, AVL trees, Red-Black trees, electronic music devices, and telecommunications netWork etc. infrastructure equipment, including but not limited to a base [0057] It is to be understood that any feature described in station and a telephone exchange. Such apparatus and devices relation to any one embodiment may be used alone, or in Will typically include one or more processors 810, memory/ combination With other features described, and may also be memories 811, antenna and/or other communications com used in combination With one or more features of any other of ponent and circuitry 812, etc. to enable communication With the embodiments, or any combination of any other of the other devices and/ or the netWork 803. The computer program embodiments. Furthermore, equivalents and modi?cations or softWare described by Way of example above Will typically not described above may also be employed Without departing be stored in some non-transitory storage 813 on one or more from the scope of the invention, Which is de?ned in the of the apparatus or apparatus and run in memory 812 under accompanying claims. control of the processor(s) 810. What is claimed is: [0053] Examples of embodiments of the present invention 1. A computer-implemented method, comprising: provide and make use of ?nite state machines that are hierar operating a ?nite state machine Which causes a function to chical and have dynamic jump tables. In embodiments, the be carried out in dependence on at least an event input to underlying system supports metadata and use of a scripting the ?nite state machine and the current state of the ?nite language to modify the jump tables. The speci?c examples state machine; described herein provide several advantages over traditional identifying associations betWeen the functions that are to methods. For example, events and state keys do not have to be be carried out and combinations of the states and the normalized to a common integer range; the same event can be events using an associative array; and handled by multiple ?nite state machines; designs can be amending the associations identi?ed using the associative rapidly implemented by using a library of base classes that array While the ?nite state machine is operating to provide common behavior; designs can be rapidly altered dynamically recon?gure the operation of the ?nite state because of the dynamic nature of the jump tables, alloWing machine. requirements changes and bug ?xes to be made quickly for 2. The method according to claim 1, Wherein the ?nite state example; and, state-event handlers can be simpler due to the machine is constructed using State Chart eXtensible Markup addition of conditions to the state-event handler object. Language, the associations identi?ed using the associative [0054] Embodiments of the present invention may be used array being amended by receiving input of an eXtensible in may different ?elds and applications. Some speci?c appli Markup Language ?le and parsing the XML ?le. cations Where embodiments of the present invention may be 3. The method according to claim 1, Wherein at least some used include telecommunications (such as in telephone sys of the associations identi?ed using the associative array are tem exchanges, base stations, radio netWork controllers, etc.), indexed in the associative array by use of keys, the keys being consumer electronics devices (including for example radios, a function of the corresponding current state and event for televisions, smart phone “apps”, etc.), and other computing said function. devices and softWare in many different ?elds (including in 4. The method according to claim 1, Wherein at least some email softWare, netWork protocols, computer languages and of the associations identi?ed using the associative array are standards, databases, etc.). indexed in the associative array by use of keys, the keys being [0055] Although at least some aspects of the embodiments non-sequential. described herein With reference to the draWings comprise 5. The method according to claim 4, Wherein the keys are computer processes performed in processing systems or pro randomly or pseudorandomly generated. cessors, the invention also extends to computer programs, 6. The method according to claim 1, Wherein at least some particularly computer programs on or in a carrier, adapted for of the associations identi?ed using the associative array are putting the invention into practice. The program may be in the stored in a hash table, the index of the location of the data of form of non-transitory source code, object code, a code inter each of said functions in the hash table being obtained as a mediate source and object code such as in partially compiled hash of identi?ers of the corresponding current state and form, or in any other non-transitory form suitable for use in event for said function. the implementation of processes according to the invention. 7. The method according to claim 1, Wherein at least some The carrier may be any entity or device capable of carrying of the associations identi?ed using the associative array are the program. For example, the carrier may comprise a storage accessed using nested hash tables in Which at least a ?rst hash medium, such as a solid-state drive (SSD) or other semicon table has a second hash table nested therein, one of said hash ductor-based RAM; a ROM, for example a CD ROM or a tables storing identi?ers of states of the ?nite state machine semiconductor ROM; a magnetic recording medium, for and the other of said hash tables storing identi?ers of events. example a ?oppy disk or hard disk; optical memory devices in 8. The method according to claim 1, Wherein the ?nite state general; etc. The exemplary embodiments may be imple machine is implemented on telecommunications apparatus. mented at least in part by computer softWare stored in (non 9. A computer-implemented method, comprising: transitory) memory and executable by the processor. operating a ?nite state machine Which causes a function to [0056] The above embodiments are to be understood as be carried out in dependence on at least an event input to illustrative examples of the invention. Further embodiments the ?nite state machine and the current state of the ?nite of the invention are envisaged. For example, While the spe state machine; ci?c examples described above make use of associative identifying associations betWeen the functions that are to arrays, particularly in the form of hash tables, and particularly be carried out and combinations of the states and the using binary trees, other forms of associative array Which use events using an associative array, at least some of the US 2013/0138593 A1 May 30,2013
associations identi?ed using the associative array being 16. The apparatus according to claim 10, con?gured such accessed using nested hash tables in Which at least a ?rst that at least some of the associations identi?ed using the hash table has a second hash table nested therein, one of associative array are accessed using nested hash tables in said hash tables storing identi?ers of states of the ?nite Which at least a ?rst hash table has a second hash table nested state machine and the other of said hash tables storing therein, one of said hash tables storing identi?ers of states of identi?ers of events, the data relating to the functions the ?nite state machine and the other of said hash tables that are to be carried out being indexed by use of keys storing identi?ers of events. that are a hash function of the corresponding current 17. The apparatus according to claim 10, Wherein the com state and event for said function; and puting apparatus is a telecommunications apparatus. amending the associations identi?ed using the associative 18. A non-transitory computer-readable storage medium array While the state machine is running by receiving an comprising a set of computer-readable instructions stored eXtensible Markup Language ?le and parsing the XML thereon, Which, When executed by a processing system, cause ?le. the processing system to carry out a method, the method 10. A computing apparatus, comprising: comprising: at least one processor; and operating a ?nite state machine Which causes a function to at least one memory, be carried out in dependence on at least an event input to Wherein the processor and the memory are con?gured to the ?nite state machine and the current state of the ?nite cause the apparatus to operate a ?nite state machine state machine; Which causes a function to be carried out in dependence identifying associations betWeen the functions that are to on at least an event input to the ?nite state machine and be carried out and combinations of the states and the the current state of the ?nite state machine, and events using an associative array; and Wherein associations betWeen the functions that are to be amending the associations identi?ed using the associative carried out and combinations of the states and the events array While the ?nite state machine is operating to are identi?ed using an associative array, the associations dynamically recon?gure the operation of the ?nite state identi?ed using the associative array being amendable machine. While the ?nite state machine is operating to alloW the 19. A non-transitory computer-readable storage medium operation of the ?nite state machine to be dynamically comprising a set of computer-readable instructions stored recon?gured. thereon, Which, When executed by a processing system, cause 11. The apparatus according to claim 10, con?gured such the processing system to carry out a method, the method that the ?nite state machine is constructed using State Chart comprising: eXtensible Markup Language, the associations identi?ed operating a ?nite state machine Which causes a function to using the associative array being amended by the apparatus be carried out in dependence on at least an event input to receiving input of an eXtensible Markup Language ?le and the ?nite state machine and the current state of the ?nite parsing the XML ?le. state machine; 12. The apparatus according to claim 10, con?gured such identifying associations betWeen the functions that are to that at least some of the associations identi?ed using the be carried out and combinations of the states and the associative array are indexed in the associative array by use of events using an associative array, at least some of the keys, the keys being a function of the corresponding current associations identi?ed using the associative array being state and event for said function. accessed using nested hash tables in Which at least a ?rst 13. The apparatus according to claim 10, con?gured such hash table has a second hash table nested therein, one of that at least some of associations identi?ed using the associa said hash tables storing identi?ers of states of the ?nite tive array are indexed in the associative array by use of keys, state machine and the other of said hash tables storing the keys being non-sequential. identi?ers of events, the data relating to the functions 14. The apparatus according to claim 13, con?gured such that are to be carried out being indexed by use of keys that the keys are randomly or pseudorandomly generated. that are a hash function of the corresponding current 15. The apparatus according to claim 10, con?gured such state and event for said function; and that at least some of associations identi?ed using the associa amending the associations identi?ed using the associative tive array are stored in a hash table, the index of the location array While the state machine is running by receiving an of the data of each of said functions in the hash table being eXtensible Markup Language ?le and parsing the XML obtained as a hash of identi?ers of the corresponding current ?le. state and event for said function.