Created
July 8, 2013 19:21
-
-
Save siniypin/5951687 to your computer and use it in GitHub Desktop.
Creating sip preconfigured and dynamic sip accounts.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Class1 | |
{ | |
public class MyConfigurator : IConfigurationProvider | |
{ | |
public void Configure(IConfigurationContext context) | |
{ | |
var registrar = "sipgate.de"; | |
var accountId = new SipUriBuilder().AppendDomain("sipgate.de").AppendExtension("me").ToString(); | |
var proxy = "proxy.live.sipgate.de"; | |
context.RegisterAccounts(new[] | |
{ | |
new AccountConfig() | |
{ | |
RegUri = registrar, | |
Id = accountId, | |
Credentials = new List<NetworkCredential>() {new NetworkCredential("me", "password", "*")}, | |
Proxy = new List<string>() {proxy} | |
}, | |
}); | |
} | |
} | |
public static void Main() | |
{ | |
//account to be configured in initialization stage | |
var ua = Configure.Pjsip4Net().With(new MyConfigurator()).WithVersion_1_4().Build().Start(); | |
//account to be configured dynamically | |
ua.Container.Get<IAccountBuilder>() | |
.WithExtension("me") | |
.WithPassword("password") | |
.At("sipgate.de") | |
.ExposeAccount(x => x.Proxies.Add("proxy.live.sipgate.de")) | |
.Register(); | |
ua.Destroy(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment