[svn-commits] russell: trunk r275466 - in /trunk: ./ channels/ configs/
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Sat Jul 10 09:44:30 CDT 2010
Author: russell
Date: Sat Jul 10 09:44:18 2010
New Revision: 275466
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=275466
Log:
Add support for devices with less than 3 lines on the LCD.
(closes issue #17600)
Reported by: minaguib
Patches:
ast_unistim_height_v2.patch uploaded by minaguib (license 1078)
Tested by: minaguib
Modified:
trunk/CHANGES
trunk/CREDITS
trunk/channels/chan_unistim.c
trunk/configs/unistim.conf.sample
Modified: trunk/CHANGES
URL: http://svnview.digium.com/svn/asterisk/trunk/CHANGES?view=diff&rev=275466&r1=275465&r2=275466
==============================================================================
--- trunk/CHANGES (original)
+++ trunk/CHANGES Sat Jul 10 09:44:18 2010
@@ -513,7 +513,8 @@
* The addition of G.719 pass-through support.
* Added support for 16khz Speex audio. This can be enabled by using 'allow=speex16'
during device configuration.
-
+ * The UNISTIM channel driver (chan_unistim) has been updated to support devices that
+ have less than 3 lines on the LCD.
CLI Changes
-----------
Modified: trunk/CREDITS
URL: http://svnview.digium.com/svn/asterisk/trunk/CREDITS?view=diff&rev=275466&r1=275465&r2=275466
==============================================================================
--- trunk/CREDITS (original)
+++ trunk/CREDITS Sat Jul 10 09:44:18 2010
@@ -174,6 +174,8 @@
Cedric Hans - Development of chan_unistim
cedric.hans(AT)mlkj.net
+Takao Takahashi & Mina Naguib - chan_unistim improvements for smaller devices
+
Sergio Fadda - console_video: video support for chan_oss and chan_alsa
Marta Carbone - console_video and the astobj2 framework
Modified: trunk/channels/chan_unistim.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_unistim.c?view=diff&rev=275466&r1=275465&r2=275466
==============================================================================
--- trunk/channels/chan_unistim.c (original)
+++ trunk/channels/chan_unistim.c Sat Jul 10 09:44:18 2010
@@ -76,6 +76,7 @@
#define DEFAULTCONTEXT "default"
#define DEFAULTCALLERID "Unknown"
#define DEFAULTCALLERNAME " "
+#define DEFAULTHEIGHT 3
#define USTM_LOG_DIR "unistimHistory"
/*! Size of the transmit buffer */
@@ -433,6 +434,7 @@
char softkeyicon[6]; /*!< icon number */
char softkeydevice[6][16]; /*!< name of the device monitored */
struct unistim_device *sp[6]; /*!< pointer to the device monitored by this soft key */
+ int height; /*!< The number of lines the phone can display */
char maintext0[25]; /*!< when the phone is idle, display this string on line 0 */
char maintext1[25]; /*!< when the phone is idle, display this string on line 1 */
char maintext2[25]; /*!< when the phone is idle, display this string on line 2 */
@@ -2280,11 +2282,21 @@
pte->device->size_phone_number = 15;
strcpy(tmp, "Number : ...............");
memcpy(tmp + 9, pte->device->phone_number, pte->device->size_phone_number);
- send_text(TEXT_LINE2, TEXT_NORMAL, pte, tmp);
- send_blink_cursor(pte);
- send_cursor_pos(pte,
+
+ if (pte->device->height == 1) {
+ send_text(TEXT_LINE0, TEXT_NORMAL, pte, tmp);
+ send_blink_cursor(pte);
+ send_cursor_pos(pte,
+ (unsigned char) (TEXT_LINE0 + 0x09 +
+ pte->device->size_phone_number));
+ } else {
+ send_text(TEXT_LINE2, TEXT_NORMAL, pte, tmp);
+ send_blink_cursor(pte);
+ send_cursor_pos(pte,
(unsigned char) (TEXT_LINE2 + 0x09 +
pte->device->size_phone_number));
+ }
+
send_led_update(pte, 0);
return;
}
@@ -2295,13 +2307,24 @@
else
send_select_output(pte, pte->device->output, pte->device->volume, MUTE_OFF);
SendDialTone(pte);
- send_text(TEXT_LINE0, TEXT_NORMAL, pte, "Enter the number to dial");
- send_text(TEXT_LINE1, TEXT_NORMAL, pte, "and press Call");
+
+ if (pte->device->height > 1) {
+ send_text(TEXT_LINE0, TEXT_NORMAL, pte, "Enter the number to dial");
+ send_text(TEXT_LINE1, TEXT_NORMAL, pte, "and press Call");
+ }
send_text_status(pte, "Call Redial BackSpcErase");
- }
- send_text(TEXT_LINE2, TEXT_NORMAL, pte, "Number : ...............");
- send_blink_cursor(pte);
- send_cursor_pos(pte, TEXT_LINE2 + 0x09);
+
+ }
+
+ if (pte->device->height == 1) {
+ send_text(TEXT_LINE0, TEXT_NORMAL, pte, "Number : ...............");
+ send_blink_cursor(pte);
+ send_cursor_pos(pte, TEXT_LINE0 + 0x09);
+ } else {
+ send_text(TEXT_LINE2, TEXT_NORMAL, pte, "Number : ...............");
+ send_blink_cursor(pte);
+ send_cursor_pos(pte, TEXT_LINE2 + 0x09);
+ }
pte->device->size_phone_number = 0;
pte->device->phone_number[0] = 0;
change_favorite_icon(pte, FAV_ICON_PHONE_BLACK);
@@ -2376,10 +2399,16 @@
if (!sub->rtp)
start_rtp(sub);
send_select_output(s, s->device->output, s->device->volume, MUTE_OFF);
- send_text(TEXT_LINE0, TEXT_NORMAL, s, "Calling :");
- send_text(TEXT_LINE1, TEXT_NORMAL, s, s->device->phone_number);
- send_text(TEXT_LINE2, TEXT_NORMAL, s, "Dialing...");
+
+ if (s->device->height == 1) {
+ send_text(TEXT_LINE0, TEXT_NORMAL, s, s->device->phone_number);
+ } else {
+ send_text(TEXT_LINE0, TEXT_NORMAL, s, "Calling :");
+ send_text(TEXT_LINE1, TEXT_NORMAL, s, s->device->phone_number);
+ send_text(TEXT_LINE2, TEXT_NORMAL, s, "Dialing...");
+ }
send_text_status(s, "Hangup");
+
/* start switch */
if (ast_pthread_create(&t, NULL, unistim_ss, c)) {
display_last_error("Unable to create switch thread");
@@ -2426,9 +2455,14 @@
/* Swap things around between the three-way and real call */
swap_subs(p, SUB_THREEWAY, SUB_REAL);
send_select_output(s, s->device->output, s->device->volume, MUTE_OFF);
- send_text(TEXT_LINE0, TEXT_NORMAL, s, "Calling (pre-transfer)");
- send_text(TEXT_LINE1, TEXT_NORMAL, s, s->device->phone_number);
- send_text(TEXT_LINE2, TEXT_NORMAL, s, "Dialing...");
+
+ if (s->device->height == 1) {
+ send_text(TEXT_LINE0, TEXT_NORMAL, s, s->device->phone_number);
+ } else {
+ send_text(TEXT_LINE0, TEXT_NORMAL, s, "Calling (pre-transfer)");
+ send_text(TEXT_LINE1, TEXT_NORMAL, s, s->device->phone_number);
+ send_text(TEXT_LINE2, TEXT_NORMAL, s, "Dialing...");
+ }
send_text_status(s, "TransfrCancel");
if (ast_pthread_create(&t, NULL, unistim_ss, p->subs[SUB_THREEWAY]->owner)) {
@@ -2691,7 +2725,11 @@
pte->device->phone_number[i] = keycode;
pte->device->size_phone_number++;
pte->device->phone_number[i + 1] = 0;
- send_text(TEXT_LINE2, TEXT_NORMAL, pte, tmpbuf);
+ if (pte->device->height == 1) {
+ send_text(TEXT_LINE0, TEXT_NORMAL, pte, tmpbuf);
+ } else {
+ send_text(TEXT_LINE2, TEXT_NORMAL, pte, tmpbuf);
+ }
send_blink_cursor(pte);
send_cursor_pos(pte, (unsigned char) (TEXT_LINE2 + 0x0a + i));
return;
@@ -2699,9 +2737,15 @@
if (keycode == KEY_FUNC4) {
pte->device->size_phone_number = 0;
- send_text(TEXT_LINE2, TEXT_NORMAL, pte, "Number : ...............");
- send_blink_cursor(pte);
- send_cursor_pos(pte, TEXT_LINE2 + 0x09);
+ if (pte->device->height == 1) {
+ send_text(TEXT_LINE0, TEXT_NORMAL, pte, "Number : ...............");
+ send_blink_cursor(pte);
+ send_cursor_pos(pte, TEXT_LINE0 + 0x09);
+ } else {
+ send_text(TEXT_LINE2, TEXT_NORMAL, pte, "Number : ...............");
+ send_blink_cursor(pte);
+ send_cursor_pos(pte, TEXT_LINE2 + 0x09);
+ }
return;
}
@@ -2739,10 +2783,16 @@
ast_moh_stop(ast_bridged_channel(pte->device->lines->subs[SUB_REAL]->owner));
pte->device->moh = 0;
pte->state = STATE_CALL;
- send_text(TEXT_LINE0, TEXT_NORMAL, pte, "Dialing canceled,");
- send_text(TEXT_LINE1, TEXT_NORMAL, pte, "switching back to");
- send_text(TEXT_LINE2, TEXT_NORMAL, pte, "previous call.");
+
+ if (pte->device->height == 1) {
+ send_text(TEXT_LINE0, TEXT_NORMAL, pte, "Dial Cancel,back to priv. call.");
+ } else {
+ send_text(TEXT_LINE0, TEXT_NORMAL, pte, "Dialing canceled,");
+ send_text(TEXT_LINE1, TEXT_NORMAL, pte, "switching back to");
+ send_text(TEXT_LINE2, TEXT_NORMAL, pte, "previous call.");
+ }
send_text_status(pte, "Hangup Transf");
+
} else
show_main_page(pte);
break;
@@ -3099,8 +3149,12 @@
send_favorite(pte->device->softkeylinepos, FAV_ICON_ONHOOK_BLACK, pte,
pte->device->softkeylabel[pte->device->softkeylinepos]);
if (!ast_strlen_zero(pte->device->call_forward)) {
- send_text(TEXT_LINE0, TEXT_NORMAL, pte, "Call forwarded to :");
- send_text(TEXT_LINE1, TEXT_NORMAL, pte, pte->device->call_forward);
+ if (pte->device->height == 1) {
+ send_text(TEXT_LINE0, TEXT_NORMAL, pte, "Forwarding ON");
+ } else {
+ send_text(TEXT_LINE0, TEXT_NORMAL, pte, "Call forwarded to :");
+ send_text(TEXT_LINE1, TEXT_NORMAL, pte, pte->device->call_forward);
+ }
Sendicon(TEXT_LINE0, FAV_ICON_REFLECT + FAV_BLINK_SLOW, pte);
send_text_status(pte, "Dial Redial NoForwd");
} else {
@@ -3683,10 +3737,18 @@
if (sub->owner) {
if (sub->owner->connected.id.number) {
- send_text(TEXT_LINE1, TEXT_NORMAL, session, sub->owner->connected.id.number);
+ if (session->device->height == 1) {
+ send_text(TEXT_LINE0, TEXT_NORMAL, session, sub->owner->connected.id.number);
+ } else {
+ send_text(TEXT_LINE1, TEXT_NORMAL, session, sub->owner->connected.id.number);
+ }
change_callerid(session, 0, sub->owner->connected.id.number);
} else {
- send_text(TEXT_LINE1, TEXT_NORMAL, session, DEFAULTCALLERID);
+ if (session->device->height == 1) {
+ send_text(TEXT_LINE0, TEXT_NORMAL, session, DEFAULTCALLERID);
+ } else {
+ send_text(TEXT_LINE1, TEXT_NORMAL, session, DEFAULTCALLERID);
+ }
change_callerid(session, 0, DEFAULTCALLERID);
}
if (sub->owner->connected.id.name) {
@@ -3697,8 +3759,9 @@
change_callerid(session, 1, DEFAULTCALLERNAME);
}
}
+
send_text(TEXT_LINE2, TEXT_NORMAL, session, "is calling you.");
- send_text_status(session, "Accept Ignore");
+ send_text_status(session, "Accept Ignore");
if (sub->ringstyle == -1)
send_ring(session, session->device->ringvolume, session->device->ringstyle);
@@ -4364,8 +4427,12 @@
}
if (size <= TEXT_LENGTH_MAX * 2) {
- send_text(TEXT_LINE0, TEXT_NORMAL, pte, "Message :");
- send_text(TEXT_LINE1, TEXT_NORMAL, pte, text);
+ if (pte->device->height == 1) {
+ send_text(TEXT_LINE0, TEXT_NORMAL, pte, text);
+ } else {
+ send_text(TEXT_LINE0, TEXT_NORMAL, pte, "Message :");
+ send_text(TEXT_LINE1, TEXT_NORMAL, pte, text);
+ }
if (size <= TEXT_LENGTH_MAX) {
send_text(TEXT_LINE2, TEXT_NORMAL, pte, "");
return 0;
@@ -5057,6 +5124,7 @@
d->previous_output = OUTPUT_HANDSET;
d->volume = VOLUME_LOW;
d->mute = MUTE_OFF;
+ d->height = DEFAULTHEIGHT;
linelabel[0] = '\0';
dateformat = 1;
timeformat = 1;
@@ -5219,6 +5287,10 @@
l->next = d->lines;
d->lines = l;
}
+ } else if (!strcasecmp(v->name, "height")) {
+ /* Allow the user to lower the expected display lines on the phone
+ * For example the Nortal I2001 and I2002 only have one ! */
+ d->height = atoi(v->value);
} else
ast_log(LOG_WARNING, "Don't know keyword '%s' at line %d\n", v->name,
v->lineno);
Modified: trunk/configs/unistim.conf.sample
URL: http://svnview.digium.com/svn/asterisk/trunk/configs/unistim.conf.sample?view=diff&rev=275466&r1=275465&r2=275466
==============================================================================
--- trunk/configs/unistim.conf.sample (original)
+++ trunk/configs/unistim.conf.sample Sat Jul 10 09:44:18 2010
@@ -48,6 +48,8 @@
;rtp_method=0 ; If you don't have sound, you can try 1, 2 or 3, default = 0
;status_method=0 ; If you don't see status text, try 1, default = 0
;titledefault=Asterisk ; default = "TimeZone (your time zone)". 12 characters max
+;height=3 ; default = 3, the number of display lines the device can show
+ ; For example on a Nortel I2001 or I2002, set this to 1
;maintext0="you can insert" ; default = "Welcome", 24 characters max
;maintext1="a custom text" ; default = the name of the device, 24 characters max
;maintext2="(main page)" ; default = the public IP of the phone, 24 characters max
More information about the svn-commits
mailing list