[Asterisk-cvs] asterisk/channels chan_skinny.c,1.63,1.64
markster at lists.digium.com
markster at lists.digium.com
Mon Jan 24 21:38:46 CST 2005
- Previous message: [Asterisk-cvs] libpri q931.c,1.107,1.108
- Next message: [Asterisk-cvs] asterisk .cleancount, 1.2, 1.3 Makefile, 1.131,
1.132 asterisk.c, 1.136, 1.137 config.c, 1.49, 1.50 enum.c,
1.20, 1.21 loader.c, 1.36, 1.37 logger.c, 1.54, 1.55 manager.c,
1.81, 1.82 rtp.c, 1.107, 1.108
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv26486/channels
Modified Files:
chan_skinny.c
Log Message:
Improve skinny display (bug #3416)
Index: chan_skinny.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_skinny.c,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -d -r1.63 -r1.64
--- chan_skinny.c 21 Jan 2005 07:06:24 -0000 1.63
+++ chan_skinny.c 25 Jan 2005 03:41:05 -0000 1.64
@@ -256,6 +256,8 @@
char text[40];
} displaytext_message;
+#define CLEAR_DISPLAY_MESSAGE 0x009A
+
#define REGISTER_REJ_MESSAGE 0x009D
typedef struct register_rej_message {
char errMsg[33];
@@ -934,6 +936,32 @@
transmit_response(s, req);
}
+static void transmit_displaymessage(struct skinnysession *s, char *text)
+{
+ skinny_req *req;
+
+ if (text == 0) {
+ req = req_alloc(4);
+ req->len = 4;
+ req->e = CLEAR_DISPLAY_MESSAGE;
+ } else {
+ req = req_alloc(sizeof(struct displaytext_message));
+
+ strncpy(req->data.displaytext.text, text, sizeof(req->data.displaytext.text)-1);
+ req->len = sizeof(displaytext_message) + 4;
+ req->e = DISPLAYTEXT_MESSAGE;
+ if (skinnydebug) {
+ ast_verbose("Displaying message '%s'\n", req->data.displaytext.text);
+ }
+ }
+
+ if (!req) {
+ ast_log(LOG_ERROR, "Unable to allocate skinny_request, this is bad\n");
+ return;
+ }
+ transmit_response(s, req);
+}
+
/* I do not believe skinny can deal with video.
Anyone know differently? */
static struct ast_rtp *skinny_get_vrtp_peer(struct ast_channel *chan)
@@ -1508,6 +1536,51 @@
transmit_lamp_indication(session, l->instance, SKINNY_LAMP_BLINK);
transmit_ringer_mode(session, SKINNY_RING_INSIDE);
+
+ if (ast->cid.cid_num){
+
+ char ciddisplay[41] = "";
+
+ /* We'll assume that if it is 10 numbers, it is a standard NANPA number
+ Why? Because I am bloody American, and I'm bigoted that way. */
+
+ if (strlen(ast->cid.cid_num) == 10) {
+
+ strcat (ciddisplay, "(");
+ strncat (ciddisplay, ast->cid.cid_num,3);
+ strcat (ciddisplay, ") ");
+
+ strncat (ciddisplay, &ast->cid.cid_num[3],3);
+ strcat (ciddisplay,"-");
+ strncat (ciddisplay, &ast->cid.cid_num[6],4);
+
+ strncat (ciddisplay, " ", 6);
+
+ strncat (ciddisplay, ast->cid.cid_name,17);
+ } else {
+ if (strlen(ast->cid.cid_num) < 40) {
+ strncpy(ciddisplay,ast->cid.cid_num,strlen(ast->cid.cid_num));
+ strcat (ciddisplay," -- ");
+
+ if (sizeof(ast->cid.cid_name) > (40 - (strlen(ast->cid.cid_num) + 4))) {
+ strncat (ciddisplay, ast->cid.cid_name, (40 - (strlen(ast->cid.cid_num) + 4)));
+ } else {
+ strncat (ciddisplay, ast->cid.cid_name, strlen(ast->cid.cid_name));
+ }
+ } else {
+ strncpy(ciddisplay, "Number too long!", 15);
+ }
+ }
+
+ if (skinnydebug) {
+ ast_verbose("Trying to send: '%s'\n",ciddisplay);
+ }
+
+ transmit_displaymessage(session, ciddisplay);
+ }else{
+ transmit_displaymessage(session, "Unknown Name");
+ }
+
transmit_tone(session, tone);
transmit_callstate(session, l->instance, SKINNY_RINGIN, sub->callid);
@@ -1551,12 +1624,22 @@
if ((sub->parent->type = TYPE_LINE) && (sub->parent->hookstate == SKINNY_OFFHOOK)) {
sub->parent->hookstate = SKINNY_ONHOOK;
transmit_callstate(s, l->instance, SKINNY_ONHOOK, sub->callid);
+ transmit_lamp_indication(s, l->instance, SKINNY_LAMP_OFF);
+ if (skinnydebug) {
+ ast_verbose("Attempting to Clear display on Skinny %s@%s\n",sub->parent->name, sub->parent->parent->name);
+ }
+ transmit_displaymessage(s, 0); /* clear display */
transmit_speaker_mode(s, SKINNY_SPEAKEROFF);
} else if ((sub->parent->type = TYPE_LINE) && (sub->parent->hookstate == SKINNY_ONHOOK)) {
transmit_callstate(s, l->instance, SKINNY_ONHOOK, sub->callid);
transmit_speaker_mode(s, SKINNY_SPEAKEROFF);
transmit_ringer_mode(s, SKINNY_RING_OFF);
transmit_tone(s, SKINNY_SILENCE);
+ transmit_lamp_indication(s, l->instance, SKINNY_LAMP_OFF);
+ if (skinnydebug) {
+ ast_verbose("Attempting to Clear display on Skinny %s@%s\n",sub->parent->name, sub->parent->parent->name);
+ }
+ transmit_displaymessage(s, 0); /* clear display */
}
}
ast_mutex_lock(&sub->lock);
@@ -2182,6 +2265,13 @@
}
}
+ if (skinnydebug) {
+ ast_verbose("Attempting to Clear display on Skinny %s@%s\n",sub->parent->name, sub->parent->parent->name);
+ }
+
+ transmit_displaymessage(s, 0); /* clear display */
+
+
if ((sub->parent->hookstate == SKINNY_ONHOOK) && (!sub->next->rtp)) {
if (has_voicemail(sub->parent)) {
transmit_lamp_indication(s, s->device->lines->instance, SKINNY_LAMP_FLASH);
- Previous message: [Asterisk-cvs] libpri q931.c,1.107,1.108
- Next message: [Asterisk-cvs] asterisk .cleancount, 1.2, 1.3 Makefile, 1.131,
1.132 asterisk.c, 1.136, 1.137 config.c, 1.49, 1.50 enum.c,
1.20, 1.21 loader.c, 1.36, 1.37 logger.c, 1.54, 1.55 manager.c,
1.81, 1.82 rtp.c, 1.107, 1.108
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the svn-commits
mailing list