[asterisk-users] sending sms from Asterisk server

Steve Edwards asterisk.org at sedwards.com
Wed Aug 18 15:02:56 CDT 2010


Un-top-posting...

> On 08/17/2010 09:00 AM, Tino wrote:
> 
> I would like to send sms to some external phone numbers from my asterisk 
> server. Is it possible to send sms via softphones like X-Lite ? . Any 
> tips regarding this will be helpful

> On Wed, Aug 18, 2010 at 3:13 AM, Johann Hoehn 
> <johann.hoehn at ecommerce.com> wrote:

> This is easy to do by using email to SMS gateways.  A list of them is on 
> wikipedia (http://en.wikipedia.org/wiki/List_of_SMS_gateways).  For the 
> Asterisk side, you have an extension that sends the email.  I personally 
> use an AGI script for this part, but you could use a System() call as 
> well.

Using system() is almost always a hack -- and not the good kind :)

On Wed, 18 Aug 2010, Tino wrote:

> Thanks for your advice in this matter. But i am not sure how to pass the 
> numbers to be sent sms  in the dialplan.

You have a choice: you can pass them as channel variables or as command 
line options. I use both, frequently in the same program. Unfortunately, I 
can't clearly articulate why I use one over the other. If the variable is 
something that exists for the life of the call like ${CLIENT-ID} I tend to 
access it as a channel variable. If it's something that modifies the 
behavior of the AGI (--debug or --verbose) I always pass it as a command 
line option and use getopt_long()

First, you need to pick a language. If this is a SOHOish hobby project, it 
doesn't matter -- pick a language you are comfortable with.

If this is a high volume, performance critical project -- I'd vote for c.

Once you've decided on a language, search out an established AGI library 
and learn a bit about the protocol. It's very simple but not always 
obvious. The 3 biggest stumbling blocks that trip up programmers are:

1) You have to read the AGI environment before anything else.

2) It's a request followed by a response. If you don't read the response, 
bad things will happen.

3) It's STDIN/STDOUT based. If you try to "debug" by writing variables or 
messages using echo/printf/puts/etc, bad things will happen.

Check out voip-info.org for more information on AGI.

-- 
Thanks in advance,
-------------------------------------------------------------------------
Steve Edwards       sedwards at sedwards.com      Voice: +1-760-468-3867 PST
Newline                                              Fax: +1-760-731-3000


More information about the asterisk-users mailing list