Code Monkey home page Code Monkey logo

neventsocket's People

Contributors

ajgolledge avatar anber avatar danbarua avatar gitter-badger avatar iamkinetic avatar josbleuet avatar pragmatrix avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

neventsocket's Issues

does support Freeswitch 1.10.6 ?

some code like these :
using (var socket = await InboundSocket.Connect("192.168.1.100", 8021, "123456789"))
{

                //Tell FreeSwitch which events we are interested in
              //  await socket.SubscribeEvents(EventName.All);
                 await socket.SubscribeEvents(EventName.ChannelAnswer,EventName.ChannelCreate);
                //Handle events as they come in using Rx
                socket.ChannelEvents.Where(x => (x.EventName == EventName.ChannelAnswer
                || x.EventName == EventName.ChannelCreate
                    || x.EventName == EventName.ChannelHangup
                       || x.EventName == EventName.ChannelHangupComplete
                || EventName.ChannelOriginate == x.EventName
                || x.EventName == EventName.ChannelDestroy))
                          .Subscribe(async x =>
                      {
                          Console.WriteLine("Channel Answer Event " + x.UUID);

                          //we have a channel id, now we can control it
                          await socket.Play(x.UUID, "misc/8000/misc-freeswitch_is_state_of_the_art.wav");
                      });

                var apiResponse = await socket.SendApi("status");
                Console.WriteLine(apiResponse.BodyText);
                Console.WriteLine((await socket.SendApi("status")).BodyText);
                Console.WriteLine();
                Console.WriteLine((await socket.SendApi("invalid_api_command")).BodyText);
                Console.WriteLine();
                Console.WriteLine((await socket.SendApi("sofia status")).BodyText);
                Console.WriteLine();
                Console.WriteLine((await socket.SendApi("show bridged_calls")).BodyText);

                Console.WriteLine("Press [Enter] to exit.");
                Console.ReadLine();
            }

SendApi(...) looks ok . but xxxxx. .Subscribe(async x =>..... nothing happen at all when i use microsip for some dials .
i need some help for my question . please.. .

Examples cannot run

Examples cannot run. tips: Net.Reflection, Net.System, Net.Text not found!

ChannelData.UUID from InboundSocket.Originate returns null

I was following the Demo https://github.com/iamkinetic/NEventSocket/blob/master/NEventSocket.Examples/Examples/DtmfExample.cs
But the program crashes since ChannelData.UUID is null.
I am using Freeswitch 1.10.6, with default configuration
For the softphones I used MicroSip and PhonerLite
the OS is Windows10

To Reproduce
Steps to reproduce the behavior:

  1. Download Freeswitch,softphones and setup visual studio
  2. Create new solution/project (and install NEventSocket using NuGet)
  3. In Program.cs put this code:
    `using Microsoft.Extensions.Logging;
    using NEventSocket;
    using NEventSocket.FreeSwitch;
    using System;
    using System.Collections.Generic;
    using System.Reactive.Linq;
    using System.Threading.Tasks;

namespace Test_FSw
{
class Program
{
static async Task Main(string[] args)
{
NEventSocket.Logging.Logger.Configure(new LoggerFactory());
InboundSocket client;
client = await InboundSocket.Connect("localhost", 8021, "ClueCon", TimeSpan.FromSeconds(20));

        var originate = await client.Originate("user/1001", new OriginateOptions
        {
            CallerIdNumber = "123456789",
            CallerIdName = "test2",
            HangupAfterBridge = false,
            TimeoutSeconds = 20
        });

        if (!originate.Success)
        {
            Console.WriteLine("Failed");
            Console.WriteLine(originate.HangupCause.ToString());
            await client.Exit();
        }
        else
        {
            Console.WriteLine(originate.ChannelData.UUID);/*UUID or ChannelData is null*/
            var uuid = originate.ChannelData.UUID;
            /*unreached code*/
            await client.SubscribeEvents(EventName.Dtmf);
        }
        Console.WriteLine("Exit[Enter]");
        Console.ReadLine();


    }
   
}

}

`
4. Execute

Value cannot be null. (Parameter 'factory')

I created a simple program and got Value cannot be null. (Parameter 'factory') from Microsoft.Extensions.Logging.Abstractions

code as follows :

using System;
using System.Reactive.Linq;
using System.Threading.Tasks;
using NEventSocket;
using NEventSocket.FreeSwitch;

namespace ConsoleApp1
{
class Program
{
static async Task Main(string[] args)
{
await CallTracking();

        Console.WriteLine("Hello World!");
    }

    public static async Task CallTracking()
    {
        using (var socket = await InboundSocket.Connect("XXX.XXX.XXX.XXX", 8021, "ClueCon"))
        {
            var apiResponse = await socket.SendApi("status");
            Console.WriteLine(apiResponse.BodyText);

            //Tell FreeSwitch which events we are interested in
            await socket.SubscribeEvents(EventName.ChannelAnswer);

            //Handle events as they come in using Rx
            socket.ChannelEvents.Where(x => x.EventName == EventName.ChannelAnswer)
                  .Subscribe(async x =>
                  {
                      Console.WriteLine("Channel Answer Event " + x.UUID);

                      //we have a channel id, now we can control it
                      await socket.Play(x.UUID, "misc/8000/misc-freeswitch_is_state_of_the_art.wav");
                  });
        }
    }
}

}

any ideas ??

i am using .net core 3.1

Update documentation

Is your feature request related to a problem? Please describe.
The documentation is not up to date. Some work needs to be done.

I don't understand how to use it

For beginners, I don't need to care about NEventSocket.Tests. I just need to introduce the NEventSocket class library in my own project, and call InboundSocket.cs and OutboundListener.cs during project execution. Can I just listen? Is there a demo that can be run directly.

Examples are not compatible with Net Core 3.x

Solution builds ok on Net Core 2.x. But when changing to Net Core 3.0, example project doesn't build. Get a lot of errors like:
'ILifetimeScope' does not contain a definition for 'ImplementationsFor' and no accessible extension method 'ImplementationsFor' accepting a first argument of type 'ILifetimeScope' could be found

Guess some extensions are missing in Net Core 3.x.

Any ideas?

Best regards, Gregor

Error compiling file commandlinereader

'“string”未包含“To”的定义,并且找不到可接受第一个“string”类型参数的可访问扩展方法“To”(是否缺少 using 指令或程序集引用?)NEventSocket.Examples\NetCore\CommandLineReader.cs
'“PropertyInfo”未包含“GetAttribute”的定义,并且找不到可接受第一个“PropertyInfo”类型参数的可访问扩展方法“GetAttribute”(是否缺少 using 指令或程序集引用?) NEventSocket.Examples\NetCore\CommandLineReader.cs

命名空间“Net”中不存在类型或命名空间名“System”(是否缺少程序集引用?) NEventSocket.Examples K:\FSEventSocket\NEventSocket.Examples\NetCore\CommandLineReader.cs
命名空间“Net”中不存在类型或命名空间名“Text”(是否缺少程序集引用?) NEventSocket.Examples K:\FSEventSocket\NEventSocket.Examples\NetCore\CommandLineReader.cs

Support Voicemail natively

ITNOA

Is your feature request related to a problem? Please describe.
This feature request is aimed at accessing the events published by freeswitch regarding it's VoiceMail functionality.

Describe the solution you'd like
Natively supporting Event Headers and Messages in a structured way pertaining to Voice mail module of freeswitch.

Describe alternatives you've considered
while these events can be manually parsed as any other custom event at a higher layer, It is preferable to Implement the parsing of these events data alongside other custom events to prevent code duplication and move logic closer to data.

SubscribeEvents may not be Thread-Safe

I was using InboundSocket to originate some calls and play Audio files, and sometimes i got an ThrowInvalidOperationException_ConcurrentOperationsNotSupported where I called Play(...).

Here is the call stack:

    System.ThrowHelper.ThrowInvalidOperationException_ConcurrentOperationsNotSupported()
    System.Collections.Generic.HashSet<T>.FindItemIndex(T)
    System.Collections.Generic.HashSet<T>.Contains(T)
    NEventSocket.Sockets.EventSocket.SubscribeEvents.AnonymousMethod__28_0(NEventSocket.FreeSwitch.EventName)
    System.Linq.Enumerable.All<TSource>(System.Collections.Generic.IEnumerable<TSource>, System.Func<TSource, bool>)
    NEventSocket.Sockets.EventSocket.SubscribeEvents(NEventSocket.FreeSwitch.EventName[])
    NEventSocket.Sockets.EventSocket.ExecuteApplication(string, string, string, bool, bool, int)
    NEventSocket.ApplicationExtensions.Play(NEventSocket.Sockets.EventSocket, string, string, NEventSocket.FreeSwitch.PlayOptions)

I checked the library and I noticed the use of HashSet:
private readonly HashSet<EventName> subscribedEvents = new HashSet<EventName>();

Am I missing something or is it really not Thread-Safe ?

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.