• No results found

Sms Server

N/A
N/A
Protected

Academic year: 2021

Share "Sms Server"

Copied!
22
0
0

Loading.... (view fulltext now)

Full text

(1)

SMS Server tools

Nii Okai Quaye

(2)

SMS SERVER TOOLS

o 

Install

o  Aptitude search sms/smstools

o  Sudo apt-get install smstools

(3)

 

SMS Server Tools Config files

 

start /etc/init.d/sms start

 

stop /etc/init.d/sms stop

 

config file /etc/smsd.conf

 

error logfile /var/log/smsd.log

 

sms queues /var/spool/sms

 

Apache webserver

 

start /etc/init.d/apache2 start

 

stop /etc/init.d/apache2 stop

 

config file /usr/apache2/conf/httpd.conf

 

error logfile /usr/apache2/logs/error.log

 

web pages /usr/apache2/htdocs

 

The location of these files is different on some linux distributions.

 

MySQL database

 

start /etc/init.d/mysqld start

 

stop /etc/init.d/mysqld stop

 

client mysql -u root -p

(4)

 

Programs the run repeatedly at specified times

 

Every day, hour, minute

 

Windows

 

nnCron lite c:\programme\cron\cron.tab

 

Part of *nix systems

 

*/10****cp/tmp/logfile.old /tmp/logfile.new

 

minute (0-59)

 

hour (0-23)

 

day (1-31)

 

month (1-12)

 

weekday (0=sunday, 1=monday, ...)

(5)

 

Open source sms and wap gateway

 

WAP

 

Communicates to the phone via wap stack and

translates request it receives to http for

content and service providers

 

Compresses WML scripts into more compact

format to save bandwidth and

 

SMS

 

Abstract various smsc protocols and exposes http

interface for content providers

(6)

 

Consists of three programs called boxes

 

bearerbox

- 

Accepts sms and wap messages and sends them to

other boxes

 

wapbox

- 

Handles wap messages

 

smsbox

- 

Handles sms messages

 

It is possible to have multiple sms and wap

boxes on the same or different hosts

(7)

 

Apt-get install

 

/etc/init.d/kannel

- 

start / stop / restart

(8)

# mkdir src

# cd src

# tar xfz ../downloads/gateway-1.4.1.tar.gz

# cd gateway-1.4.1

# configure –prefix=/usr/local/kannel

# make

# sudo make install

password: **************

(9)

 

Group (assume comm from localhost only)

 

group = core

 

admin-port = 13000

 

smsbox-port = 13001

 

admin-password = bar

 

log-file = "/tmp/kannel.log"

 

log-level = 0

- 

0 - 4. 0 => debug and development 4=>critical errors

and problems

- 

Ex 0 for development and 1 for production

 

box-deny-ip = "*.*.*.*"

 

box-allow-ip = "127.0.0.1"

(10)

 

Smsc Group

 

Kannel allows many smsc conf

- 

Fakesms service for development and testing

- 

GSM

- 

SMS service over Http

 

group = smsc

 

smsc = at

 

modemtype = auto

 

device=/dev/ttyUSB*

- 

Serial port through which device is connected

 

my-number = XXXXXXXXXX

 

connect-allow-ip = 127.0.0.1

 

log-level = 0

(11)

 

Receives and sends sms received by the core

- 

group = smsbox

- 

bearerbox-host = 127.0.0.1

- 

sendsms-port = 13013

- 

Global-sender = XXXXXXXX

 

Outgoing number of modem

- 

log-level = 0

(12)

 

Allows web apps to send sms(over http) using

kannel

- 

group = sendsms-user

- 

username = kanneluser

- 

password = XXX

- 

concatenation= true

- 

max-messages = 10

(13)

 

Configures how Kannel sends messages to applications

 

Possible to setup to catch incoming messages based on various

criteria

 

Using HTTP Get to send message to an app all messages go to one

script

- 

group = sms-service

- 

keyword =

- 

keyword-regex = .*

- 

catch-all = yes

- 

Max-messages = 0

 

Tells kannel to never send reply directly from incoming

message ans for :<empty reply for service provider>

- 

get-url = "http://localhost/sms?phone=%p&text=%a"

(14)

 

Kannel calls the url sepecified in sms-service

group

 

Further processing and use up to us and the

specific application/service we intend to

deliver

(15)

 

Done over Http

function sendSmsMessage($in_phoneNumber, $in_msg)!

{!

$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_msg));!

$results = file('http://'!

. CONFIG_KANNEL_HOST . ':'!

. CONFIG_KANNEL_PORT . $url);!

}!

 

Php iconv

 

allow_url_fopen set to On in php.ini

(16)

 

Enable SMSBOX

 

sudo vi /etc/default/kannel

- 

START_WAPBOX=1

- 

START_SMSBOX=1

 

Add kannel user to dialout group to enable

kannel user to use /dev/ttyUSB0 device that is

necessary for GSM modems

 

sudo vi /etc/group

- 

dialout:x:20:daniel,kannel

Kannel Hands on

(17)

# !

# Sample configuration file for Kannel bearerbox on Debian. ! # See the documentation for explanations of fields. ! #!

# HTTP administration is disabled by default. Make sure you set the ! # password if you enable it.!

group = core ! admin-port = 13000 ! admin-password = bar ! admin-deny-ip = "*.*.*.*" ! admin-allow-ip = "" ! wapbox-port = 13002 ! wdp-interface-name = "*" ! log-file = "/var/log/kannel/bearerbox.log" ! box-deny-ip = "*.*.*.*" ! box-allow-ip = "127.0.0.1" ! smsbox-port = 13003! group = wapbox ! bearerbox-host = localhost ! log-file = "/var/log/kannel/wapbox.log"! ####### SMS box setup ! group = smsbox ! bearerbox-host = localhost ! log-file = "/var/log/kannel/smsbox.log"!

####### SMSC / GSM modem setup, using enfora modem defined below ! group = smsc !

smsc = at !

modemtype = enfora ! device = /dev/ttyUSB0!

(18)

 

Information pull

 

Keywords auto reply can be sent to provide the

requested information

 

We can also link keywords to forward message

to a predifined group or individual

- 

Eg For customer complaint

 

Keywords can be linked to multiple actions

- 

Eg join group ,auto reply and forward

(19)

 

This allows for of FLSMS be programmed to

perform some action based on an external

(http) command

 

Need to establish port to listen to

 

Format

 

http://localhost:<portNumber>/send/sms/

<destinationPhoneNumber>/<messageContent>/

 

Where

(20)

<?php

include_once("config.php"); // database definition include_once("dbclass.php"); // sql Where Conditios $objDB = new DB();

// Query messages by campaign ID //

if(isset($_POST['campaignid']) && $_POST['campaignid'] != "") {

$Query = "select * from custom_fields where campaign = '".$_POST['campaignid']."' "; $objDB->setQuery($Query); $rs = $objDB->select(); ?> <?php if(count($rs)>0) { $counter = 0; foreach($rs as $data) {

// You can change the format or the message here //--- Message Format ---

$message =rawurlencode($data['var1']." ".$data['var2']." ".$data['var3']." ".$data['var4']); //--- Message Format --- $url = "http://localhost:8000/send/sms/".$data['phone']."/".$message."/"; // Using Curl $curl_handle=curl_init(); curl_setopt($curl_handle,CURLOPT_URL,$url); curl_setopt($curl_handle,CURLOPT_CONNECTTIMEOUT,2); $output = curl_exec($curl_handle); curl_close($curl_handle);

$content.= $url." - ".$output; // used for debug $content.="- ".$data['phone']."<br/>"; // used for debug ?>

(21)

String encodedPhoneNumber =

URLEncoder.encode

("+2348069361226","UTF-8");!

String encodedMessage =

URLEncoder.encode("helo","UTF-8");!

URL url=new URL("http://localhost:

8181/send/sms/"!

+ encodedPhoneNumber + "/"!

+ encodedMessage);!

(22)

References

Related documents

16) Switch to the Drawings and Reports task from the Tasks &gt; Drawings and Reports command to create isometric drawings for the created WBS items. 17) In the Management

Alle informantene i denne undersøkelsen gir spesialpedagogisk hjelp til flere barn - noen til mange andre barn.. Organiseringen virker til å være ganske lik den jeg kjenner til,

To determine whether MTBD-E-hook interactions induce a drop in the population of E-hook conformational states that are highly populated in the absence of the MTBD and an increase

z Send SMS &lt;apnuser+password+space+B card APN user content+ space +A card APN user content&gt; the tracker will reply SMS “APNUSER OK!”. Note: if use B card only, then no need

When you want to know the PT502 location, you can send SMS command to the tracker, and after few seconds, the tracker will reply you SMS with the position Lat &amp; Log data. To

Conduct outreach and develop partnerships with AAPI organizations to identify Native Hawaiian and Pacific Islander candidates for professional and other vacancies at the

To judge whether the email address is true or not, they send a test message or a real spam to the guessed addresses and wait for reply.. The reply could be confirmation which

You can send the message to a mailbox number, a name in the Voice Mail service directory or a Group List number2. When you send, reply to, or copy a message, you must assign a