context dialout_default {
includes {
// We want to use VoipJet as the default provider
dialout_provider_voipjet;
};
};
// Set the first alternate provider for dialout service
context dialout_alternate {
includes {
// We want to use VoicePulse Connect! as the alternate provider
dialout_provider_voicepulse;
};
};
// If the call did not go through using the primary provider, we will
// try to route it through the alternate provider. Check the call
// status and act accordingly
context dialout_consider_alternate {
_1NXXNXXXXXX => {
switch (${DIALSTATUS}) {
case CONGESTION:
Goto dialout_alternate|${EXTEN}|1;
break;
case CHANUNAVAIL:
Goto dialout_alternate|${EXTEN}|1;
break;
default:
NoOp(No problem, the call went through as expected);
};
};
};
// VoipJet
context dialout_provider_voipjet {
_1NXXNXXXXXX => {
SetCallerID(${CIDNUMOVR});
Dial(IAX2/voipjet/${EXTEN});
Goto dialout_consider_alternate|${EXTEN}|1;
};
};
// VoicePulse Connect!
context dialout_provider_voicepulse {
_1NXXNXXXXXX => {
SetCallerID(${CODNUMOVR});
Dial(IAX2/voicepulse/${EXTEN});
};
};