
Patch submitted by Mihai Moldovan to the chan-capi mailing list on July 17th, 2013 (s. http://lists.melware.net/pipermail/chan-capi-users/2013-July/001361.html).

--- chan_capi_ami.c
+++ chan_capi_ami.c
@@ -94,35 +94,50 @@
 "    *Channel: <channame>\n"
 "    *Capicommand: <capicommand>\n";
 
-void pbx_capi_ami_register(void)
+void pbx_capi_ami_register(struct ast_module *myself)
 {
 	capiChatListRegistered = ast_manager_register2(CC_AMI_ACTION_NAME_CHATLIST,
 																								EVENT_FLAG_REPORTING,
 																								pbx_capi_ami_capichat_list,
+#ifdef CC_AST_HAS_VERSION_11_0
+																								myself,
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
 																								"List participants in a conference",
 																								mandescr_capichatlist) == 0;
 
 	capiChatMuteRegistered = ast_manager_register2(CC_AMI_ACTION_NAME_CHATMUTE,
 																								EVENT_FLAG_CALL,
 																								pbx_capi_ami_capichat_mute,
+#ifdef CC_AST_HAS_VERSION_11_0
+																								myself,
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
 																								"Mute a conference user",
 																								mandescr_capichatmute) == 0;
 
 	capiChatUnmuteRegistered = ast_manager_register2(CC_AMI_ACTION_NAME_CHATUNMUTE,
 																								EVENT_FLAG_CALL,
 																								pbx_capi_ami_capichat_unmute,
+#ifdef CC_AST_HAS_VERSION_11_0
+																								myself,
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
 																								"Unmute a conference user",
 																								mandescr_capichatunmute) == 0;
 
 	capiChatRemoveRegistered = ast_manager_register2(CC_AMI_ACTION_NAME_CHATREMOVE,
 																								EVENT_FLAG_CALL,
 																								pbx_capi_ami_capichat_remove,
+#ifdef CC_AST_HAS_VERSION_11_0
+																								myself,
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
 																								"Remove a conference user",
 																								mandescr_capichatremove) == 0;
 
 	capiCommandRegistered = ast_manager_register2(CC_AMI_ACTION_NAME_CAPICOMMAND,
 																								EVENT_FLAG_CALL,
 																								pbx_capi_ami_capicommand,
+#ifdef CC_AST_HAS_VERSION_11_0
+																								myself,
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
 																								"Exec capicommand",
 																								mandescr_capicommand) == 0;
 }
@@ -204,6 +219,11 @@
 			}
 
 			total++;
+#ifdef CC_AST_HAS_VERSION_11_0
+			const char *cur_name = ast_channel_name(c);
+#else /* !defined(CC_AST_HAS_VERSION_11_0) */
+			const char *cur_name = c->name;
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
 			astman_append(s,
 				"Event: "CC_AMI_ACTION_NAME_CHATLIST"\r\n"
 				"%s"
@@ -232,7 +252,7 @@
 				total,
 				(cidVisual != 0) ? cidVisual : "?",
 				(callerNameVisual != 0) ? callerNameVisual : "?",
-				c->name,
+				cur_name,
 				(isMemberOperator != 0) ? "Yes" : "No",
 				(isCapiChatMemberListener != 0) ? "Listen only" : "Talk and listen" /* "Talk only" */,
 				(isCapiChatMostRecentMember != 0) ? "Yes" : "No",
@@ -379,7 +399,7 @@
 }
 
 #else
-void pbx_capi_ami_register(void)
+void pbx_capi_ami_register(struct ast_module *myself)
 {
 }
 void pbx_capi_ami_unregister(void)
@@ -389,6 +409,14 @@
 
 void pbx_capi_chat_join_event(struct ast_channel* c, const struct capichat_s * room)
 {
+#ifdef CC_AST_HAS_VERSION_11_0
+	const char *cur_name = ast_channel_name(c);
+	const char *cur_uniqid = ast_channel_uniqueid(c);
+#else /* !defined(CC_AST_HAS_VERSION_11_0) */
+	const char *cur_name = c->name;
+	const char *cur_uniqid = c->uniqueid;
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
+
 #ifdef CC_AST_HAS_VERSION_1_8
 	ast_manager_event(c,
 #else
@@ -401,7 +429,7 @@
 		"Conferencenum: %u\r\n"
 		"CallerIDnum: %s\r\n"
 		"CallerIDname: %s\r\n",
-		c->name, c->uniqueid,
+		cur_name, cur_uniqid,
 		pbx_capi_chat_get_room_name(room),
 		pbx_capi_chat_get_room_number(room),
 		pbx_capi_get_cid (c, "<unknown>"),
@@ -412,6 +440,14 @@
 															 const struct capichat_s *room,
 															 long duration)
 {
+#ifdef CC_AST_HAS_VERSION_11_0
+	const char *cur_name = ast_channel_name(c);
+	const char *cur_uniqid = ast_channel_uniqueid(c);
+#else /* !defined(CC_AST_HAS_VERSION_11_0) */
+	const char *cur_name = c->name;
+	const char *cur_uniqid = c->uniqueid;
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
+
 #ifdef CC_AST_HAS_VERSION_1_8
 	ast_manager_event(c,
 #else
@@ -425,7 +461,7 @@
 		"CallerIDNum: %s\r\n"
 		"CallerIDName: %s\r\n"
 		"Duration: %ld\r\n",
-		c->name, c->uniqueid,
+		cur_name, cur_uniqid,
 		pbx_capi_chat_get_room_name(room),
 		pbx_capi_chat_get_room_number(room),
 		pbx_capi_get_cid (c, "<unknown>"),
--- chan_capi_ami.h
+++ chan_capi_ami.h
@@ -26,7 +26,7 @@
 #ifndef __CC_AMI_INTERFACE_H__
 #define __CC_AMI_INTERFACE_H__
 
-void pbx_capi_ami_register(void);
+void pbx_capi_ami_register(struct ast_module *myself);
 void pbx_capi_ami_unregister(void);
 struct capichat_s;
 void pbx_capi_chat_join_event(struct ast_channel* c, const struct capichat_s * room);
--- chan_capi.c
+++ chan_capi.c
@@ -138,6 +138,10 @@
 
 static int usecnt;
 
+#ifdef CC_AST_HAS_VERSION_1_4
+struct ast_module *myself;
+#endif
+
 /*
  * LOCKING RULES
  * =============
@@ -536,8 +540,14 @@
 	chan_for_task = c;
 	channel_task = task;
 
+#ifdef CC_AST_HAS_VERSION_11_0
+	const char *cur_name = ast_channel_name(c);
+#else /* !defined(CC_AST_HAS_VERSION_11_0) */
+	const char *cur_name = c->name;
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
+
 	cc_verbose(4, 1, VERBOSE_PREFIX_4 "%s: set channel task to %d\n",
-		c->name, task);
+		cur_name, task);
 }
 
 /*
@@ -1038,12 +1048,18 @@
 		return -1;
 	}
 
+#ifdef CC_AST_HAS_VERSION_11_0
+	const enum ast_channel_state cur_state = ast_channel_state(c);
+#else /* !defined(CC_AST_HAS_VERSION_11_0) */
+	const enum ast_channel_state cur_state = c->_state;
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
+
 	cc_verbose(3, 1, VERBOSE_PREFIX_3 "%s: send_digit '%c' in state %d(%d)\n",
-		i->vname, digit, i->state, c->_state);
+		i->vname, digit, i->state, cur_state);
 
 	cc_mutex_lock(&i->lock);
 
-	if ((c->_state == AST_STATE_DIALING) &&
+	if ((cur_state == AST_STATE_DIALING) &&
 	    (i->state != CAPI_STATE_DISCONNECTING)) {
 		if (!(i->isdnstate & CAPI_ISDN_STATE_ISDNPROGRESS)) {
 			did[0] = digit;
@@ -1211,6 +1227,9 @@
 
 	i->peer = NULL;	
 	i->owner = NULL;
+#ifdef CC_AST_HAS_VERSION_1_4
+	ast_module_unref(myself);
+#endif
 	i->used = NULL;
 	i->reserved = 0;
 
@@ -1325,7 +1344,13 @@
 	const char *cause;
 
 	if (c) {
-		i->cause = c->hangupcause;
+#ifdef CC_AST_HAS_VERSION_11_0
+		int hangupcause = ast_channel_hangupcause(c);
+#else /* !defined(CC_AST_HAS_VERSION_11_0) */
+		int hangupcause = c->hangupcause;
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
+
+		i->cause = hangupcause;
 		if ((cause = pbx_builtin_getvar_helper(c, "PRI_CAUSE"))) {
 			i->cause = atoi(cause);
 		}
@@ -1429,7 +1454,15 @@
 	}
 
 	i->owner = NULL;
+#ifdef CC_AST_HAS_VERSION_1_4
+	ast_module_unref(myself);
+#endif
+
+#ifdef CC_AST_HAS_VERSION_11_0
+	ast_channel_tech_pvt_set(c, NULL);
+#else /* !defined(CC_AST_HAS_VERSION_11_0) */
 	CC_CHANNEL_PVT(c) = NULL;
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
 
 	cc_mutex_unlock(&i->lock);
 
@@ -1460,7 +1493,20 @@
 	int CLIR;
 	int callernplan;
 
-#ifdef CC_AST_HAS_VERSION_1_8
+#ifdef CC_AST_HAS_VERSION_11_0
+	if (ast_channel_connected(c)->id.number.valid) {
+		CLIR = ast_channel_connected(c)->id.number.presentation;
+		callernplan = ast_channel_connected(c)->id.number.plan & 0x7f;
+	} else {
+		CLIR = 0;
+		callernplan = 0;
+	}
+	if (ast_channel_connected(c)->id.number.valid && !ast_strlen_zero(ast_channel_connected(c)->id.number.str)) {
+		ast_copy_string(callerid, ast_channel_connected(c)->id.number.str, sizeof(callerid));
+	} else {
+		memset(callerid, 0, sizeof(callerid));
+	}
+#elif defined(CC_AST_HAS_VERSION_1_8)
 	if (c->connected.id.number.valid) {
 		CLIR = c->connected.id.number.presentation;
 		callernplan = c->connected.id.number.plan & 0x7f;
@@ -1473,7 +1519,7 @@
 	} else {
 		memset(callerid, 0, sizeof(callerid));
 	}
-#else
+#else /* !(defined(CC_AST_HAS_VERSION_11_0) || defined(CC_AST_HAS_VERSION_1_8)) */
 	CLIR = c->cid.cid_pres;
 	callernplan = c->cid.cid_ton & 0x7f;
 
@@ -1482,7 +1528,7 @@
 	} else {
 		memset(callerid, 0, sizeof(callerid));
 	}
-#endif
+#endif /* defined(CC_AST_HAS_VERSION_11_0) || defined(CC_AST_HAS_VERSION_1_8) */
 
 	if (use_defaultcid) {
 		cc_copy_string(callerid, i->defaultcid, sizeof(callerid));
@@ -1502,15 +1548,25 @@
 	calling[2] = 0x80 | (CLIR & 0x63);
 	strncpy(&calling[3], callerid, max_calling - 4);
 
+#ifdef CC_AST_HAS_VERSION_11_0
+	const char *cur_name = ast_channel_name(c);
+#else /* !defined(CC_AST_HAS_VERSION_11_0) */
+	const char *cur_name = c->name;
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
+
 	cc_verbose(1, 1, VERBOSE_PREFIX_2 "%s: Call %s %s%s (pres=0x%02x, ton=0x%02x)\n",
-		i->vname, c->name, i->doB3 ? "with B3 ":" ",
+		i->vname, cur_name, i->doB3 ? "with B3 ":" ",
 		i->doOverlap ? "overlap":"", CLIR, callernplan);
 }
 
 /*
  * PBX tells us to make a call
  */
-static int pbx_capi_call(struct ast_channel *c, char *idest, int timeout)
+#ifdef CC_AST_HAS_VERSION_11_0
+static int pbx_capi_call(struct ast_channel *c, const char *idest, int timeout)
+#else /* !defined(CC_AST_HAS_VERSION_11_0) */
+static int pbx_capi_call(struct ast_channel *c, void *idest, int timeout)
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
 {
 	struct capi_pvt *i = CC_CHANNEL_PVT(c);
 	char *dest, *interface, *param, *ocid;
@@ -1595,7 +1651,14 @@
 
 	i->peer = cc_get_peer_link_id(pbx_builtin_getvar_helper(c, "CAPIPEERLINKID"));
 	i->outgoing = 1;
-	i->transfercapability = c->transfercapability;
+
+#ifdef CC_AST_HAS_VERSION_11_0
+	unsigned short cur_xfercap = ast_channel_transfercapability(c);
+#else /* !defined(CC_AST_HAS_VERSION_11_0) */
+	unsigned short cur_xfercap = c->transfercapability;
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
+
+	i->transfercapability = cur_xfercap;
 	i->isdnstate |= CAPI_ISDN_STATE_PBX;
 	i->state = CAPI_STATE_CONNECTPENDING;
 	ast_setstate(c, AST_STATE_DIALING);
@@ -1979,16 +2042,26 @@
 		} else if (f->frametype == AST_FRAME_DTMF) {
 /* Work around problem with recognition of fast sequences of events,
  * see main/channel.c for details
+ * ... or better yet, get rid of this ugly hack alltogether.
  */
+#ifdef CC_AST_HAS_VERSION_11_0
+			if (!(ast_test_flag(ast_channel_flags(c), AST_FLAG_END_DTMF_ONLY) ||
+						ast_test_flag(ast_channel_flags(c), AST_FLAG_EMULATE_DTMF) ||
+						ast_test_flag(ast_channel_flags(c), AST_FLAG_IN_DTMF))) {
+				ast_set_flag(ast_channel_flags(c), AST_FLAG_IN_DTMF);
+				struct timeval back_to_the_past = ast_tvsub(ast_tvnow(), ast_tv(0, 250*1000 /* to msec */));
+				ast_channel_dtmf_tv_set(c, &back_to_the_past);
+#else /* !defined(CC_AST_HAS_VERSION_11_0 */
 			if (!(ast_test_flag(c, AST_FLAG_END_DTMF_ONLY) ||
 						ast_test_flag(c, AST_FLAG_EMULATE_DTMF) ||
 						ast_test_flag(c, AST_FLAG_IN_DTMF))) {
 				ast_set_flag(c, AST_FLAG_IN_DTMF);
 				c->dtmf_tv = ast_tvsub(ast_tvnow(),ast_tv(0,250*1000));
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
 				if (!f->len)
 						f->len = 100;
 			}
-#endif
+#endif /* defined(CC_AST_HAS_VERSION_1_4) */
 		}
 	}
 
@@ -2015,8 +2088,16 @@
 {
 	struct capi_pvt *i = CC_CHANNEL_PVT(newchan);
 
+#ifdef CC_AST_HAS_VERSION_11_0
+	const char *old_name = ast_channel_name(oldchan);
+	const char *new_name = ast_channel_name(newchan);
+#else /* !defined(CC_AST_HAS_VERSION_11_0) */
+	const char *old_name = oldchan->name;
+	const char *new_name = newchan->name;
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
+
 	cc_verbose(3, 1, VERBOSE_PREFIX_2 "%s: %s fixup now %s\n",
-		i->vname, oldchan->name, newchan->name);
+		i->vname, old_name, new_name);
 
 	cc_mutex_lock(&i->lock);
 	i->owner = newchan;
@@ -2123,8 +2204,15 @@
 	
 		if (ret == 2) {	
 			/* don't do bridge - call transfer is active */
+#ifdef CC_AST_HAS_VERSION_11_0
+			const char *c0_name = ast_channel_name(c0);
+			const char *c1_name = ast_channel_name(c1);
+#else /* !defined(CC_AST_HAS_VERSION_11_0) */
+			const char *c0_name = c0->name;
+			const char *c1_name = c1->name;
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
 			cc_verbose(3, 1, VERBOSE_PREFIX_2 "%s:%s cancelled bridge (path replacement was sent) for %s and %s\n",
-				   i0->vname, i1->vname, c0->name, c1->name);
+				   i0->vname, i1->vname, c0_name, c1_name);
 		}
 	} else {
 		/* standard ECT */
@@ -2271,8 +2359,15 @@
 	struct capi_pvt *i1 = CC_CHANNEL_PVT(c1);
 	CC_BRIDGE_RETURN ret = AST_BRIDGE_COMPLETE;
 
+#ifdef CC_AST_HAS_VERSION_11_0
+	const char *c0_name = ast_channel_name(c0);
+	const char *c1_name = ast_channel_name(c1);
+#else /* !defined(CC_AST_HAS_VERSION_11_0) */
+	const char *c0_name = c0->name;
+	const char *c1_name = c1->name;
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
 	cc_verbose(3, 1, VERBOSE_PREFIX_2 "%s:%s Requested native bridge for %s and %s\n",
-		i0->vname, i1->vname, c0->name, c1->name);
+		i0->vname, i1->vname, c0_name, c1_name);
 
 	if ((i0->isdnstate & CAPI_ISDN_STATE_ECT) ||
 	    (i1->isdnstate & CAPI_ISDN_STATE_ECT)) {
@@ -2440,11 +2535,17 @@
 #endif
 	}
 
+#ifdef CC_AST_HAS_VERSION_11_0
+	ast_channel_tech_pvt_set(tmp, i);
+
+	ast_channel_callgroup_set(tmp, i->callgroup);
+	ast_channel_pickupgroup_set(tmp, i->pickupgroup);
+#else /* !defined(CC_AST_HAS_VERSION_11_0) */
 	CC_CHANNEL_PVT(tmp) = i;
 
 	tmp->callgroup = i->callgroup;
 	tmp->pickupgroup = i->pickupgroup;
-
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
 
 #if 0
 	i->bproto = CC_BPROTO_TRANSPARENT;
@@ -2465,56 +2566,86 @@
 #else
 	if ((i->rtpcodec = (capi_controllers[i->controller]->rtpcodec & i->capability))) {
 		i->bproto = CC_BPROTO_VOCODER;
-		cc_add_formats(tmp->nativeformats, i->rtpcodec);
+#ifdef CC_AST_HAS_VERSION_11_0
+		struct ast_format_cap *cur_nativefmts = ast_channel_nativeformats(tmp);
+#else /* !defined(CC_AST_HAS_VERSION_11_0) */
+		struct ast_format_cap *cur_nativefmts = tmp->nativeformats;
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
+		cc_add_formats(cur_nativefmts, i->rtpcodec);
 	} else {
 		i->bproto = CC_BPROTO_TRANSPARENT;
-		cc_add_formats(tmp->nativeformats, capi_capability);
+#ifdef CC_AST_HAS_VERSION_11_0
+		struct ast_format_cap *cur_nativefmts = ast_channel_nativeformats(tmp);
+#else /* !defined(CC_AST_HAS_VERSION_11_0) */
+		struct ast_format_cap *cur_nativefmts = tmp->nativeformats;
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
+		cc_add_formats(cur_nativefmts, capi_capability);
 	}
 	fmt = cc_set_best_codec(tmp);
 	i->codec = fmt;
 #endif
 
+#ifdef CC_AST_HAS_VERSION_11_0
+	ast_channel_tech_set(tmp, &capi_tech);
+	struct ast_format_cap *cur_nativefmts = ast_channel_nativeformats(tmp);
+#else /* !defined(CC_AST_HAS_VERSION_11_0) */
 	tmp->tech = &capi_tech;
-
+	struct ast_format_cap *cur_nativefmts = tmp->nativeformats;
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
 
 	cc_verbose(3, 1, VERBOSE_PREFIX_2 "%s: setting format %s - %s%s\n",
 		i->vname, cc_getformatname(fmt),
 		ast_getformatname_multiple(alloca(80), 80,
-		tmp->nativeformats),
+		cur_nativefmts),
 		(i->bproto == CC_BPROTO_VOCODER) ? "VOCODER" : ((i->rtp) ? " (RTP)" : ""));
 
 	if (!ast_strlen_zero(i->cid)) {
-#ifdef CC_AST_HAS_VERSION_1_8
+#ifdef CC_AST_HAS_VERSION_11_0
+		ast_free (ast_channel_connected(tmp)->id.number.str);
+		ast_channel_connected(tmp)->id.number.valid = 1;
+		ast_channel_connected(tmp)->id.number.str = ast_strdup(i->cid);
+		ast_channel_connected(tmp)->id.number.plan = i->cid_ton;
+#elif defined(CC_AST_HAS_VERSION_1_8)
 		ast_free (tmp->connected.id.number.str);
 		tmp->connected.id.number.valid = 1;
 		tmp->connected.id.number.str = ast_strdup(i->cid);
 		tmp->connected.id.number.plan = i->cid_ton;
-#else
+#else /* !(defined(CC_AST_HAS_VERSION_11_0) || defined(CC_AST_HAS_VERSION_1_8)) */
 		ast_free(tmp->cid.cid_num);
 		tmp->cid.cid_num = ast_strdup(i->cid);
-#endif
+#endif /* defined(CC_AST_HAS_VERSION_11_0) || defined(CC_AST_HAS_VERSION_1_8) */
 	}
 	if (!ast_strlen_zero(i->dnid)) {
-#ifdef CC_AST_HAS_VERSION_1_8
+#ifdef CC_AST_HAS_VERSION_11_0
+		ast_free (ast_channel_dialed(tmp)->number.str);
+		ast_channel_dialed(tmp)->number.str  = ast_strdup (i->dnid);
+#elif defined(CC_AST_HAS_VERSION_1_8)
 		ast_free (tmp->dialed.number.str);
 		tmp->dialed.number.str  = ast_strdup (i->dnid);
-#else
+#else /* !(defined(CC_AST_HAS_VERSION_11_0) || defined(CC_AST_HAS_VERSION_1_8)) */
 		ast_free(tmp->cid.cid_dnid);
 		tmp->cid.cid_dnid = ast_strdup(i->dnid);
-#endif
+#endif /* defined(CC_AST_HAS_VERSION_11_0) || defined(CC_AST_HAS_VERSION_1_8) */
 	}
-#ifdef CC_AST_HAS_VERSION_1_8
+#ifdef CC_AST_HAS_VERSION_11_0
+	ast_channel_dialed(tmp)->number.plan = i->cid_ton;
+#elif defined(CC_AST_HAS_VERSION_1_8)
 	tmp->dialed.number.plan = i->cid_ton;
-#else
+#else /* !(defined(CC_AST_HAS_VERSION_11_0) || defined(CC_AST_HAS_VERSION_1_8)) */
 	tmp->cid.cid_ton = i->cid_ton;
-#endif
+#endif /* defined(CC_AST_HAS_VERSION_11_0) || defined(CC_AST_HAS_VERSION_1_8) */
 
 #ifndef CC_AST_HAS_EXT2_CHAN_ALLOC
 	if (i->amaflags)
 		tmp->amaflags = i->amaflags;
 	
+#ifdef CC_AST_HAS_VERSION_11_0
+	cc_copy_string(ast_channel_context(tmp), i->context, sizeof(ast_channel_context(tmp)));
+	cc_copy_string(ast_channel_exten(tmp), i->dnid, sizeof(ast_channel_exten(tmp)));
+#else
 	cc_copy_string(tmp->context, i->context, sizeof(tmp->context));
 	cc_copy_string(tmp->exten, i->dnid, sizeof(tmp->exten));
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
 #ifdef CC_AST_HAS_STRINGFIELD_IN_CHANNEL
 	ast_string_field_set(tmp, accountcode, i->accountcode);
 	ast_string_field_set(tmp, language, i->language);
@@ -2525,7 +2656,12 @@
 #endif
 
 #ifdef CC_AST_HAS_STRINGFIELD_IN_CHANNEL
+#ifdef CC_AST_HAS_VERSION_11_0
+	if (!ast_strlen_zero(i->language))
+		ast_channel_language_set(tmp, i->language);
+#else /* !defined(CC_AST_HAS_VERSION_11_0) */
 	ast_string_field_set(tmp, language, i->language);
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
 #else
 	cc_copy_string(tmp->language, i->language, sizeof(tmp->language));
 #endif
@@ -2536,6 +2672,7 @@
 #ifdef CC_AST_HAS_VERSION_1_4
 	ast_atomic_fetchadd_int(&usecnt, 1);
 	ast_jb_configure(tmp, &i->jbconf);
+	ast_module_ref(myself);
 #else
 	cc_mutex_lock(&usecnt_lock);
 	usecnt++;
@@ -2561,9 +2698,12 @@
 #elif !defined(CC_AST_HAS_VERSION_10_0) /* } { */
 static struct ast_channel *
 pbx_capi_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause)
-#else /* } { */
+#elif !defined(CC_AST_HAS_VERSION_11_0) /* } { */
 static struct ast_channel *
 pbx_capi_request(const char *type, struct ast_format_cap *format, const struct ast_channel *requestor, void *data, int *cause)
+#else /* } { */
+static struct ast_channel *
+pbx_capi_request(const char *type, struct ast_format_cap *format, const struct ast_channel *requestor, const char *data, int *cause)
 #endif /* } */
 
 #else /* } { */
@@ -2668,7 +2808,11 @@
 		cc_mutex_unlock(&iflock);
 		tmp = capi_new(i, AST_STATE_RESERVED,
 #ifdef CC_AST_HAS_REQUEST_REQUESTOR
+#ifdef CC_AST_HAS_VERSION_11_0
+			requestor ? ast_channel_linkedid(requestor) : NULL
+#else /* !defined(CC_AST_HAS_VERSION_11_0) */
 			requestor ? requestor->linkedid : NULL
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
 #else
 			NULL
 #endif
@@ -3227,7 +3371,12 @@
 				if (errno == 0 || errno == EINTR)
 					continue;
 				cc_log(LOG_WARNING, "%s: Wait failed (%s).\n",
-					chan->name, strerror(errno));
+#ifdef CC_AST_HAS_VERSION_11_0
+					ast_channel_name(chan),
+#else /* !defined(CC_AST_HAS_VERSION_11_0) */
+					chan->name,
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
+					strerror(errno));
 				break;
 			}
 		}
@@ -3624,7 +3773,7 @@
 static void capi_handle_dtmf_fax(struct capi_pvt *i)
 {
 	struct ast_channel *c = i->owner;
-	char *faxcontext;
+	const char *faxcontext;
 
 	if (!c) {
 		/* no channel, ignore */
@@ -3643,24 +3792,40 @@
 			i->vname);
 		return;
 	}
-	if ((i->faxdetecttime > 0) && (c->cdr)) {
+#ifdef CC_AST_HAS_VERSION_11_0
+	struct ast_cdr *cur_cdr = ast_channel_cdr(c);
+#else /* !defined(CC_AST_HAS_VERSION_11_0) */
+	struct ast_cdr *cur_cdr = c->cdr;
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
+
+	if ((i->faxdetecttime > 0) && cur_cdr) {
 		struct timeval now;
 		gettimeofday(&now, NULL);
-		if ((c->cdr->start.tv_sec + i->faxdetecttime) < now.tv_sec) {
+		if ((cur_cdr->start.tv_sec + i->faxdetecttime) < now.tv_sec) {
 			cc_verbose(3, 0, VERBOSE_PREFIX_3
 				"%s: Fax detected after %ld seconds, limit %u - ignored\n",
-				i->vname, (long) (now.tv_sec - c->cdr->start.tv_sec),
+				i->vname, (long) (now.tv_sec - cur_cdr->start.tv_sec),
 				i->faxdetecttime);
 			return;
 		}
 	}
 
-	faxcontext = c->context;
+#ifdef CC_AST_HAS_VERSION_11_0
+	const char *cur_context = ast_channel_context(c);
+	const char *cur_exten = ast_channel_exten(c);
+	const char *cur_name = ast_channel_name(c);
+#else /* !defined(CC_AST_HAS_VERSION_11_0) */
+	const char *cur_context = c->context;
+	const char *cur_exten = c->exten;
+	const char *cur_name = c->name;
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
+
+	faxcontext = cur_context;
 	if (strlen(i->faxcontext) > 0)
 		faxcontext = i->faxcontext;
 	
-	if ((!strcmp(c->exten, i->faxexten)) &&
-	    (!strcmp(c->context, faxcontext))) {
+	if ((!strcmp(cur_exten, i->faxexten)) &&
+	    (!strcmp(cur_context, faxcontext))) {
 		cc_log(LOG_DEBUG, "Already in fax context/extension, not redirecting\n");
 		return;
 	}
@@ -3668,12 +3833,12 @@
 	if (!ast_exists_extension(c, faxcontext, i->faxexten, i->faxpriority, i->cid)) {
 		cc_verbose(3, 0, VERBOSE_PREFIX_3
 			"Fax tone detected, but no extension '%s' for %s in context '%s'\n",
-			i->faxexten, c->name, faxcontext);
+			i->faxexten, cur_name, faxcontext);
 		return;
 	}
 
 	cc_verbose(2, 0, VERBOSE_PREFIX_3 "%s: Redirecting %s for fax to %s,%s,%d\n",
-		i->vname, c->name, faxcontext, i->faxexten, i->faxpriority);
+		i->vname, cur_name, faxcontext, i->faxexten, i->faxpriority);
 			
 	capi_channel_task(c, CAPI_CHANNEL_TASK_GOTOFAX);
 
@@ -3694,27 +3859,42 @@
 	struct capi_pvt *i = CC_CHANNEL_PVT(c);
 	char *exten;
     
+#ifdef CC_AST_HAS_VERSION_11_0
+	const char *cur_context = ast_channel_context(c);
+	char *cur_exten = (char*)ast_channel_exten(c);
+	const char *cur_name = ast_channel_name(c);
+#else /* !defined(CC_AST_HAS_VERSION_11_0) */
+	const char *cur_context = c->context;
+	char *cur_exten = (char*)c->exten;
+	const char *cur_name = c->name;
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
+
 	if (!strlen(i->dnid) && (i->immediate)) {
 		exten = "s";
 		cc_verbose(3, 1, VERBOSE_PREFIX_3 "%s: %s: %s matches in context %s for immediate\n",
-			i->vname, c->name, exten, c->context);
+			i->vname, cur_name, exten, cur_context);
 	} else {
 		if (strlen(i->dnid) < strlen(i->incomingmsn))
 			return 0;
 		exten = i->dnid;
 	}
 
-	if (ast_exists_extension(NULL, c->context, exten, 1, i->cid)) {
+	if (ast_exists_extension(NULL, cur_context, exten, 1, i->cid)) {
+#ifdef CC_AST_HAS_VERSION_11_0
+		ast_channel_priority_set(c, 1);
+#else /* !defined(CC_AST_HAS_VERSION_11_0) */
 		c->priority = 1;
-		cc_copy_string(c->exten, exten, sizeof(c->exten));
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
+
+		cc_copy_string(cur_exten, exten, sizeof(cur_exten));
 		cc_verbose(3, 1, VERBOSE_PREFIX_3 "%s: %s: %s matches in context %s\n",
-			i->vname, c->name, exten, c->context);
+			i->vname, cur_name, exten, cur_context);
 		return 0;
 	}
 
-	if (ast_canmatch_extension(NULL, c->context, exten, 1, i->cid)) {
+	if (ast_canmatch_extension(NULL, cur_context, exten, 1, i->cid)) {
 		cc_verbose(3, 1, VERBOSE_PREFIX_3 "%s: %s: %s would possibly match in context %s\n",
-			i->vname, c->name, exten, c->context);
+			i->vname, cur_name, exten, cur_context);
 		return 1;
 	}
 
@@ -3775,13 +3955,21 @@
 
 	c = i->owner;
 
+#ifdef CC_AST_HAS_VERSION_11_0
+	const char *cur_name = ast_channel_name(c);
+	char *cur_exten = (char *)ast_channel_exten(c);
+#else /* !defined(CC_AST_HAS_VERSION_11_0) */
+	const char *cur_name = c->name;
+	char *cur_exten = (char *)c->exten;
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
+
 	if ((i->isdnstate & CAPI_ISDN_STATE_PBX_DONT)) {
 		/* we already found non-match here */
 		return;
 	}
 	if ((i->isdnstate & CAPI_ISDN_STATE_PBX)) {
 		cc_verbose(3, 1, VERBOSE_PREFIX_2 "%s: pbx already started on channel %s\n",
-			i->vname, c->name);
+			i->vname, cur_name);
 		return;
 	}
 
@@ -3790,7 +3978,7 @@
 		i->isdnstate |= CAPI_ISDN_STATE_PBX;
 		cc_verbose(3, 1, VERBOSE_PREFIX_2 "%s: Pickup extension '%s' found.\n",
 			i->vname, i->dnid);
-		cc_copy_string(c->exten, i->dnid, sizeof(c->exten));
+		cc_copy_string(cur_exten, i->dnid, sizeof(cur_exten));
 		pbx_capi_alert(c);
 		capi_channel_task(c, CAPI_CHANNEL_TASK_PICKUP);
 		return;
@@ -3806,7 +3994,7 @@
 			capi_channel_task(c, CAPI_CHANNEL_TASK_HANGUP); 
 		} else {
 			cc_verbose(2, 1, VERBOSE_PREFIX_2 "Started pbx on channel %s\n",
-				c->name);
+				cur_name);
 		}
 		break;
 	case 1:
@@ -3866,7 +4054,13 @@
 	
 	update_channel_name(i);	
 	
-	if (i->owner->pbx != NULL) {
+#ifdef CC_AST_HAS_VERSION_11_0
+	const struct ast_pbx *owner_pbx = ast_channel_pbx(i->owner);
+#else /* !defined(CC_AST_HAS_VERSION_11_0) */
+	const struct ast_pbx *owner_pbx = i->owner->pbx;
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
+
+	if (owner_pbx != NULL) {
 		if (did) {
 			/* we are already in pbx, so we send the digits as dtmf */
 			for (a = 0; a < strlen(did); a++) {
@@ -3892,7 +4086,11 @@
 	FRAME_SUBCLASS_INTEGER(fr.subclass) = AST_CONTROL_HANGUP;
 	
 	if ((i->owner) && (control)) {
+#ifdef CC_AST_HAS_VERSION_11_0
+		int cause = ast_channel_hangupcause(i->owner);
+#else /* !defined(CC_AST_HAS_VERSION_11_0) */
 		int cause = i->owner->hangupcause;
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
 		if (cause == AST_CAUSE_NORMAL_CIRCUIT_CONGESTION) {
 			FRAME_SUBCLASS_INTEGER(fr.subclass) = AST_CONTROL_CONGESTION;
 		} else if ((cause != AST_CAUSE_NO_USER_RESPONSE) &&
@@ -4027,7 +4225,13 @@
 	if (!(i->peer))
 		return;
 
-	if (i->peer->tech != &capi_tech)
+#ifdef CC_AST_HAS_VERSION_11_0
+	const struct ast_channel_tech *peer_tech = ast_channel_tech(i->peer);
+#else /* !defined(CC_AST_HAS_VERSION_11_0) */
+	const struct ast_channel_tech *peer_tech = i->peer->tech;
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
+
+	if (peer_tech != &capi_tech)
 		return;
 
 	i2 = CC_CHANNEL_PVT(i->peer);
@@ -4066,7 +4270,11 @@
 		cc_verbose(3, 1, VERBOSE_PREFIX_3 "%s: info element CAUSE %02x %02x\n",
 			i->vname, INFO_IND_INFOELEMENT(CMSG)[1], INFO_IND_INFOELEMENT(CMSG)[2]);
 		if (i->owner) {
+#ifdef CC_AST_HAS_VERSION_11_0
+			ast_channel_hangupcause_set(i->owner, INFO_IND_INFOELEMENT(CMSG)[2] & 0x2f);
+#else /* !defined(CC_AST_HAS_VERSION_11_0) */
 			i->owner->hangupcause = INFO_IND_INFOELEMENT(CMSG)[2] & 0x7f;
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
 		}
 		capidev_sendback_info(i, CMSG);
 		break;
@@ -4264,12 +4472,18 @@
 		 * get a PROGRESS with a hangupcause set (safer?)
 		 */
 		if (i->doB3 == CAPI_B3_DONT) {
-			if ((i->owner) &&
-			    (i->owner->hangupcause == AST_CAUSE_USER_BUSY)) {
+			if (i->owner) {
+#ifdef CC_AST_HAS_VERSION_11_0
+				int owner_hangupcause = ast_channel_hangupcause(i->owner);
+#else /* !defined(CC_AST_HAS_VERSION_11_0) */
+				int owner_hangupcause = i->owner->hangupcause;
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
+				if (owner_hangupcause == AST_CAUSE_USER_BUSY) {
 				capi_queue_cause_control(i, 1);
 				break;
 			}
 		}
+		}
 		send_progress(i);
 		break;
 	case 0x8005:	/* SETUP */
@@ -4929,9 +5143,15 @@
 					ast_set_callerid(i->owner, NULL, buffer, NULL);
 					Use code from ast_set_callerid but do not update CDR
 					*/
+#ifdef CC_AST_HAS_VERSION_11_0
+				ast_channel_caller(i->owner)->id.name.valid = 1;
+				ast_free(ast_channel_caller(i->owner)->id.name.str);
+				ast_channel_caller(i->owner)->id.name.str = ast_strdup(buffer);
+#else /* !defined(CC_AST_HAS_VERSION_11_0) */
 				i->owner->caller.id.name.valid = 1;
 				ast_free(i->owner->caller.id.name.str);
 				i->owner->caller.id.name.str = ast_strdup(buffer);
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
 #else
 				ast_free (i->owner->cid.cid_name);
 				i->owner->cid.cid_name = ast_strdup(buffer);	/* Save name to callerid */
@@ -5021,8 +5241,13 @@
 
 	if ((i->owner) && (i->FaxState & CAPI_FAX_STATE_ACTIVE)) {
 		ast_setstate(i->owner, AST_STATE_UP);
-		if (i->owner->cdr)
-			ast_cdr_answer(i->owner->cdr);
+#ifdef CC_AST_HAS_VERSION_11_0
+		struct ast_cdr *owner_cdr = ast_channel_cdr(i->owner);
+#else /* !defined(CC_AST_HAS_VERSION_11_0) */
+		struct ast_cdr *owner_cdr = i->owner->cdr;
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
+		if (owner_cdr)
+			ast_cdr_answer(owner_cdr);
 		return;
 	}
 	
@@ -5104,7 +5329,15 @@
 	}
 
 	if (i->fsetting & CAPI_FSETTING_EARLY_BRIDGE) {
-		if ((i->peer != NULL) && (i->peer->tech == &capi_tech)) {
+		if (i->peer != NULL) {
+
+#ifdef CC_AST_HAS_VERSION_11_0
+			const struct ast_channel_tech *peer_tech = ast_channel_tech(i->peer);
+#else /* !defined(CC_AST_HAS_VERSION_11_0) */
+			const struct ast_channel_tech *peer_tech = i->peer->tech;
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
+
+			if (peer_tech == &capi_tech) {
 			struct capi_pvt *i1;
 			i1 = CC_CHANNEL_PVT(i->peer);
 			if ((capi_controllers[i->controller]->lineinterconnect) && 
@@ -5116,6 +5349,7 @@
 			}
 		}
 	}
+	}
 
 	if (i->state == CAPI_STATE_CONNECTED) {
 		capi_signal_answer(i);
@@ -5244,13 +5478,24 @@
 	i->reason = DISCONNECT_IND_REASON(CMSG);
 
 	if (i->owner) {
-		if (i->owner->hangupcause == 0) {
+#ifdef CC_AST_HAS_VERSION_11_0
+		int owner_hangupcause = ast_channel_hangupcause(i->owner);
+#else /* !defined(CC_AST_HAS_VERSION_11_0) */
+		int owner_hangupcause = i->owner->hangupcause;
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
+		if (owner_hangupcause == 0) {
 			/* set hangupcause, in case there is no 
 			 * "cause" information element:
 			 */
-			i->owner->hangupcause =
+			owner_hangupcause =
 				((i->reason & 0xFF00) == 0x3400) ?
 				i->reason & 0x7F : AST_CAUSE_NORMAL_CLEARING;
+
+#ifdef CC_AST_HAS_VERSION_11_0
+			ast_channel_hangupcause_set(i->owner, owner_hangupcause);
+#else /* !defined(CC_AST_HAS_VERSION_11_0) */
+			i->owner->hangupcause = owner_hangupcause;
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
 		}
 		/* the real reason could be != 0x34xx, so provide this value in variable */
 		sprintf(buffer, "%d", i->reason);
@@ -5444,7 +5689,11 @@
 				break;
 			}
 			i->transfercapability = cip2tcap(i->cip);
+#ifdef CC_AST_HAS_VERSION_11_0
+			ast_channel_transfercapability_set(i->owner, i->transfercapability);
+#else /* !defined(CC_AST_HAS_VERSION_11_0) */
  			i->owner->transfercapability = i->transfercapability;
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
 			if (capi_tcap_is_digital(i->transfercapability)) {
 				i->bproto = CC_BPROTO_TRANSPARENT;
 			}
@@ -5458,15 +5707,32 @@
 				if (capi_national_prefix[0]      == 0 &&
 						capi_international_prefix[0] == 0 &&
 						capi_subscriber_prefix[0]    == 0) {
+#ifdef CC_AST_HAS_VERSION_11_0
+					ast_channel_caller(i->owner)->id.number.plan = callernplan;
+#else /* !defined(CC_AST_HAS_VERSION_11_0) */
 					i->owner->caller.id.number.plan = callernplan;
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
 					effective_cid = CID;
 				}
+#ifdef CC_AST_HAS_VERSION_11_0
+				ast_channel_caller(i->owner)->id.number.presentation = callpres;
+#else /* !defined(CC_AST_HAS_VERSION_11_0) */
 				i->owner->caller.id.number.presentation = callpres;
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
 
 				/* Don't use ast_set_callerid() here because it will
 					 generate a needless NewCallerID event
 					 ast_set_callerid(i->owner, effective_cid, NULL, effective_cid);
 					*/
+#ifdef CC_AST_HAS_VERSION_11_0
+				ast_channel_caller(i->owner)->id.number.valid = 1;
+				ast_free(ast_channel_caller(i->owner)->id.number.str);
+				ast_channel_caller(i->owner)->id.number.str = ast_strdup(effective_cid);
+
+				ast_channel_caller(i->owner)->ani.number.valid = 1;
+				ast_free(ast_channel_caller(i->owner)->ani.number.str);
+				ast_channel_caller(i->owner)->ani.number.str = ast_strdup(effective_cid);
+#else /* !defined(CC_AST_HAS_VERSION_11_0) */
 				i->owner->caller.id.number.valid = 1;
 				ast_free(i->owner->caller.id.number.str);
 				i->owner->caller.id.number.str = ast_strdup(effective_cid);
@@ -5474,6 +5740,7 @@
 				i->owner->caller.ani.number.valid = 1;
 				ast_free(i->owner->caller.ani.number.str);
 				i->owner->caller.ani.number.str = ast_strdup(effective_cid);
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
 			}
 #else
 			i->owner->cid.cid_pres = callpres;
@@ -5886,8 +6153,17 @@
 		if ((wInfo & 0xff00) == 0) {
 			if (i->state != CAPI_STATE_DISCONNECTING) {
 				i->state = CAPI_STATE_ALERTING;
-				if (i->owner->_state == AST_STATE_RING) {
+#ifdef CC_AST_HAS_VERSION_11_0
+				enum ast_channel_state owner_state = ast_channel_state(i->owner);
+#else /* !defined(CC_AST_HAS_VERSION_11_0) */
+				enum ast_channel_state owner_state = i->owner->_state;
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
+				if (owner_state == AST_STATE_RING) {
+#ifdef CC_AST_HAS_VERSION_11_0
+					ast_channel_rings_set(i->owner, 1);
+#else /* !defined(CC_AST_HAS_VERSION_11_0) */
 					i->owner->rings = 1;
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
 				}
 			}
 		}
@@ -6013,8 +6289,15 @@
 static struct capi_pvt* get_active_plci(struct ast_channel *c)
 {
 	struct capi_pvt* i;
+	const struct ast_channel_tech *cur_tech;
 
-	if (c->tech == &capi_tech) {
+#ifdef CC_AST_HAS_VERSION_11_0
+	cur_tech = ast_channel_tech(c);
+#else /* !defined(CC_AST_HAS_VERSION_11_0) */
+	cur_tech = c->tech;
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
+
+	if (cur_tech == &capi_tech) {
 		i = CC_CHANNEL_PVT(c);
 	} else {
 		i = pbx_check_resource_plci(c);
@@ -6034,6 +6317,12 @@
 	int numberlen;
 	char facnumber[DEFLECT_NUMBER_MAX_LEN + 4];
 
+#ifdef CC_AST_HAS_VERSION_11_0
+	const char *cur_name = ast_channel_name(c);
+#else /* !defined(CC_AST_HAS_VERSION_11_0) */
+	const char *cur_name = c->name;
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
+
 	if (!param) {
 		cc_log(LOG_WARNING, CC_MESSAGE_NAME
 			" deflection requires an argument (destination phone number)\n");
@@ -6055,7 +6344,7 @@
 	}
 	if (!(capi_controllers[i->controller]->CD)) {
 		cc_log(LOG_NOTICE,"%s: CALL DEFLECT for %s not supported by controller.\n",
-			i->vname, c->name);
+			i->vname, cur_name);
 		return -1;
 	}
 
@@ -6120,6 +6409,12 @@
 	char buffer[32];
 	int id;
 
+#ifdef CC_AST_HAS_VERSION_11_0
+	const char *cur_name = ast_channel_name(c);
+#else /* !defined(CC_AST_HAS_VERSION_11_0) */
+	const char *cur_name = c->name;
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
+
 	id = cc_add_peer_link_id(c);
 
 	if (id >= 0) {
@@ -6128,7 +6423,7 @@
 	}
 
 	cc_verbose(2, 1, VERBOSE_PREFIX_3 "Added %s as " CC_MESSAGE_BIGNAME " peer link.\n",
-		c->name);
+		cur_name);
 
 	return 0;
 }
@@ -6141,7 +6436,15 @@
 	struct capi_pvt *i = CC_CHANNEL_PVT(c); 
 	unsigned int plci = 0;
 
-	if (c->tech == &capi_tech) {
+#ifdef CC_AST_HAS_VERSION_11_0
+	const struct ast_channel_tech *cur_tech = ast_channel_tech(c);
+	const char *cur_name = ast_channel_name(c);
+#else /* !defined(CC_AST_HAS_VERSION_11_0) */
+	const struct ast_channel_tech *cur_tech = c->tech;
+	const char *cur_name = c->name;
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
+
+	if (cur_tech == &capi_tech) {
 		plci = i->onholdPLCI;
 	} else {
 		i = NULL;
@@ -6162,7 +6465,7 @@
 
 	if (!i) {
 		cc_log(LOG_WARNING, "%s is not valid or not on hold to retrieve!\n",
-			c->name);
+			cur_name);
 		return 0;
 	}
 
@@ -6185,7 +6488,7 @@
 
 	if (!(capi_controllers[i->controller]->holdretrieve)) {
 		cc_log(LOG_NOTICE,"%s: RETRIEVE for %s not supported by controller.\n",
-			i->vname, c->name);
+			i->vname, cur_name);
 		return -1;
 	}
 
@@ -6224,6 +6527,12 @@
 	char *holdid;
 	int explicit_peer_plci = 0;
 
+#ifdef CC_AST_HAS_VERSION_11_0
+	const char *cur_name = ast_channel_name(c);
+#else /* !defined(CC_AST_HAS_VERSION_11_0) */
+	const char *cur_name = c->name;
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
+
 	if ((id = pbx_builtin_getvar_helper(c, "CALLERHOLDID"))) {
 		plci = (unsigned int)strtoul(id, NULL, 0);
 	}
@@ -6288,7 +6597,7 @@
 
 	if (!(capi_controllers[i->controller]->ECT)) {
 		cc_log(LOG_WARNING, "%s: ECT for %s not supported by controller.\n",
-			i->vname, c->name);
+			i->vname, cur_name);
 		return -1;
 	}
 
@@ -6369,22 +6678,28 @@
 	struct capi_pvt *i = CC_CHANNEL_PVT(c);
 	char buffer[16];
 
+#ifdef CC_AST_HAS_VERSION_11_0
+	const char *cur_name = ast_channel_name(c);
+#else /* !defined(CC_AST_HAS_VERSION_11_0) */
+	const char *cur_name = c->name;
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
+
 	/*  TODO: support holdtype notify */
 
 	if ((i->isdnstate & CAPI_ISDN_STATE_HOLD)) {
 		cc_log(LOG_NOTICE,"%s: %s already on hold.\n",
-			i->vname, c->name);
+			i->vname, cur_name);
 		return 0;
 	}
 
 	if (!(i->isdnstate & CAPI_ISDN_STATE_B3_UP)) {
 		cc_log(LOG_NOTICE,"%s: Cannot put on hold %s while not connected.\n",
-			i->vname, c->name);
+			i->vname, cur_name);
 		return 0;
 	}
 	if (!(capi_controllers[i->controller]->holdretrieve)) {
 		cc_log(LOG_NOTICE,"%s: HOLD for %s not supported by controller.\n",
-			i->vname, c->name);
+			i->vname, cur_name);
 		return 0;
 	}
 
@@ -6424,9 +6739,15 @@
 {
 	struct capi_pvt *i = CC_CHANNEL_PVT(c);
 
+#ifdef CC_AST_HAS_VERSION_11_0
+	const char *cur_name = ast_channel_name(c);
+#else /* !defined(CC_AST_HAS_VERSION_11_0) */
+	const char *cur_name = c->name;
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
+
 	if (!(capi_controllers[i->controller]->MCID)) {
 		cc_log(LOG_NOTICE, "%s: MCID for %s not supported by controller.\n",
-			i->vname, c->name);
+			i->vname, cur_name);
 		return -1;
 	}
 
@@ -7331,6 +7652,12 @@
 	const char	*id;
 	unsigned int	plci = 0;
 
+#ifdef CC_AST_HAS_VERSION_11_0
+	const char *cur_name = ast_channel_name(c);
+#else /* !defined(CC_AST_HAS_VERSION_11_0) */
+	const char *cur_name = c->name;
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
+
 	if ((id = pbx_builtin_getvar_helper(c, "CALLERHOLDID"))) {
 		plci = (unsigned int)strtoul(id, NULL, 0);
 	}
@@ -7367,12 +7694,12 @@
 	}
 	if (!(i->isdnstate & CAPI_ISDN_STATE_B3_UP)) {
 		cc_log(LOG_NOTICE,"%s: Cannot initiate conference %s while not connected.\n",
-			i->vname, c->name);
+			i->vname, cur_name);
 		return 0;
 	}
 	if (!(capi_controllers[i->controller]->threePTY)) {
 	        cc_log(LOG_NOTICE,"%s: 3PTY for %s not supported by controller.\n",
-			i->vname, c->name);
+			i->vname, cur_name);
 		return 0;
 	}
 
@@ -7538,7 +7865,14 @@
 		return -1;
 	}
 
-	if ((chan != NULL) && (chan->tech != &capi_tech)) {
+	if (chan != NULL) {
+#ifdef CC_AST_HAS_VERSION_11_0
+		const struct ast_channel_tech *cur_tech = ast_channel_tech(chan);
+#else /* !defined(CC_AST_HAS_VERSION_11_0) */
+		const struct ast_channel_tech *cur_tech = chan->tech;
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
+
+		if (cur_tech != &capi_tech) {
 		if (capicmd->capionly != 0) {
 			struct capi_pvt* resource_plci = pbx_check_resource_plci (chan);
 
@@ -7556,6 +7890,7 @@
 			}
 		}
 	}
+	}
 
 	res = (capicmd->cmd)(chan, params);
 
@@ -7597,10 +7932,16 @@
 
 	cc_mutex_lock(&i->lock);
 
+#ifdef CC_AST_HAS_VERSION_11_0
+	const char *cur_name = ast_channel_name(c);
+#else /* !defined(CC_AST_HAS_VERSION_11_0) */
+	const char *cur_name = c->name;
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
+
 	switch (condition) {
 	case AST_CONTROL_RINGING:
 		cc_verbose(3, 1, VERBOSE_PREFIX_2 "%s: Requested RINGING-Indication for %s\n",
-			i->vname, c->name);
+			i->vname, cur_name);
 		/* TODO somehow enable unhold on ringing, but when wanted only */
 		/* 
 		if (i->isdnstate & CAPI_ISDN_STATE_HOLD)
@@ -7615,7 +7956,7 @@
 		break;
 	case AST_CONTROL_BUSY:
 		cc_verbose(3, 1, VERBOSE_PREFIX_2 "%s: Requested BUSY-Indication for %s\n",
-			i->vname, c->name);
+			i->vname, cur_name);
 		if ((i->state == CAPI_STATE_ALERTING) ||
 		    (i->state == CAPI_STATE_DID) || (i->state == CAPI_STATE_INCALL)) {
 			capi_sendf(NULL, 0, CAPI_CONNECT_RESP, i->PLCI, i->MessageNumber,
@@ -7627,7 +7968,7 @@
 		break;
 	case AST_CONTROL_CONGESTION:
 		cc_verbose(3, 1, VERBOSE_PREFIX_2 "%s: Requested CONGESTION-Indication for %s\n",
-			i->vname, c->name);
+			i->vname, cur_name);
 		if ((i->state == CAPI_STATE_ALERTING) ||
 		    (i->state == CAPI_STATE_DID) || (i->state == CAPI_STATE_INCALL)) {
 			capi_sendf(NULL, 0, CAPI_CONNECT_RESP, i->PLCI, i->MessageNumber,
@@ -7639,17 +7980,17 @@
 		break;
 	case AST_CONTROL_PROGRESS:
 		cc_verbose(3, 1, VERBOSE_PREFIX_2 "%s: Requested PROGRESS-Indication for %s\n",
-			i->vname, c->name);
+			i->vname, cur_name);
 		if (i->ntmode) pbx_capi_signal_progress(c, NULL);
 		break;
 	case AST_CONTROL_PROCEEDING:
 		cc_verbose(3, 1, VERBOSE_PREFIX_2 "%s: Requested PROCEEDING-Indication for %s\n",
-			i->vname, c->name);
+			i->vname, cur_name);
 		pbx_capi_signal_proceeding(c, NULL);
 		break;
 	case AST_CONTROL_HOLD:
 		cc_verbose(3, 1, VERBOSE_PREFIX_2 "%s: Requested HOLD-Indication for %s\n",
-			i->vname, c->name);
+			i->vname, cur_name);
 		if (i->doholdtype != CC_HOLDTYPE_LOCAL) {
 			ret = pbx_capi_hold(c, NULL);
 		}
@@ -7661,7 +8002,7 @@
 		break;
 	case AST_CONTROL_UNHOLD:
 		cc_verbose(3, 1, VERBOSE_PREFIX_2 "%s: Requested UNHOLD-Indication for %s\n",
-			i->vname, c->name);
+			i->vname, cur_name);
 		if (i->doholdtype != CC_HOLDTYPE_LOCAL) {
 			if (i->transfergroup) {
 				/* we assume bridge transfer, so wait a little bit to see
@@ -7680,7 +8021,7 @@
 		break;
 	case -1: /* stop indications */
 		cc_verbose(3, 1, VERBOSE_PREFIX_2 "%s: Requested Indication-STOP for %s\n",
-			i->vname, c->name);
+			i->vname, cur_name);
 		if ((i->isdnstate & CAPI_ISDN_STATE_HOLD)) {
 			if (i->transfergroup) {
 				/* we assume bridge transfer, so wait a little bit to see
@@ -7693,7 +8034,7 @@
 		break;
 	default:
 		cc_verbose(3, 1, VERBOSE_PREFIX_2 "%s: Requested unknown Indication %d for %s\n",
-			i->vname, condition, c->name);
+			i->vname, condition, cur_name);
 		break;
 	}
 	cc_mutex_unlock(&i->lock);
@@ -7703,7 +8044,11 @@
 /*
  * PBX wants to know the state for a specific device
  */
+#ifdef CC_AST_HAS_VERSION_11_0
+static int pbx_capi_devicestate(const char *data)
+#else /* !defined(CC_AST_HAS_VERSIOM_11_0) */
 static int pbx_capi_devicestate(void *data)
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
 {
 	char *s;
 	char *target;
@@ -7834,19 +8179,19 @@
 	case CAPI_CHANNEL_TASK_PICKUP:
 		if (ast_pickup_call(chan_for_task)) {
 			cc_verbose(3, 1, VERBOSE_PREFIX_2 "%s: Pickup not possible.\n",
-				chan_for_task->name);
+				ast_channel_name(chan_for_task));
 		}
 		ast_hangup(chan_for_task);
 		break;
 	case CAPI_CHANNEL_TASK_GOTOFAX:
 		/* deferred (out of lock) async goto fax extension */
 		/* Save the DID/DNIS when we transfer the fax call to a "fax" extension */
-		pbx_builtin_setvar_helper(chan_for_task, "FAXEXTEN", chan_for_task->exten);
+		pbx_builtin_setvar_helper(chan_for_task, "FAXEXTEN", ast_channel_exten(chan_for_task));
 		i = CC_CHANNEL_PVT(chan_for_task);
 		if (i) {
 			if (ast_async_goto(chan_for_task, i->faxcontext, i->faxexten, i->faxpriority)) {
 				cc_log(LOG_WARNING, "Failed to async goto '%s,%s,%d' for '%s'\n",
-					i->faxcontext, i->faxexten, i->faxpriority, chan_for_task->name);
+					i->faxcontext, i->faxexten, i->faxpriority, ast_channel_name(chan_for_task));
 			}
 		}
 		break;
@@ -8950,6 +9295,10 @@
 	}
 #endif
 
+#ifdef CC_AST_HAS_VERSION_1_4
+	myself = ast_module_info->self;
+#endif
+
 	diva_verbose_load();
 
 #ifdef CC_AST_HAS_VERSION_1_6
@@ -9013,7 +9362,7 @@
 	}
 
 	pbx_capi_cli_register();
-	pbx_capi_ami_register();
+	pbx_capi_ami_register(myself);
 	pbx_capi_register_device_state_providers();
 	pbx_capi_chat_init_module();
 	
@@ -9103,15 +9452,19 @@
 			cid_name = 0;
 	}
 
-#ifdef CC_AST_HAS_VERSION_1_8
+#ifdef CC_AST_HAS_VERSION_11_0
+	if (cid_name == 0 && ast_channel_connected(i->owner)->id.name.valid ) {
+		cid_name = ast_strdupa(S_COR(ast_channel_connected(i->owner)->id.name.valid, ast_channel_connected(i->owner)->id.name.str, ""));
+	}
+#elif defined(CC_AST_HAS_VERSION_1_8)
 	if (cid_name == 0 && i->owner->connected.id.name.valid ) {
 		cid_name = ast_strdupa(S_COR(i->owner->connected.id.name.valid, i->owner->connected.id.name.str, ""));
 	}
-#else
+#else /* !(defined(CC_AST_HAS_VERSION_11_0) || defined(CC_AST_HAS_VERSION_1_8)) */
   if (cid_name == 0 && i->owner->cid.cid_name && *i->owner->cid.cid_name) {
 		cid_name = ast_strdupa(i->owner->cid.cid_name);
 	}
-#endif
+#endif /* defined(CC_AST_HAS_VERSION_11_0) || defined(CC_AST_HAS_VERSION_1_8) */
 	if (cid_name != 0 && *cid_name == 0)
 		cid_name = i->name;
 
--- chan_capi_chat.c
+++ chan_capi_chat.c
@@ -618,8 +618,13 @@
 			if ((ready_fd < 0) && ms) { 
 				if (errno == 0 || errno == EINTR)
 					continue;
+#ifdef CC_AST_HAS_VERSION_11_0
+		const char *cur_name = ast_channel_name(chan);
+#else /* !defined(CC_AST_HAS_VERSION_11_0) */
+		const char *cur_name = chan->name;
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
 				cc_log(LOG_WARNING, "%s: Wait failed (%s).\n",
-					chan->name, strerror(errno));
+					cur_name, strerror(errno));
 				break;
 			}
 		}
@@ -712,7 +717,17 @@
 		options++;
 	}
 
-	if (c->tech == &capi_tech) {
+#ifdef CC_AST_HAS_VERSION_11_0
+	const struct ast_channel_tech *cur_tech = ast_channel_tech(c);
+	const char *cur_name = ast_channel_name(c);
+	const enum ast_channel_state cur_state = ast_channel_state(c);
+#else /* !defined(CC_AST_HAS_VERSION_11_0) */
+	const struct ast_channel_tech *cur_tech = c->tech;
+	const char *cur_name = c->name;
+	const enum ast_channel_state cur_state = c->_state;
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
+
+	if (cur_tech == &capi_tech) {
 		i = CC_CHANNEL_PVT(c); 
 	} else {
 		/* virtual CAPI channel */
@@ -740,9 +755,9 @@
 
 	cc_verbose(3, 1, VERBOSE_PREFIX_3 CC_MESSAGE_NAME " chat: %s: roomname=%s group=%u group users=%u"
 		"options=%s hangup_timeout=%d controller=%s (0x%llx)\n",
-		c->name, roomname, selectedGroup, bridgeUsers, options, hangup_timeout, controller, contr);
+		cur_name, roomname, selectedGroup, bridgeUsers, options, hangup_timeout, controller, contr);
 
-	if (c->tech != &capi_tech) {
+	if (cur_tech != &capi_tech) {
 		if (i == NULL) {
 			i = capi_mknullif(c, contr);
 		}
@@ -753,7 +768,7 @@
 	}
 
 
-	if (c->_state != AST_STATE_UP) {
+	if (cur_state != AST_STATE_UP) {
 		ast_answer(c);
 	}
 
@@ -888,9 +903,19 @@
 		contr = (unsigned long long)(tmpcntr >> 1);
 	}
 
+#ifdef CC_AST_HAS_VERSION_11_0
+	const char *cur_name = ast_channel_name(c);
+	const struct ast_channel_tech *cur_tech = ast_channel_tech(c);
+	const enum ast_channel_state cur_state = ast_channel_state(c);
+#else /* !defined(CC_AST_HAS_VERSION_11_0) */
+	const char *cur_name = c->name;
+	const struct ast_channel_tech *cur_tech = c->tech;
+	const enum ast_channel_state cur_state = c->_state;
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
+
 	cc_verbose(3, 1, VERBOSE_PREFIX_3 CC_MESSAGE_NAME " chat_play: %s: roomname=%s "
 		"message=%s controller=%s (0x%llx)\n",
-		c->name, roomname, file_name, controller, contr);
+		cur_name, roomname, file_name, controller, contr);
 
 	i = capi_mknullif(c, contr);
 	if (i == NULL) {
@@ -899,7 +924,7 @@
 		return (-1);
 	}
 
-	if (c->_state != AST_STATE_UP) {
+	if (cur_state != AST_STATE_UP) {
 		ast_answer(c);
 	}
 
@@ -917,7 +942,7 @@
 	}
 
 	/* main loop */
-	chat_handle_events(c, i, room, flags, (c->tech == &capi_tech) ? (CC_CHANNEL_PVT(c)) : 0, f, 0, NULL);
+	chat_handle_events(c, i, room, flags, (cur_tech == &capi_tech) ? (CC_CHANNEL_PVT(c)) : 0, f, 0, NULL);
 
 	del_chat_member(room, 1);
 
@@ -1068,7 +1093,13 @@
 		}
 	}
 
-	if (c->tech != &capi_tech) {
+#ifdef CC_AST_HAS_VERSION_11_0
+	const struct ast_channel_tech *cur_tech = ast_channel_tech(c);
+#else /* !defined(CC_AST_HAS_VERSION_11_0) */
+	const struct ast_channel_tech *cur_tech = c->tech;
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
+
+	if (cur_tech != &capi_tech) {
 		i = capi_mkresourceif(c, contr, 0, codecs, all);
 		if (i != NULL) {
 			char buffer[24];
@@ -1140,8 +1171,13 @@
 				room->number, room->name, room->i->vname,
 				"?", "?");
 		} else {
+#ifdef CC_AST_HAS_VERSION_11_0
+			const char *cur_name = ast_channel_name(c);
+#else /* !defined(CC_AST_HAS_VERSION_11_0) */
+			const char *cur_name = c->name;
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
 			ast_cli(fd, "%5d %-17s%-40s\"%s\" <%s>\n",
-				room->number, room->name, c->name,
+				room->number, room->name, cur_name,
 				pbx_capi_get_callername (c, ""), pbx_capi_get_cid (c, ""));
 		}
 		room = room->next;
@@ -1247,7 +1283,12 @@
 					c = room->i->used;
 				}
 				if (c != 0) {
-					if (strcmp (memberName, c->name) == 0) {
+#ifdef CC_AST_HAS_VERSION_11_0
+					const char *cur_name = ast_channel_name(c);
+#else /* !defined(CC_AST_HAS_VERSION_11_0) */
+					const char *cur_name = c->name;
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
+					if (strcmp (memberName, cur_name) == 0) {
 						room->info |= PBX_CHAT_MEMBER_INFO_REMOVE;
 						ret = 0;
 					}
--- chan_capi_command.c
+++ chan_capi_command.c
@@ -79,7 +79,13 @@
 	const char* key[2];
 	size_t length;
 
-	if (c->tech == &capi_tech) {
+#ifdef CC_AST_HAS_VERSION_11_0
+	const struct ast_channel_tech *cur_tech = ast_channel_tech(c);
+#else /* !defined(CC_AST_HAS_VERSION_11_0) */
+	const struct ast_channel_tech *cur_tech = c->tech;
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
+  
+	if (cur_tech == &capi_tech) {
 		i = CC_CHANNEL_PVT(c);
 	} else {
 		i = pbx_check_resource_plci(c);
@@ -200,7 +206,13 @@
 {
 	struct capi_pvt *i;
 
-	if (c->tech == &capi_tech) {
+#ifdef CC_AST_HAS_VERSION_11_0
+	const struct ast_channel_tech *cur_tech = ast_channel_tech(c);
+#else /* !defined(CC_AST_HAS_VERSION_11_0) */
+	const struct ast_channel_tech *cur_tech = c->tech;
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
+
+	if (cur_tech == &capi_tech) {
 		i = CC_CHANNEL_PVT(c);
 	} else {
 		i = pbx_check_resource_plci(c);
--- chan_capi_fmt.h
+++ chan_capi_fmt.h
@@ -122,17 +122,17 @@
 
 	ast_format_clear(&bestCodec);
 
-	if (ast_best_codec(a->nativeformats, &bestCodec) == NULL) {
+	if (ast_best_codec(ast_channel_nativeformats(a), &bestCodec) == NULL) {
 		/*
 			Fallback to aLaw
 			*/
 		ast_format_set(&bestCodec, CC_FORMAT_ALAW, 0);
 	}
 
-	ast_format_copy(&a->rawreadformat,  &bestCodec);
-	ast_format_copy(&a->readformat,     &bestCodec);
-	ast_format_copy(&a->rawwriteformat, &bestCodec);
-	ast_format_copy(&a->writeformat,    &bestCodec);
+	ast_format_copy(ast_channel_readformat(a),  &bestCodec);
+	ast_format_copy(ast_channel_readformat(a),     &bestCodec);
+	ast_format_copy(ast_channel_rawwriteformat(a), &bestCodec);
+	ast_format_copy(ast_channel_writeformat(a),    &bestCodec);
 
 	return (int)ast_format_to_old_bitfield(&bestCodec);
 }
--- chan_capi.h
+++ chan_capi.h
@@ -136,7 +136,11 @@
 /*
  * definitions for nice compatibility
  */
+#ifdef CC_AST_HAS_VERSION_10_0
+#define CC_CHANNEL_PVT(c) ast_channel_tech_pvt(c)
+#else
 #define CC_CHANNEL_PVT(c) (c)->tech_pvt
+#endif /* CC_AST_HAS_VERSION_11_0 */
 #define CC_BRIDGE_RETURN enum ast_bridge_result
 
 #ifdef CC_AST_HAS_UNION_DATA_IN_FRAME
--- chan_capi_management_common.c
+++ chan_capi_management_common.c
@@ -86,7 +86,12 @@
 					retry_search = 1;
 					break;
 				}
-				if ((!ast_strlen_zero(c->name) && (strcmp(requiredChannelName, c->name) == 0)) ||
+#ifdef CC_AST_HAS_VERSION_11_0
+				const char *cur_name = ast_channel_name(c);
+#else /* !defined(CC_AST_HAS_VERSION_11_0) */
+				const char *cur_name = c->name;
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
+				if ((!ast_strlen_zero(cur_name) && (strcmp(requiredChannelName, cur_name) == 0)) ||
 						strcmp(requiredChannelName, i->vname) == 0) {
 					struct ast_channel* usedChannel = c;
 					int ret;
--- chan_capi_qsig_ecma.c
+++ chan_capi_qsig_ecma.c
@@ -83,9 +83,15 @@
 					ast_set_callerid(i->owner, NULL, callername, NULL);
 					Use code from ast_set_callerid but do not update CDR
 					*/
+#ifdef CC_AST_HAS_VERSION_11_0
+				ast_channel_caller(i->owner)->id.name.valid = 1;
+				ast_free(ast_channel_caller(i->owner)->id.name.str);
+				ast_channel_caller(i->owner)->id.name.str = ast_strdup(callername);
+#else /* !defined(CC_AST_HAS_VERSION_11_0) */
 				i->owner->caller.id.name.valid = 1;
 				ast_free(i->owner->caller.id.name.str);
 				i->owner->caller.id.name.str = ast_strdup(callername);
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
 #else
 			i->owner->cid.cid_name = ast_strdup(callername);	/* Save name to callerid */
 #endif
@@ -421,17 +427,22 @@
 			
 			if (ii) {
 				/* send callers name to user B */
-#ifdef CC_AST_HAS_VERSION_1_8
+#ifdef CC_AST_HAS_VERSION_11_0
+ 				if (ast_channel_caller(ii->owner)->id.name.valid ) {
+					name = ast_strdupa(S_COR(ast_channel_caller(ii->owner)->id.name.valid, ast_channel_caller(ii->owner)->id.name.str, ""));
+					namelength = strlen(name);
+				}
+#elif defined(CC_AST_HAS_VERSION_1_8)
 				if (ii->owner->caller.id.name.valid ) {
 					name = ast_strdupa(S_COR(ii->owner->caller.id.name.valid, ii->owner->caller.id.name.str, ""));
 					namelength = strlen(name);
 				}
-#else
+#else /* !(defined(CC_AST_HAS_VERSION_11_0) || defined(CC_AST_HAS_VERSION_1_8)) */
 				if (ii->owner->cid.cid_name) {
 					name = ast_strdupa(ii->owner->cid.cid_name);
 					namelength = strlen(name);
 				}
-#endif
+#endif /* defined(CC_AST_HAS_VERSION_11_0) || defined(CC_AST_HAS_VERSION_1_8) */
 			}
 		} else { /* have to build first facility - send destination number back to inbound channel */
 			struct capi_pvt *ii = capi_find_interface_by_plci(i->qsig_data.partner_plci);
--- chan_capi_supplementary.c
+++ chan_capi_supplementary.c
@@ -400,9 +400,21 @@
 	c->type = "CCBS/CCNR";
 #endif
 
+#ifdef CC_AST_HAS_VERSION_11_0
+	ast_channel_priority_set(c, ccbsnr->priority);
+#else /* !defined(CC_AST_HAS_VERSION_11_0) */
 	c->priority = ccbsnr->priority;
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
 
-#ifdef CC_AST_HAS_VERSION_1_8
+#ifdef CC_AST_HAS_VERSION_11_0
+  /*! \todo verify if necessary/complete */
+	ast_channel_connected(c)->id.number.valid = 1;
+	ast_free (ast_channel_connected(c)->id.number.str);
+	ast_channel_connected(c)->id.number.str = ast_strdup(handlename);
+
+	ast_free (ast_channel_dialed(c)->number.str);
+	ast_channel_dialed(c)->number.str = ast_strdup (ccbsnr->exten);
+#elif defined(CC_AST_HAS_VERSION_1_8)
   /*! \todo verify if necessary/complete */
 	c->connected.id.number.valid = 1;
 	ast_free (c->connected.id.number.str);
@@ -410,7 +422,7 @@
 
 	ast_free (c->dialed.number.str);
 	c->dialed.number.str = ast_strdup (ccbsnr->exten);
-#else
+#else /* !(defined(CC_AST_HAS_VERSION_11_0) || defined(CC_AST_HAS_VERSION_1_8)) */
 	if (c->cid.cid_num) {
 		ast_free(c->cid.cid_num);
 	}
@@ -419,7 +431,7 @@
 		ast_free(c->cid.cid_dnid);
 	}
 	c->cid.cid_dnid = ast_strdup(ccbsnr->exten);
-#endif
+#endif /* defined(CC_AST_HAS_VERSION_11_0) || defined(CC_AST_HAS_VERSION_1_8) */
 
 #ifndef CC_AST_HAS_EXT2_CHAN_ALLOC
 	cc_copy_string(c->context, ccbsnr->context, sizeof(c->context));
--- chan_capi_utils.c
+++ chan_capi_utils.c
@@ -172,6 +172,7 @@
 	int channelcount = 0xffff;
 	int maxcontr = (CAPI_MAX_CONTROLLERS > (sizeof(controllermask)*8)) ?
 		(sizeof(controllermask)*8) : CAPI_MAX_CONTROLLERS;
+	char *cur_chan_name;
 
 	cc_verbose(3, 1, VERBOSE_PREFIX_4 "capi_mknullif: find controller for mask 0x%lx\n",
 		controllermask);
@@ -193,8 +194,17 @@
 	
 	cc_mutex_init(&tmp->lock);
 	ast_cond_init(&tmp->event_trigger, NULL);
+	if (c) {
+#ifdef CC_AST_HAS_VERSION_11_0
+		cur_chan_name = (char *)ast_channel_name(c);
+#else /* !defined(CC_AST_HAS_VERSION_11_0) */
+		cur_chan_name = c->name;
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
+	}
+	else
+		cur_chan_name = "BRIDGE";
 	
-	snprintf(tmp->name, sizeof(tmp->name) - 1, "%s-NULLPLCI", (c != 0) ? c->name : "BRIDGE");
+	snprintf(tmp->name, sizeof(tmp->name) - 1, "%s-NULLPLCI", cur_chan_name);
 	snprintf(tmp->vname, sizeof(tmp->vname) - 1, "%s", tmp->name);
 
 	tmp->channeltype = CAPI_CHANNELTYPE_NULL;
@@ -303,7 +313,11 @@
 	} else {
 		controller = data_plci_ifc->controller;
 		codecs = (all != 0) ? pbx_capi_get_controller_codecs (controller) : codecs;
+#ifdef CC_AST_HAS_VERSION_11_0
+		fmt = pbx_capi_get_controller_codecs (controller) & codecs & cc_get_formats_as_bits(ast_channel_nativeformats(c));
+#else /* !defined(CC_AST_HAS_VERSION_11_0) */
 		fmt = pbx_capi_get_controller_codecs (controller) & codecs & cc_get_formats_as_bits(c->nativeformats);
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
 		if (fmt != 0)
 			fmt = cc_get_best_codec_as_bits(fmt);
 	}
@@ -317,7 +331,13 @@
 	cc_mutex_init(&data_ifc->lock);
 	ast_cond_init(&data_ifc->event_trigger, NULL);
 	
-	snprintf(data_ifc->name, sizeof(data_ifc->name) - 1, "%s-%sPLCI", c->name, (data_plci_ifc == 0) ? "DATA" : "LINE");
+#ifdef CC_AST_HAS_VERSION_11_0
+	const char *cur_name = ast_channel_name(c);
+#else /* !defined(CC_AST_HAS_VERSION_11_0) */
+	const char *cur_name = c->name;
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
+
+	snprintf(data_ifc->name, sizeof(data_ifc->name) - 1, "%s-%sPLCI", cur_name, (data_plci_ifc == 0) ? "DATA" : "LINE");
 	snprintf(data_ifc->vname, sizeof(data_ifc->vname) - 1, "%s", data_ifc->name);
 
 	data_ifc->channeltype = CAPI_CHANNELTYPE_NULL;
@@ -1312,6 +1332,7 @@
 {
 	int id = -1;
 	struct ast_channel *chan = NULL;
+	char *cur_name = "unlinked";
 
 	if (p) {
 		id = (int)strtol(p, NULL, 0);
@@ -1322,8 +1343,15 @@
 		chan = peerlinkchannel[id].channel;
 		peerlinkchannel[id].channel = NULL;
 	}
+	if (chan) {
+#ifdef CC_AST_HAS_VERSION_11_0
+		cur_name = (char *)ast_channel_name(chan);
+#else /* !defined(CC_AST_HAS_VERSION_11_0) */
+		cur_name = (char *)chan->name;
+#endif /* defined(CC_AST_HAS_VERSION_11_0) */
+	}
 	cc_verbose(3, 1, VERBOSE_PREFIX_4 CC_MESSAGE_NAME
-		": peerlink %d allocated, peer is %s\n", id, (chan)?chan->name:"unlinked");
+		": peerlink %d allocated, peer is %s\n", id, cur_name);
 	cc_mutex_unlock(&peerlink_lock);
 	return chan;
 }
@@ -1605,15 +1633,17 @@
 	 ast_channel_lock(chan) to be held while
 	 while accessing returned pointer
 	*/
-const char* pbx_capi_get_cid(const struct ast_channel* c, const char* notAvailableVisual)
+const char* pbx_capi_get_cid(struct ast_channel* c, const char* notAvailableVisual)
 {
 	const char* cid;
 
-#ifdef CC_AST_HAS_VERSION_1_8
+#ifdef CC_AST_HAS_VERSION_11_0
+	cid = S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, notAvailableVisual);
+#elif defined(CC_AST_HAS_VERSION_1_8)
 	cid = S_COR(c->caller.id.number.valid, c->caller.id.number.str, notAvailableVisual);
-#else
+#else /* !(defined(CC_AST_HAS_VERSION_11_0) || defined(CC_AST_HAS_VERSION_1_8)) */
 	cid = c->cid.cid_num;
-#endif
+#endif /* defined(CC_AST_HAS_VERSION_11_0) || defined(CC_AST_HAS_VERSION_1_8) */
 
 	return (cid);
 }
@@ -1622,15 +1652,17 @@
 	 ast_channel_lock(chan) to be held while
 	 while accessing returned pointer
 	*/
-const char* pbx_capi_get_callername(const struct ast_channel* c, const char* notAvailableVisual)
+const char* pbx_capi_get_callername(struct ast_channel* c, const char* notAvailableVisual)
 {
 	const char* name;
 
-#ifdef CC_AST_HAS_VERSION_1_8
+#ifdef CC_AST_HAS_VERSION_11_0
+	name = S_COR(ast_channel_caller(c)->id.name.valid, ast_channel_caller(c)->id.name.str, notAvailableVisual);
+#elif defined(CC_AST_HAS_VERSION_1_8)
 	name = S_COR(c->caller.id.name.valid, c->caller.id.name.str, notAvailableVisual);
-#else
+#else /* !(defined(CC_AST_HAS_VERSION_11_0) || defined(CC_AST_HAS_VERSION_1_8)) */
 	name = (c->cid.cid_name) ? c->cid.cid_name : notAvailableVisual;
-#endif
+#endif /* defined(CC_AST_HAS_VERSION_11_0) || defined(CC_AST_HAS_VERSION_1_8) */
 
 	return (name);
 }
@@ -1639,15 +1671,17 @@
 	 ast_channel_lock(chan) to be held while
 	 while accessing returned pointer
 	*/
-const char* pbx_capi_get_connectedname(const struct ast_channel* c, const char* notAvailableVisual)
+const char* pbx_capi_get_connectedname(struct ast_channel* c, const char* notAvailableVisual)
 {
 	const char* name;
 
-#ifdef CC_AST_HAS_VERSION_1_8
+#ifdef CC_AST_HAS_VERSION_11_0
+	name = S_COR(ast_channel_connected(c)->id.name.valid, ast_channel_connected(c)->id.name.str, notAvailableVisual);
+#elif defined(CC_AST_HAS_VERSION_1_8)
 	name = S_COR(c->connected.id.name.valid, c->connected.id.name.str, notAvailableVisual);
-#else
+#else /* !(defined(CC_AST_HAS_VERSION_11_0) || defined(CC_AST_HAS_VERSION_1_8)) */
 	name = (c->cid.cid_name) ? c->cid.cid_name : notAvailableVisual;
-#endif
+#endif /* defined(CC_AST_HAS_VERSION_11_0) || defined(CC_AST_HAS_VERSION_1_8) */
 
 	return (name);
 }
--- chan_capi_utils.h
+++ chan_capi_utils.h
@@ -59,9 +59,9 @@
 extern struct ast_frame *capi_read_pipeframe(struct capi_pvt *i);
 extern int capi_write_frame(struct capi_pvt *i, struct ast_frame *f);
 extern int capi_verify_resource_plci(const struct capi_pvt *i);
-extern const char* pbx_capi_get_cid (const struct ast_channel* c, const char *notAvailableVisual);
-extern const char* pbx_capi_get_callername (const struct ast_channel* c, const char *notAvailableVisual);
-const char* pbx_capi_get_connectedname (const struct ast_channel* c, const char *notAvailableVisual);
+extern const char* pbx_capi_get_cid (struct ast_channel* c, const char *notAvailableVisual);
+extern const char* pbx_capi_get_callername (struct ast_channel* c, const char *notAvailableVisual);
+const char* pbx_capi_get_connectedname (struct ast_channel* c, const char *notAvailableVisual);
 char* pbx_capi_strsep_controller_list (char** param);
 
 #define capi_number(data, strip) \
