To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here
VBForums  

VB Wire News
MSDN Subscribers: Download the VS 2010 Release Candidate
MSDN Subscribers: Download the VS 2010 Release Candidate
Sell Your Code and Make Money?
Creating your own Tetris game using VB.NET
Article :: Improving Software Economics, Part 4 of 7: Top 10 Principles of Iterative Software Management



Go Back   VBForums > Visual Basic > Visual Basic 6 and Earlier

Reply Post New Thread
 
Thread Tools Search this Thread Display Modes
Old Sep 25th, 2000, 06:49 PM   #1
HeSaidJoe
_______
 
HeSaidJoe's Avatar
 
Join Date: Jun 99
Location: Canada
Posts: 3,946
HeSaidJoe is an unknown quantity at this point (<10)
Aaron, I am trying to run a program off the SDK4 samples called vbAnswer. I can't get it to work...need sdk4 installed to test it and I have it installed.

When I run it , I can simulate a call but it doesn't intercept calls. Can you see anything in this or am I barking at the moon.

Maybe I need refereces or something. I am using DSL (Sympatico) connection and I have a USRobitics 56K internal as well.


Code:
'This is a very simple answering machine.
'It just takes a message and writes it to a wave file in a subdirectory of the application directory.
'You can just double click on the messages and they will be played by the system sound player.

Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" _
         (hpvDest As Any, hpvSource As Any, ByVal cbCopy As Long)
         

Private Sub ViewDirectory()
'This function simply causes the Explorer to display the Messages directory (and creates it if needed),
'so each time a new message is recorded, an icon appears that can be double clicked on.
'First we try command as if we are in windows 9x, and if that doesn't work, try NT's cmd function.
On Error Resume Next
Dim slash As String
If Right(App.Path, 1) = "\" Then
    slash = ""
Else
    slash = "\"
End If
    mdir = App.Path + slash + "Messages"
    MkDir mdir
    ChDrive mdir
    ChDir mdir
    Shell "command.com /c start .", vbMinimizedNoFocus
    Shell "cmd /c start .", vbMinimizedNoFocus
End Sub

Private Sub Command1_Click()

    phone1.Initialized = 1 'run on emulator
    phone1.CallDialog
End

End Sub

Private Sub Command2_Click()
On Error Resume Next
  'If phone1.Initialized = 0 Then
  '  phone1.Initialized = 1
  'End If

   phone1.Initialized = 0 'run on real phone
   phone1.AnswerAfterRings = 4
   phone1.CallDialog
End

End Sub

Private Sub Form_Load()
    ViewDirectory
    'Command2_Click
End Sub

Private Sub phone1_DoPhoneCall(ByVal lineID As Long)
'This function gets called each time the phone is answered, for each phone line.
'Because Telephony supports multiple phone lines, this function may be called simultaneously
'several times, each version (identified by lineID) running on a different thread.
Dim result As Long
Dim size As Long
Dim wave As Long
Dim wavefile() As Byte
Dim filename As String

On Error Resume Next
    size = 0

    'this line causes a recorded wave file to be used in place of the text wherever it is spoken.
    '(if you comment out this line, the text-to-speech engine would be used instead)
    'This feature exists so you can prototype your program with text-to-speech, then use
    'the wave list editor to do recordings of the string.  See the docs for more details.
    phone1.WaveAddFromListString lineID, "[FromFile]" + vbNewLine + App.Path + _
        "\hianswer.wav=Hi. We can't come to the phone right now. Please leave a message at the beep."

    'this is the heart of the program.  The prompts are spoken (or played if the waveadd worked),
    'and the callers message is stored in wave.  See the docs for definitions of the settings used.
    phone1.RecordFromString lineID, "[Prompts]" + vbNewLine + _
                                "Main=Hi. We can't come to the phone right now. Please leave a message at the beep." + vbNewLine + _
                                "[Settings]" + vbNewLine + _
                                "BetweenUtt=10000" + vbNewLine + _
                                "InitialBuf=30000" + vbNewLine + _
                                "ReallocBuf=30000" + vbNewLine + _
                                "MaxBuf=300000" + vbNewLine + _
                                "NoAnswerTime=10" + vbNewLine _
                                , result, wave, size
                                
    If (size <> 0) Then
        'The following "casts" the wave to an array (by making a copy of it) so we can save it out to disk.
        ReDim wavefile(size)
        CopyMemory wavefile(0), ByVal wave, size
    
        'free the wave as soon as possible so we dont pig up memory
        phone1.FreeWave wave
    
        'use the date and time as the filename, and put into the Messages directory
        filename = App.Path + "\Messages" + "\Message left at " + Format(Now, "hh mm ss AMPM") + " " + Format(Now, " mmm d yyyy") + ".wav"
    
        'write the wave data out to disk. you can double click on the file to play it with sound recorder.
        Open filename For Binary Access Write As #1
        Put #1, , wavefile
        Close #1
    End If
    'hang up and wait for next call
End Sub
__________________
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."

___ Adolf Jensen
HeSaidJoe is offline   Reply With Quote
Old Sep 26th, 2000, 11:09 AM   #2
Yonatan
Guru
 
Yonatan's Avatar
 
Join Date: Apr 99
Location: Israel
Posts: 892
Yonatan is an unknown quantity at this point (<10)
Well, I don't know much about any software telephony issues (mostly because I never did anything involving that)...
But, try clicking this smily, for a site concerning this subject:
Yonatan is offline   Reply With Quote
Old Sep 26th, 2000, 11:19 AM   #3
HeSaidJoe
_______
 
HeSaidJoe's Avatar
 
Join Date: Jun 99
Location: Canada
Posts: 3,946
HeSaidJoe is an unknown quantity at this point (<10)
<?>

Thanks,

I know diddle either but I figure here is an opportunity
to learn something. Even if I can't finish the task I will learn something.

Thanks again,
Wayne
__________________
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."

___ Adolf Jensen
HeSaidJoe is offline   Reply With Quote
Reply

Go Back   VBForums > Visual Basic > Visual Basic 6 and Earlier


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 12:21 PM.




To view more projects, click here

Acceptable Use Policy


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.