diff -urN asterisk-1.0.7/channels/chan_sip.c asterisk-1.0.7-dtmf/channels/chan_sip.c
--- asterisk-1.0.7/channels/chan_sip.c	2005-03-02 18:38:27.000000000 +0100
+++ asterisk-1.0.7-dtmf/channels/chan_sip.c	2005-06-11 17:53:35.947004892 +0200
@@ -1055,6 +1055,7 @@
 		if ((result = mysql_store_result(mysql))) {
 
 			if ((rowval = mysql_fetch_row(result))) {
+				u->dtmfmode = global_dtmfmode;
 				numfields = mysql_num_fields(result);
 				fields = mysql_fetch_fields(result);
 				success = 1;
@@ -1076,6 +1077,13 @@
 						} else if (!strcasecmp(fields[x].name, "callerid")) {
 							strncpy(u->callerid, rowval[x], sizeof(u->callerid) - 1);
 							u->hascallerid=1;
+						} else if (!strcasecmp(fields[x].name, "dtmfmode")) {
+							if (!strcasecmp(rowval[x], "info"))
+								u->dtmfmode = SIP_DTMF_INFO;
+							else if (!strcasecmp(rowval[x], "rfc2833"))
+								u->dtmfmode = SIP_DTMF_RFC2833;
+							else if (!strcasecmp(rowval[x], "inband"))
+								u->dtmfmode = SIP_DTMF_INBAND;
 						}
 					}
 				}
@@ -1092,7 +1100,6 @@
 	} else {
 		u->capability = global_capability;
 		u->nat = global_nat;
-		u->dtmfmode = global_dtmfmode;
 		u->insecure = 1;
 		u->temponly = 1;
 	}
@@ -1156,6 +1163,7 @@
 		mysql_query(mysql, query);
 		if ((result = mysql_store_result(mysql))) {
 			if ((rowval = mysql_fetch_row(result))) {
+				p->dtmfmode = global_dtmfmode;
 				numfields = mysql_num_fields(result);
 				fields = mysql_fetch_fields(result);
 				success = 1;
@@ -1179,6 +1187,13 @@
 						} else if (!strcasecmp(fields[x].name, "regseconds")) {
 							if (sscanf(rowval[x], "%li", &regseconds) != 1)
 								regseconds = 0;
+						} else if (!strcasecmp(fields[x].name, "dtmfmode")) {
+							if (!strcasecmp(rowval[x], "info"))
+								p->dtmfmode = SIP_DTMF_INFO;
+							else if (!strcasecmp(rowval[x], "rfc2833"))
+								p->dtmfmode = SIP_DTMF_RFC2833;
+							else if (!strcasecmp(rowval[x], "inband"))
+								p->dtmfmode = SIP_DTMF_INBAND;
 						}
 					}
 				}
@@ -1198,7 +1213,6 @@
 		p->dynamic = 1;
 		p->capability = global_capability;
 		p->nat = global_nat;
-		p->dtmfmode = global_dtmfmode;
 		p->promiscredir = global_promiscredir;
 		p->insecure = 1;
 		p->pokeexpire = -1;
