Summary:ASTERISK-01422: [patch] SMS() text message sending/receiving to ETSI ES 201 912
Reporter:revk (revk)Labels:
Date Opened:2004-04-17 06:56:53Date Closed:2008-01-15 14:52:26.000-0600
Versions:Frequency of
Environment:Attachments:( 0) app_sms.c
( 1) app_sms.c
( 2) app_sms.c
( 3) app_sms.c.asc
( 4) app_sms.c.asc
( 5) app_sms.txt
( 6) app_sms.txt
( 7) digium.txt.asc
Description:This application allows sending and receiving of text messages over ISDN (PRI or BRI) and analogue lines using analogue PSTN caller display protocol. It can act as a client and communicate with a service centre and can also act as a service centre and commnunicate with SMS capable analogue phones.


This week British Telecom launched BT Text in the UK allowing text messages to/from all landlines. This module is compatible with that service as well as phoens such as the "BT Relate SMS". It uses ETSI ES 201 912 protocol 1 and allos setting of the protocol id and data coding scheme including both 7 and 8 bit data formats. I am uploading app_sms.c, a detached pgp signatue app_sms.c.asc, and a pgp signed disclaimer digium.txt.asc
Comments:By: philipp2 (philipp2) 2004-04-17 10:49:52

Very interesting! Since I am not so SMS savvy could you maybe clarify two questions:

1. How would I answer incoming SMS calls: Do I have to set up a dedicated phone number for this (wouldn't really work out nicely if someone SMSed another number of mine), or will I haved to identify the CallerID of the calling SMS Center to then call app_sms? I assume the inteded addressee is named in the SMS header...

2. is ETSI ES 201 912 the "typical" SMS standard (in Europe), or are there many competing protocals around and this'll only work with BT?


By: Olle Johansson (oej) 2004-04-17 17:13:14

Could this be used from app sendtext? It's messaging on zap channels and we already have messaging on other channels.

Would be interesting to be able to send text from a SIP device onto SMS...

By: Brian West (bkw918) 2004-04-17 17:17:46

with this you can SMS between asterisk boxes?!?!? :)

By: revk (revk) 2004-04-17 17:21:30

The standard allows the telco to define a specific CLI (with the last two digits having specific meaning). BT define an 0800 number.

You set a context to trap calls to any number from the specific CLI and go to SMS(queue|a) and it will place the message in the queue directory. Typically the queue would be ${EXTEN} or some such matching the called number.

With BT you have to "register" (by simply sending a text from the number) to identify that you have equipment on the number. Before this received messages are read out to you! You have to register each number (we have 1000 numbers in our DDI, so I have only registered the main ones!). BT were insisting it could not be done on PRI lines at one point yesterday, but it is working nicely!!

ETSI standards are normally followed very well throughout Europe. There used to be a whole load of pager standards for sending messages (TAP?), and they were a bit messy and varied. I have only seen SMS phones that talk the ETSI standard though and that is the only one I know of for incoming messages. There have been other provdiders using premium numbers that have been providing similar services (using the same ETSI standard), so I would expect any PSTN SMS implimentation in Europe to use it.

Of course it will work asterisk to asterisk even outside Europe - i.e. you could provide an SMS service centre using this module if you really wanted to!

We send text messages to customers when we see any problems on their broadband lines. We used to use a modem to dial up one of the mobile operators. I have today changed it all to use this module, which means we finally get a sensible CLI on the SMSs. It also means we can send messages at the rate of about 1 per second (depending on message size) which is way faster than before.

I am pretty pleased with it.

By: revk (revk) 2004-04-17 17:23:11

I wondered if/how it could be tied in with sending/receiving texts to SIP phones. I would be interested in developing some sort of link between the two. SMS() uses simple file based queuing (one text per file).

Which sip phones can handle text messaging?

By: Olle Johansson (oej) 2004-04-17 17:28:19

I've seen no hardware phones that can send messages, only soft clients like WIndows Messenger.

Asterisk have support for sending text messages in app_sendtext:
 -= Info about application 'SendText' =-

Send a Text Message

 SendText(text): Sends text to client.  If the client
does not support text transport, and  there  exists  a  step  with
priority  n + 101,  then  execution  will  continue  at that step.
Otherwise, execution will continue at  the  next  priority  level.
SendText only returns 0  if  the  text  was  sent  correctly  or  if
the channel  does  not  support text transport,  and -1 otherwise.

I think SMS-enabling a PRI line should enable us using sendtext on
that line to send an SMS message. And possibly receiving SMS
and then shipping it out as SIP Notify - a lot of phones
handle that, one of them is SNOM 200.

By: revk (revk) 2004-04-17 17:32:00

I like the idea of texts coming in on our PRI and being directed to the SIp phones (we have SNOM200's in the office).

I think to do this all I have to do is accept the call to SMS(queue|a) and then run something to pick up the message content and run SendText. This could be done with a simple AGI script I expect.

I'll have to try using SendText on the SNOMs. I don't have SendText in the stable cvs though?

By: revk (revk) 2004-04-18 04:52:00

Uploaded revised version.

Changed queue directory names to use a dot not a dash so easier to extra queue name in shell scripts.

On sc terminated calls - i.e. when acting as a service centre, the oa (originating address) is set to the caller id.

By: revk (revk) 2004-04-18 04:52:38

Uploaded some instructions - I meant to do this in the first place... Duh!

By: revk (revk) 2004-04-18 07:26:07

Just tested on a system using ISDN2 lines on BT. Works fine.

By: revk (revk) 2004-04-18 07:40:22

Just tested on Panasonic KXTCD505 cordeless (DECT) SMS capable phone.
Works fine for incoming and outgoing messages.

Like the BT Relate SMS phone it does ring once on asterisk as the CLi is sent after the first ring and not before it as is normal in the UK.

I have a typo on setting the oa on me-sc calls, I'll upload later.

edited on: 04-19-04 02:45

By: opsys (opsys) 2004-04-19 13:48:31

As we in the US are lagging behind in the SMS area, I LOVe using SMS on my Cellulat phone. Since my knowledge of SMS is quite limited, what would it take for an person using * to connect to a SS7 STP that would then give access to all of the different SMS clients??

By: revk (revk) 2004-04-21 04:41:01

I have no idea on SS7, sorry. This system uses simple text per file queuing and so could easily interwork with other modules. The file format is easily extendable using additional fields as necessary (simple key=value lines in the file).

By: revk (revk) 2004-04-21 04:41:55

Excuse my being impatient, but this is the first contribution I have made to asterisk - what is the next step - how do we go about actually getting this in the stable cvs.

I appreciate SMS may be difficult to test in the US, but I have done quite a bit of testing here and have deployed it in 3 live systems now. I can provide access to a test system on UK lines for testing if required.

By: Olle Johansson (oej) 2004-04-21 04:51:35

We need a few others to test it and confirm that it is working.

At the current stage, we will not include any major new functions into the CVS headed for 1.0/1.1 - it's so close to release. We are preparing for the next major Asterisk release and will add a lot of new functions into a combined CVS for testing. I see this new app coming into that batch, if nothing happens before that.

The way forward is really to get others to test or run it for a while and confirm that it is still working for you, that it is stable. Then you have to find bug marshals like me, push us to move it forward. We're to be found in the #asterisk-bugs channel on IRC.

Finally it needs approval by Mark. Very often we handle that since he's busy and receive requests from so many sources, we're kind of a filter for him.

By: zoa (zoa) 2004-04-21 06:05:40

Its a seperate application, why not put it in cvs (maybe not built by default).
That way more people will be tempted to try it.

More and more, I agree with bkw that we need a third cvs branch.

By: Andreas Anderson (aanderson) 2004-04-28 06:18:44

This doesn't work in the Swisscom network (Switzerland). Does someone know what standard they use for sms in fixnet? AFARIR it only works with ISDN Connections, but not with analogue...

By: digo (digo) 2004-04-28 08:16:14

Please provide real working examples for how to use it in the extensions.conf file.... (I mean, how to connect to Service Message Center ...)

edited on: 04-28-04 07:11

By: Mark Spencer (markster) 2004-04-28 09:35:25

Just need to get the comment characters changed from "//" to "/* */" and I'll gladly put this in cvs head.  Great application!  Thanks!

By: revk (revk) 2004-04-28 11:54:04

OK, I'll put examples from my extensions.conf and some manager script examples as well and upload those. I'll also change the comments. I also want to add validity period control, reverse path select, and better escaping for 8 bit data as well as more correct mapping of characters to the GSM 7 bit character set for accented characters. With any luck I'll have that lot ready later today...

By: revk (revk) 2004-04-28 14:36:28

I have uploaded another app_sms.c and app_sms.txt. The txt file now has specific examples of using this on BT lines in the UK. I have updated to allow proper translation to/from the SMS 7 bit character set (except greek as ISO8859-1 does not do greek well!) and 8 bit handling by default when illegal characters used on short enough messages. I have allows a format for raw hex 8 bit data coding (with comment line showing any printable characters for received messages). I have added validity period (relative format only). I have added reverse path (like status report request it does not work on BT, grrrrr). I have changed all comments (is that really an issue???). Would be nice to see in the CVS ASAP. We have people like Motorola using/evaluating it already and we are using it for all of our text notifications to customers.

By: Mark Spencer (markster) 2004-04-28 16:36:36

Added to CVS, thanks!

By: Digium Subversion (svnbot) 2008-01-15 14:52:26.000-0600

Repository: asterisk
Revision: 2805

U   trunk/apps/Makefile
A   trunk/apps/app_sms.c
A   trunk/doc/README.sms

r2805 | markster | 2008-01-15 14:52:26 -0600 (Tue, 15 Jan 2008) | 2 lines

Add revk's SMS application (bug ASTERISK-1422).  Thanks!