function telecoms.ivr.edit

Edit an existing IVR menu.

You can use this function to edit any aspect of an IVR menu and its options.

See telecoms.ivr.create for a fuller explanation of how IVR menus work.

Of the optional arguments below, you only need to supply arguments that correspond with values that you are changing. Any arguments you omit will cause that setting in the IVR menu to remain unchanged.

Arguments:

argrequired?syntaxinfo
ivrIDYposintivrID of ivr menu to edit
custIDNposintcustID of account that contains the IVR menu you're editing (default is your own account)
descNstringa brief textual description of your IVR menu (max 100 characters)
prompt_fg_soundclipIDNunsintID of soundclip played to the caller when they arrive at the menu (uninterruptable)
prompt_bg_soundclipIDNunsintID of soundclip played to the caller when they arrive at the menu (interruptable)
goodchoice_fg_soundclipIDNunsintID of soundclip played to the caller when they select a valid option (uninterruptable)
badchoice_fg_soundclipIDNunsintID of soundclip played to the caller when they enter a non-existant option (uninterruptable)
badchoice_bg_soundclipIDNunsintID of soundclip played to the caller when they enter a non-existant option (interruptable)
nochoice_fg_soundclipIDNunsintID of soundclip played to the caller if they fail to enter a valid option after a set time (see timeout_response) (uninterruptable)
maxreplay_hangup_fg_soundclipIDNunsintID of soundclip played to the caller prior to cutting them off after the max number of menu repeats (unterruptable)
timeout_digitNposintTimeout (in seconds) to wait for further user digits once they have started typing (default 3)
timeout_responseNposintTimeout (in seconds) to wait for the user to choose a menu option (default 10)
default_choiceNstringThe selection to assume the user made if they failed to make a selection after timeout_response seconds
nochoice_maxreplaysNposintMax number of times the menu is replayed to the customer (without them making a selection) before we hang up the call
optionsNarr:arrDefinition of the menu options available to the caller. The previous list of options will be entirely replaced with these.
options.addNarr:arrDefinition of new menu options. The previous list of options will be merged with these.
options.editNarr:arrDefinition of changes to existing options.
options.delNlist:unsintOptions to remove from the menu.
modeNenum:normal|cgi_simple|cgi_fulldefines mode for the IVR menu (default "normal")
cgi_maxdigitsNstring(for cgi_simple mode) max number of digits to accept from the user
cgi_simple_goodchoice_optNunsint(for cgi_simple mode) the "keypress" to route the call to after the user has provided their input
cgi_full_init_urlNstring(for cgi_full mode) the http/https URL of a script to query to find out the max number of digits a user can enter in this menu
cgi_full_init_methodNenum:GET|POST(for cgi_full mode) http method to use when sending data to the script defined in cgi_full_init_url
cgi_full_response_urlNstring(for cgi_full mode) the http/https URL of a script to query for call routing instructions
cgi_full_response_methodNenum:GET|POST(for cgi_full mode) http method to use when sending data to the script defined in cgi_full_response_url
cgi_full_failchoiceNunsint(for cgi_full mode) the "keypress" option to route the call to if the script defined in cgi_full_response_url cannot be reached

Further argument information

prompt_fg_soundclipID

Supply new value or specify a value of 0 to unset this option. See telecoms.ivr.create:prompt_fg_soundclipID for more information on this argument.

prompt_bg_soundclipID

Supply new value or specify a value of 0 to unset this option. See telecoms.ivr.create:prompt_bg_soundclipID for more information on this argument.

goodchoice_fg_soundclipID

Supply new value or specify a value of 0 to unset this option. See telecoms.ivr.create:goodchoice_fg_soundclipID for more information on this argument.

badchoice_fg_soundclipID

Supply new value or specify a value of 0 to unset this option. See telecoms.ivr.create:badchoice_fg_soundclipID for more information on this argument.

badchoice_bg_soundclipID

Supply new value or specify a value of 0 to unset this option. See telecoms.ivr.create:badchoice_bg_soundclipID for more information on this argument.

nochoice_fg_soundclipID

Supply new value or specify a value of 0 to unset this option. See telecoms.ivr.create:nochoice_fg_soundclipID for more information on this argument.

maxreplay_hangup_fg_soundclipID

Supply new value or specify a value of 0 to unset this option. See telecoms.ivr.create:maxreplay_hangup_fg_soundclipID for more information on this argument.

timeout_digit

Supply new value. See telecoms.ivr.create:timeout_digit for more information on this argument.

timeout_response

Supply new value. See telecoms.ivr.create:timeout_response for more information on this argument.

default_choice

Supply new value (or specify NULL or an empty string to unset this option). See telecoms.ivr.create:default_choice for more information on this argument.

nochoice_maxreplays

Supply new value. See telecoms.ivr.create:nochoice_maxreplays for more information on this argument.

options

This argument takes a full list of options. The list options defined here will replace the previous list, ie the previous options list will be deleted and this list will be saved instead.

The syntax for this argument is exactly the same as telecoms.ivr.create:options. See the documentation of that function for a fuller explanation.

This argument cannot be specified at the same time as options.add, options.edit or options.del.

options.add

This argument is syntactically the same as the options argument, except that the list of options here will be merged with the options already defined.

For any option specified here that has the same keypress value as an option already defined in this ivr menu, the new definition for that option will overwrite the older one.

Any options that have a keypress value that is not already defined in this ivr menu will be added to the options already present.

For example, suppose your IVR menu currently has the following options defined (note: the format of this list is for illustrative purposes only - it is not the correct syntax for this argument):

Now suppose you supply the following list to options.add

The resultant options will be a merge of the two lists:

This argument cannot be specified at the same time as the options argument.

options.edit

Use this argument to edit the definition of one or more options that already exist in the menu. Only elements that are supplied are changed; other settings remain unchanged.

The argument takes a list of option records, each record consisting of the following:

This argument cannot be specified at the same time as the options argument.

options.del

A comma separated list, or array of, keypresses corresponding to the options you wish to delete from the menu.

For example, if you wanted to remove options "01" and "15" you could supply "01,15" in this argument, or an array containing the two values.

This argument cannot be specified at the same time as the options argument.

mode

Supply new value. See telecoms.ivr.create:mode for more information on this argument.

cgi_maxdigits

Supply new value. See telecoms.ivr.create:cgi_maxdigits for more information on this argument.

cgi_simple_goodchoice_opt

Supply new value. See telecoms.ivr.create:cgi_simple_goodchoice_opt for more information on this argument.

cgi_full_init_url

Supply new value. See telecoms.ivr.create:cgi_full_init_url for more information on this argument.

cgi_full_init_method

Supply new value. See telecoms.ivr.create:cgi_full_init_method for more information on this argument.

cgi_full_response_url

Supply new value. See telecoms.ivr.create:cgi_full_response_url for more information on this argument.

cgi_full_response_method

Supply new value. See telecoms.ivr.create:cgi_full_response_method for more information on this argument.

cgi_full_failchoice

Supply new value. See telecoms.ivr.create:cgi_full_failchoice for more information on this argument.

Example 1

You already have a basic IVR menu that

Your IVR menu might look like this:

{
  'ivrID' => '4',
  'desc' => 'Main menu',
  'prompt_bg_soundclipID' => '1',
  'nochoice_maxreplays' => '3',
  'timeout_response' => '10',
  'timeout_digit' => '3',
  'options' =>
    [
      {
        'keypress' => '1'
        'routeto_type' => 'number',
        'destnumber' => '02031001000',
      },
      {
        'keypress' => '2'
        'routeto_type' => 'number',
        'destnumber' => '02031002000',
      }
    ],
}

You now decide that callers who enter a non-valid option (ie press something that is not defined as an option) should hear a message telling them. This message is in soundclip 84 which you've recently uploaded with telecoms.soundclip.create and assigned it the "ivr.prompt" role.

You also want to add descriptions to the options.

JSON example request:

POST https://live.apicontrol.co.uk/1/json
{
    "auth" : {
        "username" : "YOURUSERNAME",
        "password" : "YOURPASSWORD",
    },
    "func" : "telecoms.ivr.edit",
    "args" : {
       "badchoice_bg_soundclipID" : 84,
       "options.edit" : [
          {
             "keypress" : "1",
             "desc" : "sales"
          },
          {
             "desc" : "service",
             "keypress" : "2"
          }
       ],
       "ivrID" : 4
    }
}

The response

JSON example response:

{
   "success" : "1",
   "results" : {
      "eventID" : "1477555"
   }
}

Now your IVR menu looks like below. Note that it now shows badchoice_bg_soundclipID in the main record, plus the options records are now showing descriptions:

{
  'ivrID' => '4',
  'desc' => 'Main menu',
  'prompt_bg_soundclipID' => '1',
  'badchoice_bg_soundclipID' => '84',
  'nochoice_maxreplays' => '3',
  'timeout_response' => '10',
  'timeout_digit' => '3',
  'options' =>
    [
      {
        'keypress' => '1'
        'desc' => 'sales',
        'routeto_type' => 'number',
        'destnumber' => '02031001000',
      },
      {
        'keypress' => '2'
        'desc' => 'service',
        'routeto_type' => 'number',
        'destnumber' => '02031002000',
      }
   ],
}

Example 2

You've decided to further modify the menu you had from the above example such that if a caller does not select an option from the menu, they get transferred to the main switchboard. In preparation for this, you've recorded a new sound file to play to the callers when they arrive at the menu which ends with the message "or please hold to speak to the switchboard". Once you have edited your menu, you will need to rememeber to upload this in place of the existing sound file with telecoms.soundclip.edit so that the callers are aware of the new options.

You also decide to add an additional menu option, "3", to transfer to the accounts department (and remembered to mention that in your new recording). Because the accounts department is only open in the mornings, you have used telecoms.dayparting.create to create a day parting that routes to their number during the hours that are there but routes to voicemail at all other times. In this example, this day parting has a daypartID of 604.

In order to provide the default action, you need to define it as an option so that it has a defined keypress (it doesn't matter if you don't tell the caller what this is) and then you set this as the default_choice.

JSON example request:

POST https://live.apicontrol.co.uk/1/json
{
    "auth" : {
        "username" : "YOURUSERNAME",
        "password" : "YOURPASSWORD",
    },
    "func" : "telecoms.ivr.edit",
    "args" : {
       "default_choice" : "9",
       "ivrID" : 4,
       "options.add" : [
          {
             "routeto_type" : "dayparting",
             "keypress" : "3",
             "desc" : "accounts",
             "daypartID" : 604
          },
          {
             "routeto_type" : "number",
             "destnumber" : "02031009999",
             "keypress" : "9",
             "desc" : "main switchboard"
          }
       ]
    }
}

The response

JSON example response:

{
   "results" : {
      "eventID" : "1477558"
   },
   "success" : "1"
}

Now your IVR menu looks like below. Note that it now shows default_choice in the main record, plus the options records how have the two new options:

{
  'ivrID' => '4',
  'desc' => 'Main menu',
  'prompt_bg_soundclipID' => '1',
  'badchoice_bg_soundclipID' => '84',
  'default_choice' => '9',
  'nochoice_maxreplays' => '3',
  'timeout_response' => '10',
  'timeout_digit' => '3'
  'options' => [
              {
                'keypress' => '1'
                'desc' => 'sales',
                'routeto_type' => 'number',
                'destnumber' => '02031001000',
              },
              {
                'keypress' => '2'
                'desc' => 'service',
                'routeto_type' => 'number',
                'destnumber' => '02031002000',
              },
              {
                'keypress' => '3'
                'desc' => 'accounts',
                'routeto_type' => 'dayparting',
                'daypartID' => '604',
              },
              {
                'keypress' => '9'
                'desc' => 'main switchboard',
                'routeto_type' => 'number',
                'destnumber' => '02031009999',
              }
            ],
}

Example 3

You now decided to make the following changes to your IVR menu:

Let's assume that you have used telecoms.ivr.create to create an additional IVR menu for the sub-menu for option "4" and that this has an ivrID of 5.

Let's also assume that the sound file you have uploaded using telecoms.soundclip.create for playback to the caller in response to them choosing option "1" has a soundclipID of 2.

In order to add the option to repeat the menu, you will need to define an option that routes back to this same IVR menu. You do this by supplying routeto_type of "ivr" and specifying ivrID of 4 (because this menu has an ivrID of 4) or you can specify an ivrID of 0 which is a special case to mean "this menu" and will be internally translated by the API to the correct ID.

JSON example request:

POST https://live.apicontrol.co.uk/1/json
{
    "auth" : {
        "username" : "YOURUSERNAME",
        "password" : "YOURPASSWORD",
    },
    "func" : "telecoms.ivr.edit",
    "args" : {
       "options.edit" : [
          {
             "keypress" : "1",
             "fg_soundclipID" : 2
          }
       ],
       "options.add" : [
          {
             "desc" : "repeat this menu",
             "keypress" : "0",
             "routeto_type" : "ivr",
             "ivrID" : 0
          },
          {
             "ivrID" : 5,
             "keypress" : "4",
             "routeto_type" : "ivr",
             "desc" : "sub menu"
          }
       ],
       "ivrID" : 4
    }
}

The response

JSON example response:

{
   "results" : {
      "eventID" : "1477563"
   },
   "success" : "1"
}

Now your IVR menu looks like below. Note that the API has translated your ivrID of 0 into its true ivrID:

{
  'ivrID' => '4',
  'desc' => 'Main menu',
  'prompt_bg_soundclipID' => '1',
  'badchoice_bg_soundclipID' => '84',
  'default_choice' => '9',
  'nochoice_maxreplays' => '3',
  'timeout_response' => '10',
  'timeout_digit' => '3'
  'options' => [
              {
                'keypress' => '0'
                'desc' => 'repeat this menu',
                'ivrID' => '4',
                'routeto_type' => 'ivr',
              },
              {
                'keypress' => '1'
                'desc' => 'sales',
                'fg_soundclipID' => '2',
                'routeto_type' => 'number',
                'destnumber' => '02031001000',
              },
              {
                'keypress' => '2'
                'desc' => 'service',
                'routeto_type' => 'number',
                'destnumber' => '02031002000',
              },
              {
                'keypress' => '3'
                'desc' => 'accounts',
                'routeto_type' => 'dayparting',
                'daypartID' => '604',
              },
              {
                'keypress' => '4'
                'desc' => 'sub menu',
                'routeto_type' => 'ivr',
                'ivrID' => '5',
              },
              {
                'keypress' => '9'
                'desc' => 'main switchboard',
                'routeto_type' => 'number',
                'destnumber' => '02031009999',
              }
            ],
}