Tech Note 14: Phone Control

April 13, 2009

© NSB Corporation. All rights reserved.

Using the phone control, it is possible to initiate cellular phone calls and to review the incoming and outgoing call log.

In order to use the the NSBasic Phone control in your program, use the following command:

AddObject "NSBasic.Phone.1", "phone", 0, 0, 0, 0

The Phone Control must be installed and registered on your device. See Tech Note 01 for more information on how to load this module onto your system. The standard NS Basic installers do not register the control automatically: before you use it for the first time, execute the command

ShellExecute("open","regsvrce","NSBPhone.ocx"

Methods

 

Method Parameters Description

MakeCall

PhoneNumber (string)
CalledParty (string)
PromptBefore (boolean

Places a call to the  phone number and party, with the option to delay the call while prompting the user

CallLogCount

None

Returns the total number of entries in the call log. If the call log is empty, an very large number is returned.

CallLogEntry

EntryNumber (integer, 1 through CallLogCount)

This points the control to a specific log entry. Use the properties listed below to get information about a given entry.

Properties

All of the properties in the NSBPhone control are read-only and are used to access members of a call log entry. Before the properties can be retrieved, a successful call to CallLogEntry must be made. The syntax is

value = object.property

Property Description

CLECallerIDType
 

 

Caller ID information is:

0 = Unavailable
1 = Blocked
2 = Available

CLEConnected

Did the outgoing call connect?

True = Connected
False = Busy/No answer

CLEEnd

The time the call ended.

CLEEnded

How was the call ended?

True = Voluntarily
False = Dropped

CLEIOM

Incoming/Outgoing/Missed:

"i" = Incoming
"o" = Outgoing
"m" = Missed

CLEName

The name associated with the call.

CLENameType

The name type associated with the call:

"w" = Work
"h" = Home

CLENote

The file name of the Notes file associated with the call (if a Notes file exists).

CLENumber

The phone number associated with the call.

CLEOutgoing

Was the call outgoing?

True/False

CLERoam

Was the call made while roaming?

True/False

CLEStart The time the call started.

Sample

'NSBPhone example
'
'Add the NSBasic Phone control
AddObject "NSBasic.Phone.1", "phone", 0,0,0,0

'Add a labeled text box for phone number entry
AddObject "Label", "lblNumber", 5,5,110,16
lblNumber.Caption = "Phone Number:"
lblNumber.BackColor = Output.BackColor
AddObject "TextBox", "txtNumber", 5,25,160,20

'Add a labeled text box for callee name entry
AddObject "Label", "lblName", 5,50,110,16
lblName.Caption = "Name:"
lblName.BackColor = Output.BackColor
AddObject "TextBox", "txtName", 5,70,160,20

'Add a button to initiate the call
AddObject "CommandButton", "btnDial", 170,25,65,65
btnDial.Text = "Dial"

'Use a grid object to represent some info from the call log
AddObject "Grid", "grdLog", 5,95,230,170
grdLog.Redraw = False
grdLog.Rows = phone.CallLogCount
grdLog.Cols = 5
grdLog.ColWidth(0) = 180
grdLog.ColWidth(1) = 1650
grdLog.ColWidth(2) = 1650
grdLog.ColWidth(3) = 1200
grdLog.ColWidth(4) = 1500
For i = 1 To phone.CallLogCount
   phone.CallLogEntry i
   grdLog.TextMatrix(i-1, 0) = phone.CLEIOM
   grdLog.TextMatrix(i-1, 1) = phone.CLEStart
   grdLog.TextMatrix(i-1, 2) = phone.CLEEnd
   grdLog.TextMatrix(i-1, 3) = phone.CLENumber
   grdLog.TextMatrix(i-1, 4) = phone.CLEName
Next
grdLog.Redraw = True

'When the button is tapped, make the call, but don't prompt before dialing
Sub btnDial_Click
   phone.MakeCall txtNumber.Text, txtName.Text, False
End Sub