Pigeon Agents Development LUT Agent - DatasmithSA/Pigeon-Voice-Training GitHub Wiki

A LUT (Look Up Table) is a synchronous message over TCP/IP; meaning that once a voice device makes a LUT request to the Pigeon Voice Server, it will block (wait) for a response before the dialog continues to the next voice prompt/state in the Task/Voice Application running on the voice device.

Developing Pigeon LUT Agents allows you to handle LUT message requests from Vocollect Voice devices. A LUT agent will need to be developed for every type of LUT message request from the device e.g. one for a login request, another downloading a pick list etc.

In this example we will create a simple LUT agent that writes out the default request details to the console, as well as the input parameters passed in from the Task/Voice Application. Lastly it will respond to the device with an an output record.

  1. Create a new class in the TCP_IP folder and call it: LutLocationAgent
  2. At the top of the file, add the following using clauses to import the Pigeon Voice SDK namespaces:
    • using Pigeon.Voice.SDK.AgentBase.TCP_IP;
    • using Pigeon.Voice.SDK.Sockets.LUT;
  3. Inherit from the PVLutAgentBase abstract class located in the Pigeon Voice SDK. This marks your agent class as being a LUT Agent.
  4. Override the abstract Process method of the PVLutAgentBase class. It is within this method that your own business logic will be coded for the agent e.g. querying the WMS database or performing a calculation etc.
  5. The Process method provides a single input parameter, an PVLutResponse object which encapsulates both the response and request details. The PVLutResponse object contains a property called Request which holds a PVSocketRequest object containing all the request details.
  6. In the example below we write the default request properties to the console for display purposes. These properties are common to all request LUT and ODR requests from voice devices.
  7. The custom properties sent by the Task/Voice Application are held within the Request's InputRecordFieldValues property which is simply a generic list of strings. They can also be accessed directly via an a zero based index on the Request's indexer property e.g. response.Request[0] will return the input record's first field/column.
  8. Resonse records can be added with the AddRecord method on the PVLutResponse object. A record is simply a list of strings which will be returned to the device. Multiple records can be added to the response making up a table of records.
    #region Using Directives

    using System;
    using System.Collections.Generic;
    using Pigeon.Voice.SDK.Sockets.LUT;
    using Pigeon.Voice.SDK.AgentBase.TCP_IP;

    #endregion //Using Directives

    public class LutLocationAgent : PVLutAgentBase
    {
        #region Methods

        public override void Process(PVLutResponse response)
        {
            //Inputs (do something with them)
            Console.WriteLine(response.Request.ClientIpAddress);
            Console.WriteLine(response.Request.RawMessageContents);
            Console.WriteLine(response.Request.EndOfRecordTerminator);
            Console.WriteLine(response.Request.EndOfRecordSetTerminator);
            Console.WriteLine(response.Request.SocketClientDateTimeFormat);
            Console.WriteLine(response.Request.CommandName);
            Console.WriteLine(response.Request.RequestDateTimeClientOriginalFormat);
            Console.WriteLine(response.Request.RequestDateTimeClient);
            Console.WriteLine(response.Request.RequestDateTimeServer);
            Console.WriteLine(response.Request.DeviceId);
            Console.WriteLine(response.Request.OperatorId);
            Console.WriteLine(response.Request.InputRecordFieldValuesCount);
            response.Request.InputRecordFieldValues.ForEach(fieldValue => Console.WriteLine(fieldValue));

            //Output
            response.AddRecord(new List<string>() { "5 4 X 3 2", "123" }); //Return a record to the voice device.
        }

        #endregion //Methods
    }
⚠️ **GitHub.com Fallback** ⚠️