Check callid length and open a website invisibly!

Discussion in '3CX Phone System - General' started by GWN, Mar 24, 2009.

Thread Status:
Not open for further replies.
  1. GWN


    Dec 10, 2007
    Likes Received:
    Don't know if this might help someone else but thought I'd share this...

    We have an intranet helpdesk application that runs in PHP. When someone calls we used to get the deskclient to open a new tab in firefox using the external program setting, and the PHP site would query our helpdesk and display all their current tickets. Only problem is we didn't want it to trigger when an internal extension calls as this would open a new tab every time. In the end I used the following batch script to check the length of the callid and to only open a new tab if it was over 3 digits in length and not a MakeCall call. I then compiled it into an exe to get rid of the black box using

    Once this was done we just needed to call the exe in the client and add the %callid% parameter in the program parameters box.

    Hope this helps someone, here's the code below:

    echo Incoming Call!!
    echo off
    set test=%1
    if %test% == "MakeCall" GoTo end
    echo %test%> "%temp%\st.txt"
    for %%a in (%temp%\st.txt) do set /a len=%%~za & set /a len -=2 & del "%temp%\st.txt"
    set /a len -=3
    echo string "%test%" has %len% characters
    if %len% geq 4 GoTo callfirefox
    if %len% leq 3 GoTo end
    echo firefox
    cd "C:\Program Files\Mozilla Firefox"
    firefox.exe -new-tab "https://url/callid.php?phoneno=%test%"
    echo end
Thread Status:
Not open for further replies.