Summary:ASTERISK-02920: [patch] new version of app_sms.c
Reporter:revk (revk)Labels:
Date Opened:2004-12-04 10:49:25.000-0600Date Closed:2008-01-15 15:16:20.000-0600
Versions:Frequency of
Environment:Attachments:( 0) app_sms.c
( 1) app_sms.c
( 2) app_sms.diff
( 3) app_sms.diff
( 4) app_sms.diff
( 5) app_sms.diff
( 6) app_sms.html
( 7) app_sms.html
( 8) smsq.c
( 9) smsq.c
(10) smsq.c
Description:A number of changes have been made to app_sms.c
Fixed bug when used with local sip device to SMS phone
Changed directory structure to be simpler
New documentation with better examples
Made new command (smsq) to create sms messages and kick asterisk to send them


app_sms.c is the main SMS application
smsq.c is a stand alone C program to create sms messages and kick asterisk to send them
app_sms.html is a comprehensive description of app_sms and smsq
Discalimer on file.
Comments:By: revk (revk) 2004-12-04 11:03:14.000-0600

Use latest smsq.c uploaded

By: Mark Spencer (markster) 2004-12-04 11:16:25.000-0600

We need a cvs diff -u on the app_sms, not the whole new app.  Thanks!

By: revk (revk) 2004-12-05 15:05:01.000-0600

OK, various further changes...
Handling unicode messages.
Handling message reference better (i.e. does not exist on mtrx messages)
More smsq options for concurrent call handling
Latest copies of all three files being uploaded.

By: revk (revk) 2004-12-05 15:06:36.000-0600

Two of the files are new...
I'll do you a cvs diff if you insist!!!

By: revk (revk) 2004-12-05 15:11:30.000-0600

OK, second time lucky, I did the -u this time.
Is that what you need?

Where would you issue a stand alone command line app like smsq?

By: revk (revk) 2004-12-05 15:16:00.000-0600

With app_sms installed, and no extra lines in extension.conf at all, you can send messages to a magic messenger attached to an analogue port on a sipura.

E.g. I have one on extension 241, i.e. dialling 241 from default context rings that analogue port.

smsq -o123 -q241 test

Sends a text to that device from number 123 with the content "test"

It needs no config as it uses the outgoing directory to queue a call from the SMS application to Local/241 directly without need for a context. This does all the rest. The magic messenger in its default context should understand the CLI.

It may work with an IAXy. Worth a try.

By: Mark Spencer (markster) 2004-12-06 01:02:23.000-0600

There appear to be a great deal of formatting changes in your patch, making it hard to find the substantive ones.  Is it possible to separate those two or at least to point me in the right direction?

By: revk (revk) 2004-12-06 07:04:12.000-0600

I use indent a lot to format code, and if it is different to what is in CVS, it will show a lot of differences. I can certainly take the CVS version - run through indent, take mine, do the same, and then send a diff so you can see the changes. There are various changes, as I am sure you have gathered.

Having said that, I think I can make the whole thing do a lot better at handling UCS-2 coding and greek characters going to/from UTF-8, so I may do a new version yet. I would like to get this version in to CVS anyway as it works, but if you want to wait for the next update, let me know.

The important broken bit in the old code in cvs now is that there is an extra field in the frame structure - delivery time or some such - which was no initialised in my code, and so it caused completely wrong waveforms when dealing with a sip device. Took me ages to find, and I even made a variation to generate direct ALAW instead of sigend 16 bit in case there was something wrong in that. It is in an ifdef, and as US does not use ALAW I quite understand if that is not defined in the CVS version. It works either way.

By: revk (revk) 2004-12-06 12:44:33.000-0600

Ok, I am spending a fortune testing sending and receiving text messages.

I have found several bugs in the British Telecom side of things, and we even had them get a patch on their system to fix their end!

Anyway, I have a new version I am now testing.
This supports user data header - important for multipart messages and various types of special message.
This also supports UTF-8 coding, and sending and receiving (with translation to/from UTF-8) for 7 bit, 8 bit, and UCS-2. The UTF-8 finally means the UK pound sign (£) is working correctly, but should sort greek characters too.

By: revk (revk) 2004-12-07 01:39:28.000-0600

Hmm, I have decided the latest code (which I have not uplopaded) could be tider, so I'll be making a few changes before uploading it. I have UTF-8 and UCS-2 handling, and that is tested, but it would be a lot neater for the internal user data to be held in USC-2 rather than UTF-8. This then allows UTF-8 to be used only when ud=text is used in the message file. I am concerned that without this we could end up with difficulty in handling raw binary messages which would be messed up by UTF-8 escaping. It means smsq also understanding UTF-8 (which was transparrent to it before), but this is a good idea as it would allow a --raw option to specify that the SMS content is not UTF-8 encoded for binary messages.

I'll let you know when it is ready. It means even more radical changes to the code though...

By: revk (revk) 2004-12-07 10:42:12.000-0600

OK, lots of testing. Amazing what you find when testing!

I have reported a bug in BT Text service (British telecom).
I have reported a bug in a premium rate texting service in the UK.
I have reported a bug in the Magic Messenger.
(I have found and fixed several bugs in my code!)

The new code handles UTF-8 and also takes files in USC-1, and USC-2 format as well. It uses USC-2 internally now, which is much neater. It also supports 7 bit coded escape sequences used for characetrs including the EURO symbol.

So, I think the new asterisk code is ready. I'll upload current files, and then sort a diff for you Mark so you can see the changes. They are pretty extensive now.

By: revk (revk) 2004-12-07 11:09:41.000-0600

The latest diff does not have as much of the formatting changes showing so should be clearer. Let me know if anything needs any explanation.

Hopefully this can all go in the CVS now... Pretty please. <-:

By: revk (revk) 2004-12-08 15:10:45.000-0600

I suppose if I stopped tinkering you would put it in CVS!

Anyway, latest smsq.c has an additional option to make procesisng of received messagesin the queue simpler by providing a feature that will scane the receive queue, fill in environment variables for all of the fields and run a script or command for each file. In particular it utf-8 parses or hex parses the user data field so a script can rely on some sort of text in $ud which could be emailed, for example. Instructions updated accordingly.

By: Mark Spencer (markster) 2004-12-08 16:43:39.000-0600

[root@dhcp-34 asterisk]# patch -p0 < /tmp/app_sms.diff
patching file apps/app_sms.c
Hunk #2 succeeded at 59 with fuzz 1 (offset -1 lines).
Hunk #3 FAILED at 74.
Hunk #4 succeeded at 90 with fuzz 2 (offset -12 lines).
Hunk ASTERISK-1 succeeded at 163 (offset -1 lines).
Hunk ASTERISK-2 FAILED at 201.
Hunk ASTERISK-3 succeeded at 489 (offset -12 lines).
Hunk ASTERISK-4 FAILED at 682.
Hunk ASTERISK-5 succeeded at 738 (offset -2 lines).
Hunk ASTERISK-6 succeeded at 743 (offset -12 lines).
Hunk ASTERISK-7 succeeded at 770 (offset -2 lines).
Hunk ASTERISK-8 FAILED at 806.
Hunk ASTERISK-9 FAILED at 831.
Hunk ASTERISK-10 FAILED at 902.
Hunk ASTERISK-11 succeeded at 1022 (offset -27 lines).
Hunk ASTERISK-12 succeeded at 1069 with fuzz 2 (offset -2 lines).
Hunk ASTERISK-13 succeeded at 1069 (offset -27 lines).
Hunk ASTERISK-14 succeeded at 1116 (offset -2 lines).
Hunk ASTERISK-15 FAILED at 1153.
Hunk ASTERISK-16 FAILED at 1185.
Hunk ASTERISK-17 succeeded at 1182 (offset -31 lines).
Hunk ASTERISK-18 FAILED at 1191.
Hunk ASTERISK-19 FAILED at 1273.
Hunk ASTERISK-20 FAILED at 1284.
Hunk ASTERISK-21 succeeded at 1417 (offset -6 lines).
Hunk ASTERISK-22 FAILED at 1525.
Hunk ASTERISK-23 FAILED at 1537.
Hunk ASTERISK-24 FAILED at 1588.
Hunk ASTERISK-25 FAILED at 1610.
Hunk ASTERISK-26 FAILED at 1638.
Hunk ASTERISK-27 FAILED at 1690.
17 out of 31 hunks FAILED -- saving rejects to file apps/app_sms.c.rej

This patch does not appear to apply to CVS head...

By: revk (revk) 2004-12-09 02:25:05.000-0600

Mark, you wanted to see a clearer idea of the substantial changes so, as described, I reformatted the CVS to make the patch show that. It was intended for you to read. Trying to apply the patch would not work.

I can make a patch based on the CVS head for you, but it will show all the format changes. I'll do that now and upload.

BTW, a couple of very minor changes to the smsq.c and manuals this morning.

By: revk (revk) 2004-12-09 10:20:41.000-0600

Bugger, there is now a problem with receiving two messages at the same time. It was not there before, but I fixed a problem with making up message references on incoming messages when there was not one from the SMSC. Having fixed that the file names are not unique!

Fix in a few minutes.

By: Mark Spencer (markster) 2004-12-09 14:35:10.000-0600

Okies well I thin i'm ready for a *real* patch now :)

By: revk (revk) 2004-12-11 08:41:26.000-0600

Anyway, when you have it installed it yourself, do see if you can make that Magic Messenger work <-:

By: Mark Spencer (markster) 2004-12-11 17:39:54.000-0600

Added to CVS with some small cleanups.  Feel free to reopen if I broke anything.

By: revk (revk) 2004-12-12 12:49:38.000-0600

Further patch (12-12-04 12:48)
Sets separate err flag for errors rather than returning h->hangup.
h->hangup is set in normal operation, and was causing a stop in the context which should have continued.
Can you update CVS with that patch please.
[found where smsq.c is hiding...]

By: Olle Johansson (oej) 2004-12-19 07:42:02.000-0600

smsq.c did have a lot of // comments that I've changed in another bug report. Please observe that according to the bug guidelines, we should only use /* */ style comments. Thank you!

By: Mark Spencer (markster) 2004-12-19 15:31:41.000-0600

Added to CVS, thanks!

By: Russell Bryant (russell) 2004-12-24 14:24:30.000-0600

not in 1.0

By: Digium Subversion (svnbot) 2008-01-15 15:16:20.000-0600

Repository: asterisk
Revision: 4429

U   trunk/Makefile
U   trunk/apps/app_sms.c
D   trunk/astman/
A   trunk/doc/app_sms.html
_U  trunk/utils/
A   trunk/utils/.cvsignore
A   trunk/utils/Makefile
A   trunk/utils/smsq.c

r4429 | markster | 2008-01-15 15:16:19 -0600 (Tue, 15 Jan 2008) | 2 lines

Merge sms stuff and move to "utils" subdir (bug ASTERISK-2920)