Design

Top  Previous  Next

 

 

PPCSoftPhone

 

 

 

  Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    'load stored settings

    'MsgBox('frmMain_Load is started')

    LoadProperties()

    SIPEndPoint.EnableLogging(True, "SIPLog.txt")

    sipEP = New SIPEndPoint

    'adjust endpoint

 

    sipEP.Contact = LoadSetting("Contact", "sip:user@127.0.0.1")

    sipEP.UseProxy = Boolean.Parse(LoadSetting("UseProxy", Boolean.FalseString))

    sipEP.ProxyHost = LoadSetting("ProxyHost", "127.0.0.1")

    sipEP.ProxyPort = Integer.Parse(LoadSetting("ProxyPort", "5060"))

    sipEP.UseSTUN = Boolean.Parse(LoadSetting("UseStun", Boolean.FalseString))

    sipEP.STUNHost = LoadSetting("StunHost", "127.0.0.1")

    sipEP.STUNPort = Integer.Parse(LoadSetting("StunPort", "5060"))

    sipEP.Password = LoadSetting("UserPassword", "")

    sipEP.BindingIf = LoadSetting("BindingIf", "0.0.0.0")

    sipEP.BindingPort = Integer.Parse(LoadSetting("BindingPort", "5060"))

 

    'example how to get speaker and microphone lists

    Dim speakerList As Collection = New Collection

    Dim micList As Collection = New Collection

    sipEP.GetSpeakerList(speakerList)

    sipEP.GetMicrophoneList(micList)

 

    'Default values for audio

    sipEP.MicrophoneId = -1

    sipEP.SpeakerId = -1

 

    'Set the last invited URI

    Me.tbURI.Text = LoadSetting("LastURI", "sip:user@192.168.0.1:5070")

 

    sipEP.OnInvite = New SIPEndPoint.OnInviteEvent(AddressOf frmMain_OnInviteEvent)

    sipEP.OnConnected = New SIPEndPoint.OnConnectedEvent(AddressOf frmMain_OnConnected)

    sipEP.OnTerminated = New SIPEndPoint.OnTerminatedEvent(AddressOf frmMain_OnTerminated)

    sipEP.OnRegisterFailed = New SIPEndPoint.OnRegisterFailedEvent(AddressOf frmMain_OnRegisterFailed)

    sipEP.OnRegisterSuccess = New SIPEndPoint.OnRegisterSuccessEvent(AddressOf frmMain_OnRegisterSuccess)

    sipEP.OnRegisterRemoved = New SIPEndPoint.OnRegisterRemovedEvent(AddressOf frmMain_OnRegisterRemoved)

    'Start endpoint

    sipEP.Start()

  End Sub