ladendirekt / pjsip4net

A wrapper library exposing the pjsip library to the .NET world in a OO-friendly way.
71 stars 42 forks source link

invariant is not true error #92

Closed ismira closed 5 years ago

ismira commented 6 years ago

` var cfg = Configure.Pjsip4Net().FromConfig(); userAccount = cfg.Build().Start(); userAccount.ImManager.NatDetected += OnNatDetected; userAccount.CallManager.CallRedirected += CallRedirected; userAccount.CallManager.IncomingDtmfDigit += IncomingDtmfDigit; userAccount.CallManager.IncomingCall += CallManager_IncomingCall; userAccount.CallManager.Ring += CallManager_Ring; userAccount.CallManager.CallStateChanged += CallManager_CallStateChanged; userAccount.AccountManager.AccountStateChanged += AccountManager_AccountStateChanged;

        IAccount account = userAccount.AccountManager.Register(x => x.WithExtension("0002").WithPassword("123456789Aa").Through("5060").At("192.168.1.16").Register());

        while (!account.IsRegistered)
            Thread.Sleep(5000);
        userAccount.CallManager.MakeCall(x => x.At("192.168.1.16").From(userAccount.AccountManager.GetAccountById(userAccount.AccountManager.Accounts[0].Id)).RecordTo(@"C:\Users\user\source\repos\softConsole\softConsole\ss").Through("5060").To("0001").Call());

        Console.ReadLine();`

hi , userAccount.CallManager.MakeCall error invariant not true ?

jimbrzk commented 6 years ago

Hi,

You have to use SIP URI instend of just a destination number.

I using this:

// string desinationUri = "sip:0502147096@192.168.10.9:5160";
userAccount.CallManager.MakeCall(account, destinationUri);
siniypin commented 6 years ago

In fact, CallManager.MakeCall(CallBuilder b) method uses SipUriBuilder under the hood, so the resulting uri should have been equal. @ismira can you post a call stack of that exception, and your config?