SMS Gateway Part-1
Membuat SMS Gateway dengan cara yang Mudah dan Sederhana
Sebernarnya sudah banyak yang membahas mengenai Aplikasi SMS Gateway, tapi disini saya coba menulis cara mudah dan sederhana untuk membuat SMS Gateway, terutama untuk pemula/pelajar/Mahasiswa yang tertarik dengan Aplikasi berbasis SMS
Untuk membuat aplikasi SMS Gateway ini dibutuhkan beberapa hal sbb :
- Komputer / Laptop tentunya, dengan sistem operasi Windows 98, 2000, XP atau Linux., tapi untuk testing ini saya menggunakan Windows XP
- Database MySQL untuk menampung data SMS, saya pakai aplikasi yang sudah built-in dengan Apache dan PHP (wamp5_1.7.2 saya lupa situs buat downloadnya)
- Gammu, bisa didownload di http://www.gammu.org
- HP+Kabel Data atau GSM Modem+Kabel data penghubung ke computer, Disini saya menggunakan Siemens 45i
Dan untuk mengoperasionalkannya dengan langkah-langkah sbb :
- Hubungkan HP / GSM Modem anda ke komputer apakah itu melalui port COM1 atau port USB tergantung dari jenis kabel data yang anda gunakan
- Install Driver HP / GSM Modem anda, jika windows masih belum mengenal HP anda
- Cek modem HP anda ini masuk ke port COM berapa? Caranya klik kanan di My Computer à HardWare, Klik di Device Manager, Buka di Ports (COM & LPT)
- Setelah download Gammu, ekstrak file gammu_win32.zip misalnya folder C:\gammu
- Didalam Folder C:\gammu\share\doc\gammu\examples\config ada file gammurc, file ini merupakan file konfigurasi agar gammu dapat mengenali HP anda, copy file tersebut ke C:\gammu\bin, kemudian edit isinya sebagai berikut :
[gammu]
port = com1:
;model = 6110
connection = at115200
;synchronizetime = yes
logfile = gammu.log
logformat = textall
;use_locking = yes
;gammuloc = locfile
;startinfo = yes
;gammucoding = utf8
;usephonedb = yes
- Buka Command Prompt di Windows : Start à Run, Ketik cmd <enter>
- Pindah direktori ke C:\gammu\bin, lalu ketik Command : gammu -identify
- Bila Gammu sudah mampu mengenali HP anda maka akan muncul Informasi HP termasuk didalamnya ada IMEI seperti tampilan berikut :
C:\Documents and Settings\m8dodol>cd c:\gammu\bin
C:\gammu\bin>gammu –identify
Manufacturer : Siemens
Model : S45i (S45i)
Firmware : 03
IMEI : 350170210223563
Product code : S45i
SIM IMSI : 51008000214519
Untuk Menyimpan data SMS yang masuk dan keluar disimpan di database MySQL lakukan langkah-langkah konfigurasi sbb:
- Buka koneksi ke database MySQL, bisa menggunakan tools http://localhost/phpmyadmin, atau Mysql-Front ataupun Command prompt
- Buat database smsd di MySQL, masuk kedatabase tersebut
- Jalankan script C:\gammu\examples\config\mysql.sql
- Copy file C:\gammu\examples\config\smsdrc ke C:\gammu\bin
- Edit File smsdrc sebagai berikut :
[smsd]
PIN = 1234
logfile = smsd.log
commtimeout = 1
sendtimeout = 10
#receivefrequency = 0
#checksecurity = 1
#resetfrequency = 0
deliveryreport = sms
phoneid = MyPhone1
deliveryreportdelay = 10
#runonreceive = /some/script
# ————- SETTINGS FOR –smsd MYSQL or –smsd PGSQL ————–
user = root
password =
pc = localhost
# pc can also contain port or socket path after colon (eg. localhost:/path/to/socket)
database = smsd
- Kemudian Jalankan SMS Daemon Server di command prompt :
C:\gammu\bin>gammu –smsd mysql smsdrc
Log filename is “smsd.log”
Press Ctrl+C to stop the program …
- Bila tidak ada error maka SMS Daemon Server telah berhasil.
- Berikut adalah yang dilakukan oleh Gammu :
Menerima SMS :
- Tabel Inbox : INSERT
Mengirim SMS :
1. Tabel Outbox : SELECT, INSERT, DELETE and UPDATE
2. Tabel Outbox_MultiPart : SELECT, INSERT
3. Tabel SentItems : INSERT and UPDATE
- Untuk mengirimkan SMS bisa lakukan command INSERT ke table OUTBOX di MySQL sebagai berikut :
insert into outbox (InsertIntoDb, DestinationNumber, TextDecoded, coding, creatorID, DeliveryReport, multipart) values (now(),’<NO_TUJUAN>’, ‘<ISI_SMS>’,'Default_No_Compression’,'TEXT’, ‘yes’,'true’);
- Gammu akan membaca table OUTBOX sebagai data SMS yang akan dikirim, setelah berhasil dikirim data di OUTBOX dipindahkan ke table SENTITEMS, jika ada Delivery Report yang diterima maka di SENTITEMS fields DeliveryDateTime akan terisi dengan waktu Delivery message nya.
Selamat Mencoba.
Tulisan Berikutnya, saya akan menulis mengenai AUTO-REPLY SMS di Gammu dengan menggunakan TRIGGER dan STORED PROCEDURE di MySQL
(sbasuki, 31-Dec-2008)
HLR
HLR Presentation
Home Location Register
(HLR)
What is HLR ?
The HLR is the primary database that stores subscriber information for users who are “home subscribers” to that specific location register.
The HLR stores the following subscriber information
Identification information including :
Mobile Identification Number (MIN),
Mobile Directory Number (MDN), and
Equipment Serial Number (ESN)
Subscribed features and privileges
Feature information including feature activation status and feature registration information
Current subscriber location and activity status
The Role of the HLR
The HLR interworks with the MSC/VLR, AC, SMSC and feature servers to support origination/termination, authentication, SMS, packet transmission, location data, and the services of the intelligent network.
How can we know where a mobile station is?
The HLR has the necessary information for initiating, terminating, or receiving a call.
The MSC contacts the HLR prior to setting up the call.
The MSC delivers the call immediately.
As subscribers roam beyond their home area, the HLR keeps track of their locations and status.
How can we know where a mobile station is?
Whenever the MS is activated (powered on),
the Mobile Identification Number (MIN) and the Equipment Serial Number (ESN) are transmitted to the closest cell site, which notifies the HLR of the subscriber’s current location.
The HLR stores this information so calls can be forwarded to subscribers and service features can be accessed while the subscriber is roaming. The MS continues to transmit its identification at regular intervals so the network always knows the locations of all active subscribers.
The MSCs and the HLR work together to continually track the location of a subscriber. When a subscriber is roaming and activates the MS, a cell site receives the signal containing the Mobile Identification Number (MIN) and ESN. This information is received by an MSC which transmits it to the mobile network for appropriate routing to the HLR.
Every few minutes, the handset resends this signal. As the subscriber moves from one cell site to another, the receiving MSC transmits the location of the MS to the HLR database for handoff.
Authentication Center(AC)
What is AC ?
The Authentication center which is one of the elements in the ANSI-41 network ( AC) is related to the HLR.
The AC provides the HLR with different set of parameters to complete the authentication of a MS(mobile station).
The AC is utilized to protect against unauthorized access in the mobile communication by “authenticating” mobile stations (MS) upon registration, call origination, call termination, and flash requests.
The AC interworks with ans external system using the MAP protocol over the SIGTRAN signaling network.
Authentication and encryption functions are provided in order to prevent illegal use of services, and to authenticate subscribers before requested services are provided to them
The authentication function shares a secret key between MS and network, executes the same authentication algorithm for them. Then, based on the result, corresponding MS is allowed to access the network.
Definition of Authentication Data
A-Key(Authentication Key, 64 bit)
A secret,64bit pattern stored in the MS and HLR/AUC
Used to generate the SSD(Shared Secret Data).
SSD(Shared Secret Data, 128 bit)
A 128bit pattern stored in the MS and known by BSS
SSD is concatenation of two 64bit subsets;
SSD-A(64 bit) is used to support the authentication
procedure.
SSD-B(64 bit) serves as one of the input to the process
generating the encryption mask and private long code.
RAND(Random Challenge Memory)
RAND is used in conjunction with SSD-A and other
parameters, as appropriate authenticate MS orig.,
term. and registration.
Operation of Authentication
Authentication Function
Deriving the SSD from the A-key
Shared Secret Data Update
It is a procedure of updating shared secret data (SSD) of the authentication center and mobile station. This procedure may always be executed every time when the AC requires. Thus, this command should be transmitted over traffic channel or paging channel to MS.
Global Challenge
Registration
Origination
Termination
Unique Challenge
This procedure is for authentication center to ask direct authentication for a particular MS. This procedure can always be executed every time when the AC requires, the command should be able to be transmitted over paging or traffic channel. Once the unique challenge fails, MS does not allow access the network, or performs the shared secret data update procedure. Command should be transmitted to MS over a channel. Once the unique challenge fails, access is not allowed to the network, or shared secret data updating procedure is executed.
Call History Count Update
Once an originating call and a terminating call completed successfully the authentication procedure, the AC sends parameter modification message to MS to update the MS Count. In normal state, count update is made in the process of originating and terminating call, though, it may occur in other time points. Consequently the procedure should be able to be made by paging and traffics. If unclear location data is notified from HLR or VLR, call history count should be updated.
MS Registration Flow
1. MS-A sends Registration message to the Serving MSC with MIN
2. The Serving MSC receives the REGNOT and forwards to VLR.
The VLR forwards the REGNOT to HLR associated to the MS-A
3. The HLR Registers MS information in Database and returns a REGNOT to VLR
VLR records the identity of the MSC and the locations area identity an forwards a REGNOT to the Serving MSC
4. Tee Serving MSC sends Sector List information
The BSC finds out its sector id in the received sector list from MSC
If so, BSC sends HOMEZONE or MOBILE information
MS would display received information
MS Registration Flow : with Authentication
1. MS-A sends Registration message to the Serving MSC with MIN
2. The Serving MSC/VLR receives the message and sends AUTHREQ to HLR associated to MS-A
The HLR forwards AUTHREQ to AUC and receives result
3. HLR forwards the authreq to the Serving MSC/VLR
4. Following successful authentication of the MS-A the Serving MSC/VLR sends REGNOT to HLR
5. If the MS was previosly registered in another system, the HLR sends REGCANC to the previously serving system
6. The previously serving MSC/VLR returns REGCANC to HLR
7. HLR Registers MS information in Database and sends the REGNOT to the serving MSC/VLR
Call Origination(M-M:Local MS): with Authentication
1. MS-A dials MS-B with MDN
On a call origination attempt by the MS-A, the Origination MSC/VLR sends an AUTHREQ to the HLR associated with the MS-A
The HLR forwards the AUTHREQ to the AUC and receives authreq as a results
3. The HLR forwards authreq to the Originating MSC/VLR
The Originating MSC receives the message and sends LOCREQ to HLR
The HLR determines that the call shall be routed to a local MS and returns this information to the originating MSC in the LOCREQ
MSC paging to MS-B
Call Origination(M-M:Roaming MS)
MS-A dials MS-C with MDN
The originating MSC receives the message and sends LOCREQ to HLR associated to the MS-C
The HLR sends a ROUTREQ to the Serving VLR, VLR forwards the ROUTREQ to the MSC.
The Serving MSC allocated a TLDN and returns this information to the Serving VLR in the ROUTREQ
VLR forwards the ROUTREQ to the HLR
The HLR determines that the call shall be routed to an another MSC and returns this information to the MSC in the LOCREQ
A voice path is then established between the Jakarta MSC and Bandung MSC paging to MS-B
The serving MSC paging MS-C
Call Origination (M-M : Local MS)
MS-A dials MS-B with MDN
The Originating MSC receives the message and sends LOCREQ to HLR
HLR determines that the call shall be routed to a local MS and returns this information to the originating MSC int the LOCREQ
MSC paging to MS-B
Call Origination (M-M : Roaming MS)
MS-A dials MS-C with MDN
The Originating MSC receives the message and determines the MS is in Bandung HLR so Jakarta MSC sends a LOCREQ to the Bandung HLR (associated to MS-C)
The HLR determines that the MS-C is roaming in Jakarta MSC and that the call shall be routed to a local MS
The HLR returns this information to the originating MSC in the LOCREQ
MSC paging MS-C
Service Feature
Service Features
Supplementary Services Provided by HLR
Call Forwarding-Busy (Act = *73, DAct = *730)
Call Forwarding-Unconditional (Act = *71, DAct = *710)
Call Forwarding-No Answer (Act = *74, DAct = *740)
Call Forwarding-Default (Act = *72, DAct = *720)
Call Waiting (Act = *40, DAct = *400)
Call Holding
Short Message Service
Fax Mail Service
Conference Call
Call Transfer
Message Waiting Notification
Remote Feature Control
Calling Number Identification Presentation
Calling Number Identification Restriction
Voice Mail Service
Call Forwarding to VMS : Busy
MS-A dials MS-C with MDN
The Originating MSC receives the message and sends LOCREQ to HLR associated to HLR MS-B
The HLR sends a ROUTREQ to the Serving VLR
The VLR forwards the ROUTREQ to the MSC
IF MS-C is busy, the status is returned to the HLR in the ROUTREQ
The HLR determines from the service profile that VMS is active. It sends the LOCREQ to the originating MSC including the VMS_ID
The Originating MSC then establishes a call to VMS.
Call Forwarding to VMS : Unconditional
MS-A dials MS-B with MDN
The Originating MSC receives the message and sends LOCREQ to HLR associated to HLR MS-B
The HLR determines from MS’ service profile that VMU is active
The HLR sends a locreq to the originating MSC providing the VMS_ID
The Originating MSC then establishes a call to VMS.
SMS (Short Message Send)
MS sends shorts message
MSC sends SMDPP
SMSC returns smdpp
SMSC sends SMSREQ to the HLR to get SMS routing address
HLR responds with an smsreq toward the SMSC
SMSC sends SMDPP to MS-C
MSC sends smdpp to SMSC
Calling Number Identification Presentation (CNIP)
Calling Number Identification Restraction (CNIR)
MS-A dialing to MS-B
MSC receives the message and sends LOCREQ to HLR (including CNI information)
HLR sends locreq (including CNI information)
MSC paging to MS-B
IF MS-B has CNIP service, MS-B alerted including Calling Number Identification Presentation information
IF MS-A has CNIR service then CNI information will not displayed MS-B
Message Waiting Notification
Voicemail message is waiting to be delivered to the subscriber (MS-A). But the MS-A is not available for alerting
MSC receives an indication that the MS-A is available for alerting
MSC send a REGNOT to the HLR associated to the MS-A
HLR returns a regnot to the MSC/VLR
MSC then provides a MWN alert to the MS-A
What is new service?
FWA is a limited mobility service within pre-defined mobility area.
Subscriber’s mobility is limited within pre-defined Limited Mobility Service Area.
Limited Mobility Service Area (LMSA) is PSTN Local Service Area.
What is new service?
Subscriber can proceed (Originate & Terminate) a call only inside the pre-defined subscriber’s LMSA.
What is new service?
HLR send the LMSA code of Subscriber to MSC/VLR when MS‘s initial register, location update and changed profiles
What is new service?
MSC determines to permit or limit a call origination according to the result of comparing with subscriber’s present location area and LMSA
What is new service?
MSC determines to permit or limit a call termination according to the result of comparing with subscriber’s present location area and LMSA
Thank You
Sriyono.basuki@mobile-8.com
Cara Membuat Crontab
- 1. Crontab Restrictions
____________
You can execute crontab if your name appears in the file /usr/lib/cron/cron.allow. If that file does not exist, you can use
crontab if your name does not appear in the file /usr/lib/cron/cron.deny.
If only cron.deny exists and is empty, all users can use crontab. If neither file exists, only the root user can use crontab. The allow/deny files consist of one user name per line.
2. Crontab Commands
__________
export EDITOR=vi ;to specify a editor to open crontab file.
crontab -e Edit your crontab file, or create one if it doesn’t already exist.
crontab -l Display your crontab file.
crontab -r Remove your crontab file.
crontab -v Display the last time you edited your crontab file. (This option is only available on a few systems.)
3. Crontab file
___________
Crontab syntax :-
A crontab file has five fields for specifying day , date and time followed by the command to be run at that interval.
| * * * * * command to be executed - - - - - | | | | | | | | | +—– day of week (0 – 6) (Sunday=0) | | | +——- month (1 – 12) | | +——— day of month (1 – 31) | +———– hour (0 – 23) +————- min (0 – 59) |
* in the value field above means all legal values as in braces for that column.
The value column can have a * or a list of elements separated by commas. An element is either a number in the ranges shown above or two numbers in the range separated by a hyphen (meaning an inclusive range).
Note: The specification of days can be made in two fields: month day and weekday. If both are specified in an entry, they are cumulative meaning both of the entries will get executed .
4. Crontab Example
_______
A line in crontab file like below removes the tmp files from /home/someuser/tmp each day at 6:30 PM.
30 18 * * * rm /home/someuser/tmp/*
Changing the parameter values as below will cause this command to run at different time schedule below :
| min | hour | day/month | month | day/week | Execution time |
| 30 | 0 | 1 | 1,6,12 | * | – 00:30 Hrs on 1st of Jan, June & Dec. |
|
: |
|||||
| 0 | 20 | * | 10 | 1-5 | –8.00 PM every weekday (Mon-Fri) only in Oct. |
|
: |
|||||
| 0 | 0 | 1,10,15 | * | * | – midnight on 1st ,10th & 15th of month |
|
: |
|||||
| 5,10 | 0 | 10 | * | 1 | – At 12.05,12.10 every Monday & on 10th of every month |
| : | |||||
Note : If you inadvertently enter the crontab command with no argument(s), do not attempt to get out with Control-d. This removes all entries in your crontab file. Instead, exit with Control-c.
5. Crontab Environment
___________
cron invokes the command from the user’s HOME directory with the shell, (/usr/bin/sh).
cron supplies a default environment for every shell, defining:
HOME=user’s-home-directory
LOGNAME=user’s-login-id
PATH=/usr/bin:/usr/sbin:.
SHELL=/usr/bin/sh
Users who desire to have their .profile executed must explicitly do so in the crontab entry or in a script called by the entry.
6. Disable Email
____________
By default cron jobs sends a email to the user account executing the cronjob. If this is not needed put the following command At the end of the cron job line .
>/dev/null 2>&1
7. Generate log file
________________
To collect the cron execution execution log in a file :
30 18 * * * rm /home/someuser/tmp/* > /home/someuser/cronlogs/clean_tmp_dir.log
Hasil Test Toefl dan TPA Magister/S2 UI
Setelah ikut test Toefl dan TPA tanggal 6 Desember 2008, rasa penasaran terhadap hasilnya sangat menggebu-gebu, maklum jika lulus maka aku akan banyak melakukan perubahan planning hidupku.
Berikut adalah materi pada saat ujian :
Materi Ujian S2 UI 06-Desember-2008 :
1. TPA (Test Potensi Akademik)
- Bagian 1, Soalnya berupa Artikel bahasa indonesia beberapa paragraf, 1 artikel 10 soal, dan soal persamaan kata dalam bahasa Indonesia
- Bagian 2, Soal Matematika Dasar, Jika jawaban salah maka nilai dikurangi. diantaranya soal cerita, deret matematika, ini lumayan susah karena dari soal yang diberikan jawabannya merupakan rumus hasilnya, misal : jika X memiliki uang sebanyak Rp. A dan kemudia uang itu diberikan sejumlah Rp. B kepada Y dan kemudian X menerima uang dari Z sebanyak Rp. C, maka berupa uang yang dimiliki oleh X. jawab : A-B+C
- Bagian 3, Soal mengenai gambar, seperti mencocokan gambar, meneruskan gambar berikutnya
2. Toefl / Bahasa Inggris
Terdiri dari 100 soal, 40 soal grammar dan structure dan 60 soal dalam reading, lumayan aneh2 istilah bahasa inggrisnya
Tanggal 12 Desember 2008 adalah pengumuman hasil test Toefl dan TPA ku, dan setelah hasilnya aku lihat ternyata aku tidak lolos seleksi, lemas badan rasanya setelah tau ak tidak lolos, rasanya semua planning yang aku rencanakan untuk tahun depan harus aku susun ulang.
Dari hasil interospeksi ku, aku memang kurang persiapan di Toeflnya banyak pertanyaan yang aku jawab tidak meyakinkan, untuk next nya akan aku coba lagi tahun depan dan tentunya harus lolos
Materi Ujian S2 UI 01-Maret-2009 (Penilaian Jika Benar maka Nilai=1, Salah=-0.2) :
1. TPA (Test Potensi Akademik)
- Bagian 1, Soalnya berupa Artikel bahasa indonesia beberapa paragraf, 1 artikel 10 soal, total ada 2 Artikel dan soal persamaan kata/Sinonim, Antonim dan kesetaraan pernyataan dalam bahasa Indonesia
- Bagian 2, Soal Matematika Dasar, diantaranya soal cerita, deret matematika, ini lumayan susah karena dari soal yang diberikan jawabannya merupakan rumus hasilnya, misal : jika X memiliki uang sebanyak Rp. A dan kemudia uang itu diberikan sejumlah Rp. B kepada Y dan kemudian X menerima uang dari Z sebanyak Rp. C, maka berupa uang yang dimiliki oleh X. jawab : A-B+C
- Bagian 3, Soal Logika Matematika
2. Toefl / Bahasa Inggris
Terdiri dari 100 soal, 40 soal grammar dan structure dan 60 soal dalam reading, lumayan aneh2 istilah bahasa inggrisnya
Aku ikut test UI lagi yang 01 Maret, dan Alhamdulillah akhirnya berhasil lolos Test Seleksi tahap 1
Sekarang lagi nunggu hasil pengumuman akhir Test Seleksi tahap 2 tanggal 04 April 2009