Giter VIP home page Giter VIP logo

Comments (10)

danbarua avatar danbarua commented on June 15, 2024

If NEventSocket detects a logging library in your program, such as NLog, Log4Net etc then it will route log messages to that. Could you log trace-level messages to a file and paste the logs here and we can see what is going on?

from neventsocket.

gregoriusus avatar gregoriusus commented on June 15, 2024

I installed Nlog and tried example.

This is last debug trace that I get
2015-08-12 03:59:47 TID[13] DEBUG CommandReply re
ceived [+OK event listener enabled plain] for [event plain CHANNEL_EXECUTE_COMPL
ETE BACKGROUND_JOB CHANNEL_HANGUP CHANNEL_ANSWER CHANNEL_PROGRESS CHANNEL_PROGRESS_MEDIA CHANNEL_BRIDGE CHANNEL_UNBRIDGE CUSTOM conference::maintenance]

This is code snippet that I use:
await client.SubscribeEvents();

        client.Events.Where(x => x.EventName == EventName.ChannelAnswer)
              .Subscribe(x =>
                  {
                      uuid = x.UUID;
                      ColorConsole.WriteLine("Channel Answer Event ".Blue(), x.UUID);
                  });

Is there a way I can send you private my ESL settings (ip,user, pass), so you can try to subscribe for example to HEARTBEAT event?

from neventsocket.

danbarua avatar danbarua commented on June 15, 2024

Sure, it's my GitHub user name at gmail.com

from neventsocket.

danbarua avatar danbarua commented on June 15, 2024

It looks like calling Console.ReadLine() blocks subscription callbacks.
As a workaround, adding await Task.Delay(200); before Console.ReadLine(); seems to do the trick.

from neventsocket.

danbarua avatar danbarua commented on June 15, 2024

If you're calling Console.ReadLine() in production, you have bigger issues.
:) you would normally be running as a Windows Service where blocking the UI
thread is not an issue.
On Thu, 15 Oct 2015 at 18:58, gregoriusus [email protected] wrote:

That's great news. Just one question. Is this workaround ok for production?

Best regards, Gregor

On Thu, Oct 15, 2015, 19:09 Dan Barua [email protected] wrote:

It looks like calling Console.ReadLine() blocks subscription callbacks.
As a workaround, adding await Task.Delay(200); before Console.ReadLine();
seems to do the trick.


Reply to this email directly or view it on GitHub
<
https://github.com/danbarua/NEventSocket/issues/20#issuecomment-148460186>
.

Gregor Nanger

CTO
t./f.: 00386 (0) 7 6000 308/309 • m:. 00386 (0)41 756485
• Infomedia d.o.o. • Jerebova 3, Novo mesto, Slovenia
www.infomedia.si


Reply to this email directly or view it on GitHub
#20 (comment)
.

from neventsocket.

danbarua avatar danbarua commented on June 15, 2024

alternatively, instead of calling Console.ReadLine();
we can do this to avoid blocking the main thread:

Console.WriteLine("Press CTRL+C to exit");
await Observable.FromEventPattern<ConsoleCancelEventHandler, ConsoleCancelEventArgs>(
                    h => Console.CancelKeyPress += h,
                    h => Console.CancelKeyPress -= h).ToTask();

from neventsocket.

danbarua avatar danbarua commented on June 15, 2024

Seems to be working now.

from neventsocket.

Eternal21 avatar Eternal21 commented on June 15, 2024

This seems like a great library, but I'm also having the same problem. Using latest release from nuget (1.0.2). I am not using Console.ReadLine(). I'm using the sample code from the readme (below). The only change is that I write to Debug window instead of Console window. The "status" response works fine and I get status output in Debug window, but after that no events are being displayed from FreeSWITCH. I also tried subscribing to EventName.All, with no luck either. How do I go about debugging this? Thanks.

public async Task Test()
{
    using (var socket = await InboundSocket.Connect("10.10.10.77", 8021, "ClueCon"))
    {
        var apiResponse = await socket.SendApi("status");
        Debug.WriteLine(apiResponse.BodyText);

        await socket.SubscribeEvents(EventName.ChannelAnswer);

        socket.Events
            .Where(x => x.EventName == EventName.ChannelAnswer)
            .Subscribe(x =>
            {
                Debug.WriteLine("Channel Answer Event " + x.UUID);
            });
    }
}

from neventsocket.

gregoriusus avatar gregoriusus commented on June 15, 2024

Well, you have to use Readline otherwise your program finish.

from neventsocket.

Eternal21 avatar Eternal21 commented on June 15, 2024

Never mind. My fault. The local socket variable was going out of scope, so it clearly could no longer react to events. Fixed by making it an instance variable instead of a local one. Kudos on the library again.

EDIT: I posted before seeing your response. Thanks.

from neventsocket.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.