NYCPHP Meetup

NYPHP.org

[nycphp-talk] Kannel with PHP

bz-gmort at beezifies.com bz-gmort at beezifies.com
Thu Oct 18 08:59:42 EDT 2007


Keep in mind, the primary purpose of Kannel is to allow a linux box to 
send SMS messages either through a cell phone, or through another SMS 
provider.

As such, your not going to find a lot directly on Kannel and PHP, it's 
not relevant.

The codeword to search for is:
SMPP, MM1 and MM7 .  I will note that a brief google search doesn't show 
much good info.  Mainly, I believe, because the protocols themselves are 
so simple and trivial, that once you implement it most people don't even 
see it being worth their time to document.  There does seem to be a PEAR 
library for SMPP, http://pear.php.net/package/Net_SMPP_Client
That one seems to be targetted for communicating with your own PHP built 
SMPP server using the SMPP Server pear module.  However, assuming the 
protocol calls follow the standards, you should be able to use it with 
Kannels as well.

There is also one for "SMS" http://pear.php.net/package/Net_SMS
Browsing that package, it looks like a generic set of interfaces to 
either clickatell, vodafone, a generic smtp to SMS gateway, and a 
generic http gateway.



I'd attack the solution in stages.

Stage 1:
Download and setup your PHP script to use the ClickATell PHP libary. 
Spend a few bucks on buying credits from them, and get your PHP 
programming working first.


Stage 2a:
Get your kannel server configured and working correctly.  IIRC it comes 
with a simply web interface for sending SMS messages.  Since this is a 
simple post/get to a URL, you can adapt your PHP program to post the 
message data through the web interface.

OR
Stage 2b:
Give the Pear SMPP module a try with ClickATell, since they do support 
the SMPP protocol.  If you can get it working with a generic set of 
function calls, than in stage 3 try Kannel with SMPP.

Stage 3:
Look into MM7, MM1, or SMPP and work out the protocols and then adapt 
your ClickATell script for Kannel(make new functions to replace the 
ClickATell ones that implement the SMS protocol you choose)

One thing I'd recommend is hunting around for C SDK's for SMS messages 
and compiling their samples to give you a command line interface for 
testing against the various protocols.  IE if you can get a stock SMPP 
based command line program sending messages, than you know you aren't 
dealing with problems in your protocols.

Another alternative is to give NowSMS a try, as their forums are a bit 
more well trafficed for integration solutions, and then switch to Kannel 
once you have NowSMS funcitoning(NowSMS is a *shudder* windows program 
that provides the same functionality as Kannel+Mbuni ie SMS and MMS 
messages.  IIRC the lowest license for it was 500-1000, with a 60 day 
demo.  Worth giving it a try to jumpstart development, and then 
determining once you have everything working if it is more cost 
effective to buy the license or fiddle with Kannel, and then Mbuni if 
your looking for MMS messages)

As a last alternative, my memory also prods me that Kannel comes with a 
a sample program for processing email messages and converting them to 
SMS messages.  So for purely sending messages, you can give that a try.


Hmmmm, so...after all of that, I guess my first question should have 
been: What is it you want to do with PHP regarding cell phone messaging? 
  Send text messages?  Send text and multimedia messages(ClickATell 
can't send multimedia without hoops)?  Receive text messages(ClickATell 
falls flat there).  Receive text and multimedia messages?  And do you 
want to do this with an attached cell phone, or through a text message 
service?(Kannel supports both).

(I've looked into and played with SMS on a number of occassions, but the 
either the projects never materialized so I didn't take it to the 
implementation level, or I found a commercial interface such as 
ClickATell, which worked out to be more cost effective).


Lastly, now that I've given you all the various bits and pieces, here is 
my advice: For pure text messages, assuming you were considering Kannel, 
forget EVERYTHING I said above.  Your wasting time on a single solution.

If you can run a Kannel server, than you can run an AIM message bot.  So 
you can send text messages by AIM.  And AIM will send text messages to 
most cell phone carriers - for free and without sticking advertising on 
them.

So if you implement a PHP to AIM gateway instead, you will have 2 way 
functionality, the ability to send messages to instant message clients 
AND cell phones, and if your smart and use a multi-system connector like 
your own jabber server, you can send messages to most other major 
instant message applications.



More information about the talk mailing list