All pastes #454623 Raw Edit

Something

public text v1 · immutable
·published 2007-04-23 18:47 UTC
rendered paste body
/////////////////////////////////////////
/// 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;
        };
};

///////////////
/// DEFAULT ///
///////////////
context ael-internal {
        // for now, everyone can call international long distance
        includes {
                ael-international;
        }

        // emergency
        911 => {
                Dial(${TRUNK}/911);
        }
        9911 => {
                Dial(${TRUNK}/911);
        }

        // voice mail: if can detect caller id, use that; if not, prompt
        8500 => {
                if ( "${CALLERID(num)}" != "" )
                {
                        VoiceMailMain(${CALLERID(num)});
                }
                else
                {
                        VoiceMailMain();
                }
                Hangup();
        }

        // voice mail main (ignore cid)
        8501 => {
                VoiceMailMain();
                Hangup();
        }

        // dial by name directory
        8505 => {
                Directory(default,ael-internal);
                Hangup();
        }
        // employees
        // by number
        _301XX => {
                switch(${EXTEN}) {
                        case 30100:
                                &ael-std-callmain();
                                break;
                        case 30101:
                                &ael-std-exten-ael(${EXTEN:-5},${ME});
                                break;
                        case 30102:
                                &ael-std-exten-ael(${EXTEN:-5},${HIM});
                                break;
                        case 30103:
                                &ael-std-exten-ael(${EXTEN:-5},${HER});
                                break;
                }
        }
        // by name
        main => {
                &ael-std-callmain();
        }
        // record
        _89XX => {
                Wait(2);
                Record(/tmp/prompt${EXTEN:2}:wav);
                Wait(1);
                Playback(/tmp/prompt${EXTEN:2});
                Wait(2);
                Hangup();
        }
};