Announcement

Collapse
No announcement yet.

simple callerID app?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Bill Scharf
    replied
    Peter,

    You are correct. I did not word my previous post correctly. I should have said that it looks like WMI will not function *without additional software* on Win98 machines. One of the requirements for our project is supporting Win98 through Vista with nothing more than Windows updates. No add-ons, downloads, or system tweaks allowed. We have thousands of users and if this project means downloading or redistributing add-ons then the users will not be happy and the project will be axed.

    Again, I appreciate your response and it is a very good idea, but I cannot use that idea for this project.

    Leave a comment:


  • Peter Lameijn
    replied
    WMI seems to be supported for Win95/98/98SE/NT4, see: http://www.microsoft.com/downloads/d...displaylang=en

    Leave a comment:


  • Bill Scharf
    replied
    WMI for win 9x?

    Peter,

    WMI sounds good, but I have been warned that it will not function on Win 98. I looked through MSDN and could not confirm or deny this. Wikipedia confirms this, but we all know it is not always realiable. MSDN says it ws introduced with Windows 2000. Our software must be supported on Win 98 through Vista and preferrably on Win 95 also. So, I think that WMI is not an option for us. However, I do sincerely appreciate the suggestion.

    Leave a comment:


  • Peter Lameijn
    replied
    You can get (a lot of) Modem info through WMI:
    [edit] Added status and comport info[/edit]

    Code:
    ' ========================================================================================
    ' WMI example - Retrieving Modem information
    ' ========================================================================================
    
    #Compile Exe
    #Dim All
    #Include "TB_WMILIB.INC"    ' // WMI helper functions
                                ' see [url]http://www.powerbasic.com/support/pbforums/showpost.php?p=171374&postcount=3[/url]
    
    ' ========================================================================================
    ' Main
    ' ========================================================================================
    Function PBMain
    
       Local hr As Long                   ' // HRESULT
       Local oServices As Dispatch        ' // Services object
       Local vServices As Variant         ' // Services object reference
       Local oItems As Dispatch           ' // Generic collection object
       Local vItems As Variant            ' // Generic collection object reference
       Local oItem As Dispatch            ' // Generic item object
       Local vItem As Variant             ' // Generic item object reference
       Local penum As Dword               ' // Collection's enumerator reference
       Local vCount As Variant            ' // Number of items in the collection
       Local vVar As Variant              ' // General purpose variant
       Local vRes As Variant              ' // General purpose variant
       Local i As Long                    ' // Loop counter
       Local x As Long                    ' // Loop counter
       Local Temp As String               ' // Local string storage
       Dim vArray(0) As Variant           ' // General purpose array of variants
    
       ' // Connect to WMI using a moniker
       hr = WmiGetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2", vServices)
       If hr <> %S_OK Then GoTo Terminate
       Set oServices = vServices
       vServices = Empty
       If IsFalse IsObject(oServices) Then GoTo Terminate
    
       ' // Execute a query to get a reference to the collection of running processes
       vVar = "SELECT * FROM Win32_POTSModem"
       Object Call oServices.ExecQuery(vVar) To vItems
       If ObjResult Then GoTo Terminate
       Set oItems = vItems
       vItems = Empty
       If IsFalse IsObject(oItems) Then GoTo Terminate
    
       ' // Retrieve the number of items in the collection
       Object Get oItems.Count To vCount
    
       ' // Retrieve a reference to the collection's enumerator
       hr = Wmi_NewEnum(ObjPtr(oItems), penum)
       If hr <> %S_OK Or penum = %NULL Then GoTo Terminate
    
       ' // Iterate throught the collection of objects.
       For i = 1 To Variant#(vCount)
          ' // Retrieve a reference to the next object in the collection
          hr = WmiEnum_NextItem(penum, vItem)
          If hr <> %S_OK Then Exit For
          Set oItem = vItem
          If IsFalse IsObject(oItem) Then Exit For
    
          Object Get oItem.DeviceID To vRes
          Temp = Temp & "Device ID: " & $Tab & Variant$(vRes) & $Cr
          '------------------------------------------------------------------------
          Object Get oItem.Caption To vRes
          Temp = Temp & "    Caption:" & $Tab & Variant$(vRes) & $Cr
          '------------------------------------------------------------------------
          Object Get oItem.DeviceType To vRes
          Temp = Temp & "    Device type:" & $Tab & Variant$(vRes) & $Cr
          '------------------------------------------------------------------------
          Object Get oItem.AttachedTo To vRes
          Temp = Temp & "    Attached to:" & $Tab & Variant$(vRes) & $Cr
          '------------------------------------------------------------------------
          Object Get oItem.Status To vRes
          Temp = Temp & "    Status:" & $Tab & $Tab & Variant$(vRes) & $Cr
          '------------------------------------------------------------------------
          Object Get oItem.StringFormat To vRes
          Temp = Temp & "    Uses:" & $Tab & $Tab & Variant$(vRes) & $Cr & $Cr
          '------------------------------------------------------------------------
       Next
       MsgBox Temp,, "WMI Modem Info:"
    
       ' // Release the collection enumerator
       WmiRelease penum
       ' // Release the collection object
       If IsObject(oItems) Then Set oItems = Nothing
    
    Terminate:
    
       If IsObject(oServices) Then Set oServices = Nothing
    
    End Function
    ' ========================================================================================
    Last edited by Peter Lameijn; 28 Mar 2009, 09:13 AM.

    Leave a comment:


  • Mike Doty
    replied
    This works with ani-232 adapters:
    h = FREEFILE
    comport$ = "COM"+ sPortNumber
    COMM OPEN Comport$ AS h
    COMM SET #h, RXBUFFER = 4096
    COMM SET #h, BAUD = 1200
    COMM SET #h, PARITY = %FALSE
    COMM SET #h, BYTE = 8
    COMM SET #h, STOP = 0

    Leave a comment:


  • Cliff Nichols
    replied
    To my knowledge (correct me if I am wrong in explaining)
    1.) A Serial Port (ComPort) is its own device
    2.) No matter what is attached (internally such as a modem) or externally (such as a Motor Controller), it is considered an "Attached" device
    3.) (Lets skip 3 just to confuse or amuse)

    Much like any other protocol I have seen the following must hold true
    1.) Adhere to the protocol (or bridge of protocols) between port and device
    2.) The most stringent of both protocols is the one you need to assure if you can communicate.

    For example:
    (Depending on the OS) then a serial Port parameters are
    Baud: 1200
    guessing at the rest but best example
    Data bits: 8
    Parity: None
    Stop bits: 1

    and typically the attached device has its own parameters (unless set to custom for that device)
    lets say the typical 9600,8,N,1

    Now given the concept that you can make your "Best Guesstimation" at "Hey the port opened, and the device responded correctly" to find the correct combination....it is still a guesstimation (mostly right in 90% of the guesses, but there is always a fluke pitch"

    At your stage of the game, I will bet $$$ to doughnuts that most of your problems are they typical top mis-leads of any device attached.

    1.) Software SUCKS (was and after-thought of how to interface what may be a good piece of hardware

    2.) Examples Suck even more cause they "Just work" (but they only "Just Work" because only tested on 1 machine and in 1 circumstance
    (aka "Works on my Machine"...."ummm nope, I do not have a UPS attached"...ummm nope...why would I check if COM1 was already in USE??? etccccc.....)

    All in all you are on the right track, but the solution is in the details of what the attached device expects (usually the typical settings, but if not documented you are in trouble)

    Good news..you ruled out any hardware problems (because it works "Sometimes") tracking down why it does not work "Other times" is the problem

    Leave a comment:


  • Peter Lameijn
    replied
    Very helpful when developing TAPI applications:
    ftp://ftp.microsoft.com/developr/TAPI/tb20.zip (TAPI test application)
    ftp://ftp.microsoft.com/developr/TAPI/esp32.zip (Virtual TAPI provider)
    Last edited by Peter Lameijn; 27 Mar 2009, 05:23 PM.

    Leave a comment:


  • Bill Scharf
    replied
    Thank you all for your help. I am still baffled by the original program's behavior. Contrary to what has been said above, that program *will* work with another peice of software (PhoneTray). It *will not* work by itself. I keep thinking that I am hallucinating, but I have duplicated this many times.

    The VB program at www.yes-tele.com does not seem to work correctly on the XP machines I tried it on. Maybe it is out-dated or specifically for a country outside the US? Either way, it gives immediate errors on all com ports.

    The only success I have had is avoiding TAPI all together and manually opening the com port:
    Code:
    local ncBytesInBuffer as long  
    local sBuffer         as string   
    local ncomm           as long           
    
    COMM OPEN "COM3" AS nComm
    sbuffer = "AT" + $CR
    COMM SEND nComm, sBuffer  
    ncBytesInBuffer = COMM(nComm, RXQUE)
    COMM RECV nComm, ncBytesInBuffer, sBuffer  
    msgbox sbuffer,,"results from AT"                  
    'this returns OK"
    sbuffer = "ATZ" + $CR
    COMM SEND nComm, sBuffer  
    ncBytesInBuffer = COMM(nComm, RXQUE)
    COMM RECV nComm, ncBytesInBuffer, sBuffer  
    msgbox sbuffer,,"results from ATZ"  
    'this returns OK"
    sbuffer = "AT+VCID=1" + $CR            
    
    COMM SEND nComm, sBuffer  
    ncBytesInBuffer = COMM(nComm, RXQUE)
    COMM RECV nComm, ncBytesInBuffer, sBuffer  
    msgbox sbuffer,,"results from ATZ"   
    'this returns OK"
    'this loop will find the data:
    DO 
    		COMM LINE INPUT NCOMM, SbUFFER
    		if LEN(sBuffer) then
    			msgbox sbuffer,,"testing"			
    		end if
    LOOP UNTIL instr(sBuffer, "NAME")
    comm close ncomm    
    'sbuffer will get the name data
    For that to work, I need a way to auto-detect which port has a modem and preferably where there is a dial-tone. Our users would like as much auto-detection as possible. I will keep researching this. Thank you all!

    Leave a comment:


  • Cliff Nichols
    replied
    Dave hit this nail on the head with
    Only one app at a time can have the comm port open.
    That is one coffin often overlooked when developing (and I see it ALLLLL too often when getting calls that my software works, but using VB or (my ANTI-CHRIST "shudder" Labview) it does not work.

    the answer in most cases is to shut down the test code (including the environment it is running under) so that the port is forced closed (and in a few cases even then the only "Force" is a reboot

    Basically to the system its "He who has it 1st gets it"....and takes their ball and goes home if they do not share



    There are ways of making the software talk....(but even I have not collaborated all the mixtures yet when it comes to serial ports) but it can be done (or my intuition shows me it can)

    when it doubt of "What the FUBAR???" shut down everything possibly even considers the port, and if still not working then reboot and only run your test...if still failing then the hole has to be dug deeper

    Leave a comment:


  • Dave Biggs
    replied
    Originally posted by Bill Scharf View Post
    Mel,

    .. I don't believe the issue is the com port. If the com port is wrong, how could the Phonetray app work? ..
    Only one app at a time can have the comm port open.
    If all else is closed down you should be able to talk to the modem (send AT commands etc) using HyperTerminal.

    If something else has that port open already, it won't be available in HyperTerm's drop down list when you try to open a new connection...

    Leave a comment:


  • Arthur Gomide
    replied
    Maybe this help

    Leave a comment:


  • Scott Slater
    replied
    You should be able to send AT followed by a $CR and see the result OK returned from the modem. Use Comm Send to send these strings right after the port is opened in your ap.

    Leave a comment:


  • Arthur Gomide
    replied
    > I cannot figure out how to send AT+VCID=1 to the modem.

    1- Open Control Panel
    2- Phone & Modem Options
    3- Select Modem tab
    4- Select desired modem
    5- Select Properties
    6- Select Advanced tab
    7- Type AT+VCID=1
    8- Press OK

    Maybe you need to reboot

    Leave a comment:


  • Bill Scharf
    replied
    Mel,

    Thank you for your reply. That does sounds somewhat familar. I tried to mess with the com settings, but no luck. I don't believe the issue is the com port. If the com port is wrong, how could the Phonetray app work? If the com port is wrong, then why does my test app work when Phonetray is running?

    Thanks again!

    Leave a comment:


  • Mel Bishop
    replied
    May not apply here but I seem to recall that COM1 and COM3 share IRQ's as do COM2 and 4. Have you tried changing the IRQ of your modem to, say, COM2 or 4? Maybe...

    Leave a comment:


  • Bill Scharf
    replied
    Thank you all.

    I cannot figure out how to send AT+VCID=1 to the modem. I tried using the pb program in samples\comms\ but it will not run when I adjust it to com3 (where the modem is accoring to the windows control panel). Using com1, it runs, but has no affect. I then searched through all the TAPI functions and found none that appeared to do this. How can I send this string to the modem?

    Thanks!

    Leave a comment:


  • Cliff Nichols
    replied
    You guys make me want to find equipment to test. (To my knowledge, Modem = ComPort = Serial Port = Who cares??? its still a Serial Port, whatever is attached is just a matter of protocol if it works or not???"


    Its typically the same theory with any port/protocol (USB, Serial, Parallel, FireWire, anything external to the computer)

    Can you show code? or examples? or a list of what you are using to test with???? (curiosity has gotten the best of me)

    Leave a comment:


  • Scott Slater
    replied
    Once the modem has been init'd with one of these strings successfully it should return the result along with the first ring like...

    Code:
    RING
    
    NMBR   8005551212
    NAME   JOE SMITH
    TIME   1426
    
    RING
    ...
    The return is structured like above with the ID (NAME, NMBR, TIME) always 4 in LEN, and the data beginning at the 8th character, on the same line.
    Last edited by Scott Slater; 21 Mar 2009, 07:42 AM. Reason: removed the : from the TIME return since it shouldn't be there

    Leave a comment:


  • Scott Slater
    replied
    Yes its:

    AT+VCID=1 for most v.92 modems

    or

    AT#CID=1

    The first string is the most commonly accepted.

    Leave a comment:


  • colin glenn
    replied
    This is probably a question from left field, but went through something along these lines using a QB45 program I wrote many years ago, so if the memory is rusty, I'm sorry. And this is concerning the adapting the program from pure DOS to a Win32 environment.

    But, to get the program and modem talking and get caller id from the modem, under windows, I had to register my program as a recipient for dial information, then when windows "interrupted" with the message that the line was ringing, I then could interrogate the modem for the caller id information.

    But now, years later and source code having been eaten by a crash, I could not tell you what I did to inform windows that I was a ring recipient, nor the message windows sent when a ring came in.

    EDIT: And there was a modem string I sent to the modem to enable caller id prior to going passive and waiting for a call.

    Leave a comment:

Working...
X