All pastes #421226 Raw Edit

derp derp

public text v1 · immutable
·published 2007-04-02 18:34 UTC
rendered paste body
context mainmenu-HQ {

  0 => goto mainmenu-HQ|s|1;
  2 => {
      if (${hq_holiday} = yes) NoOp();
      if (${is_hq_open} = no) NoOp();
      if (${is_hq_open} = yes) goto sales-HQ|s|1;
  }
  3 => {
      if (${hq_holiday} = yes) NoOp();
      if (${is_hq_open} = no) NoOp();
      if (${is_hq_open} = yes) goto support-HQ|s|1;
  }
  4 => {
      if (${hq_holiday} = yes) NoOp();
      if (${is_hq_open} = no) NoOp();
      if (${is_hq_open} = yes) &std-exten-HQ(3114,"SIP");
  }
  5 => {
      if (${hq_holiday} = yes) NoOp();
      if (${is_hq_open} = no) NoOp();
      if (${is_hq_open} = yes) &std-exten-HQ(3204,"SIP");
  }
  # => {
      if (${hq_holiday} = yes) NoOp();
      if (${is_hq_open} = no) NoOp();
      if (${is_hq_open} = yes) goto mainmenu-HQ|s|repeat;
  }
  s => {
      // by default we are closed

      hq_holiday=no;
      is_hq_open=no;

      // normal business hours, and if
      // we ain't open, we're closed.
      ifTime (09:00-17:59|mon-fri|*|*) is_hq_open=yes;
      else is_hq_open=no;

      ifTime (*|*|1|jan) {
        hq_holiday=yes;         // New Year's Day
        is_hq_open=no;
      }
      ifTime (*|*|4|jul) {
        hq_holiday=yes;         // Independence Day
        is_hq_open=no;
      }
      ifTime (15:00-23:59|*|3|sep) {
        hq_holiday=yes;         // Labor Day
        is_hq_open=no;
      }
      ifTime (*|*|22|nov) {
        hq_holiday=yes;         // Thanksgiving
        is_hq_open=no;
      }
      ifTime (17:00-23:59|*|23|nov) {
        hq_holiday=yes;         // Black Friday
        is_hq_open=no;
      }
      ifTime (15:00-23:59|*|24|dec) {
        hq_holiday=yes;         // Christmas Eve
        is_hq_open=no;
      }
      ifTime (*|*|25|dec) {
        hq_holiday=yes;         // Christmas Day
        is_hq_open=no;
      }
      ifTime (16:00-23:59|*|31|dec) {
        hq_holiday=yes;         // New Year's Eve
        is_hq_open=no;
      }

      if (${is_hq_open} = yes) {
        Ringing();
        Wait(1);
        Set(attempts=0);
        Answer();
        Wait(1);
        Set(TIMEOUT(digit)=5);
        Set(TIMEOUT(response)=15);
        Background(HQ-sounds/thank-you-for-calling);
        WaitExten(0.3);
      repeat:
        Set(attempts=$[${attempts} + 1]);
        Background(HQ-sounds/hq-mainmenu-list);
        Background(HQ-sounds/menu-again-press-pound);
        WaitExten(10);
        if (${attempts} < 4) goto repeat;
        Background(vm-goodbye);
        Hangup();

      }
      else if (${hq_holiday} = yes) {
        Ringing();
        Wait(1);
        Set(attempts=0);
        Answer();
        Wait(1);
        Set(TIMEOUT(digit)=5);
        Set(TIMEOUT(response)=15);
      repeatholiday:
        Background(HQ-sounds/office-closed-holiday);
        Set(attempts=$[${attempts} + 1]);
        WaitExten(5);
        if (${attempts} < 2) goto repeatholiday;
        Background(vm-goodbye);
        Hangup();
      }
      else {
        Ringing();
        Wait(1);
        Set(attempts=0);
        Answer();
        Wait(1);
        Set(TIMEOUT(digit)=5);
        Set(TIMEOUT(response)=15);
      repeatclosed:
        Background(HQ-sounds/office-closed);
        Set(attempts=$[${attempts} + 1]);
        WaitExten(5);
        if (${attempts} < 2) goto repeatclosed;
        Background(vm-goodbye);
        Hangup();
      }
  }

  i => Playback(HQ-sounds/invalid-extension);
};