--- src/apps/relay/dbdrivers/dbd_redis.c.orig
+++ src/apps/relay/dbdrivers/dbd_redis.c
@@ -50,6 +50,7 @@
 	char *host;
 	char *dbname;
 	char *password;
+	char *usocket;
 	unsigned int connect_timeout;
 	unsigned int port;
 };
@@ -61,6 +62,7 @@
 		if(co->host) free(co->host);
 		if(co->dbname) free(co->dbname);
 		if(co->password) free(co->password);
+       		if(co->usocket) free(co->usocket);
 		bzero(co,sizeof(Ryconninfo));
 	}
 }
@@ -103,6 +105,8 @@
 				co->host = strdup(seq + 1);
 			else if (!strcmp(s, "hostaddr"))
 				co->host = strdup(seq + 1);
+			else if (!strcmp(s, "socket"))
+				co->usocket = strdup(seq + 1);
 			else if (!strcmp(s, "dbname"))
 				co->dbname = strdup(seq + 1);
 			else if (!strcmp(s, "db"))
@@ -185,6 +189,7 @@
 				redisContext *rc = NULL;
 
 				char ip[256] = "\0";
+				char sockpath[256] = "\0";
 				int port = DEFAULT_REDIS_PORT;
 				if (co->host)
 					STRCPY(ip,co->host);
@@ -194,13 +199,24 @@
 				if (co->port)
 					port = (int) (co->port);
 
+				if (co->usocket)
+					STRCPY(sockpath,co->usocket);
+
 				if (co->connect_timeout) {
 					struct timeval tv;
 					tv.tv_usec = 0;
 					tv.tv_sec = (time_t) (co->connect_timeout);
-					rc = redisConnectWithTimeout(ip, port, tv);
+					if (co->usocket) {
+						rc = redisConnectUnixWithTimeout(sockpath, tv);
+					} else {
+						rc = redisConnectWithTimeout(ip, port, tv);
+					}
 				} else {
-					rc = redisConnect(ip, port);
+					if (co->usocket) {
+						rc = redisConnectUnix(sockpath);
+					} else {
+						rc = redisConnect(ip, port);
+					}
 				}
 
 				if (!rc) {
@@ -248,7 +264,7 @@
 				}
 			}
 
-			ret = redisLibeventAttach(base, co->host, co->port, co->password, atoi(co->dbname));
+			ret = redisLibeventAttach(base, co->host, co->port, co->password, co->usocket, atoi(co->dbname));
 
 			if (!ret) {
 				TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "Cannot initialize Redis DB connection\n");
@@ -294,12 +310,16 @@
 			RyconninfoFree(co);
 		} else {
 			char ip[256] = "\0";
+			char sockpath[256] = "\0";
 			int port = DEFAULT_REDIS_PORT;
 			if (co->host)
 				STRCPY(ip,co->host);
 			if (!ip[0])
 				STRCPY(ip,"127.0.0.1");
 
+			if (co->usocket)
+				STRCPY(sockpath,co->usocket);
+
 			if (co->port)
 				port = (int) (co->port);
 
@@ -307,9 +327,17 @@
 				struct timeval tv;
 				tv.tv_usec = 0;
 				tv.tv_sec = (time_t) (co->connect_timeout);
-				redisconnection = redisConnectWithTimeout(ip, port, tv);
+				if (co->usocket) {
+					redisconnection = redisConnectUnixWithTimeout(sockpath, tv);
+				} else {
+					redisconnection = redisConnectWithTimeout(ip, port, tv);
+				}
 			} else {
-				redisconnection = redisConnect(ip, port);
+				if (co->usocket) {
+					redisconnection = redisConnectUnix(sockpath);
+				} else {
+					redisconnection = redisConnect(ip, port);
+				}
 			}
 
 			if (redisconnection) {
