All pastes #421972 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-04-03 04:50 UTC
rendered paste body
///////////////
/// GLOBALS ///
///////////////
globals {
        CONSOLE="Console/dsp";  // console interface for demo(?)
        TRUNK="Zap/g1";         // trunk interface
        TRUNKMSD=1;             // MSD digits to strip (usually 1 or 0)
};

/////////////////////////////////////////
/// LOCAL/(INT) LD/TOLL FREE CONTEXTS ///
/////////////////////////////////////////
// international long distance dialing through trunk
context ael-trunkint {
        _9011. => {
                Dial(${TRUNK}/${EXTEN:${TRUNKMSD}});
        };
};
// long distance dialing accessed through trunk
context ael-trunkld {
        _91NXXNXXXXXX => {
                Dial(${TRUNK}/${EXTEN:${TRUNKMSD}});
        };
};
// local seven-digit dialing accessed through trunk
context ael-trunklocal {
        _9NXXXXXX => {
                Dial(${TRUNK}/${EXTEN:${TRUNKMSD}});
        };
};
// long distance context accessed through trunk interface
context ael-trunktollfree {
        _91800NXXXXXX => Dial(${TRUNK}/${EXTEN:${TRUNKMSD}});
        _91888NXXXXXX => Dial(${TRUNK}/${EXTEN:${TRUNKMSD}});
        _91877NXXXXXX => Dial(${TRUNK}/${EXTEN:${TRUNKMSD}});
        _91866NXXXXXX => Dial(${TRUNK}/${EXTEN:${TRUNKMSD}});
};

///////////////////////
/// MASTER CONTEXTS ///
///////////////////////
// master context for international long distance
context ael-international {
        ignorepat => 9;
        includes {
                ael-longdistance;
                ael-trunkint;
        };
};
// master context for long distance
context ael-longdistance {
        ignorepat => 9;
        includes {
                ael-local;
                ael-trunkld;
        };
};
// master context for local and toll-free calls only
context ael-local {
        ignorepat => 9;
        includes {
                ael-default;
                ael-parkedcalls;
                ael-trunklocal;
                ael-trunktollfree;
        };
};

//////////////
/// MACROS ///
//////////////
macro ael-std-exten-ael( ext , dev ) {
        Dial(${dev}/${ext},20);
        switch(${DIALSTATUS}) {
        case BUSY:
                Voicemail(b${ext});
                break;
        default:
                Voicemail(u${ext});
        };
        catch a {
                VoiceMailMain(${ext});
                return;
        };
};


///////////////
/// DEFAULT ///
///////////////
context ael-internal {

        // voice mail with no caller id
        8501 => {
                VoicemailMain();
                Hangup();
        };
};

context ael-incoming {
        // test
        s => {
                Answer();
                Echo();
        };
};