Yac Caller ID to XBMC Working

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
Mooseman Offline
Junior Member
Posts: 3
Joined: Jul 2011
Reputation: 0
Post: #1
I am not a programmer but I got this thing to work.. I have a win2003 server with a caller ID modem using YAC.. There is a script which makes Yac speak the caller ID. I simply modified the .VBS file.. VBSCRIPT.. And then I send Caller ID using the message feature in XBMC ( so you need to enable HTTP web stuff on XBMC )

1) Install Yac
2) Replace Yac with modified Yac Ver .17 & scripts http://mattcollinge.wordpress.com/2007/0...using-yac/
3) Download and put "wget.exe" inside same directory ( it's a dos http thing )
I think this one, I forget the copy I have so if the switches in the script don't match, then change the commands???
http://users.ugent.be/~bpuype/wget/
4) I had to remove spaces from the data and replace with %20 as you can see..
5) change your .vbs file to this ( its a mess and a lot is garbage, I didnt clean it up ) but it does work.. and you can figure out what the stuff does.. I send the ID to 4 computers in this script.. I noticed there is space issues when i posted this solution.. So your just going to have to copy paste into the old .VBS script file using the new data watch for incorrect spaces because of this post..like this "poopne wpoop2" should NOT have a space.. sorry about this.. I wish I could up the .vbs..
    ' --------------------------------------------------------
    ' Matt Collinge :: http://www.mattcollinge.co.uk :: 17 April 2007
    ' --------------------------------------------------------
    ' Take an incoming call from YAC and use the default voice
    ' to speak it back to the user.
    ' --------------------------------------------------------

    Dim voic
    Dim message
    Dim messagePrefix

    ' Clean out any non-numbers
    Function CleanTheString(theString, theReplacement, theCharSeparator)
    'msgbox thestring
    strAlphaNumeric = "0123456789" 'Used to check for numeric characters.
    For i = 1 to len(theString)
    strChar = mid(theString,i,1)
    If instr(strAlphaNumeric,strChar) Then
    CleanedString = CleanedString & strChar & theCharSeparator
    Else
    If (theReplacement <> "") Then
    CleanedString = CleanedString & theReplacement & theCharSeparator
    End If
    End If
    Next
    'msgbox cleanedstring
    CleanTheString = CleanedString
    End Function


    calltype = WScript.Arguments(0)

    Set voic = WScript.CreateObject("SAPI.SpVoice")
    Set voic.voice = voic.GetVoices("", "Language=809").Item(0)

    select case calltype
    case "call"
    sNumber = WScript.Arguments(1)
    sName = WScript.Arguments(2)
    if (sName = "No Name") then
    messagePrefix = "Incoming call from number "
    ' Strip out characters if the message is a number
    message = CleanTheString(sNumber, "", "")
    else
    messagePrefix = "Incoming "
    message = sName
    end if
    case "message"
    message = WScript.Arguments(1)
    messagePrefix = "Incoming message "
    end select

    'voic.Speak(snumber)




    'strURL = "http://media3:8080/xbmcCmds/xbmcHttp?command=ExecBuiltIn(Notification(" + messagePrefix + ",testing123,10000))"

    'strURL = "http://media3:8080/xbmcCmds/xbmcHttp?command=ExecBuiltIn(Notification(sNumber,%20testing123,10000))"

    'strURL = "http://www.google.com" + sNumber

    poopnewpoop = Replace(sNumber," ","%20")
    poopnewpoop2 = Replace(sName," ","%20")

    'voic.Speak(poopnewpoop)
    'strURL = "http://media3:8080/xbmcCmds/xbmcHttp?command=ExecBuiltIn(Notification(" +poopnewpoop +",%20testing123,10000))"
    'strURL = "http://www.google.com"




    'strURL = "http://media3:8080/xbmcCmds/xbmcHttp?command=ExecBuiltIn(Notification("+poopnewpoop2+","+poopnewpoop+",10000))"
    'Set objShell = CreateObject("Wscript.Shell")
    'objShell.Run(strURL)



    Dim oShell
    Set oShell = WScript.CreateObject ("WScript.Shell")
    oShell.run "cmd /k C:\Progra~1\YAC\wget.exe --tries=1 --timeout=1 http://login:xbmc@media3:8080/xbmcCmds/xbmcHttp?command=ExecBuiltIn(Notification("+poopnewpoop2+","+poopnewpoop+",30000)) & C:\Progra~1\YAC\wget.exe --tries=1 --timeout=1 http://login:xbmc@kitchen:8080/xbmcCmds/xbmcHttp?command=ExecBuiltIn(Notification("+poopnewpoop2+","+poopnewpoop+",30000)) & C:\Progra~1\YAC\wget.exe --tries=1 --timeout=1 http://login:xbmc@media1:8080/xbmcCmds/xbmcHttp?command=ExecBuiltIn(Notification("+poopnewpoop2+","+poopnewpoop+",30000)) & C:\Progra~1\YAC\wget.exe --tries=1 --timeout=1 http://login:xbmc@media2:8080/xbmcCmds/xbmcHttp?command=ExecBuiltIn(Notification("+poopnewpoop2+","+poopnewpoop+",30000)) & del xbmc*.* & exit"
    Set oShell = Nothing





    Set voic = nothing
    (This post was last modified: 2011-07-20 20:46 by Mooseman.)
    find quote
    bluenote Offline
    Senior Member
    Posts: 177
    Joined: May 2010
    Reputation: 0
    Post: #2
    Thanks for this. It's really inelegant but it works Smile
    find quote
    bluenote Offline
    Senior Member
    Posts: 177
    Joined: May 2010
    Reputation: 0
    Post: #3
    I've just discovered a fatal flaw after everything else worked.
    Launching of the command prompt from the .vbs script seems to steal focus.
    How have you gotten around this?
    find quote
    Mooseman Offline
    Junior Member
    Posts: 3
    Joined: Jul 2011
    Reputation: 0
    Post: #4
    I run it on a dedicated win2003 server... and works fine for me... you are saying it takes over a window? The only thing I see is the CMD window popup for about 2 seconds... ( I wish I was a VB programmer )

    for me... it executes... and vanishes.. really fast.. the VB part I do not see at all..

    you can perform a test call on yac.. try to figure it out.. I'm not a programmer, but I can hack a bit...

    I was hoping someone might take what i send and made it better.. But I can tell you , I do have caller ID from YAC on my XBMC ... and that was the goal..

    I guess people don't use land lines much anymore...??
    find quote
    doug Offline
    Member+
    Posts: 60
    Joined: Apr 2012
    Reputation: 0
    Post: #5
    Hi,
    The script simplifies down quite a bit if no validation is needed. sTitle can easily be modified to prepend "Call From: ". This works on Eden too.

    Doug


    Code:
    ' ------------------------------------------------------------------------------------
    ' Take an incoming call from YAC (V0.17 at URL below) and broadcast it to XBMC
    ' http://mattcollinge.wordpress.com/2007/05/18/spoken-caller-id-using-yac/
    ' ------------------------------------------------------------------------------------

    sMessage = Replace(WScript.Arguments(1)," ","%20")
    sTitle = Replace(WScript.Arguments(2)," ","%20")

    Dim oShell
    Set oShell = WScript.CreateObject ("WScript.Shell")
    oShell.run "cmd /k C:\Progra~1\YAC\wget.exe --tries=1 --timeout=1 http://login:xbmc@192.168.0.111:8080/xbmcCmds/xbmcHttp?command=ExecBuiltIn(Notification("+sTitle+","+sMessage+",7000)) & C:\Progra~1\YAC\wget.exe --tries=1 --timeout=1 http://login:xbmc@MediaPlayer-FR:80/xbmcCmds/xbmcHttp?command=ExecBuiltIn(Notification("+sTitle+","+sMessage+",7000)) & del xbmc*.* & exit"
    Set oShell = Nothing
    find quote
    emanteuf Offline
    Junior Member
    Posts: 2
    Joined: Jul 2012
    Reputation: 0
    Post: #6
    If you are using Trixbox for your phone system, you can modify the [macro-user-callerid] section in the extensions_additional.conf to fire off notifications for PC's on the network running YAC and Apple TV2's running XBMC.

    In the following example I have a PC at 192.168.0.1 and an Apple TV2 running XBMC at 192.168.0.103. I send the callerid to the PC and then the XBMC and then I send the command to pause the XBMC. You can see the 3 lines of code I inserted into the middle of the existing macro. The notification time can be adjusted by changeing the 15000 (15 second) to whatever you want. You can add pictures to your xbmc and name them for each phone number (like 5251239900.jpg). I'm not sure where to put the pictures yet, but it shouldn't be too difficult to figure out.

    You'll need to install nc (netcat) and wget on your trixbox for these mods to work. You can get YAC from Sunflowerhead software for free.

    Code:
    [macro-user-callerid]
    include => macro-user-callerid-custom
    exten => s,1,Set(AMPUSER=${IF($["foo${AMPUSER}" = "foo"]?${CALLERID(number)}:${AMPUSER})})
    exten => s,n,GotoIf($["${CHANNEL:0:5}" = "Local"]?report)
    exten => s,n,ExecIf($["${REALCALLERIDNUM:1:2}" = ""]?Set(REALCALLERIDNUM=${CALLERID(number)}))
    exten => s,n,Set(AMPUSER=${DB(DEVICE/${REALCALLERIDNUM}/user)})
    exten => s,n,Set(AMPUSERCIDNAME=${DB(AMPUSER/${AMPUSER}/cidname)})
    exten => s,n,GotoIf($["x${AMPUSERCIDNAME:1:2}" = "x"]?report)
    exten => s,n,Set(AMPUSERCID=${IF($["${DB_EXISTS(AMPUSER/${AMPUSER}/cidnum)}" = "1"]?${DB_RESULT}:${AMPUSER})})
    exten => s,n,Set(CALLERID(all)="${AMPUSERCIDNAME}" <${AMPUSERCID}>)

    exten => s,n,System(echo -n -e "@CALL${CALLERID(name)} ~${CALLERID(number)}" | nc -w 1 192.168.0.1 10629 &)
    exten => s,n,System(wget --delete-after --tries=1 --timeout=1 http://192.168.0.103:8080/xbmcCmds/xbmcHttp?command=ExecBuiltIn\\(Notification\\("${CALLERID(name)}",${CALLERID(number)},15000,${CALLERID(number)}.jpg\\)\\) &)
    exten => s,n,System(wget --delete-after --tries=1 --timeout=1 http://192.168.0.103:8080/xbmcCmds/xbmcHttp?command=Pause &)

    exten => s,n,ExecIf($["${DB(AMPUSER/${AMPUSER}/language)}" != ""]?Set(CHANNEL(language)=${DB(AMPUSER/${AMPUSER}/language)}))
    exten => s,n(report),GotoIf($[ "${ARG1}" = "SKIPTTL" ]?continue)
    exten => s,n(report2),Set(__TTL=${IF($["foo${TTL}" = "foo"]?64:$[ ${TTL} - 1 ])})
    exten => s,n,GotoIf($[ ${TTL} > 0 ]?continue)
    exten => s,n,Wait(${RINGTIMER})
    exten => s,n,Answer
    exten => s,n,Wait(2)
    exten => s,n,Playback(im-sorry&an-error-has-occured&with&call-forwarding)
    exten => s,n,Macro(hangupcall,)
    exten => s,n,Congestion(20)
    exten => s,n(continue),Noop(Using CallerID ${CALLERID(all)})
    exten => h,1,Macro(hangupcall,)

    ; end of [macro-user-callerid]

    Ed
    find quote
    emanteuf Offline
    Junior Member
    Posts: 2
    Joined: Jul 2012
    Reputation: 0
    Post: #7
    Actually, if you follow my previous post, it will stop working if you make any changes to your configuration with FreePBX. You actually need to make the changes to extensions_custom.conf. Just add the following code at the end of your config. Also this won't cause internal calls to trigger the script, only incoming external calls.

    Code:
    [from-pstn-custom]
    exten => _.,1,Gosub(cidlookup,cidlookup_1,1)
    exten => _.,n,System(echo -n -e "@CALL${CALLERID(name)} ~${CALLERID(number)}" | nc -w 1 192.168.0.1 10629 &)
    exten => _.,n,System(wget --delete-after --tries=1 --timeout=1 http://192.168.0.103:8080/xbmcCmds/xbmcHttp?command=ExecBuiltIn\\(Notification\\("${CALLERID(name)}",${CALLERID(number)},15000,${CALLERID(number)}.jpg\\)\\) &)
    exten => _.,n,System(wget --delete-after --tries=1 --timeout=1 http://192.168.0.103:8080/xbmcCmds/xbmcHttp?command=Pause &)

    192.168.0.1 is my YAC listener
    192.168.0.103 is my AppleTV2 running xbmc

    Change the IP addresses to suit your environment.

    Ed
    find quote