TechDocs

Batch-Dateien im Client ausführen#

Einrichtung der Batch-Dateien#

Pfad#

Die Batch-Dateien müssen in folgendem Pfad hinterlegt werden:

C:\Program Files (x86)\Common Files\C4B\AppLink

Konfiguration im Connect Client#

Damit die Batch-Dateien vom XPhone Connect Client aufgerufen werden, muss dem Connect Client der „Befehl“ gegeben werden. Dies geschieht über die Erweiterte Einstellungen in der Administrationsoberfläche im Standort.

Folgende Parameter müssen hinzugefügt werden:

Parameter 1

  • Name: StartCall.ActionString

  • Wert: Name=<batchfile_name.bat>

    Erklärung: Name der Batch-Datei.

Parameter 2

  • Name: StartCall.Enable

  • Wert: 1

    • Wert = 1

      Die Datei wird ausgeführt bei eingehendem Anruf.

    • Wert = 0

      Die Datei wird nicht ausgeführt.

Parameter 3

  • Name: EndCall.ActionString

  • Wert: Name=<batchfile_Name.bat>

    Erklärung: Name der Batch-Datei.

Parameter 4

  • Name: EndCall.Enable

  • Wert: 1

    • Wert = 1

      Die Datei wird ausgeführt bei eingehendem Anruf.

    • Wert = 0

      Die Datei wird nicht ausgeführt.

Kurzanleitung#

  1. Erstellen Sie aus den Codebeispielen Batch-Dateien.

  2. Fügen Sie die Batch-Datei bei den Benutzern, die dieses Feature nutzen wollen, in folgendem Pfad ein:

    C:\Program Files (x86)\Common Files\C4B\AppLink\
    
  3. Aktivieren Sie die Funktion in der Administrationsoberfläche für die gewünschten Benutzer.

    • Navigieren Sie in der Adminoberfläche zum gewünschten Standort/Konfigurationsgruppe.

    • Öffnen Sie dort die Connect Client Einstellungen und scrollen Sie nach ganz unten zu den Erweiterten Einstellungen.

    • Fügen Sie folgende Parameter hinzu:

    Parameter #1

    • Name: StartCall.ActionString

    • Wert: Name=<batchfile_name>.bat

    Parameter #2

    • Name: StartCall.Enable

    • Wert: 1

Bei allen Benutzern des betroffenen Standorts bzw. der betroffenen Konfigurationsgruppe wird bei eingehendem Anruf die Batchdatei ausgeführt.

Codebeispiele für „Eingehender Ruf“#

Variablenbezeichnungen#

Die Batch-Datei wird mit verschiedenen Informationen über den Benutzer, den Anrufer und den Anruf versorgt. Bei der Ausführung stehen diese Informationen als Umgebungsvariablen zur Verfügung.

Beispiele
Kontext Benutzer:
- Vorname = XP.USER.FIRSTNAME
Kontext Kontakt:
- Vorname = XP.CONTACT.FIRSTNAME
Kontext Anruf:
- Rufnummer des Gesprächspartners = XP.CALL.CALLNO

Alle Umgebungsvariablen sind hier dokumentiert.

Batch-Beispiele#

Rufnummer in Text-Datei schreiben
<!-- : Begin batch script

    rem mshta javascript:alert^("%XP.CALL.CALLNO%"^);close^(^);


    @echo off

    cscript //nologo "%~f0?.wsf" ^""%1"^"

    exit /b

    ----- Begin wsf script --->
    <job><script language="VBScript">

        set wshShell = wscript.CreateObject( "wscript.Shell" )
        Set wshProcessEnv = wshShell.Environment( "PROCESS" )

        dim stateAsInt
        dim stateAsString
        dim callno

        'stateAsInt = 2
        'callno = "+49321"

        stateAsString  = wshProcessEnv( "XP.CALL.STATE" )
        stateAsInt  = Cint( wshProcessEnv( "XP.CALL.STATE" ) )
        callno = wshProcessEnv( "XP.CALL.CALLNO" )

            'callno = replace( callno, chr(34), "", 1, 10 ) ' Quotes entfernen
        'callno = replace( callno, " ", "", 1, 10 ) ' Blanks entfernen
        'callno = replace( callno, "+", "00", 1 )   ' + in 00 umwandeln

        ' wshShell.Popup callno, AUTO_DISMISS, "Dump output", OK_BUTTON


        ' Kommend und Klingelt

        if (stateAsInt and 1) <> 1 then
            if (stateAsInt and 2) <> 0 then
                'create the text file
                Set objFSO=CreateObject("Scripting.FileSystemObject")
                Set objFile=objFSO.CreateTextFile("C:\temp\test.txt",2,true)

                'output to file
                objFile.WriteLine (callno)
                objFile.close
            else
                dim dummy2
                dummy2 = 1
            end if
        end if

</script></job>
.exe-Datei ausführen
<!-- : Begin batch script

    rem mshta javascript:alert^("%XP.CALL.CALLNO%"^);close^(^);


    @echo off

    cscript //nologo "%~f0?.wsf" ^""%1"^"

    exit /b

    ----- Begin wsf script --->
    <job><script language="VBScript">

        set wshShell = wscript.CreateObject( "wscript.Shell" )
        Set wshProcessEnv = wshShell.Environment( "PROCESS" )

        dim stateAsInt
        dim stateAsString
        dim callno

        'stateAsInt = 2
        'callno = "+49321"

        stateAsString  = wshProcessEnv( "XP.CALL.STATE" )
        stateAsInt  = Cint( wshProcessEnv( "XP.CALL.STATE" ) )
        callno = wshProcessEnv( "XP.CALL.CALLNO" )

            'callno = replace( callno, chr(34), "", 1, 10 ) ' Quotes entfernen
        'callno = replace( callno, " ", "", 1, 10 ) ' Blanks entfernen
        'callno = replace( callno, "+", "00", 1 )   ' + in 00 umwandeln

        ' wshShell.Popup callno, AUTO_DISMISS, "Dump output", OK_BUTTON


        ' Kommend und Klingelt

        if (stateAsInt and 1) <> 1 then
            if (stateAsInt and 2) <> 0 then
                dim url
                url = "c:\temp\ConsoleAppSupport.exe "
                url = url + callno
                wshShell.Run url
            else
                dim dummy2
                dummy2 = 1
            end if
        end if

</script></job>
.exe-Datei in UNC-Pfad ausführen
<!-- : Begin batch script

    rem mshta javascript:alert^("%XP.CALL.CALLNO%"^);close^(^);


    @echo off

    cscript //nologo "%~f0?.wsf" ^""%1"^"

    exit /b

    ----- Begin wsf script --->
    <job><script language="VBScript">

        set wshShell = wscript.CreateObject( "wscript.Shell" )
        Set wshProcessEnv = wshShell.Environment( "PROCESS" )

        dim stateAsInt
        dim stateAsString
        dim callno

        'stateAsInt = 2
        'callno = "+49321"

        stateAsString  = wshProcessEnv( "XP.CALL.STATE" )
        stateAsInt  = Cint( wshProcessEnv( "XP.CALL.STATE" ) )
        callno = wshProcessEnv( "XP.CALL.CALLNO" )

            'callno = replace( callno, chr(34), "", 1, 10 ) ' Quotes entfernen
        'callno = replace( callno, " ", "", 1, 10 ) ' Blanks entfernen
        'callno = replace( callno, "+", "00", 1 )   ' + in 00 umwandeln

        ' wshShell.Popup callno, AUTO_DISMISS, "Dump output", OK_BUTTON


        ' Kommend und Klingelt

        if (stateAsInt and 1) <> 1 then
            if (stateAsInt and 2) <> 0 then
                dim url
                url = "\\fs\tmp\art\Dashboard+Batch\ConsoleAppSupport.exe "
                url = url + callno
                wshShell.Run url
            else
                dim dummy2
                dummy2 = 1
            end if
        end if

</script></job>
.exe-Datei ausführen (nur bei aufgelöstem Kontakt)
<!-- : Begin batch script

    rem mshta javascript:alert^("%XP.CALL.CALLNO%"^);close^(^);


    @echo off

    cscript //nologo "%~f0?.wsf" ^""%1"^"

    exit /b

    ----- Begin wsf script --->
    <job><script language="VBScript">

        set wshShell = wscript.CreateObject( "wscript.Shell" )
        Set wshProcessEnv = wshShell.Environment( "PROCESS" )

        dim stateAsInt
        dim stateAsString
        dim callno
        dim personenid
        personenid = ""

        'stateAsInt = 2
        'callno = "+49321"
        'personenid = "3"

        stateAsString  = wshProcessEnv( "XP.CALL.STATE" )
        stateAsInt  = Cint( wshProcessEnv( "XP.CALL.STATE" ) )
        personenid = wshProcessEnv( "XP.CONTACT.USERDEF_1" )

        'personenid = replace( personenid, " ", "", 1, 10 ) ' Blanks entfernen

        'callno = replace( callno, chr(34), "", 1, 10 ) ' Quotes entfernen
        'callno = replace( callno, " ", "", 1, 10 ) ' Blanks entfernen
        'callno = replace( callno, "+", "00", 1 )   ' + in 00 umwandeln

        ' wshShell.Popup callno, AUTO_DISMISS, "Dump output", OK_BUTTON


        ' Kommend und Klingelt und Feld befüllt

        if Len(personenid) > 0 then
            if (stateAsInt and 1) <> 1 then
                if (stateAsInt and 2) <> 0 then
                    dim url
                    url = """C:\Program Files (x86)\vea\personen\Person.exe """
                    url = url + personenid
                    wshShell.Run url
                else
                    dim dummy2
                    dummy2 = 1
                end if
            end if
        end if
</script></job>
URL aufrufen
<!-- : Begin batch script

    rem mshta javascript:alert^("%XP.CALL.CALLNO%"^);close^(^);


    @echo off

    cscript //nologo "%~f0?.wsf" ^""%1"^"

    exit /b

    ----- Begin wsf script --->
    <job><script language="VBScript">

        set wshShell = wscript.CreateObject( "wscript.Shell" )
        Set wshProcessEnv = wshShell.Environment( "PROCESS" )

        dim stateAsInt
        dim stateAsString
        dim callno

        'stateAsInt = 2
        'callno = "+49321"

        stateAsString  = wshProcessEnv( "XP.CALL.STATE" )
        stateAsInt  = Cint( wshProcessEnv( "XP.CALL.STATE" ) )
        callno = wshProcessEnv( "XP.CALL.CALLNO" )

            'callno = replace( callno, chr(34), "", 1, 10 ) ' Quotes entfernen
        'callno = replace( callno, " ", "", 1, 10 ) ' Blanks entfernen
        'callno = replace( callno, "+", "00", 1 )   ' + in 00 umwandeln

        ' wshShell.Popup callno, AUTO_DISMISS, "Dump output", OK_BUTTON


        ' Kommend und Klingelt

        if (stateAsInt and 1) <> 1 then
            if (stateAsInt and 2) <> 0 then
                dim url
                url = "https://www.c4b.com/de/"
                url = url + callno
                wshShell.Run url
            else
                dim dummy2
                dummy2 = 1
            end if
        end if

</script></job>
URL aufrufen (nicht bei unterdrückten Rufnummern)
<!-- : Begin batch script

    rem mshta javascript:alert^("%XP.CALL.CALLNO%"^);close^(^);


    @echo off

    cscript //nologo "%~f0?.wsf" ^""%1"^"

    exit /b

    ----- Begin wsf script --->
    <job><script language="VBScript">

        set wshShell = wscript.CreateObject( "wscript.Shell" )
        Set wshProcessEnv = wshShell.Environment( "PROCESS" )

        dim stateAsInt
        dim stateAsString
        dim callno
        dim customerno

        'stateAsInt = 2
        'callno = "+49321"

        stateAsString  = wshProcessEnv( "XP.CALL.STATE" )
        stateAsInt  = Cint( wshProcessEnv( "XP.CALL.STATE" ) )
        callno = wshProcessEnv( "XP.CALL.CALLNO" )
        customerno = wshProcessEnv( "XP.CONTACT.CUSTOMERNO" )

            'callno = replace( callno, chr(34), "", 1, 10 ) ' Quotes entfernen
        'callno = replace( callno, " ", "", 1, 10 ) ' Blanks entfernen
        'callno = replace( callno, "+", "00", 1 )   ' + in 00 umwandeln

        ' wshShell.Popup callno, AUTO_DISMISS, "Dump output", OK_BUTTON


        ' Kommend und Klingelt

    if not IsNull(callno) then
        if (stateAsInt and 1) <> 1 then
            if (stateAsInt and 2) <> 0 then
                dim url
                url = "https://www.c4b.com/de/"
                url = url + callno
                wshShell.Run url
            else
                dim dummy2
                dummy2 = 1
            end if
        end if
    end if

</script></job>

Call-State#

In die Environment-Variable XP.CALL.STATE schreibt der Connect Client den aktuellen Call-Status als Bit-kodierten Wert:

Bit

Wert

Bedeutung

Bit 0

1

Gehend

Bit 1

2

Klingelt

Bit 2

4

Verbunden

Bit 3

8

Interner Anruf

Bit 4

16

Softphone-Call

Bit 5

32

Konferenz-Anruf

Bit 6

64

Einwahl-Anruf für Konferenz

Ihre Meinung zählt!

Ob Lob, hilfreiche Ideen oder ein Hinweis auf einen Fehler - wir freuen uns über jede Nachricht.
Schreiben Sie uns einfach an doku@c4b.de und helfen Sie mit, diese Dokumentation noch besser zu machen.
Vielen Dank für Ihre Unterstützung!