Home > Amanda > Communications System > Amanda Work Group Manual

Amanda Work Group Manual

    Download as PDF Print this page Share this page

    Have a look at the manual Amanda Work Group Manual online for free. It’s possible to download the document as PDF or print. UserManuals.tech offer 32 Amanda manuals and user’s guides for free. Share the user manual or guide on Facebook, Twitter or Google+.

    							Chapter 10: Programming Amanda 121
    Most system variables do not have parameters. However, a couple of system variables 
    have parameters that affect the contents of that system variable. For example, to use %I, 
    the system variable that retrieves data from specific fields of specific messages, you use 
    parameters to indicate which field, message number, and mailbox you want the data from.
    Syntax
    The exact sequence of characters for each token is defined by its syntax, so you have to 
    learn to read syntax. The following table shows the conventions used in this guide. They 
    are similar to the syntax conventions used for other programming languages.
    For example, the following is the syntax for %I:
    Syntax:
    %I(
    field,
    msg_no[,
    mailbox])
    %I() has three parameters: field, msg_no and mailbox.
    Syntax ConventionMeaning
    boldBold is used for characters that must be 
    used by you exactly as they appear—if 
    you use them at all.
    italicsItalics are used for characters that you 
    must replace with real strings, numbers, 
    variables, or other commands. 
    [   ]The syntax inside the brackets is optional. 
    If you don’t use this syntax, its default is 
    used.
    {   }The syntax inside braces can be repeated. 
    The description tells you how many times 
    they can be repeated.
    |The vertical bar separates choices. For 
    example, [V|P] means that you can use V 
    or P but not both. 
    There is also a |() token. However, this | is 
    bold in the syntax because it is required. 
    						
    							122 Installing [email protected]/Windows
    Because the %I and parentheses are bold, you know that you have to include them in the 
    command. The commas are bold, but the one in front of mailbox is inside brackets […], 
    which surround optional parts of the syntax. If you use the bracketed part of the syntax, 
    you must use the comma. 
    Because field is italicized, you know that it is a place holder for information that you must 
    provide. Field can be any one of the following fields associated with messages:
    D for the Date field
    T for the Time field
    F for the From field
    Because msg_no is also italicized, you know that it is a place holder for information that 
    you must provide. For example, to find out the date for message number 8, you replace 
    msg_no with the number 8. Because mailbox is inside brackets, you replace it only if you 
    use that part of the syntax. For example, you may want to delete a message belonging to 
    mailbox 151.
    Whenever a parameter is optional, such as mailbox, it has a default. A default is the value 
    that is used for the parameter whenever the parameter is missing. The default for mailbox 
    is the current mailbox.
    Using the syntax, you can create any number of %I() commands. For example, %I(D,8) 
    provides the date for message 8 for the current mailbox, and %I(T,6,151) provides the 
    time for message 6 for mailbox 151. 
    						
    							Chapter 10: Programming Amanda 123
    Both the Extension and Notify Method fields can contain up to 65 characters. If you need 
    more than 65 characters for your program, you use:
     A command that reads additional tokens from a file
     The G() command to tell Amanda to go to the Extension field for another mailbox 
    and process the tokens the system finds there
    Files and Directories
    This section points out what you need to know about files and file names when using the 
    Token Programming Language. It assumes that you already know the following and other 
    facts about files and directories:
     DOS files are stored in directories.
     The complete name for a file starts with the root directory (usually C:), lists the 
    subdirectories leading to the file, and ends with the name of the file, each of which 
    is separated by a backslash (\). 
    When you use a DOS file name as a parameter, you must replace each backslash (\) found 
    in the name with either two backslashes (\\) or one forward slash (/). For example, 
    C:\AMANDA\FOOBAR.TXT must become either C:\\AMANDA\\FOOBAR.TXT or C:/
    AMANDA/FOOBAR.TXT.
    You can use variable names as parts of the file name. For example, if %S1 is C:, and %S2 
    is Amanda, you can use %S1\\%S2\\FOOBAR.TXT.
    Amanda can read text files (also called ASCII files) as well as files in dBase format. The 
    former have file names that usually end with .TXT, and the latter have file names that end 
    with .DBF. Amanda can read from, write to, and search files that contain database records. 
    A record is a way to group pieces of information. For example, your name and address is a 
    record in a database for any company that sends you supplies. The individual parts of your 
    name and address are fields of that record. In a database, another name for a record is a 
    row, and another name for a field is a column.
    Sample Address Record: 
    First Name: MARY Last Name: HU
    Street Address: 28291 HOOVER ST.
    City: WINTER FALLS State: MI
    Zip: 48444
    Text files that contain database records should have commas separating each field of each 
    record and a carriage return/linefeed separating one record from another. (A carriage 
    return/linefeed is the pair of ASCII characters placed in a file when you press Enter on 
    your keyboard.) 
    Sample Address Record as a line in a text file:
    MARY,HU,28291 HOOVER ST.,WINTER FALLS,MI,48444
    When Amanda reads records from a text file, you tell her the number of the fields you 
    want to read or change the data in. The fields are numbered starting with 1. In our 
    example, First Name is 1, and Last Name is 2. 
    						
    							124 Installing [email protected]/Windows
    dBase files are created using dBase, a database software product. For dBase files, you tell 
    Amanda the name of the field instead of its number. When Amanda reads data from a 
    dBase file, the system deletes any spaces at the end of the data as the system stores the 
    data into a variable. For example, if the field contains MARY             , Amanda reads 
    only MARY.
    Flow of Control: Branching and Looping
    When programming Amanda, you often type the tokens for a program in more than one 
    field. This is not because you have exceeded the 65-character limit for the Extension or 
    Notify Method field, but because you want to control the flow of token processing. For 
    example, the only way to have Amanda perform different actions based on the value of a 
    variable, is to put the tokens for one set of actions in another Extension field. 
    The commands that control the flow of tokens are:
     The I() command which compares two values. (Notice that this is not the same as 
    the %I() command/system variable discussed earlier in this chapter.) This com-
    mand is similar to the If command or If statement in other programming languag-
    es. It is used to branch in either of two directions, depending on whether the 
    comparison is true or false. If the comparison is true, Amanda goes to another 
    mailbox’s Extension field and processes the tokens there. If the comparison is 
    false (for example, %S1 is not equal to the empty string), Amanda continues pro-
    cessing tokens.
    For example, I(%S1,=,,101) can be read as “If the variable %S1 equals the empty 
    string, go to mailbox 101. If not, go to the next token in this mailbox.” 
    I(%G0,>,5,2000) can be read as “If the variable %G0 is greater than 5, go to mailbox 
    2000. If not, go to the next token in this mailbox.”
     The G() command which tells Amanda to go to another mailbox’s Extension field 
    right now. (Notice that this is not the same as the %G0 through %G9 global vari-
    ables.) There is no comparison made—just an immediate branch to a new mail-
    box.
    For example, G(2000) can be read as “Go immediately to mailbox 2000.”
    A loop is the name given to a set of tokens that are repeated. For example, if the last token 
    in the Extension field for mailbox 151 is G(151), Amanda returns to the beginning of the 
    Extension field for mailbox 151. This forms a loop. It forms an infinite loop unless 
    Amanda can branch to another mailbox’s Extension field before performing the G() 
    command. Sometimes you want an infinite loop, but usually an I() command appears 
    within the loop (somewhere between the beginning of the loop and the G() command) and 
    allows Amanda a way out of the loop. 
    For example, if you want Amanda to process the tokens for 151 exactly three times, you 
    use a variable as a counter. You add 1 to the variable every time through the loop and 
    branch when the I() command determines that the variable is equal to 3.
    If you want Amanda to process the tokens for 151 until a certain value is entered by the 
    caller, you store the caller’s input in a variable and use the I() command to branch when 
    the variable finally contains the value you are waiting for.
    The examples in this section shows a loop in which Amanda repeats the tokens in one 
    Extension field over and over—until stopped. You can make more complicated loops. For 
    example, you can use the G() command to go from mailbox 151 to mailbox 152 to  
    						
    							Chapter 10: Programming Amanda 125
    mailbox 153, before returning to mailbox 151. This is still a loop because eventually 
    Amanda returns to mailbox 151. It is just a longer, more complicated loop than the earlier 
    examples.
    T1 Lines
    If you are using a T1 line, the only tokens you can use are:
     Any DTMF digit (0–9, A, B, C, D, # , *)
     Any system, port, or global variable (any token that starts with %)
    E
    F
    P
    W
    Examples
    This section provides practical examples using some of the available tokens.
    Customizing the Employee Directory
    The default operation of the employee directory minimizes the work you have to do as a 
    system administrator. All you have to do is put values in the Dir Name 1 and Dir Name 2 
    fields for each employee’s mailbox. A little extra work on your part can make it easier for 
    the caller to use the employee directory. 
    Application
    This example explains how to streamline the functionality of the employee directory (by 
    default, mailbox 411) so that the caller does not have to dial the extension.
    The default use of the employee directory:
    1. A caller enters 411 for the employee directory.
    2. The caller enters three digits representing the first three letters in either the first or last 
    name of the person he wants to call. 
    3. Amanda reads the extension for each person whose name matches the digits. 
    4. The caller dials the correct extension.
    The customized use of the employee directory:
    1. A caller enters 411 for the employee directory.
    2. The caller enters three digits representing the first three letters in either the first or last 
    name of the person he wants to call.  
    						
    							126 Installing [email protected]/Windows
    3. If more than one employee matches the digits, Amanda asks the caller to choose. 
    For example, Amanda might say “For Steve Smith, press 1; for Stella Clark, press 2.”
    4. Amanda dials the extension. 
    Translating to Amanda’s Tokens
    This example shows the use of the G() command, which stops Amanda from processing 
    the current mailbox and goes directly to the specified mailbox. It also illustrates the M() 
    command that causes Amanda to play a greeting and wait for a single-digit number from 
    the menu as a response.
    To customize the employee directory:
    1. Make a list of everyone’s first and last names (as they will appear in the Dir Name 1 
    and Dir Name 2 fields in their mailboxes).
    Example:
    Steve Forest mailbox 105
    JoAnn Johnson mailbox 106
    Bob Knapp mailbox 107
    2. Determine what three digits would match each name:
    Example:
    Steve Forest mailbox 105
    783 367
    JoAnn Johnson mailbox 106
    562 564
    Bob Knapp mailbox 107
    262 562
    3. Create mailboxes for each of the sets of three-digits.
    Example:
    Create mailboxes 783, 367, 562, 564, and 262.
    4. For each of these mailboxes, make sure that:
    Do Not Disturb is locked OFF. (Do Not Disturb: OFF Lock: ON)
    Call screening is locked OFF. (Screen Calls? OFF Lock: ON)
    5. Fill in the Extension fields for mailboxes that only match one of the employees with 
    @G(
    employee_mailbox) 
    Example:
    Because 783 and 367 match Steve Forest, the Extension fields for mailbox 783 and 
    mailbox 367 should be:
    @G(105)
    Because 564 matches JoAnn Johnson, the Extension field for mailbox 564 should be:
    @G(106) 
    						
    							Chapter 10: Programming Amanda 127
    Because 262 matches Bob Knapp, the Extension field for mailbox 262 should be:
    @G(107)
    or
    @P(G1)P(N,107)G(107)
    6. For mailboxes that match more than one of the employees:
    a. Record G1 (Greeting 1) as “For first matching name, press 1; for second 
    matching name, press 2; …” substituting the real names of employees for the 
    italicized words.
    b. In the Menus fields, put the mailbox for the first matching name in 1; the mail-
    box for the second in 2, and so forth.
    c. In the Extension field, puts:
    @M(G1,1,30)
    This command causes Amanda to play Greeting 1 and waits for the caller to enter a 
    digit indicating a choice from the menu. If the caller does not enter a digit within 30 
    seconds, Greeting 1 repeats.
    Example:
    Because 562 matches both JoAnn Johnson and Bob Knapp, the Menus for mailbox 
    562 would be:
    1106
    2107
    The greeting would be:
    “For JoAnn Johnson, press 1; for Bob Knapp, press 2.”
    T
    IPS:To make this better yet, use:
    @P(G1)P(N,
    employee_mailbox)G(
    employee_mailbox)
    instead of:
    @G(
    employee_mailbox) 
    Record a Greeting 1 for each of the new mailboxes that says “You are 
    being transferred to” after which Amanda plays the Name and Extension 
    recording for the employee’s mailbox. For mailbox 564 in the example, 
    this would look like:
    @P(G1)P(N,106)G(106) 
    The P() command plays greetings and so forth. In this case, the first P() 
    command plays Greeting 1; the second plays the Name and Extension re-
    cording.
    If the matching digits conflict with existing mailboxes (for example, 564 
    matches JoAnn Johnson, but it is already the mailbox for another em-
    ployee), use 99564 or some other variation that does not conflict with 
    employee mailboxes.
    When more than one employee matches the digits that the caller enters, 
    you can add 9 to the menu (with mailbox 411) and append the greeting 
    to end with: “…press 9 to return to the employee directory.” Then, if the 
    caller doesn’t want any of the people mentioned in the greeting, he can 
    try another name. 
    						
    							128 Installing [email protected]/Windows
    Token Reference
    This section contains two tables, each of which lists all of the tokens in the Token 
    Programming Language: 
    A quick token reference table, which lists each token by its function or purpose. 
    The functions are in alphabetical order so that you can easily find all the tokens 
    that perform similar functions. For example, the J() and T() commands both deal 
    with faxes so they are grouped under Fax. This table provides only the syntax for 
    each token. For a full description of the token, you must look in the alphabetical 
    reference.
    An alphabetical token reference table, which lists the tokens in alphabetical or-
    der based on the first letter in the token’s name. For example, %I and I are found 
    under I. Tokens whose names do not contain a letter are listed in ASCII order be-
    fore the letters. This table provides complete descriptions and examples of each 
    token.
    Quick Token Reference
    Function/Purpose of TokenSyntax
    absolute valueP[
    repetition](
    number,N[,hangup])
    Add+(
    variable[,
    value]) 
    ANI (Automatic Number 
    Identification)%H
    Append, file|(
    file) 
    Assignment=(
    variable,
    value[,
    start,
    end]) 
    Boards, serial numbers%B1 %B2 %B3
    %B4 %B5 %B6
    Caller hang-upH(
    mailbox)
    Caller ID%H
    Comment%F(
    field[,
    mailbox]) 
    ConditionI(
    value,
    operator,
    value,
    mailbox) 
    Conference callext_noKM
    Creating message notification fileX[(
    file)] 
    CurrencyP[
    repetition](
    amount,
    currency[,
    hangup]) 
    Current connect time%T
    Current date in American format%Y
    Current port number%C
    Current time%Z
    Current mailboxP[
    repetition] (U[,
    mailbox[,
    hangup]])
    %U 
    						
    							Chapter 10: Programming Amanda 129
    Current mailbox’s Extension field%E
    Date%I(
    field,
    msg_no[,
    mailbox])
    P[
    repetition](
    date,D[,
    hangup]) 
    %Y
    Days of week%W
    Deleting fileY[(
    file)] 
    Deleting, messageKD(
    msg_no[,
    mailbox]) 
    Dial (pulse dial)~
    Dial codesF
    dial tone%X
    dial tone, wait forW(
    n,T[,
    mailbox]) 
    Directory Name field%F(
    field[,
    mailbox]) 
    Disk space%D
    P[
    repetition](D) 
    DollarsP[
    repetition](
    amount,
    currency[,
    hangup]) 
    DTMF digitsP[
    repetition](
    DTMF) 
    P[
    repetition](R) 
    01 23
    45 67
    89 AB
    CD *#
    DTMF for relay pagingP[
    repetition] (R)
    %R
    DTMF, save caller’s entryR(
    greeting[#
    mailbox],
    variable
    [,
    timeout[,
    timeout2]]) 
    Earth recallE
    Exit for caller hang upH(
    mailbox) 
    Exit for mailbox[
    ext_no]H
    Extension fieldext_no
    @
    %E
    *Extensions, partially supervised transferU-
    ext_no
    Quick Token Reference (Continued)
    Function/Purpose of TokenSyntax 
    						
    							130 Installing [email protected]/Windows
    Fax, incremental(
    file)
    Fax, initialization%A
    Fax, messagesKQ(
    phone_no[,
    mailbox])
    Fax, receiveJ(
    file_or_box,
    phone_no[,
    tokens]) 
    Fax, sendT(
    file,
    phone_no[,
    tokens]) 
    Fields, process extension or Notify field as 
    tokens@
    Fields, returns number of characters in a 
    stringLEN[
    string] 
    Fields, values in mailbox record%F(
    field [,
    mailbox]) 
    Fields, Variable field in notification record%V
    Fields, Extension %E
    Fields, information%I(
    field,
    msg_no[,
    mailbox])
    Files, append|(
    file) 
    Files, as indicatorsX[(
    file)] 
    Y[(
    file)] 
    Z[(
    file)] 
    Files, delete recordKV(
    file,
    field,
    value) 
    Files, from recordingsKR(
    file_or_box[,
    recording_info])
    Files, import{
    file}
    Files, read{
    file}
    V(
    file,
    field,
    value{,
    field,
    variable}[,
    n])
    [(
    file)
    N(
    file,
    field,
    value{,
    field,
    variable})
    Files, search?(
    line,
    file,
    mailbox) 
    Files, voiceP[
    repetition](X,
    file[,
    hangup]) 
    Files, write](
    file) 
    N(
    file,
    field,
    value{,
    field,
    variable})
    FrancsP[
    repetition](
    amount,
    currency[,
    hangup]) 
    Quick Token Reference (Continued)
    Function/Purpose of TokenSyntax 
    						
    All Amanda manuals Comments (0)

    Related Manuals for Amanda Work Group Manual