Highlight a phrase and click this icon to search it on Swyx-Forum    Highlight a phrase and click this icon to search it within the Swyx Knowledgebase    Highlight a phrase and click this icon to search it using Goolge    Highlight a phrase and click this icon to search it using Wikipedia

Forum

Bookmark and Share

Forum

Bookmark and Share

 
  Forums  Development  Extended Call R...  Upgrading the BankHoliday with time
Previous Previous
 
Next Next
New Post 12/6/2007 9:15 PM
Online now... Martin Hüser
532 posts
tinyurl.com/d4doz7p
1st Level Poster






Re: Upgrading the BankHoliday with time  (Germany)

Calrouting scripts in v6.10 are still able to access the local hard disk. You have to change the script, however, because it uses PBXUser.Datafolder as root path to find the text file. In v6.10 PBXUser.Datafolder points to a temporary folder.

Change the script to use a fixed location on the hard disk and make sure that the file is located on a shared folder so that it can be accessed from a client PC.


Martin Hüser
Product Manager, Scrum Product Owner, Swyx Solutions AG
 
New Post 3/17/2008 1:24 PM
User is offline Marco
8 posts
10th Level Poster


Re: Upgrading the BankHoliday with time  (Germany)

Hi everbody,

is there an updated way to realise this script with 6.10 (6.11) ? I couldnt get it to work with this vbs-code:

' FileOpen iomode Values
Const fsoForReading   = 1
Const fsoForWriting   = 2
Const fsoForAppending = 8

' Bankholiday Filename
Const sBHFilename     = "bankholiday.txt"

Function IsBankHoliday ( vDate )

    Dim wsh, fso, file
    Dim sDir, sFile, sLine
    Dim bReturn, nPos

    bReturn = False

    ' get share path by extracting it from user folder
    sDir = C:\
    nPos = InStrRev(sDir, "\")
    sDir = Left(sDir, nPos-1)
    nPos = InStrRev(sDir, "\")
    sDir = Left(sDir, nPos)

    ' Build file name. Textfile will be located within the global script directory, e.g.
    ' --> C:\Program Files\SwyxWare\Share\Data\PhoneClient\Scripts\bankholiday.txt
    sFile = sDir & "holiday\" & sBHFilename

    ' Create FileSystemObejct
    Set fso = CreateObject("Scripting.FileSystemObject")

    ' Open text file
    Set file = fso.OpenTextFile(sFile, fsoForReading)

    do while (not (file.AtEndOfStream)) and (not bReturn)
        sLine = file.ReadLine
        if IsDate(sLine) then
            if DateDiff("d", vDate, CDate(sLine)) = 0 then bReturn = True
        end if
    loop
    file.Close

    Set file = Nothing
    Set fso  = Nothing

    IsBankHoliday = bReturn

End Function

 

C:\holiday and the file within it is just for testing purposes, it exists on the server and the client as well, but the script just wont work (even worse: when this script is active, other scripts wont run either...very strange)

 

Best regards,

Marco

 
New Post 3/17/2008 1:34 PM
User is offline Tom Wellige
2263 posts
www.swyx.com
1st Level Poster








Re: Upgrading the BankHoliday with time  (Germany)

The reason why other scripts also seizes to work is easy: your current script causes a runtime error which ends the call automatically.

Suggestion: replace all the following code

 

' get share path by extracting it from user folder

sDir = C:\

nPos = InStrRev(sDir, "\")

sDir = Left(sDir, nPos-1)

nPos = InStrRev(sDir, "\")

sDir = Left(sDir, nPos)

 

' Build file name. Textfile will be located within the global script directory, e.g.

' --> C:\Program Files\SwyxWare\Share\Data\PhoneClient\Scripts\bankholiday.txt

sFile = sDir & "holiday\" & sBHFilename

 

by

 

sFile = "C:\holiday.txt"

 

Further more make sure, that the user the SwyxServer service is running under has at least read access to this file.

 


Tom Wellige
(Lead Solution Consultant, Swyx)

I learned very early the difference between knowing the name of something and knowing something.
Richard P. Feynman

 
New Post 3/17/2008 1:43 PM
User is offline Marco
8 posts
10th Level Poster


Re: Upgrading the BankHoliday with time  (Germany)

This solution works, thanks!

Marco

 
New Post 3/17/2008 1:48 PM
User is offline Tom Wellige
2263 posts
www.swyx.com
1st Level Poster








Re: Upgrading the BankHoliday with time  (Germany)

You're welcome

The reason for the replaced code was that in the past the file was located in the global sript folder. So the path needed to be calculated.

As there is no global script folder from v6.10 on the file needs to be located somewhere else. Of course it was also previously possible to do so. The idea behind using the global script folder was to keep all things related to each other together at one place.

Regards, Tom.


Tom Wellige
(Lead Solution Consultant, Swyx)

I learned very early the difference between knowing the name of something and knowing something.
Richard P. Feynman

 
New Post 3/17/2008 1:58 PM
User is offline Marco
8 posts
10th Level Poster


Re: Upgrading the BankHoliday with time  (Germany)

This makes sense. Im glad of having a database since 6.10 :-) And thanks for the pretty fast reply as well! :-)

 
New Post 10/31/2008 11:38 AM
User is offline thomas
16 posts
9th Level Poster


Re: Upgrading the BankHoliday with time  (Italy)

Hello everybody,

I'm trying to use the script on a 6.12 version, but I always have disconnected. I have done the modify in the VB code of Start block as suggested  by Tom, but nothing has changed. I'll copy here the actual VB code, please tell me where's the error if possible, thanks:

' FileOpen iomode Values
Const fsoForReading   = 1
Const fsoForWriting   = 2
Const fsoForAppending = 8

Function IsBankHoliday ( vDate )

    Dim wsh, fso, file
    Dim sDir, sFile, sLine
    Dim bReturn, nPos

    bReturn = False

    sFile = "C:\holiday.txt"

    ' Create FileSystemObejct
    Set fso = CreateObject("Scripting.FileSystemObject")

    ' Open text file
    Set file = fso.OpenTextFile(sFile, fsoForReading)

    do while (not (file.AtEndOfStream)) and (not bReturn)
        sLine = file.ReadLine
        if IsDate(sLine) then
            if DateDiff("d", vDate, CDate(sLine)) = 0 then bReturn = True
        end if
    loop
    file.Close

    Set file = Nothing
    Set fso  = Nothing

    IsBankHoliday = bReturn

End Function

And the text file content:

31.10.2008

 

Seems if like the rule is skipped...any idea?

 

Thanks

thomas

 
New Post 10/31/2008 11:50 AM
User is offline Tom Wellige
2263 posts
www.swyx.com
1st Level Poster








Re: Upgrading the BankHoliday with time  (Germany)

Take a look into the Windows Event Log or the Swyx Server trace file. What kind of error message do you find there ?

Just a shot into the dark: make sure the regional settings of the server machine (in terms of date format) match the date format given in the BankHoliday.txt file.

I had a case lately from Italy where the regional setting was configured to DD/MM/YYYY, but the dates given in the text file where DD.MM.YYYY. Just modify the content of the text file to match the regional settings of the server machine.

Tom.


Tom Wellige
(Lead Solution Consultant, Swyx)

I learned very early the difference between knowing the name of something and knowing something.
Richard P. Feynman

 
New Post 2/8/2009 5:26 PM
User is offline Supra
69 posts
5th Level Poster


Re: Upgrading the BankHoliday with time  (Italy)

Möchte mich schon vorab für die verwendete Sprache entschuldigen, mein Englisch reicht leider nicht...

Bin grad fleissig beim Testen und Probieren mit diesem schönen Skript, ich hätte es gerne dahingehend erweitert, dass in der Zeile der Feiertage hinten eine Rufnummer stehen kann, auf die dann entsprechend weitergeleitet wird. Wir haben in unserer Firma abwechselnd Bereitschaftsdienst und planen dies immer bereits für ein ganzes Jahr voraus, es wäre supertoll, wenn Swyx dahingehend vollautomatisiert werden könnte, ohne dass jeweils die Nummer, auf die umgeleitet wird, geändert werden muss.

Andere Frage: wo finde ich das TraceLog, um evtl. Fehler im Skript zu finden?

 

Schon mal vielen Dank im Voraus!

 
New Post 2/9/2009 7:11 AM
User is offline Tom Wellige
2263 posts
www.swyx.com
1st Level Poster








Re: Upgrading the BankHoliday with time  (Germany)
Modified By Tom Wellige  on 2/9/2009 8:12:28 AM)

 Supra wrote

ich hätte es gerne dahingehend erweitert, dass in der Zeile der Feiertage hinten eine Rufnummer stehen kann, auf die dann entsprechend weitergeleitet wird.

  • haenge einfach die weitere Nummer mittels Semikolon getrennt hinten an jedes Zeile
  • im Script wird jedes Zeile ja per ReadLine in eine Variable eingelesen und anschliessend
  • per Split in die einzelnen Bestandteile zerlegt.
  • die Nummer auf die Du zustellen willst, steht jetzt in aRange(2)
  • achte aber drauf, dass jetzt auf alle Faelle auch immer die Datums und Uhrzeit Angaben in der Textdatei gesetzt sind, sonst geht das schief
  • ich wuerde mit jetzt eine globale Variable anlegen und die Nummer dort hinein kopieren (Dim sDurchstellen)
  • innerhalb des Durchstellen Block kannst Du die jetzt direkt verwenden:  = sDurchstellen

 

 Supra wrote

Andere Frage: wo finde ich das TraceLog, um evtl. Fehler im Skript zu finden?

Script Tracing landet im Server Trace. Und zwar muss dazu das Trace Modul SrvScript auf Info3 (= 6) stehen. Weitere Infos zum Thema Tracing findet Du hier:

Hoffe, das hilft erstmal weiter.

Viele Gruesse, Tom.


Tom Wellige
(Lead Solution Consultant, Swyx)

I learned very early the difference between knowing the name of something and knowing something.
Richard P. Feynman

 
New Post 2/9/2009 7:41 AM
User is offline Supra
69 posts
5th Level Poster


Re: Upgrading the BankHoliday with time  (Italy)

Vielen Dank, so ähnlich bzw. genauso hatte ich das auch probiert, aber offensichtlich sind die Scripts so "empfindlich", dass beim kleinsten Fehler nichts mehr geht (ist ja auch klar), wie könnte man solche Scripts ausserhalb con Swyx testen bzw. welche Software/Debugger würdest Du empfehlen?

 
New Post 2/9/2009 8:00 AM
User is offline Tom Wellige
2263 posts
www.swyx.com
1st Level Poster








Re: Upgrading the BankHoliday with time  (Germany)

Speicher den VBScript Code aus dem Start Block einfach als VBS Datei ab, und nimm anstelle von PBXScript.OutputTrace -> WScript.Echo. Dann kannst Du das ganze normal von der Konsole aus starten (natuerlich musst Du in der VBS Datei auch irgendwo die Funktion IsBankHoliday einmal von Hand aufrufen) und bei Bedarf auch den Microsoft Script Debugger mit dran haengen.

Darueber hinaus findet Du am Ende des folgenden KB Artikels auch ein paar Hinweise zum Thema "Fehlerbehandlung in Call Routing Skripten":

 


Tom Wellige
(Lead Solution Consultant, Swyx)

I learned very early the difference between knowing the name of something and knowing something.
Richard P. Feynman

 
New Post 2/9/2009 11:23 AM
Online now... Martin Hüser
532 posts
tinyurl.com/d4doz7p
1st Level Poster






Re: Upgrading the BankHoliday with time  (Germany)
Modified By Martin Hüser  on 2/9/2009 12:24:17 PM)

Man kann sich das Ändern der Ausgabestatements zu WScript.Echo auch sparen, indem man eine eigene Implementierung von PBXScript für externe Tests baut:

 

 option explicit

' stub for the PBXScript object

' implements tracing and CreateObject functions only

class PBXScriptClass

    private currentTraceLevel

   

    public Sub PBXScriptClass_Initialize

        currentTraceLevel = 4

    end sub

   

    public property let TraceLevel(value)

        currentTraceLevel = value

    end property

   

    public property get TraceLevel

        TraceLevel = currentTraceLevel

    end property

   

    sub OutputTrace(msg)

        WScript.Echo msg

    end sub

   

    sub OutputTraceEx(level, msg)

        if currentTraceLevel >= level then

            WScript.Echo msg   

        end if

    end sub

   

    function CreateObject(o)

        CreateObject = WScript.CreateObject(o)

    end function

end class

 

 

dim PBXScript

set PBXScript = new PBXScriptClass

PBXScript.TraceLevel = 4

' load test code

PBXScript.OutputTrace "Testing custom VBScript " & WScript.Arguments(0)

dim oFSO

set oFSO = WScript.CreateObject("Scripting.Filesystemobject")

dim oFile

set oFile = oFSO.OpenTextFile(WScript.Arguments(0))

dim scriptToExecute

scriptToExecute = oFile.ReadAll

ExecuteGlobal scriptToExecute

PBXScript.OutputTrace "Done"

 Diesen Code speichert man als ecrtest.vbs ab. Sein eigenes Script testet man dann mit

cscript.exe ecrtest.vbs myscript.vbs


Martin Hüser
Product Manager, Scrum Product Owner, Swyx Solutions AG
 
New Post 2/10/2009 5:54 PM
User is offline Supra
69 posts
5th Level Poster


Re: Upgrading the BankHoliday with time  (Italy)

Beides sehr hilfreiche Tips, bin schon mal einen großen Schritt weiter... Danke!

 
New Post 2/10/2009 6:09 PM
User is offline Supra
69 posts
5th Level Poster


Re: Upgrading the BankHoliday with time  (Italy)

Das Script hätte ich soweit:

 Const sBuildNo        = "1.0.1"

' FileOpen iomode Values
Const fsoForReading   = 1
Const fsoForWriting   = 2
Const fsoForAppending = 8

' Bankholiday Filename
Const sBHFilename     = "BankHoliday.txt"

' use global script folder (oder users script folder ?
Const bGlobal         = True


Function IsHotline ( vDate )

    PBXScript.OutputTrace "--------> IsHotline ( " & CStr(vDate) & " ) - v" & sBuildNo

    Dim wsh, fso, file
    Dim sFile, sLine
    Dim bReturn, nPos
    Dim bRange, aRange, vStart, vEnd
    Dim HotlineNummer

    bReturn = False

    if bGlobal then
        sFile = "e:\swyx\ecr\hotline.txt"
    else
        sFile = "e:\swyx\ecr\hotline.txt"
    end if
    PBXScript.OutputTrace sFile

    ' Create FileSystemObejct
    Set fso = CreateObject("Scripting.FileSystemObject")

    ' Open text file
    Set file = fso.OpenTextFile(sFile, fsoForReading)

    do while (not (file.AtEndOfStream)) and (not bReturn)

        sLine  = file.ReadLine
        PBXScript.OutputTrace "sLine: " & sLine

        bRange = False
        aRange = Split(sLine, ";")

        if IsDate(aRange(0)) then
            vStart = CDate(aRange(0))
            PBXScript.OutputTrace "vStart: " & CStr(vStart)

            if UBound(aRange) > 0 then
                if IsDate(aRange(1)) then
                    bRange = True
                    vEnd = CDate(aRange(1))
                    PBXScript.OutputTrace "vEnd: " & CStr(vEnd)
                else
                    PBXScript.OutputTrace "invalid end date!"
                end if
            end if

            if not bRange then
                if (DateDiff("d", vDate, vStart) = 0) then bReturn = True
            else
                if (DateDiff("n", vStart, vDate) >= 0) and _
                    (DateDiff("n", vEnd, vDate) <= 0) then bReturn = True
            end if
        else
            PBXScript.OutputTrace "invalid start date!"
        end if

    loop

    HotlineNummer = aRange(2)

    if HotlineNummer = "Supra1" then
        HotlineNummer = "0348xxx"
    end if

    PBXScript.OutputTrace "Hotlinenummer: " & HotlineNummer

    file.Close

    Set file = Nothing
    Set fso  = Nothing

    IsHotline = bReturn

    PBXScript.OutputTrace "<-------- IsHotline returns: " & CStr(bReturn)

End Function

 

Genügt es aber, wenn ich beim Durchstellen-Block nun Ruf durchstellen für 90 Sekunden zu: =HotlineNummer schreibe?

Leider funktioniert mir das schon bei einer Mail-Benachrichtigung nicht, also mache ich da wohl etwas falsch.

 
New Post 2/11/2009 8:02 AM
User is offline Tom Wellige
2263 posts
www.swyx.com
1st Level Poster








Re: Upgrading the BankHoliday with time  (Germany)

 Supra wrote

Genügt es aber, wenn ich beim Durchstellen-Block nun Ruf durchstellen für 90 Sekunden zu: =HotlineNummer schreibe?

Wichtig ist, dass Du die Variable HotlineNummer nicht innerhalb des Variable Blocks definiert, sondern tatsaechlich per

       Dim HotlineNummer

im VBScript Code als globale Variable. Das hat was damit zu tun, wie der GSE den VBScript Code generiert. Variablen die Du im grafischen Teil des Skriptes definiert hast, sind im VBSCript Code des Startblocks nicht sichtbar !

Grund: der GSE erzeugt eine VBScript Funktion aus dem grafischen Skript. Alle dort verwendeten Variablen werden als lokale Variablen dieser Funktion definiert. Dein VBScript Code aus dem Start Block wird einfach vor diese Funktionsdefinition kopiert. Damit kann er nicht auf lokale Variablen der GSE Funktion zugreifen. Anders herum klappt das aber einwandfrei: Variablen, die Du global in Deinem VBScript Code im Start Block definierst sind problemlos im kompletten Skript ansprechbar.

Davon abgesehen: ja, es reicht aus in den Durchstellen Block einfach = HotlineNummer zu schreiben.

 

 Supra wrote

Leider funktioniert mir das schon bei einer Mail-Benachrichtigung nicht, also mache ich da wohl etwas falsch.

Ich vermute mal, dass das an dem zuvor geschilderten liegt, richtig ?

Gruss, Tom.


Tom Wellige
(Lead Solution Consultant, Swyx)

I learned very early the difference between knowing the name of something and knowing something.
Richard P. Feynman

 
New Post 2/11/2009 10:26 AM
User is offline Supra
69 posts
5th Level Poster


Re: Upgrading the BankHoliday with time  (Italy)

Jepp, das wars, es ist also wichtig, WO dieses Dim HotlineNummer steht....

Tausend Dank, wieder ein Problem gelöst, heute ist ein guter Tag :-)

 
New Post 2/11/2009 10:39 AM
User is offline Tom Wellige
2263 posts
www.swyx.com
1st Level Poster








Re: Upgrading the BankHoliday with time  (Germany)

 Supra wrote

Jepp, das wars, es ist also wichtig, WO dieses Dim HotlineNummer steht....

Wichtig zu wissen ist, dass Du auf Variablen die Du im grafischen Teil des Skriptes definiert hast, im VB Skript Teil im Start Block keinen Zugriff hast. Die Loesung dafuer sind entweder global im Start Block definierte Variablen oder aber man uebergibt alles als Funktionsparameter bzw. Funktionsrueckgabewerte.

Ich gebe zu, da kann man schonmal leicht drueber stolpern.

Wenn es Dich interessiert solltest Du Dir aus der Datenbank mal Deine Regel (ruleXXX.vbs) exportieren und Dir den Code darin ansehen. Da wird das dann sehr schnell ersichtich.

 

Viele Gruesse, Tom.


Tom Wellige
(Lead Solution Consultant, Swyx)

I learned very early the difference between knowing the name of something and knowing something.
Richard P. Feynman

 
New Post 2/2/2012 1:59 PM
User is offline Christian
35 posts
7th Level Poster


Re: Upgrading the BankHoliday with time  (Germany)
Hallo zusammen,funktioniert das Script denn auch noch unter 2011 R2 ?
 
New Post 2/3/2012 7:33 AM
User is offline Frank
196 posts
www.com4vision.de
4th Level Poster


Re: Upgrading the BankHoliday with time  (Germany)

Hallo,

kurze Antwort -> ja

siehe http://www.swyx-forum.com/community/Forums/tabid/54/forumid/-1/threadid/14237/scope/posts/Default.aspx

Mfg

Frank

 
Previous Previous
 
Next Next
  Forums  Development  Extended Call R...  Upgrading the BankHoliday with time

 

 

Forum Policy

The discussion forums at Swyx Forum are dedicated to the discussion of Swyx, SwyxWare and related topics.

For the benefit of the community and to protect the integrity of swyx-form, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial products and non-commercial products which are not directly related to SwyxWare, it's OEM versions.
  2. No Flaming or Trolling.
  3. No Profanity, Racism, or Prejudice.
  4. Furthermore, make sure your posts comply to our Terms of Use.
  5. Newest development in German law defines online forums as journalistic content, making the forum owner and all posters to journalists. With this statement the forum owner declares that neither he nor his users are journalists with all legal consequences.
  6. The German Jugendmedienschutz-Staatsvertrag (JMStV) (Protection of Minors) defines a disclosure of online medias which are not suitable for minors below the age of 18. The Swyx Forum webseite does not provide any such content and underlies therefore not this disclosure. Please see further details including the responsible person for the protection of minors and direct contact data in the Imprint.
  7. The forums are currently unmoderated, meaning all postings will appear immediately after submission. If this turns out not working due to massive abuse all forums will switch to moderated mode, meaning a posting must be approved after submission my a moderator before appearing.
  8. You can use any language you like (except for the project forums) but keep in mind that by using english you will reach the largest audience.
  9. Within the project forums english language is mandatory.

 

Forum Help

Stay up-to-date
Forum Icons
Image Usage
Report Abuse

 

The default language in the forums is english, but feel free to use your mother tongue. Just keep in mind that by using english you will reach the largest audience.

Sponsors