Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ISipUserAgent ua;
- public class MyConfigurator : IConfigurationProvider
- {
- string SIP_USER = "";
- string SIP_PASSWORD = "";
- string SIP_DOMAIN = "";
- public MyConfigurator(string user, string password, string domain)
- {
- SIP_USER = user;
- SIP_PASSWORD = password;
- SIP_DOMAIN = domain;
- }
- public void Configure(IConfigurationContext context)
- {
- var registrar = "sip:" + SIP_DOMAIN;
- var accountId = "sip:" + SIP_USER + "@" + SIP_DOMAIN;
- var proxy = "";
- context.RegisterAccounts(new[]
- {
- new AccountConfig()
- {
- RegUri = registrar,
- Id = accountId,
- Credentials = new List<NetworkCredential>() {new NetworkCredential(SIP_USER, SIP_PASSWORD, "*") },
- Proxy = new List<string>() {proxy}
- },
- });
- }
- }
- public SoftPhone_Widow(string user, string password, string domain)
- {
- InitializeComponent();
- Thread thread = new Thread(Method =>
- {
- ua = Configure.Pjsip4Net().With(new MyConfigurator("user1", "123312", "mangosip.ru")).Build().Start();
- ua.AccountManager.AccountStateChanged += AccountManager_AccountStateChanged;
- });
- thread.Start();
- }
- private void AccountManager_AccountStateChanged(object sender, pjsip4net.Accounts.AccountStateChangedEventArgs e)
- {
- if (e != null)
- MessageBox.Show(e.StatusText);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement