All pastes #411301 Raw Edit

derp derp

public text v1 · immutable
#411301 ·published 2007-03-26 22:53 UTC
rendered paste body
context queues-loginout {

        s => Set(queue-announce-success=0);

        // the extensions to dial to log in and out of the support queue.
        // hands off to the queues-manip context, which does the actual work.

        8001 => {

                // This uses the caller id to set the agent number
                // for the speed dial buttons on cisco phones

                Answer();
                Set(AGENT_NUMBER=${CALLERID(num)});
                Set(AGENT_EXT=${CALLERID(num)});
                Set(queue-announce-success=1);
                goto queues-manip,I${AGENT_NUMBER},1;

        }

        8002 => {

                // logs in, prompts for an agent number

                Answer();
                Read(AGENT_NUMBER,agent-user);
                Read(AGENT_EXT,agent-newlocation);
                Set(queue-announce-success=1);
                goto queues-manip,I${AGENT_NUMBER},1;
        }

        8003 => {

                // Logs out using caller id as agent number
                // for speed dial on cisco phones

                Answer();
                Set(AGENT_NUMBER=${CALLERID(num)});
                Set(AGENT_EXT=${CALLERID(num)});
                Set(queue-announce-success=1);
                goto queues-manip,O${AGENT_NUMBER},1;

        }

        8004 => {

                // Logs out prompting for agent number

                Answer();
                Read(AGENT_NUMBER,agent-user);
                Set(queue-announce-success=1);
                goto queues-manip,O${AGENT_NUMBER},1;
        }
};

context queues-manip {

        // determines which agent is doing what.

        _[IO]100 => {
                &queue-addremove(supportq,10);
                &queue-success();
        }

        _[IO]102 => {
                &queue-addremove(supportq,10);
                &queue-success();
        }

        _[IO]103 => {
                &queue-addremove(supportq,10);
                &queue-success();
        }

        _[IO]104 => {
                &queue-addremove(supportq,10);
                &queue-success();
        }

        _[IO]105 => {
                &queue-addremove(supportq,10);
                &queue-success();
        }

        _[IO]106 => {
                &queue-addremove(supportq,10);
                &queue-success();
        }
};

macro queue-success() {

        if(${queue-announce-success} > 0) {
                switch(${MACRO_EXTEN:0:1}) {
                case I:
                        Playback(agent-loginok);
                        Playback(vm-goodbye);
                        Hangup();
                case O:
                        Playback(agent-loggedoff);
                        Playback(vm-goodbye);
                        Hangup();
                }
        }
};

macro queue-addremove(queuename,penalty) {

        switch(${MACRO_EXTEN:0:1}) {
        case I: {
//              AddQueueMember(${queuename},Local/${MACRO_EXTEN:1}@staff,${penalty});
                AddQueueMember(${queuename},Local/${AGENT_EXT}@staff,${penalty});
                break;
        }
        case O: {
//              RemoveQueueMember(${queuename},Local/${MACRO_EXTEN:1}@staff);
                RemoveQueueMember(${queuename},Local/${AGENT_EXT}@staff,${penalty});
                break;
        }
        default: {
                Playback(invalid);
                break;
        }
        }
};