static int DoRegister(string aor, string pwd) { // Example cmd line: register [email protected] secret OpalMessageRef command = new OpalMessageRef(); OpalMessageRef response; Console.WriteLine("Registering {0}", aor); command.SetMessageType(Opal_API.OpalMessageType.OpalCmdRegistration); OpalParamRegistrationRef m_registrationInfo = command.GetRegistrationInfo(); if (!aor.Contains(':')) { m_registrationInfo.Protocol = "h323"; m_registrationInfo.Identifier = aor; } else { m_registrationInfo.Protocol = aor; m_registrationInfo.Identifier = aor.Substring(aor.IndexOf(':') + 1); } m_registrationInfo.Password = pwd; m_registrationInfo.TimeToLive = 300; if ((response = MySendCommand(command, "Could not register endpoint")) == null) { return(0); } return(1); }
static int DoSubscribe(string package, string aor, string from) { // Example cmd line: subscribe "dialog;sla;ma" [email protected] [email protected] OpalMessageRef command = new OpalMessageRef(); OpalMessageRef response; Console.WriteLine("Susbcribing {0}", aor); command.SetMessageType(Opal_API.OpalMessageType.OpalCmdRegistration); OpalParamRegistrationRef m_registrationInfo = command.GetRegistrationInfo(); m_registrationInfo.Protocol = "sip"; m_registrationInfo.Identifier = aor; m_registrationInfo.HostName = from; m_registrationInfo.EventPackage = package; m_registrationInfo.TimeToLive = 300; if ((response = MySendCommand(command, "Could not subscribe")) == null) { return(0); } return(1); }