<smex ...> element (Platform Messaging)


smex, short for Simple Messaging EXtension, is a SALT element that communicates with the external component of the SALT platform. It can be used to implement any application control of platform functionality such as logging and telephony control. As such, smex represents a useful mechanism for extensibility in SALT, since it allows any new functionality to be added through this messaging layer.

On its instantiation, the object is directed to establish an asynchronous message exchange channel with a platform component through its configuration parameters (specified in param elements) or attributes. The smex object can send or receive messages through this channel. The content of a message to be sent is defined in the sent property. Whenever the value of this property is updated (either on page load or by dynamic assignment through script or binding), the message is sent to the platform. The smex element can also receive XML messages from the platform component in its received property. The onReceive event is fired whenever a platform message is received. Since the smex object's basic operations are asynchronous, it also maintains a built-in timer for the manipulation of timeout settings. onTimeout and onError events may also be thrown.

The smex object makes no requirement on the means of communication with platform components. It should also be noted that the smex object has the same life span as other XML elements, that is, it will be destroyed when its hosting document is unloaded. While in many cases, the smex object can perform automatic clean-up and release communication resources when it is unloaded, there might be use cases (e.g. call control) in which a persistent communication link is desirable across pages. For those cases, SALT places the responsibility of relinquishing the allocated resources (e.g. closing the socket) on the application.

The smex object also is neutral on the format (schema) of messages. In order to encourage interoperability, however, the conformance criteria in Part 4 recommend that implementations support a known schema for common functionality, with a strong preference for existing standard message formats. Such a schema for telephony call control is suggested in section 2.4.4, and 4.3 of the SALT 1.0 Specs. In essence, SALT allows both platform and application developers to take the full advantage of the standardized extensibility of XML to introduce innovative and perhaps proprietary features without necessarily losing interoperability.


Attributes

Name Data type Default

id

ID
implied
onError
script.statement
implied
onReceive
script.statement
implied
onTimeout
script.statement
implied
sent
CDATA
implied
timer
milliseconds
implied

Children

Parents

Properties

Methods

none

Examples

<html xmlns:salt="http://www.saltforum.org/2002/SALT">
    <body>
    
         <!-- the data section -->
         <form id="get_team">
            <input name="team" />
            <input name="uid" type="hidden"/>
        </form>

        <!-- The speech section -->
        <salt:prompt id="welcome">
            Welcome, caller!
        </salt:prompt>
        <salt:prompt id="ask">
            Which team would you like the latest results for:
            Arsenal, Chelsea, Spurs or West Ham?
        </salt:prompt>
        <salt:prompt id="confirm">
            I heard <value targetelement="team" />.
            Is this correct?
        </salt:prompt>
        <salt:prompt id="thanks">
            Thank you. Please wait while I get the latest results.
        </salt:prompt>
        <salt:prompt id="retry">
            Okay, let's do this again
        </salt:prompt>
        <salt:prompt id="reprompt">
            Sorry, I missed that.
        </salt:prompt>

        <salt:listen id ="listen_team">
            <salt:grammar src="./teamtypes.grxml" />
            <salt:bind test="/[@confidence $gt$ 10]"
                    targetelement="team" value="//team" />
            <salt:bind test="/[@confidence $gt$ 10]"
                    targetelement="confirm" targetmethod="start" />
            <salt:bind test="/[@confidence $gt$ 10]"
                    targetelement="listen_yesno" targetmethod="start" />
            <salt:bind test="/[@confidence $le$ 10]"
                    targetelement="reprompt" targetmethod="start" />
            <salt:bind test="/[@confidence $le$ 10]"
                    targetelement="ask" targetmethod="start" />
            <salt:bind test="/[@confidence $le$ 10]"
                    targetelement="listen_team" targetmethod="start" />
        </salt:listen>
        <salt:listen id="listen_yesno">
            <salt:grammar src="./yesno.grxml" />
            <salt:bind test="/yes[@confidence $gt$ 10]"
                    targetelement="thanks" targetmethod="start" />
            <salt:bind test="/yes[@confidence $gt$ 10]"
                    targetelement="get_team" targetmethod="submit" />
            <salt:bind test="/no or ./[@confidence $le$ 10]" />
                    targetelement="retry" targetmethod="start"
            <salt:bind test="/no or ./[@confidence $le$ 10]"
                    targetelement="ask" targetmethod="start" />
            <salt:bind test="/no or ./[@confidence $le$ 10]"
                    targetelement="listen_team" targetmethod="start" />
        </salt:listen>

        <!-- call control section -->
        <salt:smex id="telephone" sent="start_listening">
            <salt:param name="server" value="ccxmlproc" />
            <salt:bind targetelement="uid" value="/@uid" />
            <salt:bind test="/Call_connected"
                    targetelement="welcome" targetmethod="queue" />
            <salt:bind test="/Call_connected"
                    targetelement="ask" targetmethod="start" />
            <salt:bind test="/Call_connected"
                    targetelement="listen_team" targetmethod="start" />

        </salt:smex>

    </body>
</html>

 

<!-- logging mechanism that uses a COM object with its class id and interface id -->
<!-- See SALT 1.0 Specs (2.6.6) for more detailed info -->

<salt:smex id="logServer">
    <salt:param name="d:server" xmlns:d="urn:Microsoft.com/COM">
        <d:protocol>DCOM</d:protocol>
        <d:clsid>2093093029302029320942098432098</d:clsid>
        <d:iid>0903859304903498530985309094803</d:iid>
    </salt:param>

</salt:smex>


<salt:listen>
    // other directives binding listen results to input fields
    <salt:bind targetelement="logServer" targetattribute="sent"
            value="*[@log $ge$ 3]"/>
</salt:listen>

 

Extra info

For details on usage of this element, see the SALT Specification, Version 1.0.