Index: channels/chan_unistim.c =================================================================== --- channels/chan_unistim.c (revision 274278) +++ channels/chan_unistim.c (working copy) @@ -9,6 +9,11 @@ * * Asterisk 1.4 patch by Peter Be * + * Initial i2002 Single line display support by Takao Takahashi + * http://vopi-info.jp + * Modified for 1.6 and "height" support by Mina Naguib + * + * * See http://www.asterisk.org for more information about * the Asterisk project. Please do not directly contact * any of the maintainers of this project for assistance; @@ -76,6 +81,7 @@ #define DEFAULTCONTEXT "default" #define DEFAULTCALLERID "Unknown" #define DEFAULTCALLERNAME " " +#define DEFAULTHEIGHT 3 #define USTM_LOG_DIR "unistimHistory" /*! Size of the transmit buffer */ @@ -433,6 +439,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 */ @@ -2274,11 +2281,22 @@ 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; } @@ -2289,13 +2307,25 @@ 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); @@ -2370,10 +2400,17 @@ 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"); @@ -2420,9 +2457,15 @@ /* 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)) { @@ -2685,7 +2728,12 @@ 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; @@ -2693,9 +2741,16 @@ 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; } @@ -2733,10 +2788,17 @@ 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; @@ -3093,8 +3155,13 @@ 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 { @@ -3677,10 +3744,20 @@ 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) { @@ -3691,8 +3768,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); @@ -4358,8 +4436,13 @@ } 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; @@ -5051,6 +5134,7 @@ d->previous_output = OUTPUT_HANDSET; d->volume = VOLUME_LOW; d->mute = MUTE_OFF; + d->height = DEFAULTHEIGHT; linelabel[0] = '\0'; dateformat = 1; timeformat = 1; @@ -5213,6 +5297,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); Index: configs/unistim.conf.sample =================================================================== --- configs/unistim.conf.sample (revision 274278) +++ configs/unistim.conf.sample (working copy) @@ -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