Thursday, June 6, 2013

How to Send an SMS Using Kannel


1. Download Kannel. Go to the Kannel website and click on 'Download' under Latest News. Click on the version of Kannel you want to download. Upload the file to your server. Access the 'SSH/Telnet' program, or other Unix command program, on your Web server.
2. Type in the Unix code to compile and install Kannel on your server:'# mkdir src# cd src# tar xfz ./downloads/(Kannel file)# cd (Kannel file)# configure --prefex=/usr/local/(folder to install to)'# make# sudo make installpassword: *********Change the '(Kannel file)' to the official file name of the Kannel installation file that you downloaded. It will look something like 'gateway-1.4.1.tar.gz.' It is a compressed file and you use the 'tar xfz' command to extract the documents. Change the '(folder to install to)' to the name of the folder on your server that you want to install Kannel to. On the 'password' line, enter in your password that you use to sign into your server.
3. Open the smskannel.conf file in the gw/ directory to change some of the configurations in order to send SMS messages. Type in the following configurations for the core configuration group:'group = coreadmin-port = 13000smsbox-port = 13001admin-password = ******#log-file = '/tmp/kannel.log'#log-level = 0box-deny-IP = '*.*.*.*'box-allow-IP = 'enter your IP address''Type in your password again on the line that says 'admin-password.' Type in your IP address in the 'box-allow-IP' address line, assuming that you will be sending SMS messages from the same computer. If you want to block access to a certain IP address, type it on the 'box-deny-IP' line.
4. Type in the following configurations for the smsc group. This allows you to send SMS over HTTP protocols.'group = smscsmsc = atmodemtype = autodevice=/dev/ttyS0my-number = (Your GSM Modem SIM Chip Number)connect-allow-IP = (Your IP Address)log-level = 0'Change the information in the parentheses. Do not include the parentheses in the configuration file.
5. Type in the configurations for the smsbox and Sendsms groups. These are the configurations that will handle sending and receiving SMS messages.'group = smsboxbearerbox-host = 127.0.0.1sendsms-port = 13013global-sender = (Your GMS Modem SIM Chip Number)log-level = 0group = sendsms-userusername = (Your Username)password = (Your Password)concatenation= truemax-messages = 10'Change the information in the parentheses. The Username and Password are what you will make up in order to provide access to Kannel to send SMS messages.
6. Add the final configuration that will control the way Kannel will communicate with your website during the sending and receiving process.'group = sms-servicekeyword =keyword-regex = .*catch-all = yesmax-messages = 0get-URL = '(Web page location for SMS messages)''Type in the specific address to the Web page that you will be using to send SMS messages. This is a page that has the form that you will use to type in the SMS messages.
7. Add the code to the Web page that you will use to send the SMS messages that will do the actual sending of the message. This is the page that has the user interface to enter the information for the actual text message.'function sendSmsText ($in_phoneNumber, $in_message){$URL = '/cgi-bin/sendsms?username=' . CONFIG_KANNEL_USER_NAME. '&password=' . CONFIG_KANNEL_PASSWORD. '&charset=UCS-2&coding=2'. '&to={$in_phoneNumber}'. '&text=' . urlencode(iconv('utf-8', 'ucs-2', $in_message));$results = file('http://'. CONFIG_KANNEL_HOST . ':'. CONFIG_KANNEL_PORT . $URL);}'Save the changes. Go the the Web page and test sending an SMS message.

No comments:

Post a Comment