Phone number

Discuss anything else that does not suite other forums.

Moderator: Rathinagiri

Post Reply
User avatar
zolysoftsolutions
Posts: 139
Joined: Wed Feb 29, 2012 3:33 am
Location: Gyulakuta, Erdélyország
Contact:

Phone number

Post by zolysoftsolutions »

Hello everybody,

First of all I wish a Merry Christmas for you and for your families.
My question is not a matter of HMG, but I found here very clever and experienced people.

I want to catch the phone number of the caller trough my laptop. The phone line is connected to my laptop trough a modem.
The voice (telephone) service I think permit this, becouse on the phone display appear the caller ID.

Can you recommend where I have to start to experience this?

I am building a HMG applcation, where I want to build an extra function and to catch the callers phonenumber.

Best regards,
Zoli B.
_______________________________
Open eyes for you!
User avatar
mol
Posts: 3825
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: Phone number

Post by mol »

Few years ago, when I used modem, there was a software bounded to modem to send, faxes, catch messages as voice mail. Maybe you will find solution using such a software?
User avatar
zolysoftsolutions
Posts: 139
Joined: Wed Feb 29, 2012 3:33 am
Location: Gyulakuta, Erdélyország
Contact:

Re: Phone number

Post by zolysoftsolutions »

Thank you Marek.
I downloaded Free Serial Port Monitor, and the data traffic is visible, when I recieve a call.
So, exist a possibility in HMG to capture the incoming data from a COM (serial) port?
I will try HBCOMM..
_______________________________
Open eyes for you!
User avatar
mol
Posts: 3825
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: Phone number

Post by mol »

Yes, it,s really possible. I have functions for serial comunication with fiscal printer. I'll post here
User avatar
mol
Posts: 3825
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: Phone number

Post by mol »

Here are some function I'm using for communication. Maybe it will be useful for you:

Code: Select all

FUNCTION InitCOMPort
	param cPortName, nBaud, xTypZadania, xTypTransmisji, nPoczatek, nKoniec
	local lRet := .t., cAnswer := space(1000)
	local lCTS, lDSR, lRing, lDCD
	local nNumerKasyPodlaczonej

	ECR_LastErrorNR := 0
	ECR_LastErrorTXT := ""
	
	if type("cPortName") == "N"
		cPortName := "COM"+alltrim(str(cPortName))
	endif
	
	oWinPort := win_com():Init(cPortName, nBaud, NOPARITY, 8, ONESTOPBIT)
    if !oWinPort:Open
		lRet := .f.
        walert("Error opening COM port" )
		return lRet
    else
        // Success
		oWinPort:QueueSize( 1000, 1000 )
		oWinPort:Purge()
		//TimeOuts( nInterval, nReadMultiplier, nReadConstant, nWriteMultiplier, nWriteConstant )
		oWinPort:Timeouts(1500,1000,20000,1000,20000)
		
        oWinPort:RTSFlow(.t.)
        oWinPort:DTRFlow(.t.)
        oWinPort:XonXoffFlow(.t.)
        oWinPort:SetDTR(.t.)
        oWinPort:SetDTR(.t.)
        oWinPort:SetRTS(.t.)
    endif

 RETURN lRet
*-------------------
function ComClose
	local nCount := 0, cAnswer := ""
	
	if oWinPort <> NIL
		oWinPort:QueueStatus( , , , , , @nCount,  )
		oWinPort:Read(@cAnswer, nCount)
		oWinPort:Purge()
		oWinPort:RTSFlow(.f.)
		oWinPort:DTRFlow(.f.)
		oWinPort:XonXoffFlow(.f.)
		oWinPort:SetDTR(.f.)
		oWinPort:SetDTR(.f.)
		oWinPort:SetRTS(.f.)
		oWinPort:Close()
	endif
	oWinPort := NIL
return .t.
*-------------------
*---------------------
function COMRead
	local cAnswer := space(50)
	local lRet := .F.
	local cNrBleduHex := "", nNrBledu := -1

	BEGIN SEQUENCE
		cTXTError := ""
		// read error code - it'sspecialized for electronic register cash
		if (oWinPort:Write(EOT) < 1)
			// no communication
			break
		endif
		oWinPort:Read(@cAnswer, 1)
		if cAnswer == WACK
			do while cAnswer == WACK .or. len(cAnswer) < 1
				oWinPort:Read(@cAnswer, 1)
			enddo
		endif
		
		if cAnswer != ENQ
			break
		endif
		
		if (oWinPort:Write(ACK) < 1)
			break
		endif
		
		oWinPort:Read(@cAnswer, 47)
		if len(cAnswer) < 47
			// no answer
		else
			cNrBleduHex := substr(cAnswer, 5, 2)	
			cTXTError := TXT_Error(cNrBleduHex)
			nNrBledu	:= ECR_LastErrorNR
		endif

		// acknowledge of reading packet
		if (oWinPort:Write(ACK) < 1)
			break
		endif
		// wait for EOT
		oWinPort:Read(@cAnswer, 1)
		if cAnswer == EOT
			// write EOT
			oWinPort:Write(EOT)
		endif
		
		lRet := .f.
	END SEQUENCE
	
return nNrBledu
*---------------------
function COM_EndTransmission
	local lRet := .t.
	local cAnswer := space(1000)
	local cOdp := ""
	
	if oWinPort = NIL
		return .f.
	endif
	
	BEGIN SEQUENCE
		if (oWinPort:Write(EOT) < 1)
			// no communication
			lret := .f.
			break
		endif
		oWinPort:Read(@cAnswer, 1)
		cOdp += "  Odp.3:"+NtoC(asc(cAnswer), 16,4,"0")
		if cAnswer != EOT
			// no communication
			lret := .f.
			break
		endif
	END SEQUENCE
	ECR_COMClose()
 return lRet

User avatar
dhaine_adp
Posts: 457
Joined: Wed Aug 06, 2008 12:22 pm
Location: Manila, Philippines

Re: Phone number

Post by dhaine_adp »

I want to catch the phone number of the caller trough my laptop. The phone line is connected to my laptop trough a modem.
The voice (telephone) service I think permit this, becouse on the phone display appear the caller ID.
Hello Zoli,

I haven't written app to read COMM however I can suggest that before you embarked on a major programming tasks perhaps you would like to test first with Hyperterminal or Putty and send some AT commands like (and see what will be the response):

Code: Select all

AT#CID=1
AT+VCID=1
That way you can test the parameters and it may also help debugging your code later.
Regards,

Danny
Manila, Philippines
Post Reply