Summary:ASTERISK-09493: Add 12-hour clock support for skinny phones
Reporter:dea (dea)Labels:
Date Opened:2007-05-22 18:23:11Date Closed:2007-08-02 16:37:28
Versions:Frequency of
Environment:Attachments:( 0) ampm.patch
( 1) skinny-12-hour-clock.txt
Description:Super trivial patch.  Appending a capital 'A' to the
dateFormat string sets the phone in 12 clock mode.

I extended the char arrays for date_format and dateTemplate
by 1 and added a comment to the config file about this.

To make it clear what appending an 'A' means, I changed the
default dateFormat to be 12-hour (slap me down if this is considered
Comments:By: Jason Parker (jparker) 2007-05-22 19:51:12

I'm pretty sure the protocol defines this as 6 chars.  Moving it to 7 will suddenly shift everything else in the message by a whole char.

By: dea (dea) 2007-05-23 00:11:15

I have captures of a phone registering showing this format:
M-D-YA and have found references to that pattern online as
well. (6 characters)  

What I am not sure about is if the string must be \0 terminated.

In any case I have confirmed that if I set dateFormat to M-D-YA
in the config file, I get a 12-hour clock and if I use M-D-Y I get
a 24-hour clock.

The remaining values in the message appear to be hardcoded, but I can
compare them to my captures to see how they line up.

By: Damien Wedhorn (wedhorn) 2007-05-23 04:28:10

I agree with qwell. At the moment I don't think skinny uses any of the other stuff that follows the dateTemplate, but when we patch bug8934(keepalives), we'll probably want to use the secondaryKeepAlive which is after dateTemplate in the same structure. Making dateTemplate 7 bytes could stuff around with that. Worth noting that there seems to be 2 bytes between the two.

Can you try it with a char[6] but with your modified string and see if it works. Ideally this should be incorporated as an option in skinny.conf

By: dea (dea) 2007-05-23 11:11:45

That was one of my first steps, no joy.  I did not
dig deep, but I assumed that ast_copy_string() will
null terminate a string.  If dateFormat is left at
6 characters, we lose the clock flag.

By: dea (dea) 2007-05-23 11:33:42

OK, I think I see an option.

Leave dateTemplate[] set to 6
Set dateFormat[] to 7

ast_copy_string(req->data.regack.dateTemplate, date_format, sizeof(req->data.regack.dateTemplate));

memcpy(req->data.regack.dateTemplate, date_format, sizeof(req->data.regack.dateTemplate));

Tested and works.  The phone reacts properly.  Since the field
is a fixed length, copying M-D-Y results in a \0 terminated field,
copying M-D-YA is not terminated, but the filed is 'full'

Does this approach make sense?

By: Damien Wedhorn (wedhorn) 2007-06-02 04:41:07

Combined all of DEA's stuff into a patch and uploaded. Changed skinny.conf example to include a note on the adding of an A at the end of dateformat. As far as default format, I think it should stay as 24 hour.

Works fine here on 30VIP's.

By: Michiel van Baak (mvanbaak) 2007-07-12 13:12:04

Works on my 7905 and 7960.
Both phones dont act weird after this patch.

ampm.patch does not apply cleanly to current trunk.
Trivial to patch it by hand tho.

By: Digium Subversion (svnbot) 2007-08-02 16:37:28

Repository: asterisk
Revision: 77997

r77997 | qwell | 2007-08-02 16:37:27 -0500 (Thu, 02 Aug 2007) | 14 lines

Merged revisions 77996 via svnmerge from

(closes issue ASTERISK-9493)
r77996 | qwell | 2007-08-02 16:53:39 -0500 (Thu, 02 Aug 2007) | 5 lines

Make sure we actually allow 6 chars to be sent.
Also make note of the "A" option of date format.

Issue 9779, modifications by DEA, wedhorn, and myself.