Jump to content
Gold Sponsor: Data-Way IT-Consulting, Austria

  • PBXScript.PreviousScripts()

    PBXScript.PreviousScripts()

    Lua   → VBScript   SwxWare v13.10

     

    This function returns a list (indexed table) with information about all call routing scripts the call was in before reaching the current one.

     

    local tScripts = PBXScript.PreviousScripts()

     

     

    This function returns an indexed table with the following content per entry:

     

    [
        {
            .userid   : number
            .username : string
            .start    : {
                            .sec   : number
                            .min   : number
                            .hour  : number
                            .day   : number
                            .month : number
                            .year  : number
                            .wday  : number
                            .yday  : number
                            .isdst : boolean
                        }
            .finish   : {
                            .sec   : number
                            .min   : number
                            .hour  : number
                            .day   : number
                            .month : number
                            .year  : number
                            .wday  : number
                            .yday  : number
                            .isdst : boolean
                        }
        }
    ]

     

    Please note, that the date and time is given in Universal Time Coordinated (UTC), so it comes without any daylight savin time problems.

     

     

    The follwing example lists all available information into the Server trace file:

     

    local tScripts  = nil
    tScripts = PBXScript.PreviousScripts()
    if (tScripts ~= nil) then
        for i = 1, #tScripts do
    
            PBXScript.OutputTrace("UserName: "  .. tScripts[i].username)
            PBXScript.OutputTrace("UserId: "    .. tScripts[i].userid)
            PBXScript.OutputTrace("StartTime: " .. AddLeadingZeros(tScripts[i].start.day,    2) .. "." .. 
                                                   AddLeadingZeros(tScripts[i].start.month,  2) .. "." .. 
                                                   AddLeadingZeros(tScripts[i].start.year,   4) .. " " .. 
                                                   AddLeadingZeros(tScripts[i].start.hour,   2) .. ":" .. 
                                                   AddLeadingZeros(tScripts[i].start.min,    2) .. ":" .. 
                                                   AddLeadingZeros(tScripts[i].start.sec,    2))
            PBXScript.OutputTrace("EndTime: "   .. AddLeadingZeros(tScripts[i].finish.day,   2) .. "." .. 
                                                   AddLeadingZeros(tScripts[i].finish.month, 2) .. "." .. 
                                                   AddLeadingZeros(tScripts[i].finish.year,  4) .. " " .. 
                                                   AddLeadingZeros(tScripts[i].finish.hour,  2) .. ":" .. 
                                                   AddLeadingZeros(tScripts[i].finish.min,   2) .. ":" .. 
                                                   AddLeadingZeros(tScripts[i].finish.sec,   2))
    
        end
    end

     

    This example makes use of the string helper function AddLeadingZeros() from the GSE build-in helper functions.

     

    Resulting trace lines if call was forwarded by one previous user:

     

    04 18:18:23.840 001e70 Info SrvScript  0942A7E8 00000084 SPBXScriptLua::OutputTrace  () UserName: Erika Mustermann
    04 18:18:23.840 001e70 Info SrvScript  0942A7E8 00000084 SPBXScriptLua::OutputTrace  () UserId: 20
    04 18:18:23.840 001e70 Info SrvScript  0942A7E8 00000084 SPBXScriptLua::OutputTrace  () StartTime: 04.06.2022 16:18:00
    04 18:18:23.840 001e70 Info SrvScript  0942A7E8 00000084 SPBXScriptLua::OutputTrace  () EndTime: 04.06.2022 16:18:20

     

     

    Examples from the Function Collection

     

     

     


    Tom Wellige
     Share


     Share




×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and have taken note of our Privacy Policy.
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.