[asterisk-commits] mvanbaak: trunk r135300 - /trunk/channels/chan_skinny.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Aug 2 07:29:24 CDT 2008


Author: mvanbaak
Date: Sat Aug  2 07:29:23 2008
New Revision: 135300

URL: http://svn.digium.com/view/asterisk?view=rev&rev=135300
Log:
pass device instead of session to transmit_ functions.

(closes issue #10396)
Reported by: wedhorn
Patches:
      transmit3a.diff uploaded by wedhorn (license 30)
Tested by: wedhorn, mvanbaak

Modified:
    trunk/channels/chan_skinny.c

Modified: trunk/channels/chan_skinny.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_skinny.c?view=diff&rev=135300&r1=135299&r2=135300
==============================================================================
--- trunk/channels/chan_skinny.c (original)
+++ trunk/channels/chan_skinny.c Sat Aug  2 07:29:23 2008
@@ -1823,8 +1823,9 @@
 	return -1; /* main loop will destroy the session */
 }
 
-static int transmit_response(struct skinnysession *s, struct skinny_req *req)
-{
+static int transmit_response(struct skinny_device *d, struct skinny_req *req)
+{
+	struct skinnysession *s = d->session;
 	int res = 0;
 
 	if (!s) {
@@ -1863,7 +1864,7 @@
 	return 1;
 }
 
-static void transmit_speaker_mode(struct skinnysession *s, int mode)
+static void transmit_speaker_mode(struct skinny_device *d, int mode)
 {
 	struct skinny_req *req;
 
@@ -1871,10 +1872,10 @@
 		return;
 
 	req->data.setspeaker.mode = htolel(mode);
-	transmit_response(s, req);
+	transmit_response(d, req);
 }
 /*
-static void transmit_microphone_mode(struct skinnysession *s, int mode)
+static void transmit_microphone_mode(struct skinny_device *d, int mode)
 {
 	struct skinny_req *req;
 
@@ -1882,23 +1883,23 @@
 		return;
 
 	req->data.setmicrophone.mode = htolel(mode);
-	transmit_response(s, req);
+	transmit_response(d, req);
 }
 */
 
-static void transmit_callinfo(struct skinnysession *s, const char *fromname, const char *fromnum, const char *toname, const char *tonum, int instance, int callid, int calltype)
+static void transmit_callinfo(struct skinny_device *d, const char *fromname, const char *fromnum, const char *toname, const char *tonum, int instance, int callid, int calltype)
 {
 	struct skinny_req *req;
 
-	/* We should not be able to get here without a session */
-	if (!s)
+	/* We should not be able to get here without a device */
+	if (!d)
 		return;
 
 	if (!(req = req_alloc(sizeof(struct call_info_message), CALL_INFO_MESSAGE)))
 		return;
 
 	if (skinnydebug)
-			ast_verb(1, "Setting Callinfo to %s(%s) from %s(%s) on %s(%d)\n", fromname, fromnum, toname, tonum, s->device->name, instance);
+			ast_verb(1, "Setting Callinfo to %s(%s) from %s(%s) on %s(%d)\n", fromname, fromnum, toname, tonum, d->name, instance);
 
 	if (fromname) {
 		ast_copy_string(req->data.callinfo.callingPartyName, fromname, sizeof(req->data.callinfo.callingPartyName));
@@ -1915,10 +1916,10 @@
 	req->data.callinfo.instance = htolel(instance);
 	req->data.callinfo.reference = htolel(callid);
 	req->data.callinfo.type = htolel(calltype);
-	transmit_response(s, req);
-}
-
-static void transmit_connect(struct skinnysession *s, struct skinny_subchannel *sub)
+	transmit_response(d, req);
+}
+
+static void transmit_connect(struct skinny_device *d, struct skinny_subchannel *sub)
 {
 	struct skinny_req *req;
 	struct skinny_line *l = sub->parent;
@@ -1935,10 +1936,10 @@
 	req->data.openreceivechannel.capability = htolel(codec_ast2skinny(fmt.bits));
 	req->data.openreceivechannel.echo = htolel(0);
 	req->data.openreceivechannel.bitrate = htolel(0);
-	transmit_response(s, req);
-}
-
-static void transmit_tone(struct skinnysession *s, int tone, int instance, int reference)
+	transmit_response(d, req);
+}
+
+static void transmit_tone(struct skinny_device *d, int tone, int instance, int reference)
 {
 	struct skinny_req *req;
 
@@ -1963,10 +1964,10 @@
 	if (tone > 0) {
 		req->data.starttone.tone = htolel(tone);
 	}
-	transmit_response(s, req);
-}
-
-static void transmit_selectsoftkeys(struct skinnysession *s, int instance, int callid, int softkey)
+	transmit_response(d, req);
+}
+
+static void transmit_selectsoftkeys(struct skinny_device *d, int instance, int callid, int softkey)
 {
 	struct skinny_req *req;
 
@@ -1977,10 +1978,10 @@
 	req->data.selectsoftkey.reference = htolel(callid);
 	req->data.selectsoftkey.softKeySetIndex = htolel(softkey);
 	req->data.selectsoftkey.validKeyMask = htolel(0xFFFFFFFF);
-	transmit_response(s, req);
-}
-
-static void transmit_lamp_indication(struct skinnysession *s, int stimulus, int instance, int indication)
+	transmit_response(d, req);
+}
+
+static void transmit_lamp_indication(struct skinny_device *d, int stimulus, int instance, int indication)
 {
 	struct skinny_req *req;
 
@@ -1990,10 +1991,10 @@
 	req->data.setlamp.stimulus = htolel(stimulus);
 	req->data.setlamp.stimulusInstance = htolel(instance);
 	req->data.setlamp.deviceStimulus = htolel(indication);
-	transmit_response(s, req);
-}
-
-static void transmit_ringer_mode(struct skinnysession *s, int mode)
+	transmit_response(d, req);
+}
+
+static void transmit_ringer_mode(struct skinny_device *d, int mode)
 {
 	struct skinny_req *req;
 
@@ -2015,10 +2016,10 @@
 	/* XXX the value here doesn't seem to change anything.  Must be higher than 0.
 	   Perhaps a packet capture can shed some light on this. */
 	req->data.setringer.unknown2 = htolel(1);
-	transmit_response(s, req);
-}
-
-static void transmit_displaymessage(struct skinnysession *s, const char *text, int instance, int reference)
+	transmit_response(d, req);
+}
+
+static void transmit_displaymessage(struct skinny_device *d, const char *text, int instance, int reference)
 {
 	struct skinny_req *req;
 
@@ -2040,10 +2041,10 @@
 			ast_verb(1, "Displaying message '%s'\n", req->data.displaytext.text);
 	}
 
-	transmit_response(s, req);
-}
-
-static void transmit_displaynotify(struct skinnysession *s, const char *text, int t)
+	transmit_response(d, req);
+}
+
+static void transmit_displaynotify(struct skinny_device *d, const char *text, int t)
 {
 	struct skinny_req *req;
 
@@ -2056,10 +2057,10 @@
 	if (skinnydebug)
 		ast_verb(1, "Displaying notify '%s'\n", text);
 
-	transmit_response(s, req);
-}
-
-static void transmit_displaypromptstatus(struct skinnysession *s, const char *text, int t, int instance, int callid)
+	transmit_response(d, req);
+}
+
+static void transmit_displaypromptstatus(struct skinny_device *d, const char *text, int t, int instance, int callid)
 {
 	struct skinny_req *req;
 
@@ -2085,10 +2086,10 @@
 			ast_verb(1, "Displaying Prompt Status '%s'\n", text);
 	}
 
-	transmit_response(s, req);
-}
-
-static void transmit_dialednumber(struct skinnysession *s, const char *text, int instance, int callid)
+	transmit_response(d, req);
+}
+
+static void transmit_dialednumber(struct skinny_device *d, const char *text, int instance, int callid)
 {
 	struct skinny_req *req;
 
@@ -2099,10 +2100,10 @@
 	req->data.dialednumber.lineInstance = htolel(instance);
 	req->data.dialednumber.callReference = htolel(callid);
 
-	transmit_response(s, req);
-}
-
-static void transmit_closereceivechannel(struct skinnysession *s, struct skinny_subchannel *sub)
+	transmit_response(d, req);
+}
+
+static void transmit_closereceivechannel(struct skinny_device *d, struct skinny_subchannel *sub)
 {
 	struct skinny_req *req;
 
@@ -2111,10 +2112,10 @@
 
 	req->data.closereceivechannel.conferenceId = htolel(0);
 	req->data.closereceivechannel.partyId = htolel(sub->callid);
-	transmit_response(s, req);
-}
-
-static void transmit_stopmediatransmission(struct skinnysession *s, struct skinny_subchannel *sub)
+	transmit_response(d, req);
+}
+
+static void transmit_stopmediatransmission(struct skinny_device *d, struct skinny_subchannel *sub)
 {
 	struct skinny_req *req;
 
@@ -2123,10 +2124,10 @@
 
 	req->data.stopmedia.conferenceId = htolel(0);
 	req->data.stopmedia.passThruPartyId = htolel(sub->callid);
-	transmit_response(s, req);
-}
-
-static void transmit_activatecallplane(struct skinnysession *s, struct skinny_line *l)
+	transmit_response(d, req);
+}
+
+static void transmit_activatecallplane(struct skinny_device *d, struct skinny_line *l)
 {
 	struct skinny_req *req;
 
@@ -2134,10 +2135,10 @@
 		return;
 
 	req->data.activatecallplane.lineInstance = htolel(l->instance);
-	transmit_response(s, req);
-}
-
-static void transmit_callstateonly(struct skinnysession *s, struct skinny_subchannel *sub, int state)
+	transmit_response(d, req);
+}
+
+static void transmit_callstateonly(struct skinny_device *d, struct skinny_subchannel *sub, int state)
 {
 	struct skinny_req *req;
 
@@ -2147,10 +2148,10 @@
 	req->data.callstate.callState = htolel(state);
 	req->data.callstate.lineInstance = htolel(sub->parent->instance);
 	req->data.callstate.callReference = htolel(sub->callid);
-	transmit_response(s, req);
-}
-
-static void transmit_callstate(struct skinnysession *s, int instance, int state, unsigned callid)
+	transmit_response(d, req);
+}
+
+static void transmit_callstate(struct skinny_device *d, int instance, int state, unsigned callid)
 {
 	struct skinny_req *req;
 
@@ -2160,18 +2161,18 @@
 
 		req->data.closereceivechannel.conferenceId = htolel(callid);
 		req->data.closereceivechannel.partyId = htolel(callid);
-		transmit_response(s, req);
+		transmit_response(d, req);
 
 		if (!(req = req_alloc(sizeof(struct stop_media_transmission_message), STOP_MEDIA_TRANSMISSION_MESSAGE)))
 			return;
 
 		req->data.stopmedia.conferenceId = htolel(callid);
 		req->data.stopmedia.passThruPartyId = htolel(callid);
-		transmit_response(s, req);
-
-		transmit_speaker_mode(s, SKINNY_SPEAKEROFF);
-
-		transmit_displaypromptstatus(s, NULL, 0, instance, callid);
+		transmit_response(d, req);
+
+		transmit_speaker_mode(d, SKINNY_SPEAKEROFF);
+
+		transmit_displaypromptstatus(d, NULL, 0, instance, callid);
 	}
 
 	if (!(req = req_alloc(sizeof(struct call_state_message), CALL_STATE_MESSAGE)))
@@ -2180,10 +2181,10 @@
 	req->data.callstate.callState = htolel(state);
 	req->data.callstate.lineInstance = htolel(instance);
 	req->data.callstate.callReference = htolel(callid);
-	transmit_response(s, req);
+	transmit_response(d, req);
 
 	if (state == SKINNY_ONHOOK) {
-		transmit_selectsoftkeys(s, 0, 0, KEYDEF_ONHOOK);
+		transmit_selectsoftkeys(d, 0, 0, KEYDEF_ONHOOK);
 	}
 
 	if (state == SKINNY_OFFHOOK || state == SKINNY_ONHOOK) {
@@ -2191,12 +2192,12 @@
 			return;
 
 		req->data.activatecallplane.lineInstance = htolel(instance);
-		transmit_response(s, req);
-	}
-}
-
-
-static void transmit_cfwdstate(struct skinnysession *s, struct skinny_line *l)
+		transmit_response(d, req);
+	}
+}
+
+
+static void transmit_cfwdstate(struct skinny_device *d, struct skinny_line *l)
 {
 	struct skinny_req *req;
 	int anyon = 0;
@@ -2237,14 +2238,13 @@
 	else
 		req->data.forwardstat.activeforward = htolel(0);
 
-	transmit_response(s, req);
+	transmit_response(d, req);
 }
 
 static int skinny_extensionstate_cb(char *context, char *exten, int state, void *data)
 {
 	struct skinny_speeddial *sd = data;
 	struct skinny_device *d = sd->parent;
-	struct skinnysession *s = d->session;
 	char hint[AST_MAX_EXTENSION];
 	int callstate = SKINNY_CALLREMOTEMULTILINE;
 	int lamp = SKINNY_LAMP_OFF;
@@ -2286,8 +2286,8 @@
 		}
 	}
 
-	transmit_lamp_indication(s, STIMULUS_LINE, sd->instance, lamp);
-	transmit_callstate(s, sd->instance, callstate, 0);
+	transmit_lamp_indication(d, STIMULUS_LINE, sd->instance, lamp);
+	transmit_callstate(d, sd->instance, callstate, 0);
 	sd->laststate = state;
 
 	return 0;
@@ -2343,17 +2343,17 @@
 				ast_verb(1, "Checking for voicemail Skinny %s@%s\n", l->name, d->name);
 			if (skinnydebug)
 				ast_verb(1, "Skinny %s@%s has voicemail!\n", l->name, d->name);
-			transmit_lamp_indication(s, STIMULUS_VOICEMAIL, l->instance, l->mwiblink?SKINNY_LAMP_BLINK:SKINNY_LAMP_ON);
+			transmit_lamp_indication(d, STIMULUS_VOICEMAIL, l->instance, l->mwiblink?SKINNY_LAMP_BLINK:SKINNY_LAMP_ON);
 			device_lamp++;
 		} else {
-			transmit_lamp_indication(s, STIMULUS_VOICEMAIL, l->instance, SKINNY_LAMP_OFF);
+			transmit_lamp_indication(d, STIMULUS_VOICEMAIL, l->instance, SKINNY_LAMP_OFF);
 		}
 	}
 	/* If at least one line has VM, turn the device level lamp on */
 	if (device_lamp)
-		transmit_lamp_indication(s, STIMULUS_VOICEMAIL, 0, SKINNY_LAMP_ON);
+		transmit_lamp_indication(d, STIMULUS_VOICEMAIL, 0, SKINNY_LAMP_ON);
 	else
-		transmit_lamp_indication(s, STIMULUS_VOICEMAIL, 0, SKINNY_LAMP_OFF);
+		transmit_lamp_indication(d, STIMULUS_VOICEMAIL, 0, SKINNY_LAMP_OFF);
 }
 
 /* I do not believe skinny can deal with video.
@@ -2440,7 +2440,7 @@
 
 		req->data.stopmedia.conferenceId = htolel(sub->callid);
 		req->data.stopmedia.passThruPartyId = htolel(sub->callid);
-		transmit_response(s, req);
+		transmit_response(d, req);
 
 		if (skinnydebug)
 			ast_verb(1, "Peerip = %s:%d\n", ast_inet_ntoa(them.sin_addr), ntohs(them.sin_port));
@@ -2469,7 +2469,7 @@
 		req->data.startmedia.qualifier.vad = htolel(0);
 		req->data.startmedia.qualifier.packets = htolel(0);
 		req->data.startmedia.qualifier.bitRate = htolel(0);
-		transmit_response(s, req);
+		transmit_response(d, req);
 
 		return 0;
 	}
@@ -2624,7 +2624,7 @@
 				req->data.reset.resetType = 1;
 
 			ast_verb(3, "%s device %s.\n", (fullrestart) ? "Restarting" : "Resetting", d->id);
-			transmit_response(d->session, req);
+			transmit_response(d, req);
 		}
 	}
 	AST_LIST_UNLOCK(&devices);
@@ -3261,7 +3261,7 @@
 		ast_rtp_codec_setpref(sub->rtp, &l->prefs);
 
 	/* Create the RTP connection */
-	transmit_connect(d->session, sub);
+	transmit_connect(d, sub);
 	ast_mutex_unlock(&sub->lock);
 }
 
@@ -3271,7 +3271,6 @@
 	struct skinny_subchannel *sub = c->tech_pvt;
 	struct skinny_line *l = sub->parent;
 	struct skinny_device *d = l->parent;
-	struct skinnysession *s = d->session;
 	int res = 0;
 
 	ast_copy_string(l->lastnumberdialed, c->exten, sizeof(l->lastnumberdialed));
@@ -3286,7 +3285,7 @@
 	res = ast_pbx_run(c);
 	if (res) {
 		ast_log(LOG_WARNING, "PBX exited non-zero\n");
-		transmit_tone(s, SKINNY_REORDER, l->instance, sub->callid);
+		transmit_tone(d, SKINNY_REORDER, l->instance, sub->callid);
 	}
 	return NULL;
 }
@@ -3297,7 +3296,6 @@
 	struct skinny_subchannel *sub = c->tech_pvt;
 	struct skinny_line *l = sub->parent;
 	struct skinny_device *d = l->parent;
-	struct skinnysession *s = d->session;
 	int len = 0;
 	int timeout = firstdigittimeout;
 	int res = 0;
@@ -3323,7 +3321,7 @@
 		len = strlen(d->exten);
 
 		if (!ast_ignore_pattern(c->context, d->exten)) {
-			transmit_tone(s, SKINNY_SILENCE, l->instance, sub->callid);
+			transmit_tone(d, SKINNY_SILENCE, l->instance, sub->callid);
 		}
 		if (ast_exists_extension(c, c->context, d->exten, 1, l->cid_num)) {
 			if (!res || !ast_matchmore_extension(c, c->context, d->exten, 1, l->cid_num)) {
@@ -3332,10 +3330,10 @@
 					set_callforwards(l, d->exten, l->getforward);
 					ast_verb(3, "Setting call forward (%d) to '%s' on channel %s\n",
 							l->cfwdtype, d->exten, c->name);
-					transmit_tone(s, SKINNY_DIALTONE, l->instance, sub->callid);
-					transmit_lamp_indication(s, STIMULUS_FORWARDALL, 1, SKINNY_LAMP_ON);
-					transmit_displaynotify(s, "CFwd enabled", 10);
-					transmit_cfwdstate(s, l);
+					transmit_tone(d, SKINNY_DIALTONE, l->instance, sub->callid);
+					transmit_lamp_indication(d, STIMULUS_FORWARDALL, 1, SKINNY_LAMP_ON);
+					transmit_displaynotify(d, "CFwd enabled", 10);
+					transmit_cfwdstate(d, l);
 					ast_safe_sleep(c, 500);
 					ast_indicate(c, -1);
 					ast_safe_sleep(c, 1000);
@@ -3362,7 +3360,7 @@
 		} else if (res == 0) {
 			ast_debug(1, "Not enough digits (%s) (and no ambiguous match)...\n", d->exten);
 			memset(d->exten, 0, sizeof(d->exten));
-			transmit_tone(s, SKINNY_REORDER, l->instance, sub->callid);
+			transmit_tone(d, SKINNY_REORDER, l->instance, sub->callid);
 			if (sub->owner && sub->owner->_state != AST_STATE_UP) {
 				ast_indicate(c, -1);
 				ast_hangup(c);
@@ -3372,7 +3370,7 @@
 			   ((d->exten[0] != '*') || (!ast_strlen_zero(d->exten) > 2))) {
 			ast_log(LOG_WARNING, "Can't match [%s] from '%s' in context %s\n", d->exten, c->cid.cid_num ? c->cid.cid_num : "<Unknown Caller>", c->context);
 			memset(d->exten, 0, sizeof(d->exten));
-			transmit_tone(s, SKINNY_REORDER, l->instance, sub->callid);
+			transmit_tone(d, SKINNY_REORDER, l->instance, sub->callid);
 			/* hang out for 3 seconds to let congestion play */
 			ast_safe_sleep(c, 3000);
 			break;
@@ -3399,7 +3397,6 @@
 	struct skinny_subchannel *sub = ast->tech_pvt;
 	struct skinny_line *l = sub->parent;
 	struct skinny_device *d = l->parent;
-	struct skinnysession *s = d->session;
 
 	if (!d->registered) {
 		ast_log(LOG_ERROR, "Device not registered, cannot call %s\n", dest);
@@ -3431,12 +3428,12 @@
 		break;
 	}
 
-	transmit_callstateonly(s, sub, SKINNY_RINGIN);
-	transmit_selectsoftkeys(s, l->instance, sub->callid, KEYDEF_RINGIN);
-	transmit_displaypromptstatus(s, "Ring-In", 0, l->instance, sub->callid);
-	transmit_callinfo(s, ast->cid.cid_name, ast->cid.cid_num, l->cid_name, l->cid_num, l->instance, sub->callid, 1);
-	transmit_lamp_indication(s, STIMULUS_LINE, l->instance, SKINNY_LAMP_BLINK);
-	transmit_ringer_mode(s, SKINNY_RING_INSIDE);
+	transmit_callstateonly(d, sub, SKINNY_RINGIN);
+	transmit_selectsoftkeys(d, l->instance, sub->callid, KEYDEF_RINGIN);
+	transmit_displaypromptstatus(d, "Ring-In", 0, l->instance, sub->callid);
+	transmit_callinfo(d, ast->cid.cid_name, ast->cid.cid_num, l->cid_name, l->cid_num, l->instance, sub->callid, 1);
+	transmit_lamp_indication(d, STIMULUS_LINE, l->instance, SKINNY_LAMP_BLINK);
+	transmit_ringer_mode(d, SKINNY_RING_INSIDE);
 
 	ast_setstate(ast, AST_STATE_RINGING);
 	ast_queue_control(ast, AST_CONTROL_RINGING);
@@ -3479,30 +3476,30 @@
 						l->activesub = AST_LIST_FIRST(&l->sub);
 					}
 				}
-				transmit_callstate(s, l->instance, SKINNY_ONHOOK, sub->callid);
-				transmit_activatecallplane(s, l);
-				transmit_closereceivechannel(s,sub);
-				transmit_stopmediatransmission(s,sub);
-				transmit_lamp_indication(s, STIMULUS_LINE, l->instance, SKINNY_LAMP_BLINK);
+				transmit_callstate(d, l->instance, SKINNY_ONHOOK, sub->callid);
+				transmit_activatecallplane(d, l);
+				transmit_closereceivechannel(d,sub);
+				transmit_stopmediatransmission(d,sub);
+				transmit_lamp_indication(d, STIMULUS_LINE, l->instance, SKINNY_LAMP_BLINK);
 			} else {    /* we are killing a background sub on the line with other subs*/
 				if (AST_LIST_NEXT(sub, list)) {
-					transmit_lamp_indication(s, STIMULUS_LINE, l->instance, SKINNY_LAMP_BLINK);
+					transmit_lamp_indication(d, STIMULUS_LINE, l->instance, SKINNY_LAMP_BLINK);
 				} else {
-					transmit_lamp_indication(s, STIMULUS_LINE, l->instance, SKINNY_LAMP_ON);
+					transmit_lamp_indication(d, STIMULUS_LINE, l->instance, SKINNY_LAMP_ON);
 				}
 			}
 		} else {                                                /* no more subs on line so make idle */
 
 			l->hookstate = SKINNY_ONHOOK;
-			transmit_callstate(s, l->instance, SKINNY_ONHOOK, sub->callid);
+			transmit_callstate(d, l->instance, SKINNY_ONHOOK, sub->callid);
 			l->activesub = NULL;
-			transmit_lamp_indication(s, STIMULUS_LINE, l->instance, SKINNY_LAMP_OFF);
+			transmit_lamp_indication(d, STIMULUS_LINE, l->instance, SKINNY_LAMP_OFF);
 			if (sub->parent == d->activeline) {
-				transmit_activatecallplane(s, l);
-				transmit_closereceivechannel(s,sub);
-				transmit_stopmediatransmission(s,sub);
-				transmit_speaker_mode(s, SKINNY_SPEAKEROFF);
-				transmit_ringer_mode(s, SKINNY_RING_OFF);
+				transmit_activatecallplane(d, l);
+				transmit_closereceivechannel(d,sub);
+				transmit_stopmediatransmission(d,sub);
+				transmit_speaker_mode(d, SKINNY_SPEAKEROFF);
+				transmit_ringer_mode(d, SKINNY_RING_OFF);
 				/* we should check to see if we can start the ringer if another line is ringing */
 			}
 		}
@@ -3526,7 +3523,6 @@
 	struct skinny_subchannel *sub = ast->tech_pvt;
 	struct skinny_line *l = sub->parent;
 	struct skinny_device *d = l->parent;
-	struct skinnysession *s = d->session;
 	char exten[AST_MAX_EXTENSION] = "";
 
 	ast_copy_string(exten, S_OR(ast->macroexten, ast->exten), sizeof(exten));
@@ -3550,15 +3546,15 @@
 		ast_setstate(ast, AST_STATE_UP);
 	}
 
-	transmit_tone(s, SKINNY_SILENCE, l->instance, sub->callid);
+	transmit_tone(d, SKINNY_SILENCE, l->instance, sub->callid);
 	/* order matters here...
 	   for some reason, transmit_callinfo must be before transmit_callstate,
 	   or you won't get keypad messages in some situations. */
-	transmit_callinfo(s, ast->cid.cid_name, ast->cid.cid_num, exten, exten, l->instance, sub->callid, 2);
-	transmit_callstateonly(s, sub, SKINNY_CONNECTED);
-	transmit_selectsoftkeys(s, l->instance, sub->callid, KEYDEF_CONNECTED);
-	transmit_dialednumber(s, exten, l->instance, sub->callid);
-	transmit_displaypromptstatus(s, "Connected", 0, l->instance, sub->callid);
+	transmit_callinfo(d, ast->cid.cid_name, ast->cid.cid_num, exten, exten, l->instance, sub->callid, 2);
+	transmit_callstateonly(d, sub, SKINNY_CONNECTED);
+	transmit_selectsoftkeys(d, l->instance, sub->callid, KEYDEF_CONNECTED);
+	transmit_dialednumber(d, exten, l->instance, sub->callid);
+	transmit_displaypromptstatus(d, "Connected", 0, l->instance, sub->callid);
 	l->activesub = sub;
 	return res;
 }
@@ -3675,7 +3671,7 @@
 	int tmp;
 	/* not right */
 	sprintf(tmp, "%d", digit);
-	transmit_tone(d->session, digit, l->instance, sub->callid);
+	transmit_tone(d, digit, l->instance, sub->callid);
 #endif
 	return -1; /* Stop inband indications */
 }
@@ -3848,12 +3844,12 @@
 		if (ast->_state != AST_STATE_UP) {
 			if (!sub->progress) {
 				if (!d->earlyrtp) {
-					transmit_tone(s, SKINNY_ALERT, l->instance, sub->callid);
+					transmit_tone(d, SKINNY_ALERT, l->instance, sub->callid);
 				}
-				transmit_callstateonly(s, sub, SKINNY_RINGOUT);
-				transmit_dialednumber(s, exten, l->instance, sub->callid);
-				transmit_displaypromptstatus(s, "Ring Out", 0, l->instance, sub->callid);
-				transmit_callinfo(s, ast->cid.cid_name, ast->cid.cid_num, exten, exten, l->instance, sub->callid, 2); /* 2 = outgoing from phone */
+				transmit_callstateonly(d, sub, SKINNY_RINGOUT);
+				transmit_dialednumber(d, exten, l->instance, sub->callid);
+				transmit_displaypromptstatus(d, "Ring Out", 0, l->instance, sub->callid);
+				transmit_callinfo(d, ast->cid.cid_name, ast->cid.cid_num, exten, exten, l->instance, sub->callid, 2); /* 2 = outgoing from phone */
 				sub->ringing = 1;
 				if (!d->earlyrtp) {
 					break;
@@ -3864,9 +3860,9 @@
 	case AST_CONTROL_BUSY:
 		if (ast->_state != AST_STATE_UP) {
 			if (!d->earlyrtp) {
-				transmit_tone(s, SKINNY_BUSYTONE, l->instance, sub->callid);
-			}
-			transmit_callstateonly(s, sub, SKINNY_BUSY);
+				transmit_tone(d, SKINNY_BUSYTONE, l->instance, sub->callid);
+			}
+			transmit_callstateonly(d, sub, SKINNY_BUSY);
 			sub->alreadygone = 1;
 			ast_softhangup_nolock(ast, AST_SOFTHANGUP_DEV);
 			if (!d->earlyrtp) {
@@ -3877,9 +3873,9 @@
 	case AST_CONTROL_CONGESTION:
 		if (ast->_state != AST_STATE_UP) {
 			if (!d->earlyrtp) {
-				transmit_tone(s, SKINNY_REORDER, l->instance, sub->callid);
-			}
-			transmit_callstateonly(s, sub, SKINNY_CONGESTION);
+				transmit_tone(d, SKINNY_REORDER, l->instance, sub->callid);
+			}
+			transmit_callstateonly(d, sub, SKINNY_CONGESTION);
 			sub->alreadygone = 1;
 			ast_softhangup_nolock(ast, AST_SOFTHANGUP_DEV);
 			if (!d->earlyrtp) {
@@ -3890,11 +3886,11 @@
 	case AST_CONTROL_PROGRESS:
 		if ((ast->_state != AST_STATE_UP) && !sub->progress && !sub->outgoing) {
 			if (!d->earlyrtp) {
-				transmit_tone(s, SKINNY_ALERT, l->instance, sub->callid);
-			}
-			transmit_callstateonly(s, sub, SKINNY_PROGRESS);
-			transmit_displaypromptstatus(s, "Call Progress", 0, l->instance, sub->callid);
-			transmit_callinfo(s, ast->cid.cid_name, ast->cid.cid_num, exten, exten, l->instance, sub->callid, 2); /* 2 = outgoing from phone */
+				transmit_tone(d, SKINNY_ALERT, l->instance, sub->callid);
+			}
+			transmit_callstateonly(d, sub, SKINNY_PROGRESS);
+			transmit_displaypromptstatus(d, "Call Progress", 0, l->instance, sub->callid);
+			transmit_callinfo(d, ast->cid.cid_name, ast->cid.cid_num, exten, exten, l->instance, sub->callid, 2); /* 2 = outgoing from phone */
 			sub->progress = 1;
 			if (!d->earlyrtp) {
 				break;
@@ -3902,7 +3898,7 @@
 		}
 		return -1; /* Tell asterisk to provide inband signalling */
 	case -1:  /* STOP_TONE */
-		transmit_tone(s, SKINNY_SILENCE, l->instance, sub->callid);
+		transmit_tone(d, SKINNY_SILENCE, l->instance, sub->callid);
 		break;
 	case AST_CONTROL_HOLD:
 		ast_moh_start(ast, data, l->mohinterpret);
@@ -4029,7 +4025,6 @@
 {
 	struct skinny_line *l = sub->parent;
 	struct skinny_device *d = l->parent;
-	struct skinnysession *s = d->session;
 
 	/* Don't try to hold a channel that doesn't exist */
 	if (!sub || !sub->owner)
@@ -4043,12 +4038,12 @@
 		S_OR(l->mohsuggest, NULL),
 		!ast_strlen_zero(l->mohsuggest) ? strlen(l->mohsuggest) + 1 : 0);
 
-	transmit_activatecallplane(s, l);
-	transmit_closereceivechannel(s,sub);
-	transmit_stopmediatransmission(s,sub);
-
-	transmit_callstateonly(s, sub, SKINNY_HOLD);
-	transmit_lamp_indication(s, STIMULUS_LINE, l->instance, SKINNY_LAMP_WINK);
+	transmit_activatecallplane(d, l);
+	transmit_closereceivechannel(d,sub);
+	transmit_stopmediatransmission(d,sub);
+
+	transmit_callstateonly(d, sub, SKINNY_HOLD);
+	transmit_lamp_indication(d, STIMULUS_LINE, l->instance, SKINNY_LAMP_WINK);
 	sub->onhold = 1;
 	return 1;
 }
@@ -4057,7 +4052,6 @@
 {
 	struct skinny_line *l = sub->parent;
 	struct skinny_device *d = l->parent;
-	struct skinnysession *s = d->session;
 
 	/* Don't try to unhold a channel that doesn't exist */
 	if (!sub || !sub->owner)
@@ -4069,11 +4063,11 @@
 
 	ast_queue_control(sub->owner, AST_CONTROL_UNHOLD);
 
-	transmit_activatecallplane(s, l);
-
-	transmit_connect(s, sub);
-	transmit_callstateonly(s, sub, SKINNY_CONNECTED);
-	transmit_lamp_indication(s, STIMULUS_LINE, l->instance, SKINNY_LAMP_ON);
+	transmit_activatecallplane(d, l);
+
+	transmit_connect(d, sub);
+	transmit_callstateonly(d, sub, SKINNY_CONNECTED);
+	transmit_lamp_indication(d, STIMULUS_LINE, l->instance, SKINNY_LAMP_ON);
 	l->hookstate = SKINNY_OFFHOOK;
 	sub->onhold = 0;
 	return 1;
@@ -4090,10 +4084,10 @@
 	} else {
 		if (sub->onhold) {
 			skinny_unhold(sub);
-			transmit_selectsoftkeys(sub->parent->parent->session, sub->parent->instance, sub->callid, KEYDEF_CONNECTED);
+			transmit_selectsoftkeys(sub->parent->parent, sub->parent->instance, sub->callid, KEYDEF_CONNECTED);
 		} else {
 			skinny_hold(sub);
-			transmit_selectsoftkeys(sub->parent->parent->session, sub->parent->instance, sub->callid, KEYDEF_ONHOLD);
+			transmit_selectsoftkeys(sub->parent->parent, sub->parent->instance, sub->callid, KEYDEF_ONHOLD);
 		}
 	}
 	return 1;
@@ -4103,7 +4097,6 @@
 {
 	struct skinny_line *l = sub->parent;
 	struct skinny_device *d = l->parent;
-	struct skinnysession *s = d->session;
 	struct skinny_subchannel *newsub;
 	struct ast_channel *c;
 	pthread_t t;
@@ -4125,12 +4118,12 @@
 			sub->related = newsub;
 			newsub->xferor = 1;
 			l->activesub = newsub;
-			transmit_callstate(s, l->instance, SKINNY_OFFHOOK, newsub->callid);
+			transmit_callstate(d, l->instance, SKINNY_OFFHOOK, newsub->callid);
 			if (skinnydebug)
 				ast_debug(1, "Attempting to Clear display on Skinny %s@%s\n", l->name, d->name);
-			transmit_displaymessage(s, NULL, l->instance, newsub->callid); /* clear display */
-			transmit_tone(s, SKINNY_DIALTONE, l->instance, newsub->callid);
-			transmit_selectsoftkeys(s, l->instance, newsub->callid, KEYDEF_OFFHOOKWITHFEAT);
+			transmit_displaymessage(d, NULL, l->instance, newsub->callid); /* clear display */
+			transmit_tone(d, SKINNY_DIALTONE, l->instance, newsub->callid);
+			transmit_selectsoftkeys(d, l->instance, newsub->callid, KEYDEF_OFFHOOKWITHFEAT);
 			/* start the switch thread */
 			if (ast_pthread_create(&t, NULL, skinny_ss, c)) {
 				ast_log(LOG_WARNING, "Unable to create switch thread: %s\n", strerror(errno));
@@ -4166,13 +4159,14 @@
 	if (!(req = req_alloc(0, KEEP_ALIVE_ACK_MESSAGE)))
 		return -1;
 
-	transmit_response(s, req);
+	transmit_response(s->device, req);
 	do_housekeeping(s);
 	return 1;
 }
 
 static int handle_register_message(struct skinny_req *req, struct skinnysession *s)
 {
+	struct skinny_device *d;
 	char name[16];
 	int res;
 
@@ -4185,10 +4179,13 @@
 			return -1;
 
 		snprintf(req->data.regrej.errMsg, sizeof(req->data.regrej.errMsg), "No Authority: %s", name);
-		transmit_response(s, req);
+		d->session = s;
+		transmit_response(d, req);
 		return 0;
 	}
 	ast_verb(3, "Device '%s' successfully registered\n", name);
+	
+	d = s->device;
 
 	if (!(req = req_alloc(sizeof(struct register_ack_message), REGISTER_ACK_MESSAGE)))
 		return -1;
@@ -4200,14 +4197,14 @@
 	req->data.regack.res2[0] = '0';
 	req->data.regack.res2[1] = '\0';
 	req->data.regack.secondaryKeepAlive = htolel(keep_alive);
-	transmit_response(s, req);
+	transmit_response(d, req);
 	if (skinnydebug)
 		ast_verb(1, "Requesting capabilities\n");
 
 	if (!(req = req_alloc(0, CAPABILITIES_REQ_MESSAGE)))
 		return -1;
 
-	transmit_response(s, req);
+	transmit_response(d, req);
 
 	return res;
 }
@@ -4216,34 +4213,33 @@
 {
 	struct skinny_line *l = sub->parent;
 	struct skinny_device *d = l->parent;
-	struct skinnysession *s = d->session;
 	struct ast_channel *c = sub->owner;
 	pthread_t t;
 
 	if (l->hookstate == SKINNY_ONHOOK) {
 		l->hookstate = SKINNY_OFFHOOK;
-		transmit_speaker_mode(s, SKINNY_SPEAKERON);
-		transmit_callstate(s, l->instance, SKINNY_OFFHOOK, sub->callid);
+		transmit_speaker_mode(d, SKINNY_SPEAKERON);
+		transmit_callstate(d, l->instance, SKINNY_OFFHOOK, sub->callid);
 	}
 	if (skinnydebug)
 		ast_verb(1, "Attempting to Clear display on Skinny %s@%s\n", l->name, d->name);
-	transmit_displaymessage(s, NULL, l->instance, sub->callid); /* clear display */
+	transmit_displaymessage(d, NULL, l->instance, sub->callid); /* clear display */
 
 	if (l->cfwdtype & cfwdtype) {
 		set_callforwards(l, NULL, cfwdtype);
 		ast_safe_sleep(c, 500);
-		transmit_speaker_mode(s, SKINNY_SPEAKEROFF);
-		transmit_callstate(s, l->instance, SKINNY_ONHOOK, sub->callid);
-		transmit_displaynotify(s, "CFwd disabled", 10);
+		transmit_speaker_mode(d, SKINNY_SPEAKEROFF);
+		transmit_callstate(d, l->instance, SKINNY_ONHOOK, sub->callid);
+		transmit_displaynotify(d, "CFwd disabled", 10);
 		if (sub->owner && sub->owner->_state != AST_STATE_UP) {
 			ast_indicate(c, -1);
 			ast_hangup(c);
 		}
-		transmit_cfwdstate(s, l);
+		transmit_cfwdstate(d, l);
 	} else {
 		l->getforward = cfwdtype;
-		transmit_tone(s, SKINNY_DIALTONE, l->instance, sub->callid);
-		transmit_selectsoftkeys(s, l->instance, sub->callid, KEYDEF_RINGOUT);
+		transmit_tone(d, SKINNY_DIALTONE, l->instance, sub->callid);
+		transmit_selectsoftkeys(d, l->instance, sub->callid, KEYDEF_RINGOUT);
 		if (ast_pthread_create(&t, NULL, skinny_ss, c)) {
 			ast_log(LOG_WARNING, "Unable to create switch thread: %s\n", strerror(errno));
 			ast_hangup(c);
@@ -4367,8 +4363,8 @@
 		if (ast_strlen_zero(l->lastnumberdialed)) {
 			ast_log(LOG_WARNING, "Attempted redial, but no previously dialed number found.\n");
 			l->hookstate = SKINNY_ONHOOK;
-			transmit_speaker_mode(s, SKINNY_SPEAKEROFF);
-			transmit_callstate(s, l->instance, SKINNY_ONHOOK, instance);
+			transmit_speaker_mode(d, SKINNY_SPEAKEROFF);
+			transmit_callstate(d, l->instance, SKINNY_ONHOOK, instance);
 			break;
 		}
 
@@ -4380,16 +4376,16 @@
 			l = sub->parent;
 			if (l->hookstate == SKINNY_ONHOOK) {
 				l->hookstate = SKINNY_OFFHOOK;
-				transmit_callstate(s, l->instance, SKINNY_OFFHOOK, sub->callid);
+				transmit_callstate(d, l->instance, SKINNY_OFFHOOK, sub->callid);
 			}
 			if (skinnydebug)
 				ast_verb(1, "Attempting to Clear display on Skinny %s@%s\n", l->name, d->name);
-			transmit_displaymessage(s, NULL, l->instance, sub->callid); /* clear display */
-			transmit_tone(s, SKINNY_DIALTONE, l->instance, sub->callid);
-			transmit_selectsoftkeys(s, l->instance, sub->callid, KEYDEF_RINGOUT);
+			transmit_displaymessage(d, NULL, l->instance, sub->callid); /* clear display */
+			transmit_tone(d, SKINNY_DIALTONE, l->instance, sub->callid);
+			transmit_selectsoftkeys(d, l->instance, sub->callid, KEYDEF_RINGOUT);
 
 			if (!ast_ignore_pattern(c->context, l->lastnumberdialed)) {
-				transmit_tone(s, SKINNY_SILENCE, l->instance, sub->callid);
+				transmit_tone(d, SKINNY_SILENCE, l->instance, sub->callid);
 			}
 			ast_copy_string(c->exten, l->lastnumberdialed, sizeof(c->exten));
 			if (ast_pthread_create(&t, NULL, skinny_newcall, c)) {
@@ -4420,17 +4416,17 @@
 			l = sub->parent;
 			if (l->hookstate == SKINNY_ONHOOK) {
 				l->hookstate = SKINNY_OFFHOOK;
-				transmit_speaker_mode(s, SKINNY_SPEAKERON);
-				transmit_callstate(s, l->instance, SKINNY_OFFHOOK, sub->callid);
+				transmit_speaker_mode(d, SKINNY_SPEAKERON);
+				transmit_callstate(d, l->instance, SKINNY_OFFHOOK, sub->callid);
 			}
 			if (skinnydebug)
 				ast_verb(1, "Attempting to Clear display on Skinny %s@%s\n", l->name, d->name);
-			transmit_displaymessage(s, NULL, l->instance, sub->callid); /* clear display */
-			transmit_tone(s, SKINNY_DIALTONE, l->instance, sub->callid);
-			transmit_selectsoftkeys(s, l->instance, sub->callid, KEYDEF_RINGOUT);
+			transmit_displaymessage(d, NULL, l->instance, sub->callid); /* clear display */
+			transmit_tone(d, SKINNY_DIALTONE, l->instance, sub->callid);
+			transmit_selectsoftkeys(d, l->instance, sub->callid, KEYDEF_RINGOUT);
 
 			if (!ast_ignore_pattern(c->context, sd->exten)) {
-				transmit_tone(s, SKINNY_SILENCE, l->instance, sub->callid);
+				transmit_tone(d, SKINNY_SILENCE, l->instance, sub->callid);
 			}
 			if (ast_exists_extension(c, c->context, sd->exten, 1, l->cid_num)) {
 				ast_copy_string(c->exten, sd->exten, sizeof(c->exten));
@@ -4456,7 +4452,7 @@
 		if (l->transfer)
 			handle_transfer_button(sub);
 		else
-			transmit_displaynotify(s, "Transfer disabled", 10);
+			transmit_displaynotify(d, "Transfer disabled", 10);
 		break;
 	case STIMULUS_CONFERENCE:
 		if (skinnydebug)
@@ -4483,19 +4479,19 @@
 
 			if (l->hookstate == SKINNY_ONHOOK){
 				l->hookstate = SKINNY_OFFHOOK;
-				transmit_speaker_mode(s, SKINNY_SPEAKERON);
-				transmit_callstate(s, l->instance, SKINNY_OFFHOOK, sub->callid);
+				transmit_speaker_mode(d, SKINNY_SPEAKERON);
+				transmit_callstate(d, l->instance, SKINNY_OFFHOOK, sub->callid);
 			}
 
 			if (skinnydebug)
 				ast_verb(1, "Attempting to Clear display on Skinny %s@%s\n", l->name, d->name);
 
-			transmit_displaymessage(s, NULL, l->instance, sub->callid); /* clear display */
-			transmit_tone(s, SKINNY_DIALTONE, l->instance, sub->callid);
-			transmit_selectsoftkeys(s, l->instance, sub->callid, KEYDEF_RINGOUT);
+			transmit_displaymessage(d, NULL, l->instance, sub->callid); /* clear display */
+			transmit_tone(d, SKINNY_DIALTONE, l->instance, sub->callid);
+			transmit_selectsoftkeys(d, l->instance, sub->callid, KEYDEF_RINGOUT);
 
 			if (!ast_ignore_pattern(c->context, vmexten)) {
-				transmit_tone(s, SKINNY_SILENCE, l->instance, sub->callid);
+				transmit_tone(d, SKINNY_SILENCE, l->instance, sub->callid);
 			}
 
 			if (ast_exists_extension(c, c->context, l->vmexten, 1, l->cid_num)) {
@@ -4521,12 +4517,12 @@
 			c = sub->owner;
 			if (!ast_masq_park_call(ast_bridged_channel(c) , c, 0, &extout)) {
 				snprintf(message, sizeof(message), "Call Parked at: %d", extout);
-				transmit_displaynotify(s, message, 10);
+				transmit_displaynotify(d, message, 10);
 			} else {
-				transmit_displaynotify(s, "Call Park failed", 10);
+				transmit_displaynotify(d, "Call Park failed", 10);
 			}
 		} else {
-			transmit_displaynotify(s, "Call Park not available", 10);
+			transmit_displaynotify(d, "Call Park not available", 10);
 		}
 		}
 		break;
@@ -4538,13 +4534,13 @@
 		if (l->dnd != 0){
 			ast_verb(3, "Disabling DND on %s@%s\n", l->name, d->name);
 			l->dnd = 0;
-			transmit_lamp_indication(s, STIMULUS_DND, 1, SKINNY_LAMP_ON);
-			transmit_displaynotify(s, "DnD disabled", 10);
+			transmit_lamp_indication(d, STIMULUS_DND, 1, SKINNY_LAMP_ON);
+			transmit_displaynotify(d, "DnD disabled", 10);
 		} else {
 			ast_verb(3, "Enabling DND on %s@%s\n", l->name, d->name);
 			l->dnd = 1;
-			transmit_lamp_indication(s, STIMULUS_DND, 1, SKINNY_LAMP_OFF);
-			transmit_displaynotify(s, "DnD enabled", 10);
+			transmit_lamp_indication(d, STIMULUS_DND, 1, SKINNY_LAMP_OFF);
+			transmit_displaynotify(d, "DnD enabled", 10);
 		}
 		break;
 	case STIMULUS_FORWARDALL:
@@ -4618,20 +4614,20 @@
 		d->activeline = l;
 
 		/* turn the speaker on */
-		transmit_speaker_mode(s, SKINNY_SPEAKERON);
-		transmit_ringer_mode(s, SKINNY_RING_OFF);
-		transmit_lamp_indication(s, STIMULUS_LINE, l->instance, SKINNY_LAMP_ON);
+		transmit_speaker_mode(d, SKINNY_SPEAKERON);
+		transmit_ringer_mode(d, SKINNY_RING_OFF);
+		transmit_lamp_indication(d, STIMULUS_LINE, l->instance, SKINNY_LAMP_ON);
 
 		l->hookstate = SKINNY_OFFHOOK;
 
 		if (sub && sub->outgoing) {
 			/* We're answering a ringing call */
 			ast_queue_control(sub->owner, AST_CONTROL_ANSWER);
-			transmit_callstate(s, l->instance, SKINNY_OFFHOOK, sub->callid);
-			transmit_tone(s, SKINNY_SILENCE, l->instance, sub->callid);
-			transmit_callstateonly(s, sub, SKINNY_CONNECTED);
-			transmit_displaypromptstatus(s, "Connected", 0, l->instance, sub->callid);
-			transmit_selectsoftkeys(s, l->instance, sub->callid, KEYDEF_CONNECTED);
+			transmit_callstate(d, l->instance, SKINNY_OFFHOOK, sub->callid);
+			transmit_tone(d, SKINNY_SILENCE, l->instance, sub->callid);
+			transmit_callstateonly(d, sub, SKINNY_CONNECTED);
+			transmit_displaypromptstatus(d, "Connected", 0, l->instance, sub->callid);
+			transmit_selectsoftkeys(d, l->instance, sub->callid, KEYDEF_CONNECTED);
 			start_rtp(sub);
 			ast_setstate(sub->owner, AST_STATE_UP);
 		} else {
@@ -4641,12 +4637,12 @@
 				c = skinny_new(l, AST_STATE_DOWN);
 				if (c) {
 					sub = c->tech_pvt;
-					transmit_callstate(s, l->instance, SKINNY_OFFHOOK, sub->callid);
+					transmit_callstate(d, l->instance, SKINNY_OFFHOOK, sub->callid);
 					if (skinnydebug)
 						ast_verb(1, "Attempting to Clear display on Skinny %s@%s\n", l->name, d->name);
-					transmit_displaymessage(s, NULL, l->instance, sub->callid); /* clear display */
-					transmit_tone(s, SKINNY_DIALTONE, l->instance, sub->callid);
-					transmit_selectsoftkeys(s, l->instance, sub->callid, KEYDEF_OFFHOOK);
+					transmit_displaymessage(d, NULL, l->instance, sub->callid); /* clear display */
+					transmit_tone(d, SKINNY_DIALTONE, l->instance, sub->callid);
+					transmit_selectsoftkeys(d, l->instance, sub->callid, KEYDEF_OFFHOOK);
 
 					/* start the switch thread */
 					if (ast_pthread_create(&t, NULL, skinny_ss, c)) {
@@ -4711,7 +4707,7 @@
 		sub = l->activesub;
 	}
 
-	transmit_ringer_mode(s, SKINNY_RING_OFF);
+	transmit_ringer_mode(d, SKINNY_RING_OFF);
 	l->hookstate = SKINNY_OFFHOOK;
 
 	ast_devstate_changed(AST_DEVICE_INUSE, "Skinny/%s@%s", l->name, d->name);
@@ -4720,15 +4716,15 @@
 		return 1;
 	}
 
-	transmit_lamp_indication(s, STIMULUS_LINE, l->instance, SKINNY_LAMP_ON);
+	transmit_lamp_indication(d, STIMULUS_LINE, l->instance, SKINNY_LAMP_ON);
 
 	if (sub && sub->outgoing) {
 		/* We're answering a ringing call */
 		ast_queue_control(sub->owner, AST_CONTROL_ANSWER);
-		transmit_callstateonly(s, sub, SKINNY_CONNECTED);
-		transmit_tone(s, SKINNY_SILENCE, l->instance, sub->callid);
-		transmit_callstate(s, l->instance, SKINNY_CONNECTED, sub->callid);
-		transmit_selectsoftkeys(s, l->instance, sub->callid, KEYDEF_CONNECTED);
+		transmit_callstateonly(d, sub, SKINNY_CONNECTED);
+		transmit_tone(d, SKINNY_SILENCE, l->instance, sub->callid);
+		transmit_callstate(d, l->instance, SKINNY_CONNECTED, sub->callid);
+		transmit_selectsoftkeys(d, l->instance, sub->callid, KEYDEF_CONNECTED);
 		start_rtp(sub);
 		ast_setstate(sub->owner, AST_STATE_UP);
 	} else {
@@ -4738,12 +4734,12 @@
 			c = skinny_new(l, AST_STATE_DOWN);
 			if (c) {

[... 296 lines stripped ...]



More information about the asterisk-commits mailing list