Keywords: asterisk

### The Main Menu

At Digium, incoming callers are sent to the "mainmenu" context, where they are greeted, and directed to the numbers they choose...

-     context mainmenu {

      	includes {
      		digium;
      		queues-loginout;
      	}

              0 => goto dispatch,s,1;
              2 => goto sales,s,1;
              3 => goto customerservice,s,1;
              4 => goto dispatch,s,1;

              s => {
                      Ringing();
                      Wait(1);
                      Set(attempts=0);
                      Answer();
                      Wait(1);
                      Background(digium/ThankYouForCallingDigium);
                      Background(digium/YourOpenSourceTelecommunicationsSupplier);
                      WaitExten(0.3);
              repeat:
                      Set(attempts=$[${attempts} + 1]);
                      Background(digium/IfYouKnowYourPartysExtensionYouMayDialItAtAnyTime);
                      WaitExten(0.1);
                      Background(digium/Otherwise);
                      WaitExten(0.1);
                      Background(digium/ForSalesPleasePress2);
                      WaitExten(0.2);
                      Background(digium/ForCustomerServicePleasePress3);
                      WaitExten(0.2);
                      Background(digium/ForAllOtherDepartmentsPleasePress4);
                      WaitExten(0.2);
                      Background(digium/ToSpeakWithAnOperatorPleasePress0AtAnyTime);
                      if( ${attempts} < 2 ) {
                              WaitExten(0.3);
                              Background(digium/ToHearTheseOptionsRepeatedPleaseHold);
                      }
                      WaitExten(5);
                      if( ${attempts} < 2 ) goto repeat;
                      Background(digium/YouHaveMadeNoSelection);
                      Background(digium/ThisCallWillBeEnded);
                      Background(goodbye);
                      Hangup();
              }
      }