Tec Posted December 2, 2009 Share Posted December 2, 2009 Here is some example Code for Tapi Call. Works for me with WinXP SP3 and Siemens Hipath and Tapi v170. Const $LINEADDRESSTYPE_PHONENUMBER = "&H1" Const $LINEMEDIAMODE_INTERACTIVEVOICE = "&H4" Const $TAPI3_ALL_TAPI_EVENTS = "&H1FFFF" Local $lAddressType = $LINEADDRESSTYPE_PHONENUMBER Local $txtAddressName = "LineName" ;Name of Line Local $Number = "123456" ; Number to call $objTapi = ObjCreate("TAPI.TAPI.1") $mapper = ObjCreate("DispatchMapper.DispatchMapper.1") $objTapi.Initialize $objTapi.EventFilter = $TAPI3_ALL_TAPI_EVENTS $objCollAddresses = $objTapi.Addresses For $lLoop = 1 To $objCollAddresses.Count $objCrtAddress = $objCollAddresses.Item($lLoop) If $objCrtAddress.AddressName = $txtAddressName Then $gobjAddress = $objCrtAddress $bolFoundLine = True ExitLoop EndIf Next If $bolFoundLine = True Then $TestCall = $gobjAddress.CreateCall($Number, $lAddressType, $LINEMEDIAMODE_INTERACTIVEVOICE) $TestCall.connect(False) EndIf Link to comment Share on other sites More sharing options...
fomas Posted May 24, 2010 Share Posted May 24, 2010 Thank you for this. I have elaborated it a bit, so that it takes command line arguments. Secondly I've made a small script that registers the dialer script so that "callto:\\" links on websites are routed to it. Works like a charm with our Tiptel PBX and the addressbook on the intranet website! If anyone is interested I'd be happy to share. However, can anyone give me a clue on how to detect the actual line status through TAPI? I know that it has something to do with "registercallnotifications" but can't seem to wrap my head around it... Thomas Link to comment Share on other sites More sharing options...
EssentialTech Posted July 23, 2010 Share Posted July 23, 2010 Hi fomas. I am very interested in the script you have to register the script to use the dail links. We have some new phones in our office which can place a call be sending them a URL string and I am very keen to write something to take advantage of that. Regards, Steve Link to comment Share on other sites More sharing options...
msdd Posted February 7, 2016 Share Posted February 7, 2016 hi, alltough its an old post, its greatly apretiated. It works in the application i am triying to build. I need the code to transfer a call can someone help? that would allow me to solve some really tough problems for me. Cheers, Martin Link to comment Share on other sites More sharing options...
PixelPixPanreyes Posted September 9, 2021 Share Posted September 9, 2021 Hi! Thanks Tec for the snippet, it was really useful! I used your example it to create a Windows 10 tel: protocol handler. Here it is if for anyone interested expandcollapse popup#NoTrayIcon Opt('MustDeclareVars', 1) ;;;;;;;;;;;;;;; OPTIONS! Global $requiredProgramPath="" Global $txtAddressName = "" Global $Number = "" ;;;;;;;;;;;;;; END OF OPTIONS ;Based on from https://www.autoitscript.com/forum/topic/106221-tapi-call/ ;Kudos to Tec from Autoit Forum! Const $LINEADDRESSTYPE_PHONENUMBER = "&H1" Const $LINEMEDIAMODE_INTERACTIVEVOICE = "&H4" Const $TAPI3_ALL_TAPI_EVENTS = "&H1FFFF" Local $lAddressType = $LINEADDRESSTYPE_PHONENUMBER ;Check if a required program exists If($requiredProgramPath<>"") Then If(Not FileExists($requiredProgramPath)) Then MsgBox(16,"TapiCall - Error","Required program has not been found.") Exit EndIf EndIf ;Associate this program with the tel: protocol RegWrite("HKCU64\SOFTWARE\RegisteredApplications","TapiCall","REG_SZ","SOFTWARE\\TapiCall\\TapiCall\\Capabilities") RegWrite("HKCU64\SOFTWARE\TapiCall\TapiCall\Capabilities","ApplicationDescription","REG_SZ","Interface between tel: protocol and TAPI.") RegWrite("HKCU64\SOFTWARE\TapiCall\TapiCall\Capabilities","ApplicationName","REG_SZ","TapiCall") RegWrite("HKCU64\SOFTWARE\TapiCall\TapiCall\Capabilities\UrlAssociations","tel","REG_SZ","TapiCall.TapiCall") RegWrite("HKCU64\SOFTWARE\Classes\TapiCall.TapiCall","","REG_SZ","TapiCall") RegWrite("HKCU64\SOFTWARE\Classes\TapiCall.TapiCall","FriendlyTypeName","REG_SZ","TapiCall") RegWrite("HKCU64\SOFTWARE\Classes\TapiCall.TapiCall\DefaultIcon","","REG_SZ",'"'&$requiredProgramPath&',0"') RegWrite("HKCU64\SOFTWARE\Classes\TapiCall.TapiCall\shell\open\command","","REG_SZ",@ScriptFullPath&" %1") ;Receive tel: string from command line If($cmdLine[0]=1) Then $Number=StringReplace($cmdLine[1],"tel:","") if(StringLeft($Number,1)<>"+") Then $Number="+"&$Number EndIf Else MsgBox(16,"TapiCall - Error","Wrong command line parameters."&@CRLF&@CRLF&"Usage: "&@ScriptName&" tel:+PHONENUMBER") Exit EndIf ;Find out if the required TAPI "address" does exist Local $objTapi = ObjCreate("TAPI.TAPI.1") Local $mapper = ObjCreate("DispatchMapper.DispatchMapper.1") $objTapi.Initialize $objTapi.EventFilter = $TAPI3_ALL_TAPI_EVENTS Local $bolFoundLine = False Local $objCollAddresses = $objTapi.Addresses Local $objCrtAddress Local $gobjAddress For $lLoop = 1 To $objCollAddresses.Count $objCrtAddress = $objCollAddresses.Item($lLoop) If $objCrtAddress.AddressName = $txtAddressName Then $gobjAddress = $objCrtAddress $bolFoundLine = True ExitLoop EndIf Next ;TAPI address does exist, we make the call If $bolFoundLine = True Then Local $TestCall = $gobjAddress.CreateCall($Number, $lAddressType, $LINEMEDIAMODE_INTERACTIVEVOICE) $TestCall.connect(False) Else ;TAPI address was not found MsgBox(16,"TapiCall - Error",'Could not find TAPI address "'&$txtAddressName&'"') EndIf Link to comment Share on other sites More sharing options...
HJL Posted May 4, 2022 Share Posted May 4, 2022 Does anyone perhaps also have an idea how to query a line? Line busy or line free? I would like to use this to control an "On Air" display via a Shelly when I am on the phone. LWC 1 Link to comment Share on other sites More sharing options...
LWC Posted June 10, 2023 Share Posted June 10, 2023 (edited) On 5/4/2022 at 9:36 PM, HJL said: Does anyone perhaps also have an idea how to query a line? Line busy or line free? I would like to use this to control an "On Air" display via a Shelly when I am on the phone. +1! Landlines can still be connected to PCs, so it would be nice to have a caller ID through AutoIt. But I'm surprised the original code worked in 2021 since: $mapper was defined but not used. $bolFoundLine wasn't declared outside the if statement, meaning If $bolFoundLine = True Then will break the script in case of no match. It should have had local $bolFoundLine = False before the loop. Which is exactly what happens since most importantly $objTapi is always blank for me (i.e. an object with an UBound of 0). Edited June 17, 2023 by LWC Moved between bullets Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now