Closed padmanabanravikumar closed 9 years ago
Hi @padmanabanravikumar , I am on the fence as to whether we ought to remove the response timeout code altogether (you will see that it is marked with the [Obsolete] attribute in the codebase.)
However, if you are using database logging with NLog, then perhaps you might benefit from wrapping your database logging in an async target: https://github.com/nlog/NLog/wiki/AsyncWrapper-target This will keep the NEventSocket worker threads from blocking and is generally worth doing if your log writes are going to be non-trivial.
Since working with FreeSwitch can involve a lot of trial and error, NEventSocket can be quite chatty with its logs to give you as much information as possible, you might also want to filter out Trace and Debug level logs from going to the DB.
thank you for your support. its working fine now. i have one more issue. sometimes "StartDtmf" function call does not working well, no response received after a long period of waiting. i have debugged for a while and noticed in EventSocket.cs file line 238 the method "SendCommand" call never happens.
Is this an Inbound socket controlling many channels or with just one channel?
Have you tried calling socket.SubscribeEvents() after connecting?
i am just using one channel. i have called client.SubscribeEvents(EventName.Dtmf).
Let's move this discussion to the chat room: https://gitter.im/danbarua/NEventSocket I might need you to paste me some trace level logs.
I've managed to replicate this now. Using LINQ queries with Rx is nice but sometimes you get race conditions where the message you want has arrived before the subscriber has been hooked up.
Is there any workaround?
Try the latest code, it should be ok now - v0.3.0 is up on NuGet.
@padmanabanravikumar Did this work for you?
yes, thank you.
"No Auth Request received within the specified timeout of 00:00:05" exception thrown when using NLog with database logging. If i remove NLog then everything works fine.
var socket = new InboundSocket(host, port, timeout);
await socket.Messages.Where(x => x.ContentType == ContentTypes.AuthRequest) .Take(1) .Timeout( socket.ResponseTimeOut, Observable.Throw(
new TimeoutException(
"No Auth Request received within the specified timeout of {0}.".Fmt(socket.ResponseTimeOut))))
.Do(_ => Log.Trace(() => "Received Auth Request"), ex => Log.ErrorException("Error waiting for AuthRequest.", ex))
.ToTask();
In these statements, If there is no delay in execution between these two statements it just works fine. and if there is a delay executing the second statement then it always fails.
for example, if we add the "System.Threading.Thread.Sleep(50);" in between the above two statements then second statement always fails and throws "No Auth Request received within the specified timeout of 00:00:05" exception.