// Copyright 2018-2024 Open Networking Foundation (ONF) and the ONF Contributors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at:
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

option go_package = "github.com/opencord/voltha-protos/v5/go/voip_system_profile";
option java_package = "org.opencord.voltha.voip_system_profile";

package voip_system_profile;
import "google/api/annotations.proto";

message VoipSystemProfileRequest {
  string key = 1;
  VoipSystemProfile voipSystemProfile = 2;
}

// A system wide profile for voip service that can be stored into voltha KV anytime.
// Designed based on G988-2017 (also designed flexible to be able to be modified later on)
message VoipSystemProfile {
  SipConfig sipConfig = 1;
  VoipConfig voipConfig = 2;
}

// Common voip fields are grouped here
message VoipConfig {
  IpHostConfig ipHostConfig = 1;
  TcpUdpConfig tcpUdpConfig = 2;
  VoipVoiceCtp voipVoiceCtp = 3;
  VoipMediaProfile voipMediaProfile = 4;
  VoiceServiceProfile voiceServiceProfile = 5;
  RtpProfile rtpProfile = 6;
  PptpPotsUni pptpPotsUni = 7;
}

message IpHostConfig {
  uint32 ipOptions = 1;
  string onuIdentifier = 2;
  string ipAddress = 3;
  string mask = 4;
  string gateway = 5;
  string primaryDns = 6;
  string secondaryDns = 7;
  string relayAgentOptions = 8;
}

message TcpUdpConfig {
  uint32 protocol = 1;
  string tosField = 2;
}

message VoipVoiceCtp {
  uint32 signallingCode = 1;
}

message VoipMediaProfile {
  uint32 faxMode = 1;
  uint32 codecSelection1 = 2;
  uint32 packetPeriodSelection1 = 3;
  uint32 silenceSuppression1 = 4;
  uint32 codecSelection2 = 5;
  uint32 packetPeriodSelection2 = 6;
  uint32 silenceSuppression2 = 7;
  uint32 codecSelection3 = 8;
  uint32 packetPeriodSelection3 = 9;
  uint32 silenceSuppression3 = 10;
  uint32 codecSelection4 = 11;
  uint32 packetPeriodSelection4 = 12;
  uint32 silenceSuppression4 = 13;
  uint32 oobDtmf = 14;
}

message VoiceServiceProfile {
  uint32 announcementType = 1;
  uint32 jitterTarget = 2;
  uint32 jitterBufferMax = 3;
  bool echoCancelInd = 4;
  uint32 pstnProtocolVariant = 5;
  uint32 dtmfDigitLevels = 6;
  uint32 dtmfDigitDuration = 7;
  uint32 hookFlashMinimumTime = 8;
}

message RtpProfile {
  uint32 localPortMin = 1;
  uint32 localPortMax = 2;
  string dscpMark = 3;
  uint32 piggyBackEvents = 4;
  uint32 toneEvents = 5;
  uint32 dtmfEvents = 6;
  uint32 casEvents = 7;
}

message PptpPotsUni {
  string arc = 1;
  string arcInterval = 2;
  uint32 impedance = 3;
  uint32 transmissionPath = 4;
  sint32 rxGain = 5;
  sint32 txGain = 6;
  uint32 potsHoldOverTime = 7;
  uint32 nominalFeedVoltage = 8;
  uint32 lossOfSoftSwitch = 9;
}

// Sip specific fields are grouped here
message SipConfig {
  SipUserData sipUserData = 1;
  SipAgentConfig sipAgentConfig = 2;
  NetworkDialPlan  networkDialPlan = 3;
  VoipFeatureAccessCodes voipFeatureAccessCodes = 4;
  VoipApplicationServiceProfile voipApplicationServiceProfile = 5;
}

message SipUserData {
  string userPartAor = 1;
  UsernameAndPassword usernameAndPassword = 2;
  string voicemailServerSipUri = 3;
  int32 voicemailSubscriptionExpirationTime = 4;
  int32 releaseTimer = 5;
  int32 rohTimer = 6;
}

message SipAgentConfig {
  string outboundProxyAddress = 1;
  string primarySipDns = 2;
  string secondarySipDns = 3;
  int32 sipRegExpTime = 4;
  int32 sipReregHeadStartTime = 5;
  string SipRegistrar = 6;
  string softSwitch = 7;
  SipResponseTable sipResponseTable = 8;
  bool sipOptionTransmitControl = 9;
  string sipUriFormat = 10;
  string redundantSipAgentPointer = 11;
}

message NetworkDialPlan {
  uint32 criticalDialTimeout = 1;
  uint32 partialDialTimeout = 2;
  uint32 dialPlanFormat = 3;
  DialPlanTable dialPlanTable = 4;
}

message UsernameAndPassword {
  int32 validationScheme = 1;
}

message SipResponseTable {
  string sipResponseCode = 1;
  string tone = 2;
  string textMessage = 3;
}

message DialPlanTable {
  uint32 dialPlanId = 1;
  uint32 action = 2;
  string dialPlanToken = 3;
  uint32 dialPlanTableMaxSize = 4;
}

message VoipFeatureAccessCodes {
  string cancelCallWaiting = 1;
  string callHold = 2;
  string callPark = 3;
  string callerIdActivate = 4;
  string callerIdDeactivate = 5;
  string doNotDisturbActivation = 6;
  string doNotDisturbDeactivation = 7;
  string doNotDisturbPinChange = 8;
  string emergencyServiceNumber = 9;
  string intercomService = 10;
  string unattendedCallTransfer = 11;
  string attendedCallTransfer = 12;
}

message VoipApplicationServiceProfile {
  uint32 cidFeatures = 1;
  uint32 callWaitingFeatures = 2;
  uint32 callProgressOrTransferFeatures = 3;
  uint32 callPresentationFeatures = 4;
  uint32 directConnectFeature = 5;
  string directConnectUriPointer = 6;
  string bridgedLineAgentUriPointer = 7;
  string conferenceFactoryUriPointer = 8;
  uint32 dialToneDelayTimer = 9;
}