Установил через диспетчер пакетов nuget библиотеку pjsua. используя using
подключаю ее и все нормально, могу использовать классы и методы. В reference
она тоже добавлена. Однако при компиляции получаю ошибку DllNotFoundException
.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;
using pjsip4net.Accounts;
using System.Runtime.InteropServices;
using org.pjsip.pjsua2;
using System.IO;
namespace WindowsFormsApp2
{
public partial class Form1 : Form
{
class MyAccount : Account
{
public override void onRegState(OnRegStateParam prm)
{
base.onRegState(prm);
System.Console.WriteLine("*** On registration state: " + prm.code.ToString() + prm.reason.ToString());
}
}
public Form1()
{
InitializeComponent();
Endpoint endpoint = new Endpoint();
endpoint.libCreate();
EpConfig config = new EpConfig();
endpoint.libInit(config);
TransportConfig transportConfig = new TransportConfig();
transportConfig.port = 5060;
AccountSipConfig accountSipConfig = new AccountSipConfig();
AccountCallConfig accountCallConfig = new AccountCallConfig();
AccountConfig accountConfig = new AccountConfig();
accountConfig.regConfig.registrarUri = "sip:pjsip.org";
accountConfig.idUri = "sip:[email protected]";
accountConfig.callConfig = accountCallConfig;
AuthCredInfo authCredInfo = new AuthCredInfo("digest", "*", "test", 0, "secret");
accountSipConfig.authCreds.Add(authCredInfo);
accountConfig.sipConfig = accountSipConfig;
MyAccount myAccount = new MyAccount();
myAccount.create(accountConfig);
}
}
}