--- i4b_l2if.c.orig	Mon Jan  1 07:12:50 1996
+++ i4b_l2if.c	Mon Jan  1 07:41:00 1996
@@ -33,6 +33,8 @@
  *
  *      last edit-date: [Mon May 29 16:56:22 2000]
  *
+ * 12/01/01 DOV changes added - guy@traverse.com.au
+ *
  *---------------------------------------------------------------------------*/
 
 #include "i4bq931.h"
@@ -425,6 +427,8 @@
 	int slen = strlen(cd->src_telno);
 	int dlen = strlen(cd->dst_telno);
 	int klen = strlen(cd->keypad);	
+    	int dov;
+    	char *ch = cd->dst_telno;
 
 	/*
 	 * there is one additional octet if cd->bprot == BPROT_NONE
@@ -432,6 +436,15 @@
 	 *       protocol is highly questionable and a better
 	 *       mechanism should be used in future. (-hm)
 	 */
+	/* first check if call type is dov */
+	if ((*ch == 'v') || (*ch == 'V'))
+	{
+		dov = TRUE;
+		ch++;
+		dlen--;
+	} else
+		dov = FALSE;
+
 
 	NDBGL3(L3_PRIM, "unit %d, cr = 0x%02x", ctrl_desc[cd->controller].unit, cd->cr);
 	
@@ -440,7 +453,7 @@
 		(slen ? (3+slen) : 0)	+
 		(dlen ? (3+dlen) : 0)	+
 		(klen ? (2+klen) : 0)	+
-		(cd->bprot == BPROT_NONE ? 1 : 0);
+		(((cd->bprot == BPROT_NONE)|(cd->bprot == BPROT_RHDLC && dov))? 1 : 0); 
 
 	if((m = i4b_Dgetmbuf(len)) == NULL)
 	{
@@ -477,9 +490,16 @@
 			break;
 
 		case BPROT_RHDLC:	/* raw HDLC */
-			*ptr++ = IEI_BEARERCAP_LEN;
-			*ptr++ = IT_CAP_UNR_DIG_INFO;
-			*ptr++ = IT_RATE_64K;
+			if (dov) {
+				*ptr++ = IEI_BEARERCAP_LEN+1;
+				*ptr++ = IT_CAP_SPEECH;
+				*ptr++ = IT_RATE_64K;
+				*ptr++ = IT_UL1_G711A;
+			} else {	
+				*ptr++ = IEI_BEARERCAP_LEN;
+				*ptr++ = IT_CAP_UNR_DIG_INFO;
+				*ptr++ = IT_RATE_64K;
+			}
 			break;
 
 		default:
@@ -527,7 +547,8 @@
 		*ptr++ = IEI_CALLEDPN;		/* called party no */
 		*ptr++ = IEI_CALLEDPN_LEN+dlen;	/* called party no length */
 		*ptr++ = NUMBER_TYPEPLAN;	/* type of number, number plan id */
-		strncpy(ptr, cd->dst_telno, dlen);
+		/* strncpy(ptr, cd->dst_telno, dlen); */
+		strncpy (ptr, ch, dlen);
 		ptr += dlen;
 	}
 	
