Lampiran I
Proposal Tugas Akhir
JURUSAN TEKNIK ELEKTRO FAKULTAS TEKNOLOGI INDUSTRI UNIVERSITAS KRISTEN PETRA SURABAYA
USULAN TUGAS AKHIR
Nama : F. X. Andrianto Raharjo
NRP : 23402044
Bidang Studi : Telematika
Judul Tugas Akhir : Aplikasi Voice Modem Sebagai Perekam Pembicaraan Telepon
Pembimbing I : Ir. Resmana Lim, M.Eng.
Pembimbing II : Iwan Njoto Sandjaja, S. T.
Dilaksanakan : Semester Genap 2005/2006
Surabaya, 25 Januari 2006
Yang mengusulkan,
( F. X Andrianto Raharjo ) Mengetahui :
Pembimbing I, Pembimbing II,
( Ir. Resmana Lim, M.Eng. ) ( Iwan Njoto Sandjaja, S. T.)
Koordinator Tugas Akhir,
( Petrus Santoso, S.T., M.Sc. )
PROPOSAL TUGAS AKHIR
1. Judul Tugas Akhir
Aplikasi Voice Modem Sebagai Perekam Telepon
2. Latar Belakang Masalah
Pada zaman yang semakin maju ini teknologi informasi berkembang cukup pesat. Banyak sekali aplikasi-aplikasi yang muncul seiring dengan kemajuan tersebut. Jarak menjadi semakin tidak berarti dengan majunya teknologi informasi ini. Kita bisa mendapatkan berita dari belahan dunia lain dari tempat mana pun di mana kita berada.
Kemajuan teknologi informasi ini menyebabkan teknologi komunikasi menjadi ikut berkembang pula. Kedua teknologi ini memang saling terkait satu sama lain. Banyak sekali aplikasi dalam teknologi komunikasi yang bisa kita nikmati saat ini dan itu mempermudah kita untuk melakukan komunikasi dengan orang lain.
Dengan adanya kemudahan tersebut, orang akan semakin gemar melakukan komunikasi khususnya melalui telepon. Ini bisa menjadi hal yang merugikan bagi suatu perusahaan apabila para karyawannya melakukan panggilan telepon yang sebenarnya tidak perlu, seperti contohnya : menelpon teman atau pacar dengan menggunakan telepon kantor. Untuk itu penulis ingin membuat suatu program yang bisa merekam pembicaraan telepon seseorang dan disimpan dalam bentuk file dalam komputer. Program tersebut bisa merekam pembicaraan telepon sesorang baik itu panggilan masuk maupun panggilan keluar. File tersebut bisa sewaktu-waktu didengarkan kembali di dalam komputer.
3. Perumusan Masalah
Masalah yang akan dibahas adalah bagaimana kita bisa merekam
pembicaraan telepon seseorang, baik itu panggilan masuk atau pun panggilan
keluar dan menyimpannya ke dalam bentuk file di dalam komputer. Sistem ini
bekerja dengan bantuan voice modem yang bisa mengubah sinyal suara yang
masuk menjadi bentuk data di dalam komputer. Masalah lain adalah bagaimana kita bisa memanfaatkan fungsi-fungsi yang ada dalam TAPI (Telephony Application Programming Interfaces) yang akan digunakan untuk merekam pembicaraan telepon tersebut dan cara untuk mendapatkan caller ID dari telepon yang masuk.
PSTN
Voice Modem
` Komputer
Telepon Line Telp Com User 1
User 2
Blok Diagram Sistem
Cara kerja dari program yang akan saya buat adalah : 1. Telepon masuk / keluar
2. Gagang telepon diangkat dan mulai merekam dan berhenti merekam setelah gagang telepon ditutup (untuk telepon masuk). Untuk telepon keluar, pembicaraan mulai direkam setelah ada jawaban dari pemilik telepon yang dituju dan berhenti merekam setelah gagang telepon ditutup.
3. Voice modem bertugas untuk mengubah sinyal suara menjadi bentuk data di dalam komputer sekaligus merekam pembicaraan telepon tersebut.
4. Data yang didapatkan kemudian disimpan dalam bentuk file di dalam komputer yang sewaktu-waktu bisa didengarkan kembali.
4. Tujuan Tugas Akhir
Adapun tujuan yang ingin dicapai dalam tugas akhir ini adalah
membuat aplikasi voice modem sebagai perekam pembicaraan telepon dengan
memanfaatkan library TAPI (Telephony Application Programming
Interfaces).
5. Batasan Masalah
Adapun hal-hal yang membatasi Tugas Akhir ini adalah:
1. Kerja program adalah merekam panggilan telepon baik panggilan masuk maupun panggilan keluar.
2. Proses perekaman suara dilakukan dengan bantuan voice modem yang kemudian disimpan ke dalam bentuk file di dalam komputer.
3. File tersebut disimpan dalam bentuk compress file.
4. Di dalam file tersebut terdapat data-data penting seperti caller ID dan waktu telepon.
5. Aplikasi ini menggunakan teknologi TAPI (Telephony Application Programming Interfaces).
6. Fitur-fitur dari aplikasi ini terdiri dari :
• Perekam pembicaraan telepon (panggilan masuk / keluar).
• Searching untuk mencari file yang ingin didengarkan ulang berdasarkan tanggal, caller ID, dan telepon masuk atau keluar.
• Playback untuk mendengarkan kembali pembicaraan telepon yang sudah direkam.
• Caller ID untuk mengetahui nomor telepon orang yang menelpon kita.
6. Tinjauan Pustaka
TAPI (Telephony Application Programming Interface) adalah suatu teknologi yang dirilis oleh Microsoft, di mana teknologi ini berfungsi sebagai interface bagi aplikasi untuk mengakses fungsi-fungsi telephony. TAPI merangkum semua fungsi telephony dalam sebuah library dengan nama TAPI32.dll.
Dengan TAPI, kita dapat membangun aplikasi personal telephony bagi
user. TAPI mendukung teknologi, baik voice maupun transmisi data. Selain
itu, TAPI dapat digunakan dalam berbagai terminal device, mendukung tipe
koneksi yang kompleks dan berbagai teknik call management, seperti
conference call, call waiting, voice record, dan voice mail.
Aplikasi perekam panggilan telepon menggunakan salah satu fungsi dari TAPI yaitu voice record. Setelah TAPI merekam pembicaraan telepon maka data tersebut akan disimpan dalam bentuk file pada suatu folder di dalam komputer. File tersebut bisa didengarkan kembali sewaktu-waktu di komputer. Di dalam file tersebut juga terdapat data dari mana telepon yang masuk atau ke nomor mana panggilan telepon tersebut ditujukan. Data tersebut sering kita sebut sebagai caller ID.
7. Metodologi Penelitian
Dalam Tugas Akhir ini ada beberapa metodologi yang digunakan antara lain :
1. Studi Literatur
Mencari dan mempelajari dasar-dasar teori yang berkaitan dengan topik yang akan dibahas yaitu TAPI, Delphi, dan voice modem. Serta mencari referensi-referensi yang terkait dengan topik Tugas Akhir ini.
2. Studi aplikatif
Mengaplikasikan langsung teori-teori yang bersangkutan dalam sistem berupa:
• Desain sistem
• Desain user interface
• Pembuatan program untuk merekam panggilan telepon
• Pembuatan user interface
• Penyimpanan data yang didapatkan dari hasil rekaman
pembicaraan telepon
• Pembuatan player untuk mendengarkan kembali pembicaraan yang sudah direkam.
3. Studi analisis
Melakukan pengujian terhadap sistem dan menganalisa kerja dari sistem yang telah dibuat. Analisa tersebut juga termasuk analisa program yang telah dibuat.
4. Pembuatan laporan
8. Relevansi
Aplikasi perekam pembicaraan telepon ini akan membantu suatu perusahaan dalam mengawasi penggunaan telepon dalam perusahaan tersebut.
Perusahaan bisa mengetahui apabila ada pembicaraan telepon yang dirasa tidak perlu dan segera menindaklanjutinya. Selain itu bisa juga digunakan untuk merekam pembicaraan telepon yang penting dan sewaktu-waktu bisa didengarkan kembali. Dengan adanya aplikasi ini diharapkan bisa meminimalisasi penyalahgunaan telepon di dalam suatu perusahaan.
9. Jadwal Kegiatan
Target Bulan
No Topik I II III IV
1 Desain sistem dan user interface 2 Pembuatan program dan user interface
3 Pengujian system
4 Analisa system
5 Pembuatan laporan
10. Daftar Pustaka
Dethan, Ridwan M. Pemrograman Telephony dengan Delphi. Jakarta : PT Elex Media Komputindo. 2004.
Pranata, Anthony. Pemrograman Borland Delphi 6. Yogyakarta : Andi. 2003.
Call Recorder: Manual call recorder software. 2005.
http://www.teley.com/products/redcall/
Phone Recorder – Features. 2005.
http://www.kaed.com/hardware/pr_features.html Voice Modems and Professional Telephony Hardware. 2005.
http://www.nch.com.au/ivm/modems.html
Lampiran II
Listing Program
unit UnitUtama;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls, OleCtrls, TAPIEXLib_TLB, StdCtrls, ComCtrls, MPlayer, Gauges, Grids, DB, DBTables, Menus, Buttons;
type
TFormUtama = class(TForm) ImagePSP: TImage;
ImageButtonContactPress: TImage;
ImageButtonIncomingPress: TImage;
ImageButtonOutgoingPress: TImage;
TAPIExCtlPhoneRecorder: TTAPIExCtl;
TimerRingCount: TTimer;
MediaPlayerUtama: TMediaPlayer;
ImageBackground: TImage;
MemoCallState: TMemo;
EditDial: TEdit;
EditRecord: TEdit;
ListViewDevices: TListView;
EditDeviceID: TEdit;
EditRingCount: TEdit;
MemoStatus: TMemo;
EditStatus: TEdit;
OpenDialogPlay: TOpenDialog;
LabelCallState: TLabel;
ImageButtonLineOpenPress: TImage;
ImageButtonLineOpen: TImage;
ImageButtonLineClosePress: TImage;
ImageButtonLineClose: TImage;
ImageButtonDialPress: TImage;
ImageButtonDial: TImage;
ImageButtonEndCallPress: TImage;
ImageButtonEndCall: TImage;
ImageKeypadDisable: TImage;
ImageButtonContact: TImage;
ImageButtonContactHandPoint: TImage;
ImageButtonIncoming: TImage;
ImageButtonIncomingHandPoint: TImage;
ImageButtonOutgoing: TImage;
ImageButtonOutgoingHandPoint: TImage;
ImageButtonPlayPress: TImage;
ImageButtonPlay: TImage;
ImageButtonPausePress: TImage;
ImageButtonPause: TImage;
ImageButtonStopPress: TImage;
ImageButtonStop: TImage;
ImageButtonOpenFilePress: TImage;
ImageButtonOpenFile: TImage;
ImageButtonOpenFileHandPoint: TImage;
ImageLampuLineClose: TImage;
ImageLampuLineOpen: TImage;
LabelStatus: TLabel;
ImageButtonLineOpenDisable: TImage;
ImageButtonLineOpenHandPoint: TImage;
ImageButtonLineCloseDisable: TImage;
ImageButtonLineCloseHandPoint: TImage;
ImageButtonDialDisable: TImage;
ImageButtonDialHandPoint: TImage;
ImageButtonEndCallDisable: TImage;
ImageButtonEndCallHandPoint: TImage;
LabelPhoneNumber: TLabel;
ImageKeypad: TImage;
ImageKeypadHandPoint: TImage;
ImageButton1Press: TImage;
ImageButton2Press: TImage;
ImageButton3Press: TImage;
ImageButton4Press: TImage;
ImageButton5Press: TImage;
ImageButton6Press: TImage;
ImageButton7Press: TImage;
ImageButton8Press: TImage;
ImageButton9Press: TImage;
ImageButtonBintangPress: TImage;
ImageButton0Press: TImage;
ImageButtonPagarPress: TImage;
ImageButton1: TImage;
ImageButton2: TImage;
ImageButton3: TImage;
ImageButton6: TImage;
ImageButton5: TImage;
ImageButton4: TImage;
ImageButton7: TImage;
ImageButton8: TImage;
ImageButton9: TImage;
ImageButtonPagar: TImage;
ImageButton0: TImage;
ImageButtonBintang: TImage;
ImageButton1HandPoint: TImage;
ImageButton2HandPoint: TImage;
ImageButton3HandPoint: TImage;
ImageButton6HandPoint: TImage;
ImageButton5HandPoint: TImage;
ImageButton4HandPoint: TImage;
ImageButton7HandPoint: TImage;
ImageButton8HandPoint: TImage;
ImageButton9HandPoint: TImage;
ImageButtonPagarHandPoint: TImage;
ImageButton0HandPoint: TImage;
ImageButtonBintangHandPoint: TImage;
ImageLampuRecord: TImage;
ImageLampuRecordOff: TImage;
ImageButtonVolMinPress: TImage;
ImageButtonVolMin: TImage;
ImageButtonVolMinHandPoint: TImage;
ImageButtonVolPlusPress: TImage;
ImageButtonVolPlus: TImage;
ImageButtonVolPlusHandPoint: TImage;
LabelModem: TLabel;
LabelOpenFile: TLabel;
ImageButtonPlayDisable: TImage;
ImageButtonPauseDisable: TImage;
ImageButtonStopDisable: TImage;
MediaPlayerFile: TMediaPlayer;
TimerPlayer: TTimer;
LabelPlayFile: TLabel;
GaugeUtama: TGauge;
ImageButtonStopHandPoint: TImage;
ImageButtonPlayHandPoint: TImage;
ImageButtonPauseHandPoint: TImage;
TimerDelay: TTimer;
TimerRecording: TTimer;
StringGridDevice: TStringGrid;
ImageFoto: TImage;
LabelNama: TLabel;
TableContact: TTable;
ImageButtonHelpPress: TImage;
ImageButtonHelp: TImage;
ImageButtonHelpHandPoint: TImage;
TableIncoming: TTable;
TableOutgoing: TTable;
LabelNewIncoming: TLabel;
LabelNewOutgoing: TLabel;
QueryUtama: TQuery;
ImageButtonSettingPress: TImage;
ImageButtonSetting: TImage;
ImageButtonSettingDisable: TImage;
ImageButtonSettingHandPoint: TImage;
MainMenuUtama: TMainMenu;
MainMenuShortcut: TMenuItem;
MainMenuAbout: TMenuItem;
MainMenuOpenFile: TMenuItem;
MainMenuPlay: TMenuItem;
MainMenuPause: TMenuItem;
MainMenuStop: TMenuItem;
MainMenuOpenLine: TMenuItem;
MainMenuCloseLine: TMenuItem;
MainMenuDial: TMenuItem;
MainMenuEndCall: TMenuItem;
MainMenuContact: TMenuItem;
MainMenuIncoming: TMenuItem;
MainMenuOutgoing: TMenuItem;
MainMenuSetting: TMenuItem;
MainMenuHelp: TMenuItem;
GaugeVolume: TGauge;
ImageButtonAboutPress: TImage;
ImageButtonAbout: TImage;
ImageButtonAboutHandPoint: TImage;
ImageButtonClosePress: TImage;
ImageButtonClose: TImage;
ImageButtonCloseHandPoint: TImage;
PanelStartRecord: TPanel;
LabelTeleponTersambung: TLabel;
LabelAngkatTelepon: TLabel;
LabelMulaiMerekam: TLabel;
BitBtnOK: TBitBtn;
TimerStartRecord: TTimer;
LabelTanggal: TLabel;
LabelJam: TLabel;
TimerJam: TTimer;
LabelRecordFormat: TLabel;
procedure FormKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure TAPIExCtlPhoneRecorderCallStateChange(ASender: TObject;
const m_Call: ITAPICall; NewState: TOleEnum);
procedure FormCreate(Sender: TObject);
procedure TAPIExCtlPhoneRecorderDebug(ASender: TObject;
const msg: WideString);
procedure TAPIExCtlPhoneRecorderOffering(ASender: TObject;
const m_Call: ITAPICall; OfferingMode: TOleEnum);
procedure TimerRingCountTimer(Sender: TObject);
procedure TAPIExCtlPhoneRecorderIdle(ASender: TObject;
const m_Call: ITAPICall);
procedure TAPIExCtlPhoneRecorderBusy(ASender: TObject;
const m_Call: ITAPICall; BusyMode: TOleEnum);
procedure ImageButtonLineOpenHandPointMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure ImageButtonLineOpenHandPointMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure ImageButtonLineCloseHandPointMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure ImageButtonLineCloseHandPointMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure ImageButtonDialHandPointMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure ImageButtonDialHandPointMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure ImageButtonEndCallHandPointMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure ImageButtonEndCallHandPointMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure ImageButtonContactHandPointMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure ImageButtonContactHandPointMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure ImageButtonIncomingHandPointMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure ImageButtonIncomingHandPointMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure ImageButtonOutgoingHandPointMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure ImageButtonOutgoingHandPointMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure ImageButtonPlayHandPointMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure ImageButtonPlayHandPointMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure ImageButtonPauseHandPointMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure ImageButtonPauseHandPointMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure ImageButtonStopHandPointMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure ImageButtonStopHandPointMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure ImageButtonOpenFileHandPointMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure ImageButtonOpenFileHandPointMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure ImageButton1HandPointMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure ImageButton1HandPointMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure ImageButton2HandPointMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure ImageButton2HandPointMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure ImageButton3HandPointMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure ImageButton3HandPointMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure ImageButton4HandPointMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure ImageButton4HandPointMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure ImageButton5HandPointMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure ImageButton5HandPointMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure ImageButton6HandPointMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure ImageButton6HandPointMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure ImageButton7HandPointMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure ImageButton7HandPointMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure ImageButton8HandPointMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure ImageButton8HandPointMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure ImageButton9HandPointMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure ImageButton9HandPointMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure ImageButtonBintangHandPointMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure ImageButtonBintangHandPointMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure ImageButton0HandPointMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure ImageButton0HandPointMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure ImageButtonPagarHandPointMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure ImageButtonPagarHandPointMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure ImageButtonVolMinHandPointMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure ImageButtonVolMinHandPointMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure ImageButtonVolPlusHandPointMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure ImageButtonVolPlusHandPointMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure ImageKeypadHandPointMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure TimerPlayerTimer(Sender: TObject);
procedure TimerDelayTimer(Sender: TObject);
procedure FormKeyPress(Sender: TObject; var Key: Char);
procedure TimerRecordingTimer(Sender: TObject);
procedure TAPIExCtlPhoneRecorderCallerID(ASender: TObject;
const m_Call: ITAPICall; const CallerName, CallerNumber: WideString);
procedure TAPIExCtlPhoneRecorderDisConnected(ASender: TObject;
const m_Call: ITAPICall; DisconnectedMode: TOleEnum);
procedure ImageButtonHelpHandPointMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure ImageButtonHelpHandPointMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure TAPIExCtlPhoneRecorderRecordComplete(ASender: TObject;
const m_Call: ITAPICall);
procedure LabelNewIncomingMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure LabelNewIncomingMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure LabelNewIncomingMouseMove(Sender: TObject;
Shift: TShiftState; X, Y: Integer);
procedure LabelNewOutgoingMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure LabelNewOutgoingMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure LabelNewOutgoingMouseMove(Sender: TObject;
Shift: TShiftState; X, Y: Integer);
procedure ImageBackgroundMouseMove(Sender: TObject; Shift: TShiftState;
X, Y: Integer);
procedure ImageButtonSettingHandPointMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure ImageButtonSettingHandPointMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure ImageButtonAboutHandPointMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure ImageButtonAboutHandPointMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure ImageButtonCloseHandPointMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure ImageButtonCloseHandPointMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure TimerStartRecordTimer(Sender: TObject);
procedure BitBtnOKClick(Sender: TObject);
procedure TimerJamTimer(Sender: TObject);
procedure MainMenuAboutClick(Sender: TObject);
procedure MainMenuContactClick(Sender: TObject);
procedure MainMenuIncomingClick(Sender: TObject);
procedure MainMenuOutgoingClick(Sender: TObject);
procedure MainMenuSettingClick(Sender: TObject);
procedure MainMenuHelpClick(Sender: TObject);
procedure MainMenuOpenFileClick(Sender: TObject);
procedure MainMenuPlayClick(Sender: TObject);
procedure MainMenuPauseClick(Sender: TObject);
procedure MainMenuStopClick(Sender: TObject);
procedure MainMenuOpenLineClick(Sender: TObject);
procedure MainMenuCloseLineClick(Sender: TObject);
procedure MainMenuDialClick(Sender: TObject);
procedure MainMenuEndCallClick(Sender: TObject);
private
{ Private declarations } m_currCall : ITAPICall;
Procedure SetVolume;
Procedure PlayWav(Filename : ShortString);
Procedure DetectDevice;
Procedure LineOpen;
Procedure LineClose;
Procedure DialCall;
Procedure EndCall;
Procedure ClickContact;
Procedure ClickIncoming;
Procedure ClickOutgoing;
Procedure ClickOpenFile;
Procedure ClickPlay;
Procedure ClickPause;
Procedure ClickStop;
Procedure ClickOpenLine;
Procedure ClickCloseLine;
Procedure ClickDial;
Procedure ClickEndCall;
Procedure ClickNewIncoming;
Procedure ClickNewOutgoing;
Procedure ClickSetting;
Procedure ClickHelp;
Procedure ClickAbout;
Procedure AutoGenerateKodeIncoming;
Procedure AutoGenerateKodeOutgoing;
Procedure CheckNewIncoming;
Procedure CheckNewOutgoing;
public
{ Public declarations } m_currLine : ITAPILine;
end;
var
FormUtama: TFormUtama;
Function LeadingZero(Number : word; Digit : byte) : ShortString;
implementation
uses UnitContact, UnitIncoming, UnitOutgoing, UnitHelp, UnitAbout, UnitNewIncoming, UnitNewOutgoing, UnitSetting, mmsystem;
{$R *.dfm}
var
KodeIncoming, KodeOutgoing : TKode;
TanggalIncoming, TanggalOutgoing : TTanggal;
JamIncoming, JamOutgoing : TJam;
PhoneNumber : ShortString;
Volume : Word;
Supported : Boolean;
Const
StatusLineClose = 'Line tertutup';
StatusLineOpen = 'Line terbuka, siap menggunakan telepon ...';
StatusNoDevice = 'Tidak ada device yang mendukung';
StatusIncomingCall = 'Telepon Masuk';
StatusStartRecording = 'Mulai merekam';
StatusRecording = 'Merekam detik ke ';
StatusStopRecording = 'Selesai merekam';
StatusDialing = 'Menelpon ke nomor ';
StatusEndCall = 'Telepon selesai';
StatusPlayFile = 'Playing audio file';
StatusPauseFile = 'Paused';
CallStateUnknown = 'Call State : Unknown';
/////////////////////////////////////////////////////////////////////////////
///
{
LeadingZero( 7, 3) => '007' LeadingZero(2006, 3) => '2006' LeadingZero(2006, 5) => '02006' }
Function LeadingZero(Number : word; Digit : byte) : ShortString;
var
s : ShortString;
Begin
str(Number, s);
While Length(S) < Digit do Insert('0', S, 1);
LeadingZero := S; // Return value End;
/////////////////////////////////////////////////////////////////////////////
///
Procedure TFormUtama.SetVolume;
var
MyWaveOutCaps : TWaveOutCaps;
begin
GaugeVolume.Progress := Volume;
if waveOutGetDevCaps(WAVE_MAPPER, @MyWaveOutCaps, Sizeof(MyWaveOutCaps)) = MMSYSERR_NOERROR then
waveOutSetVolume(WAVE_MAPPER, MakeLong(Volume, Volume));
end;
/////////////////////////////////////////////////////////////////////////////
///
procedure TFormUtama.PlayWav(Filename: ShortString);
begin
MediaPlayerUtama.Close;
MediaPlayerUtama.FileName := ExtractFilePath(Application.ExeName) + 'Sound FX\' + FileName;
MediaPlayerUtama.Open;
MediaPlayerUtama.Play;
end;
/////////////////////////////////////////////////////////////////////////////
///
procedure TFormUtama.DetectDevice;
var
i : Shortint;
NamaDevice, S : ShortString;
baris : Smallint;
Terbuka : Boolean;
DeviceID : Byte;
ListItem : TListItem;
begin
LabelModem.Caption := '';
for i := 1 to StringGridDevice.RowCount - 1 do if LabelModem.Caption = '' then
begin
DeviceID := StrToInt(StringGridDevice.Cells[0, i]);
NamaDevice := StringGridDevice.Cells[1, i];
Terbuka := True;
for baris := 0 to MemoStatus.Lines.Count - 1 do begin
S := MemoStatus.Lines[baris];
if Pos(NamaDevice, S) >= 1 then begin
if pos('H323 Line', S) >= 1 then Terbuka := false else
if Pos('Unable to open the device', S) >= 1 then Terbuka := false;
end;
end;
if Terbuka then begin
LabelModem.Caption := NamaDevice;
EditDeviceID.Text := IntToStr(DeviceID);
end;
end;
if LabelModem.Caption = '' then begin
LabelModem.Caption := StatusNoDevice;
EditDeviceID.Text := '';
end;
end;
/////////////////////////////////////////////////////////////////////////////
///
procedure TFormUtama.LineOpen; // Prosedur membuka semua line var
i : integer;
line : ITAPILine;
begin
for i := 1 to StringGridDevice.RowCount - 1 do begin //open the spceial lines
line :=
TAPIExCtlPhoneRecorder.Lines.Item(StrToInt(StringGridDevice.Cells[0,i]));
line.Open();
end;
EditRingCount.Text := '0';
DetectDevice;
if EditDeviceID.Text <> '' then begin
m_CurrLine :=
TAPIExCtlPhoneRecorder.Lines.Item(StrToInt(EditDeviceID.Text));
m_CurrLine.Open(); //open the line end;
end;
/////////////////////////////////////////////////////////////////////////////
///
procedure TFormUtama.LineClose; // Prosedur menutup semua line begin
TAPIExCtlPhoneRecorder.CloseAll;
LabelCallState.Caption := CallStateUnknown;
end;
/////////////////////////////////////////////////////////////////////////////
///
procedure TFormUtama.DialCall; // Prosedur telepon keluar begin
EditStatus.Text := 'Drop';
EditDial.Text := 'Dial';
EditRecord.Text := '';
m_CurrCall := m_CurrLine.MakeCall(LabelPhoneNumber.Caption);
end;
/////////////////////////////////////////////////////////////////////////////
///
procedure TFormUtama.EndCall; // Prosedur menutup telepon begin
EditStatus.Text := 'Drop';
EditDial.Text := '';
EditRecord.Text := '';
m_CurrCall.Drop;
end;
/////////////////////////////////////////////////////////////////////////////
///
procedure TFormUtama.ClickContact; // Prosedur menekan tombol Contact begin
With FormContact do begin
Left := FormUtama.Left + 273;
Top := FormUtama.Top + 53;
DiactivateMenu;
TagMenu := 1;
ActivateMenu;
ShowModal;
end;
end;
/////////////////////////////////////////////////////////////////////////////
///
procedure TFormUtama.ClickIncoming; // Prosedur menekan tombol Incoming begin
With FormIncoming do begin
Left := FormUtama.Left + 273;
Top := FormUtama.Top + 53;
DiactivateMenu;
TagMenu := 1;
ActivateMenu;
ShowModal;
end;
end;
/////////////////////////////////////////////////////////////////////////////
///
procedure TFormUtama.ClickOutgoing; // Prosedur menekan tombol outgoing begin
With FormOutgoing do begin
Left := FormUtama.Left + 273;
Top := FormUtama.Top + 53;
DiactivateMenu;
TagMenu := 1;
ActivateMenu;
ShowModal;
end;
end;
/////////////////////////////////////////////////////////////////////////////
///
procedure TFormUtama.ClickOpenFile;
begin
OpenDialogPlay.InitialDir := ExtractFilePath(Application.ExeName);
OpenDialogPlay.FileName := '*.wav';
if OpenDialogPlay.Execute then
begin
TimerPlayer.Enabled := false;
LabelOpenFile.Caption := 'Open File : ' + OpenDialogPlay.FileName;
LabelPlayFile.Caption := '';
MediaPlayerFile.Close;
MediaPlayerFile.FileName := OpenDialogPlay.FileName;
MediaPlayerFile.Open;
ImageButtonPlayHandPoint.Picture := ImageButtonPlay.Picture;
ImageButtonPauseHandPoint.Picture := ImageButtonPauseDisable.Picture;
ImageButtonStopHandPoint.Picture := ImageButtonStopDisable.Picture;
GaugeUtama.Progress := 0;
GaugeUtama.MaxValue := MediaPlayerFile.Length;
end;
end;
/////////////////////////////////////////////////////////////////////////////
///
procedure TFormUtama.ClickPlay;
var
NamaFile : ShortString;
Kode : TKode;
begin
ImageButtonPlayHandPoint.Picture := ImageButtonPlayDisable.Picture;
ImageButtonPauseHandPoint.Picture := ImageButtonPause.Picture;
ImageButtonStopHandPoint.Picture := ImageButtonStop.Picture;
LabelPlayFile.Caption := StatusPlayFile;
NamaFile := ExtractFileName(MediaPlayerFile.FileName);
if Length(NamaFile) = 19 then begin
Kode := Copy(NamaFile, 1, 15);
If Kode[1] in ['I', 'O'] then begin
With QueryUtama do begin
Active := False;
SQL.Clear;
Case Kode[1] of 'I' : Begin
SQL.Append('UPDATE Incoming ');
SQL.Append('SET Baru = ''FALSE'' ');
SQL.Append('WHERE Kode = ''' + Kode + '''');
end;
'O' : Begin
SQL.Append('UPDATE Outgoing ');
SQL.Append('SET Baru = ''FALSE'' ');
SQL.Append('WHERE Kode = ''' + Kode + '''');
end;
end;
ExecSQL;
end;
Case Kode[1] of
'I' : CheckNewIncoming;
'O' : CheckNewOutgoing;
end;
end;
end;
MediaPlayerFile.Play;
TimerPlayer.Enabled := True;
end;
/////////////////////////////////////////////////////////////////////////////
///
procedure TFormUtama.ClickPause;
begin
TimerPlayer.Enabled := false;
ImageButtonPauseHandPoint.Picture := ImageButtonPauseDisable.Picture;
ImageButtonPlayHandPoint.Picture := ImageButtonPlay.Picture;
ImageButtonStopHandPoint.Picture := ImageButtonStop.Picture;
LabelPlayFile.Caption := StatusPauseFile;
MediaPlayerFile.Pause;
end;
/////////////////////////////////////////////////////////////////////////////
///
procedure TFormUtama.ClickStop;
begin
TimerPlayer.Enabled := false;
ImageButtonStopHandPoint.Picture := ImageButtonStopDisable.Picture;
ImageButtonPlayHandPoint.Picture := ImageButtonPlay.Picture;
ImageButtonPauseHandPoint.Picture := ImageButtonPauseDisable.Picture;
LabelPlayFile.Caption := '';
MediaPlayerFile.Stop;
MediaPlayerFile.Position := 0;
GaugeUtama.Progress := 0;
end;
/////////////////////////////////////////////////////////////////////////////
///
procedure TFormUtama.ClickOpenLine;
begin
ImageButtonLineOpenHandPoint.Picture := ImageButtonLineOpenDisable.Picture;
LineOpen;
ImageButtonLineCloseHandPoint.Picture := ImageButtonLineClose.Picture;
ImageButtonDialHandPoint.Picture := ImageButtonDial.Picture;
ImageButtonEndCallHandPoint.Picture := ImageButtonEndCallDisable.Picture;
ImageButton1HandPoint.Visible := True;
ImageButton2HandPoint.Visible := True;
ImageButton3HandPoint.Visible := True;
ImageButton4HandPoint.Visible := True;
ImageButton5HandPoint.Visible := True;
ImageButton6HandPoint.Visible := True;
ImageButton7HandPoint.Visible := True;
ImageButton8HandPoint.Visible := True;
ImageButton9HandPoint.Visible := True;
ImageButtonBintangHandPoint.Visible := True;
ImageButton0HandPoint.Visible := True;
ImageButtonPagarHandPoint.Visible := True;
end;
/////////////////////////////////////////////////////////////////////////////
///
procedure TFormUtama.ClickCloseLine;
begin
ImageButtonLineCloseHandPoint.Picture :=
ImageButtonLineCloseDisable.Picture;
LineClose;
ImageButtonLineOpenHandPoint.Picture := ImageButtonLineOpen.Picture;
ImageButtonDialHandPoint.Picture := ImageButtonDialDisable.Picture;
ImageButtonEndCallHandPoint.Picture := ImageButtonEndCallDisable.Picture;
ImageButton1HandPoint.Visible := False;
ImageButton2HandPoint.Visible := False;
ImageButton3HandPoint.Visible := False;
ImageButton4HandPoint.Visible := False;
ImageButton5HandPoint.Visible := False;
ImageButton6HandPoint.Visible := False;
ImageButton7HandPoint.Visible := False;
ImageButton8HandPoint.Visible := False;
ImageButton9HandPoint.Visible := False;
ImageButtonBintangHandPoint.Visible := False;
ImageButton0HandPoint.Visible := False;
ImageButtonPagarHandPoint.Visible := False;
end;
/////////////////////////////////////////////////////////////////////////////
///
procedure TFormUtama.ClickDial;
var
CallerID : ShortString;
Ada : Boolean;
Nama : TNama;
Telepon : TTelepon;
HP : THP;
begin
ImageButtonDialHandPoint.Picture := ImageButtonDialDisable.Picture;
ImageButtonEndCallHandPoint.Picture := ImageButtonEndCall.Picture;
ImageButtonLineCloseHandPoint.Picture :=
ImageButtonLineCloseDisable.Picture;
LabelStatus.Caption := StatusDialing + LabelPhoneNumber.Caption;
CallerID := LabelPhoneNumber.Caption;
if CallerID[1] <> '0' then CallerID := '031' + CallerID;
TableContact.Active := true;
Ada := false;
TableContact.First;
While (not Ada) AND (not TableContact.Eof) do begin
Telepon := TableContact.FieldByName('Telepon').AsString;
HP := TableContact.FieldByName('HP' ).AsString;
if (CallerID = Telepon) or (CallerID = HP) then Ada := true
else TableContact.Next;
end;
if Ada then begin
Nama := TableContact.FieldByName('Nama').AsString;
LabelNama.Caption := Nama;
ImageFoto.Picture.Assign(TableContact.FieldByName('Foto'));
end else begin
LabelNama.Caption := '';
ImageFoto.Picture := nil;
end;
TableContact.Active := false;
DialCall;
end;
/////////////////////////////////////////////////////////////////////////////
///
procedure TFormUtama.ClickEndCall;
begin
TimerRecording.Enabled := false;
ImageButtonEndCallHandPoint.Picture := ImageButtonEndCallDisable.Picture;
ImageButtonDialHandPoint.Picture := ImageButtonDial.Picture;
ImageButtonLineCloseHandPoint.Picture := ImageButtonLineClose.Picture;
LabelStatus.Caption := StatusEndCall;
LabelPhoneNumber.Caption := '';
GaugeUtama.Progress := 0;
EndCall;
TimerDelay.Enabled := true;
end;
/////////////////////////////////////////////////////////////////////////////
///
procedure TFormUtama.ClickNewIncoming;
begin
With FormNewIncoming do begin
Left := FormUtama.Left + 273;
Top := FormUtama.Top + 53;
QueryIncoming.Active := true;
MengosongiForm;
MerelasikanDBGrid;
ShowModal;
end;
end;
/////////////////////////////////////////////////////////////////////////////
///
procedure TFormUtama.ClickNewOutgoing;
begin
With FormNewOutgoing do begin
Left := FormUtama.Left + 273;
Top := FormUtama.Top + 53;
QueryOutgoing.Active := true;
MengosongiForm;
MerelasikanDBGrid;
ShowModal;
end;
end;
/////////////////////////////////////////////////////////////////////////////
///
procedure TFormUtama.ClickSetting;
begin
With FormSetting do begin
Left := FormUtama.Left + 273;
Top := FormUtama.Top + 53;
ShowModal;
end;
end;
/////////////////////////////////////////////////////////////////////////////
///
procedure TFormUtama.ClickHelp;
begin
With FormHelp do begin
Left := FormUtama.Left + 273;
Top := FormUtama.Top + 53;
//TreeViewHelp.FullExpand;
RichEditHelp.Lines.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Help\Pengenalan.rtf');
ShowModal;
end;
end;
/////////////////////////////////////////////////////////////////////////////
///
procedure TFormUtama.ClickAbout;
begin
With FormAbout do begin
Left := FormUtama.Left + 273;
Top := FormUtama.Top + 53;
ShowModal;
end;
end;
/////////////////////////////////////////////////////////////////////////////
///
procedure TFormUtama.AutoGenerateKodeIncoming;
var
Year, Month, Day, Hour, Min, Sec, MSec : Word;
begin
TanggalIncoming := Now;
JamIncoming := Now;
DecodeDate(TanggalIncoming, Year, Month, Day);
DecodeTime(JamIncoming, Hour, Min, Sec, Msec);
KodeIncoming := 'I' + LeadingZero(Year, 4) + LeadingZero(Month, 2) + LeadingZero(Day, 2) + LeadingZero(Hour, 2) + LeadingZero(Min, 2) + LeadingZero(Sec, 2);
end;
/////////////////////////////////////////////////////////////////////////////
///
procedure TFormUtama.AutoGenerateKodeOutgoing;
var
Year, Month, Day, Hour, Min, Sec, MSec : Word;
begin
TanggalOutgoing := Now;
JamOutgoing := Now;
DecodeDate(TanggalOutgoing, Year, Month, Day);
DecodeTime(JamOutgoing, Hour, Min, Sec, Msec);
KodeOutgoing := 'O' + LeadingZero(Year, 4) + LeadingZero(Month, 2) + LeadingZero(Day, 2) + LeadingZero(Hour, 2) + LeadingZero(Min, 2) + LeadingZero(Sec, 2);
end;
/////////////////////////////////////////////////////////////////////////////
///
procedure TFormUtama.CheckNewIncoming;
var
JumlahBaru : Byte;
begin
With QueryUtama Do Begin
Active := False;
SQL.Clear;
SQL.Append('SELECT COUNT(Kode) AS JumlahBaru');
SQL.Append('FROM Incoming ');
SQL.Append('WHERE Baru = ''TRUE'' ');
Active := True;
JumlahBaru := FieldByName('JumlahBaru').AsInteger;
Active := false;
End;
Case JumlahBaru of
0 : LabelNewIncoming.Caption := '';
1 : LabelNewIncoming.Caption := '1 New Incoming Call';
else LabelNewIncoming.Caption := IntToStr(JumlahBaru) + ' New Incoming Calls';
end;
if JumlahBaru = 0
then LabelNewIncoming.Cursor := crDefault else LabelNewIncoming.Cursor := crHandPoint;
end;
/////////////////////////////////////////////////////////////////////////////
///
procedure TFormUtama.CheckNewOutgoing;
var
JumlahBaru : Byte;
begin
With QueryUtama Do
Begin
Active := False;
SQL.Clear;
SQL.Append('SELECT COUNT(Kode) AS JumlahBaru');
SQL.Append('FROM Outgoing ');
SQL.Append('WHERE Baru = ''TRUE'' ');
Active := True;
JumlahBaru := FieldByName('JumlahBaru').AsInteger;
Active := false;
End;
Case JumlahBaru of
0 : LabelNewOutgoing.Caption := '';
1 : LabelNewOutgoing.Caption := '1 New Outgoing Call';
else LabelNewOutgoing.Caption := IntToStr(JumlahBaru) + ' New Outgoing Calls';
end;
if JumlahBaru = 0
then LabelNewOutgoing.Cursor := crDefault else LabelNewOutgoing.Cursor := crHandPoint;
end;
/////////////////////////////////////////////////////////////////////////////
///
procedure TFormUtama.FormCreate(Sender: TObject);
var
i : integer;
line : ITAPILine;
ListItem : Tlistitem;
baris : byte;
begin
FormUtama.ClientWidth := 1280;
FormUtama.ClientHeight := 646;
LabelStatus.Caption := StatusLineClose;
LabelPhoneNumber.Caption := '';
LabelNama.Caption := '';
LabelOpenFile.Caption := '';
LabelPlayFile.Caption := '';
LabelNewIncoming.Caption := '';
LabelNewOutgoing.Caption := '';
Volume := 32640;
SetVolume;
m_currCall := nil;
m_currLine := nil;
TAPIExCtlPhoneRecorder.initialize ; //Initailize Baris := 0;
for i := 0 to TAPIExCtlPhoneRecorder.Lines.Count - 1 do begin
line := TAPIExCtlPhoneRecorder.Lines.Item(i); //enum all the devices
if (line.caps.Media_Modes And MEDIAMODE_AUTOMATEDVOICE > 0) or (line.Caps.Media_Modes and MEDIAMODE_INTERACTIVEVOICE > 0) then begin
ListItem := ListViewDevices.Items.Add;
ListItem.Caption := inttostr(line.Get_DeviceID);
ListItem.Data := pointer(i);
ListItem.SubItems.Add(line.DeviceName);
inc(baris);
StringGridDevice.Cells[0, baris] := IntToStr(line.Get_DeviceID);
StringGridDevice.Cells[1, baris] := line.DeviceName;
end;
end;
StringGridDevice.RowCount := Baris + 1;
LineOpen;
ImageButtonDialHandPoint.Picture := ImageButtonDial.Picture;
ImageButtonLineCloseHandPoint.Picture := ImageButtonLineClose.Picture;
CheckNewIncoming;
CheckNewOutgoing;
Supported := true;
ShortDateFormat := 'dddd, d mmmm yyyy';
LabelTanggal.Caption := DateToStr(Now);
LabelJam.Caption := TimeToStr(Now);
TimerJam.Enabled := true;
end;
/////////////////////////////////////////////////////////////////////////////
///
procedure TFormUtama.TAPIExCtlPhoneRecorderCallStateChange(
ASender: TObject; const m_Call: ITAPICall; NewState: TOleEnum);
begin
//CALLSTATE_ACCEPTED The call was in the offering state and has been accepted. This indicates to other (monitoring) applications that the current owner application has claimed responsibility for answering the call. In ISDN, the accepted state is entered when the called-party equipment sends a message to the switch indicating that it is willing to present the call to the called person. This has the side effect of alerting (ringing) the users at both ends of the call. An incoming call can always be immediately answered without first being separately accepted.
//CALLSTATE_BUSY The call is receiving a busy tone. A busy tone indicates that the call cannot be completed—either a circuit (trunk) or the remote party's station are in use.
//CALLSTATE_CONFERENCED The call is a member of a conference call and is logically in the connected state.
//CALLSTATE_CONNECTED The call has been established and the connection is made. Information is able to flow over the call between the originating address and the destination address.
//CALLSTATE_DIALING The originator is dialing digits on the call. The dialed digits are collected by the switch.
//CALLSTATE_DIALTONE The call is receiving a dial tone from the switch, which means that the switch is ready to receive a dialed number.
//CALLSTATE_DISCONNECTED The remote party has disconnected from the call.
//CALLSTATE_IDLE The call exists but has not been connected. No activity exists on the call, which means that no call is currently active. A call can never transition out of the idle state.
//CALLSTATE_OFFERING The call is being offered to the station, signaling the arrival of a new call. The offering state is not the same as causing a phone or computer to ring. In some environments, a call in the offering state does not ring the user until the switch instructs the line to ring. An
example use might be where an incoming call appears on several station sets but only the primary address rings. The instruction to ring does not affect any call states.
//CALLSTATE_ONHOLD The call is on hold by the switch. This frees the physical line, which allows another call to use the line.
//CALLSTATE_ONHOLDPENDCONF The call is currently on hold while it is being added to a conference.
//CALLSTATE_ONHOLDPENDTRANSFER The call is currently on hold awaiting transfer to another number.
//CALLSTATE_PROCEEDING Dialing has completed and the call is proceeding through the switch or telephone network. This occurs after dialing is complete and before the call reaches the dialed party, as indicated by ringback, busy, or answer.
//CALLSTATE_RINGBACK The station to be called has been reached, and the destination's switch is generating a ring tone back to the originator. A ringback means that the destination address is being alerted to the call.
//CALLSTATE_SPECIALINFO The call is receiving a special information signal, which precedes a prerecorded announcement indicating why a call cannot be completed.
//CALLSTATE_UNKNOWN
if NewState = CALLSTATE_ACCEPTED then begin
MemoCallState.Lines.Add('CALLSTATE_ACCEPTED');
LabelCallState.Caption := 'Call State : Accepted';
LabelStatus.Caption := StatusStartRecording;
TableIncoming.Active := true;
AutoGenerateKodeIncoming;
TableIncoming.Active := false;
ImageLampuRecordOff.Visible := false;
ImageLampuRecord.Visible := true;
GaugeUtama.Progress := 0;
GaugeUtama.MaxValue := TAPIExCtlPhoneRecorder.RecordTimeOut;
TimerRecording.Enabled := true;
m_Call.Record_(ExtractFilePath(Application.ExeName) + 'Incoming Call\' + KodeIncoming + '.wav');
end
else
if NewState = CALLSTATE_BUSY then begin
MemoCallState.Lines.Add('CALLSTATE_BUSY');
LabelCallState.Caption := 'Call State : Busy';
end else
if NewState = CALLSTATE_CONFERENCED then begin
MemoCallState.Lines.Add('CALLSTATE_CONFERENCED');
LabelCallState.Caption := 'Call State : Conferenced';
end else
if NewState = CALLSTATE_CONNECTED then begin
MemoCallState.Lines.Add('CALLSTATE_CONNECTED');
LabelCallState.Caption := 'Call State : Connected';
if (EditDial.Text = 'Dial') and (EditRecord.Text = '') then begin
PanelStartRecord.Left := ImageBackground.Left + ((ImageBackground.Width - PanelStartRecord.Width ) div 2);
PanelStartRecord.Top := ImageBackground.Top + ((ImageBackground.Height - PanelStartRecord.Height) div 2);
PanelStartRecord.Visible := true;
TimerStartRecord.Enabled := true;
end;
end else
if NewState = CALLSTATE_DIALING then begin
MemoCallState.Lines.Add('CALLSTATE_DIALING');
LabelCallState.Caption := 'Call State : Dialing';
end else
if NewState = CALLSTATE_DIALTONE then begin
MemoCallState.Lines.Add('CALLSTATE_DIALTONE');
LabelCallState.Caption := 'Call State : Dialtone';
end else
if NewState = CALLSTATE_DISCONNECTED then begin
if PanelStartRecord.Visible then begin
TimerStartRecord.Enabled := false;
PanelStartRecord.Visible := false;
end;
MemoCallState.Lines.Add('CALLSTATE_DISCONNECTED');
LabelCallState.Caption := 'Call State : Disconnected';
ImageButtonEndCallHandPoint.Picture := ImageButtonEndCallDisable.Picture;
LabelPhoneNumber.Caption := '';
LabelNama.Caption := '';
ImageFoto.Picture := nil;
end
else
if NewState = CALLSTATE_IDLE then begin
MemoCallState.Lines.Add('CALLSTATE_IDLE');
LabelCallState.Caption := 'Call State : Idle';
end else
if NewState = CALLSTATE_OFFERING then begin
MemoCallState.Lines.Add('CALLSTATE_OFFERING');
LabelCallState.Caption := 'Call State : Offering';
end else
if NewState = CALLSTATE_ONHOLD then begin
MemoCallState.Lines.Add('CALLSTATE_ONHOLD');
LabelCallState.Caption := 'Call State : On Hold';
end else
if NewState = CALLSTATE_ONHOLDPENDCONF then begin
MemoCallState.Lines.Add('CALLSTATE_ONHOLDPENDCONF');
LabelCallState.Caption := 'Call State : On Hold Pend Conf';
end else
if NewState = CALLSTATE_ONHOLDPENDTRANSFER then begin
MemoCallState.Lines.Add('CALLSTATE_ONHOLDPENDTRANSFER');
LabelCallState.Caption := 'Call State : On Hold Pend Transfer';
end else
if NewState = CALLSTATE_PROCEEDING then begin
MemoCallState.Lines.Add('CALLSTATE_PROCEEDING');
LabelCallState.Caption := 'Call State : Proceeding';
end else
if NewState = CALLSTATE_RINGBACK then begin
MemoCallState.Lines.Add('CALLSTATE_RINGBACK');
LabelCallState.Caption := 'Call State : Ring Back';
end else
if NewState = CALLSTATE_SPECIALINFO then begin
MemoCallState.Lines.Add('CALLSTATE_SPECIALINFO');
LabelCallState.Caption := 'Call State : Special Info';
end else
if NewState = CALLSTATE_UNKNOWN then begin
MemoCallState.Lines.Add('CALLSTATE_UNKNOWN');
LabelCallState.Caption := 'Call State : Unknown';
end;
end;
/////////////////////////////////////////////////////////////////////////////
///
procedure TFormUtama.TAPIExCtlPhoneRecorderDebug(ASender: TObject;
const msg: WideString);
var
RecordFormat : ShortString;
begin
if pos('Registered copy', msg) = 0 then
MemoStatus.Text := msg + #13#10 + MemoStatus.Text;
if pos('Already in Opened state', msg) >= 1 then begin
LabelStatus.Caption := StatusLineOpen;
ImageLampuLineClose.Visible := false;
ImageLampuLineOpen.Visible := true;
end else
if pos('Close the Line', msg) >= 1 then begin
LabelStatus.Caption := StatusLineClose;
ImageLampuLineOpen.Visible := false;
ImageLampuLineClose.Visible := true;
end else
if pos('dialing', msg) >= 1 then
LabelStatus.Caption := StatusDialing + LabelPhoneNumber.Caption else
if pos('OnEndCall', msg) >= 1 then begin
if not ((EditStatus.Text = 'Accept') or (EditStatus.Text = 'Drop')) then m_CurrCall.Drop;
EditRingCount.Text := '0';
EditStatus.Text := '';
TimerRingCount.Enabled := false;
LabelStatus.Caption := StatusEndCall;
Application.ProcessMessages;
Sleep(1000);
LabelStatus.Caption := StatusLineOpen;
ImageButtonDialHandPoint.Picture := ImageButtonDial.Picture;
ImageButtonLineCloseHandPoint.Picture := ImageButtonLineClose.Picture;
end else
if pos('Ring! ring count', msg) >= 1 then begin
TimerRingCount.Enabled := false;
EditRingCount.Text := IntToStr(StrToInt(EditRingCount.Text) + 1);
TimerRingCount.Enabled := true;
end else
if (pos('wave format', msg) >= 1) and (pos('not supported', msg) >= 1) then Supported := false
else
if (pos('Starting record wave to file', msg) >= 1) and (not Supported) then begin
RecordFormat := msg;
Delete(RecordFormat, 1, pos('in format:', RecordFormat) + 9);
LabelRecordFormat.Caption := 'Record Format is not supported. Autoselect :' + RecordFormat;
end;
end;
/////////////////////////////////////////////////////////////////////////////
///
procedure TFormUtama.TAPIExCtlPhoneRecorderOffering(ASender: TObject;
const m_Call: ITAPICall; OfferingMode: TOleEnum);
begin
m_CurrCall := m_Call;
ImageButtonDialHandPoint.Picture := ImageButtonDialDisable.Picture;
ImageButtonEndCallHandPoint.Picture := ImageButtonEndCall.Picture;
LabelStatus.Caption := StatusIncomingCall;
end;
/////////////////////////////////////////////////////////////////////////////
///
procedure TFormUtama.TimerRingCountTimer(Sender: TObject);
var
counter : byte;
begin
counter := StrToInt(EditRingCount.Text) + 1;
if pos('Ring! ring count ' + IntToStr(Counter), MemoStatus.Lines[0]) = 0 then
begin
TimerRingCount.Enabled := false;
EditStatus.Text := 'Accept';
m_currCall.Answer();
//m_currCall.Accept('');
//m_currCall.User_Data1 := 1;
end;
end;
/////////////////////////////////////////////////////////////////////////////
///
procedure TFormUtama.TAPIExCtlPhoneRecorderIdle(ASender: TObject;
const m_Call: ITAPICall);
begin
m_currCall := nil;
end;
/////////////////////////////////////////////////////////////////////////////
///
procedure TFormUtama.TAPIExCtlPhoneRecorderBusy(ASender: TObject;
const m_Call: ITAPICall; BusyMode: TOleEnum);
begin
m_CurrCall.Drop;
end;
/////////////////////////////////////////////////////////////////////////////
///
procedure TFormUtama.ImageButtonLineOpenHandPointMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if (LabelStatus.Caption = StatusLineClose) AND (LabelModem.Caption <> StatusNoDevice) then
ImageButtonLineOpenHandPoint.Picture := ImageButtonLineOpenPress.Picture;
end;
procedure TFormUtama.ImageButtonLineOpenHandPointMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if (LabelStatus.Caption = StatusLineClose) AND (LabelModem.Caption <> StatusNoDevice) then begin
PlayWav('Space Open.wav');
ClickOpenLine;
end
else PlayWav('Space Error.wav');
end;
/////////////////////////////////////////////////////////////////////////////
///
procedure TFormUtama.ImageButtonLineCloseHandPointMouseDown(
Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if LabelStatus.Caption = StatusLineOpen then ImageButtonLineCloseHandPoint.Picture :=
ImageButtonLineClosePress.Picture;
end;
procedure TFormUtama.ImageButtonLineCloseHandPointMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if LabelStatus.Caption = StatusLineOpen then begin
PlayWav('Space Close.wav');
ClickCloseLine;
end
else PlayWav('Space Error.wav');
end;
/////////////////////////////////////////////////////////////////////////////
///
procedure TFormUtama.ImageButtonDialHandPointMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if ((LabelStatus.Caption = StatusLineOpen) or (LabelStatus.Caption = StatusEndCall)) And (LabelPhoneNumber.Caption <> '') then
ImageButtonDialHandPoint.Picture := ImageButtonDialPress.Picture;
end;
procedure TFormUtama.ImageButtonDialHandPointMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if ((LabelStatus.Caption = StatusLineOpen) or (LabelStatus.Caption = StatusEndCall)) And (LabelPhoneNumber.Caption <> '')
then ClickDial
else PlayWav('Space Error.wav');
end;
/////////////////////////////////////////////////////////////////////////////
///
procedure TFormUtama.ImageButtonEndCallHandPointMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if (LabelStatus.Caption = StatusDialing + LabelPhoneNumber.Caption) or (LabelStatus.Caption = StatusStartRecording)
or (LabelStatus.Caption = StatusRecording + IntToStr(GaugeUtama.Progress) + ' dari total waktu ' + IntToStr(GaugeUtama.MaxValue) + ' detik')
or (LabelStatus.Caption = StatusStopRecording) then
ImageButtonEndCallHandPoint.Picture := ImageButtonEndCallPress.Picture;
end;
procedure TFormUtama.ImageButtonEndCallHandPointMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if (LabelStatus.Caption = StatusDialing + LabelPhoneNumber.Caption) or (LabelStatus.Caption = StatusStartRecording)
or (LabelStatus.Caption = StatusRecording + IntToStr(GaugeUtama.Progress) + ' dari total waktu ' + IntToStr(GaugeUtama.MaxValue) + ' detik')
or (LabelStatus.Caption = StatusStopRecording) then ClickEndCall
else PlayWav('Space Error.wav');
end;
/////////////////////////////////////////////////////////////////////////////
///
procedure TFormUtama.ImageButtonContactHandPointMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
ImageButtonContactHandPoint.Picture := ImageButtonContactPress.Picture;
end;
procedure TFormUtama.ImageButtonContactHandPointMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
ImageButtonContactHandPoint.Picture := ImageButtonContact.Picture;
PlayWav('Space Open.wav');
ClickContact;
end;
/////////////////////////////////////////////////////////////////////////////
///
procedure TFormUtama.ImageButtonIncomingHandPointMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
ImageButtonIncomingHandPoint.Picture := ImageButtonIncomingPress.Picture;
end;
procedure TFormUtama.ImageButtonIncomingHandPointMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
ImageButtonIncomingHandPoint.Picture := ImageButtonIncoming.Picture;
PlayWav('Space Open.wav');
ClickIncoming;
CheckNewIncoming;
end;
/////////////////////////////////////////////////////////////////////////////
///
procedure TFormUtama.ImageButtonOutgoingHandPointMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
ImageButtonOutgoingHandPoint.Picture := ImageButtonOutgoingPress.Picture;
end;
procedure TFormUtama.ImageButtonOutgoingHandPointMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
ImageButtonOutgoingHandPoint.Picture := ImageButtonOutgoing.Picture;
PlayWav('Space Open.wav');
ClickOutgoing;
CheckNewOutgoing;
end;
/////////////////////////////////////////////////////////////////////////////
///
procedure TFormUtama.ImageButtonPlayHandPointMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
If LabelOpenFile.Caption <> '' then
ImageButtonPlayHandPoint.Picture := ImageButtonPlayPress.Picture;
end;
procedure TFormUtama.ImageButtonPlayHandPointMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if LabelOpenFile.Caption = '' then PlayWav('Space Error.wav') else ClickPlay;
end;
/////////////////////////////////////////////////////////////////////////////
///
procedure TFormUtama.ImageButtonPauseHandPointMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if LabelPlayFile.Caption = StatusPlayFile then
ImageButtonPauseHandPoint.Picture := ImageButtonPausePress.Picture;
end;
procedure TFormUtama.ImageButtonPauseHandPointMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if LabelPlayFile.Caption = StatusPlayFile then ClickPause
else PlayWav('Space Error.wav');
end;
/////////////////////////////////////////////////////////////////////////////
///
procedure TFormUtama.ImageButtonStopHandPointMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if (LabelPlayFile.Caption = StatusPlayFile)
or (LabelPlayFile.Caption = StatusPauseFile) then
ImageButtonStopHandPoint.Picture := ImageButtonStopPress.Picture;
end;
procedure TFormUtama.ImageButtonStopHandPointMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if (LabelPlayFile.Caption = StatusPlayFile) or (LabelPlayFile.Caption = StatusPauseFile) then ClickStop
else PlayWav('Space Error.wav');
end;
/////////////////////////////////////////////////////////////////////////////
///
procedure TFormUtama.ImageButtonOpenFileHandPointMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
ImageButtonOpenFileHandPoint.Picture := ImageButtonOpenFilePress.Picture;
end;
procedure TFormUtama.ImageButtonOpenFileHandPointMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
ImageButtonOpenFileHandPoint.Picture := ImageButtonOpenFile.Picture;
PlayWav('daVinci Open.wav');
ClickOpenFile;
end;
/////////////////////////////////////////////////////////////////////////////
///
procedure TFormUtama.ImageKeypadHandPointMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if LabelStatus.Caption = StatusLineClose then PlayWav('Space Error.wav');
end;
/////////////////////////////////////////////////////////////////////////////
///