<script xmlns="http://www.nokia.com/ns/cep/script/1.0/"
xmlns:cep="http://www.nokia.com/ns/cep/1.0/">
    <!-- Check if we just have incoming call -->
    <if>
        <or>
            <equals>
                <contextRef source='Call' type='State'/>
                <string>Ringing</string>
            </equals>
            <equals>
                <contextRef source='Call' type='State'/>
                <string>Connected</string>
            </equals>
            <equals>
                <contextRef source='Call' type='State'/>
                <string>Alerting</string>
            </equals>
        </or>
        <actions>
            <!-- Activate call state call events -->
            <!-- Remove call state routing table -->
            <Tsp
            removeRoutingTable='04'/>
            
            <Tsp
            routingTable='04'
            keyEventRemConExtCallAnswerCall='00'
            keyEventRemConExtCallEndCall='01'
            keyEventRemConExtCallAnswerEnd='02'
            keyEventRemConExtCall3WaysCalling='06'
            keyEventRemConExtCallGenerateDTMF='07'/>
            
            <Tsp
            routingTable='04'
    	    ruleDefaultApp='02'
    	    defaultApplicationPhone='100058B3'/>
        </actions>
    </if>
    <elseIf>
        <equals>
            <contextRef source='Call' type='State'/>
            <string>Disconnecting</string>
        </equals>
        <actions>
            <!-- Remove call state routing table -->
            <Tsp
            removeRoutingTable='04'/>
            
            <Tsp
    	    routingTable='04'
            keyEventRemConExtCallAnswerCall='00'
            keyEventRemConExtCallEndCall='01'
            keyEventRemConExtCallAnswerEnd='02'
            />
    	    
    	    <Tsp
    	    routingTable='04'
    	    ruleForeground='01'
    	    ruleActiveAudio='00'
    	    ruleLastPlayedAudio='03'/>
        </actions>
    </elseIf>
</script>