[libpri-commits] rmudgett: branch rmudgett/display_text r2189 - /team/rmudgett/display_text/
SVN commits to the libpri project
libpri-commits at lists.digium.com
Fri Feb 4 13:02:37 CST 2011
Author: rmudgett
Date: Fri Feb 4 13:02:32 2011
New Revision: 2189
URL: http://svnview.digium.com/svn/libpri?view=rev&rev=2189
Log:
Merged revisions 2187 via svnmerge from
https://origsvn.digium.com/svn/libpri/branches/1.4
........
r2187 | rmudgett | 2011-02-04 12:09:46 -0600 (Fri, 04 Feb 2011) | 18 lines
Add Q931_IE_TIME_DATE to CONNECT message when in network mode.
Add the Q931_IE_TIME_DATE with the current date/time of the system to the
Q.931 CONNECT message when in network mode. The date/time IE allows
attached equipment to synchronize their clock with the network. Most
notably, ISDN phones can display the current date/time.
See issue #18047 about a concern with non-conforming Siemens terminals.
(closes issue #18047)
Reported by: wuwu
Patches:
timedate.patch uploaded by rmudgett (license 664)
Tested by: rmudgett
JIRA SWP-2955
JIRA ABE-2747
........
Modified:
team/rmudgett/display_text/ (props changed)
team/rmudgett/display_text/q931.c
Propchange: team/rmudgett/display_text/
------------------------------------------------------------------------------
automerge = *
Propchange: team/rmudgett/display_text/
------------------------------------------------------------------------------
--- display_text-integrated (original)
+++ display_text-integrated Fri Feb 4 13:02:32 2011
@@ -1,1 +1,1 @@
-/branches/1.4:1-2183
+/branches/1.4:1-2188
Modified: team/rmudgett/display_text/q931.c
URL: http://svnview.digium.com/svn/libpri/team/rmudgett/display_text/q931.c?view=diff&rev=2189&r1=2188&r2=2189
==============================================================================
--- team/rmudgett/display_text/q931.c (original)
+++ team/rmudgett/display_text/q931.c Fri Feb 4 13:02:32 2011
@@ -34,6 +34,7 @@
#include <unistd.h>
#include <stdlib.h>
+#include <time.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
@@ -3055,6 +3056,28 @@
pri_message(ctrl, " ]\n");
}
+static int receive_time_date(int full_ie, struct pri *ctrl, q931_call *call, int msgtype, q931_ie *ie, int len)
+{
+ /* Ignore incoming Date/Time since we have no use for it at this time. */
+ return 0;
+}
+
+static int transmit_time_date(int full_ie, struct pri *ctrl, q931_call *call, int msgtype, q931_ie *ie, int len, int order)
+{
+ time_t now;
+ struct tm timedate;
+
+ /* Send the current time. */
+ time(&now);
+ localtime_r(&now, &timedate);
+ ie->data[0] = timedate.tm_year - 100; /* 1900+ */
+ ie->data[1] = timedate.tm_mon + 1;
+ ie->data[2] = timedate.tm_mday;
+ ie->data[3] = timedate.tm_hour;
+ ie->data[4] = timedate.tm_min;
+ return 7;
+}
+
static void dump_keypad_facility(int full_ie, struct pri *ctrl, q931_ie *ie, int len, char prefix)
{
char tmp[64];
@@ -3703,7 +3726,7 @@
{ 1, Q931_IE_ENDPOINT_ID, "Endpoint Identification" },
{ 1, Q931_IE_NOTIFY_IND, "Notification Indicator", dump_notify, receive_notify, transmit_notify },
{ 1, Q931_DISPLAY, "Display", dump_display, receive_display, transmit_display },
- { 1, Q931_IE_TIME_DATE, "Date/Time", dump_time_date },
+ { 1, Q931_IE_TIME_DATE, "Date/Time", dump_time_date, receive_time_date, transmit_time_date },
{ 1, Q931_IE_KEYPAD_FACILITY, "Keypad Facility", dump_keypad_facility, receive_keypad_facility, transmit_keypad_facility },
{ 0, Q931_IE_SIGNAL, "Signal", dump_signal },
{ 1, Q931_IE_SWITCHHOOK, "Switch-hook" },
@@ -5425,6 +5448,17 @@
-1
};
+static int connect_net_ies[] = {
+ Q931_CHANNEL_IDENT,
+ Q931_IE_FACILITY,
+ Q931_PROGRESS_INDICATOR,
+ Q931_DISPLAY,
+ Q931_IE_TIME_DATE,
+ Q931_IE_CONNECTED_NUM,
+ Q931_IE_CONNECTED_SUBADDR,
+ -1
+};
+
int q931_connect(struct pri *ctrl, q931_call *c, int channel, int nonisdn)
{
if (c->ourcallstate == Q931_CALL_STATE_CALL_INDEPENDENT_SERVICE) {
@@ -5483,7 +5517,12 @@
} else {
q931_display_clear(c);
}
- return send_message(ctrl, c, Q931_CONNECT, connect_ies);
+ if (ctrl->localtype == PRI_NETWORK) {
+ /* networks may send date/time */
+ return send_message(ctrl, c, Q931_CONNECT, connect_net_ies);
+ } else {
+ return send_message(ctrl, c, Q931_CONNECT, connect_ies);
+ }
}
static int release_ies[] = { Q931_CAUSE, Q931_IE_FACILITY, Q931_IE_USER_USER, -1 };
More information about the libpri-commits
mailing list