Lurker News
I think I've broken my own record with this one ~2500 lines of incoherent JavaScript/C#. Works though.

Comments (578) 119 threads

Show all comments

Showing thread 66 of 119

wernsey#
My first job out of university was to program IVR systems for a telecom company using an in-house developed framework.

An IVR application would typically play a recording to the user, then wait for the DTMF signal, then maybe take the user to a sub-menu, prompt the user to choose another option and do a database query and then play another recording and so on.
The IVRs had to repeat a menu if the user made an invalid selection, and "press 'star' to return to the main menu" and so on.
So most of the applications I maintained were thousand line C++ functions that looked something like this (paraphrased):

  void ivr_main(int ch) {
  main_menu:
    play("mainmenu.vox");
    d = get_dtmf(ch);
    if(user_hung_up(ch)) return;
    switch(d) {
    case '1' : goto menu_1;
    case '2' : goto menu_2;
    case '3' : goto menu_3;
    case '4' : goto menu_4;
    }
    goto main_menu;
  menu_1:
    play("menu1.vox");
    d = get_dtmf(ch);
    if(user_hung_up(ch)) return;
    switch(d) {
    case '1': goto menu_1_1;
    case '2': goto menu_1_2;
    case '*': goto main_menu;
    }
    goto menu_1;
  // etc...
  }