Hi
I have developed a winform app and used Ozeki.VoIP sdk by reading tutorials, but it does not register sip account to elastix PBX and after a moments it "time out". But I cant register account using free softphones like Expresstalk ....
I saw sip debug messages in server and see there was not request from my win app. I also added this winform app into firewall exceptions.
Would you help me please?
Here is my code:
private static ISoftPhone mySoftphone;
private static IPhoneLine phoneLine;
private static void Main(string[] args)
{
mySoftphone = SoftPhoneFactory.CreateSoftPhone(SoftPhoneFactory.GetLocalIP(), 5000, 5700);
var registrationRequired = true;
var userName = "100";
var displayName = "100";
var authenticationId = "100";
var registerPassword = "12345rt";
var domainHost = "192.168.150.134";
var domainPort = 5060;
mySoftphone_Register(mySoftphone, registrationRequired, displayName, userName, authenticationId, registerPassword,
domainHost, domainPort);
while (true) Thread.Sleep(10);
}
static void mySoftphone_Register(ISoftPhone softphone, bool registrationRequired, string displayName, string userName,
string authenticationId, string registerPassword, string domainHost, int domainPort)
{
try
{
var account = new SIPAccount(registrationRequired, displayName, userName, authenticationId, registerPassword, domainHost, domainPort);
var natConfiguration = new NatConfiguration("192.168.150.1",true);
PhoneLineConfiguration plin=new PhoneLineConfiguration(account);
plin.NatConfig=natConfiguration;
phoneLine = softphone.CreatePhoneLine(plin);
phoneLine.RegistrationStateChanged += mySoftphone_PhoneLineStateChanged;
softphone.RegisterPhoneLine(phoneLine);
}
catch (Exception ex)
{
Console.WriteLine("Error during SIP registration: " + ex.ToString());
}
}
static void mySoftphone_PhoneLineStateChanged(object sender, RegistrationStateChangedArgs e)
{
if (e.State == RegState.NotRegistered || e.State == RegState.Error)
Console.WriteLine("Registration failed!");
if (e.State == RegState.RegistrationSucceeded)
Console.WriteLine("Registration succeeded - Online!");
}