TAPI3, DTMF and VBA

Dranoweb

Registered User.
Local time
Tomorrow, 02:44
Joined
Sep 28, 2009
Messages
68
Hi,

I currently have a job management system I have written for an electrical services company.

Specs:
access 2007
OS: Vista (tell me about it)

What I want to acheive:

I have a contact list for our staff, I would like to be able to click on a number, and have it generate the DTMF equivalent through the systems speakers, so that I can hold a phone handset nearby. For those unfamiliar, this will allow me to quickly dial a phone number without pressing handset keys.

My current issues:

I have come to beleive I can do this with TAPI3, but i am unsure of wether I need a module to drive this, and/or what functions i will need.

I have added TAPI3 to my references in the VB editor. I have also experimented with functions like DIALNUMBER() etc.

Most code examples seem to be oriented around dialing a fax/modem via com port.

I have also, unsuccessfully tried to make this happen with simultaneous beep tones at the corresponding frequencies, but vba seems to only want one at a time.

any suggestions or finger pointing will be appreciated.
 
if you download the MS sample app for a Contacts database, it includes a phone dialler function.

I have never used it, but as it's MS, it will most certainly do what its sdupposed to. Might be a good place to start.
 
I seem to be having some issues finding exactly where to download the sample apps from microsoft.

So far all I have found is how to either detect dtmf, or how to dial to a com port.

I getting to a last resort here and embedding a .wav file for each dtmf digit and play them back with a big bunch of if - then - else statements.

unless someone can tell me how to play two tones simultaneously.
 
Ok, well i got it working for now. Not as perfect as what I had hoped but it works as a stopgap until I have time to improve it.

I found a couple of hints here:
Playing a Wav File in access:
http://www.tek-tips.com/faqs.cfm?fid=251

DTMF tones in WAV form - for those too lazy to do it themselves.
http://evolution.voxeo.com/library/audio/prompts/dtmf/index.jsp

How to remove left character:
http://www.automateexcel.com/2005/02/18/excel_vba_remove_n_characters_from_left/


I ended up playing a wav file for each digit, then deteling the left character from the srting. Code below:


Private Sub Command6_Click()
Dim MyString As String
Dim PlayChar As String
'MyString = ""
'PlayChar = ""
'Dump contents of textbox into MyString
Text9.SetFocus
MyString = Text9.Text
'if no numbers - stop looking for them
If MyString = "" Then
Exit Sub
End If
'Grab the first number out of mystring, and put it into PlayChar
PlayChar = Left(MyString, 1)
'Start of badly arranged if loops
If PlayChar = "0" Then
'this makes reference to a module I added
x% = sndPlaySound("C:\Users\Austin Electrics 1\Documents\dtmf tones\Dtmf-0.wav", SND_SYNC)
End If
If PlayChar = "1" Then
'this makes reference to a module I added
x% = sndPlaySound("C:\Users\Austin Electrics 1\Documents\dtmf tones\Dtmf-1.wav", SND_SYNC)
End If
If PlayChar = "2" Then
'this makes reference to a module I added
x% = sndPlaySound("C:\Users\Austin Electrics 1\Documents\dtmf tones\Dtmf-2.wav", SND_SYNC)
End If
If PlayChar = "3" Then
'this makes reference to a module I added
x% = sndPlaySound("C:\Users\Austin Electrics 1\Documents\dtmf tones\Dtmf-3.wav", SND_SYNC)
End If
If PlayChar = "4" Then
'this makes reference to a module I added
x% = sndPlaySound("C:\Users\Austin Electrics 1\Documents\dtmf tones\Dtmf-4.wav", SND_SYNC)
End If
If PlayChar = "5" Then
'this makes reference to a module I added
x% = sndPlaySound("C:\Users\Austin Electrics 1\Documents\dtmf tones\Dtmf-5.wav", SND_SYNC)
End If
If PlayChar = "6" Then
'this makes reference to a module I added
x% = sndPlaySound("C:\Users\Austin Electrics 1\Documents\dtmf tones\Dtmf-6.wav", SND_SYNC)
End If
If PlayChar = "7" Then
'this makes reference to a module I added
x% = sndPlaySound("C:\Users\Austin Electrics 1\Documents\dtmf tones\Dtmf-7.wav", SND_SYNC)
End If
If PlayChar = "8" Then
'this makes reference to a module I added
x% = sndPlaySound("C:\Users\Austin Electrics 1\Documents\dtmf tones\Dtmf-8.wav", SND_SYNC)
End If
If PlayChar = "9" Then
'this makes reference to a module I added
x% = sndPlaySound("C:\Users\Austin Electrics 1\Documents\dtmf tones\Dtmf-9.wav", SND_SYNC)
End If
'remove a character
MyString = Right(MyString, Len(MyString) - 1)
Text9.SetFocus
Text9.Text = MyString
Command6_Click

End Sub
 

Users who are viewing this thread

Back
Top Bottom