diff --git a/Asterisk.2013/Asterisk.NET/Manager/ManagerConnection.cs b/Asterisk.2013/Asterisk.NET/Manager/ManagerConnection.cs index 49d2302..0dc7e63 100644 --- a/Asterisk.2013/Asterisk.NET/Manager/ManagerConnection.cs +++ b/Asterisk.2013/Asterisk.NET/Manager/ManagerConnection.cs @@ -46,6 +46,7 @@ namespace AsterNET.Manager private int pingInterval = 10000; private object lockSocket = new object(); + private object lockSocketWrite = new object(); private object lockHandlers = new object(); private bool enableEvents = true; @@ -1594,7 +1595,10 @@ namespace AsterNET.Manager private void sendToAsterisk(string buffer) { - mrSocket.Write(buffer); + lock (lockSocketWrite) + { + mrSocket.Write(buffer); + } } #endregion