Create a default IP restriction for your future VoIP lines

REST: POST /me/telephony/defaultIpRestriction
@param subnet [required] The IPv4 subnet you want to allow
@param type [required] The protocol you want to restrict (sip/mgcp)
499003
public OvhDefaultIpRestriction telephony_defaultIpRestriction_POST(String subnet, OvhProtocolEnum type) throws IOException {
		String qPath = "/me/telephony/defaultIpRestriction";
		StringBuilder sb = path(qPath);
		HashMap<String, Object>o = new HashMap<String, Object>();
		addBody(o, "subnet", subnet);
		addBody(o, "type", type);
		String resp = exec(qPath, "POST", sb.toString(), o);
		return convertTo(resp, OvhDefaultIpRestriction.class);
	}
596859
protected void validate(String operationType) throws Exception
	{
		super.validate(operationType);

		MPSInt timeout_validator = new MPSInt();
		timeout_validator.setConstraintMinValue(MPSConstants.GENERIC_CONSTRAINT, 0);
		timeout_validator.setConstraintMaxValue(MPSConstants.GENERIC_CONSTRAINT, 18000);
		timeout_validator.validate(operationType, timeout, "\"timeout\"");
		
		MPSIPAddress ns_ip_address_validator = new MPSIPAddress();
		ns_ip_address_validator.setConstraintIsReq(MPSConstants.ADD_CONSTRAINT, true);
		ns_ip_address_validator.validate(operationType, ns_ip_address, "\"ns_ip_address\"");
		
	}
404438
public void setOutboundInterface(SipURI outboundInterface) {
		if(outboundInterface == null) {
			throw new NullPointerException("outbound Interface param shouldn't be null");
		}
		List<SipURI> list = this.sipFactoryImpl.getSipNetworkInterfaceManager().getOutboundInterfaces();
		SipURI networkInterface = null;
		for(SipURI networkInterfaceURI : list) {
			if(networkInterfaceURI.equals(outboundInterface)) {
				networkInterface = networkInterfaceURI;
				break;
			}
		}
		
		if(networkInterface == null) throw new IllegalArgumentException("Network interface for " +
				outboundInterface + " not found");		
		
		this.outboundInterface = networkInterface;
	}
1095863
protected static io.grpc.netty.NegotiationType of(final NegotiationType negotiationType) {
        switch (negotiationType) {
            case PLAINTEXT:
                return io.grpc.netty.NegotiationType.PLAINTEXT;
            case PLAINTEXT_UPGRADE:
                return io.grpc.netty.NegotiationType.PLAINTEXT_UPGRADE;
            case TLS:
                return io.grpc.netty.NegotiationType.TLS;
            default:
                throw new IllegalArgumentException("Unsupported NegotiationType: " + negotiationType);
        }
    }
491705
private void setupAudioChannelOutbound(MediaDescriptionField remoteAudio) throws IOException {
        // Negotiate audio codecs
        this.audioChannel.negotiateFormats(remoteAudio);
        if (!this.audioChannel.containsNegotiatedFormats()) {
            throw new IOException("Audio codecs were not supported");
        }

        // connect to remote peer - RTP
        String remoteRtpAddress = remoteAudio.getConnection().getAddress();
        int remoteRtpPort = remoteAudio.getPort();

        // only connect is calls are plain old SIP
        // For WebRTC cases, the ICE Agent must connect upon candidate selection
        boolean connectNow = !(this.outbound && audioChannel.isIceEnabled());
        if (connectNow) {
            this.audioChannel.connectRtp(remoteRtpAddress, remoteRtpPort);
            // connect to remote peer - RTCP
            boolean remoteRtcpMux = remoteAudio.isRtcpMux();
            if (remoteRtcpMux) {
                this.audioChannel.connectRtcp(remoteRtpAddress, remoteRtpPort);
            } else {
                RtcpAttribute remoteRtcp = remoteAudio.getRtcp();
                if (remoteRtcp == null) {
                    // No specific RTCP port, so default is RTP port + 1
                    this.audioChannel.connectRtcp(remoteRtpAddress, remoteRtpPort + 1);
                } else {
                    // Specific RTCP address and port contained in SDP
                    String remoteRtcpAddress = remoteRtcp.getAddress();
                    if (remoteRtcpAddress == null) {
                        // address is optional in rtcp attribute
                        // will match RTP address if not defined
                        remoteRtcpAddress = remoteRtpAddress;
                    }
                    int remoteRtcpPort = remoteRtcp.getPort();
                    this.audioChannel.connectRtcp(remoteRtcpAddress, remoteRtcpPort);
                }
            }
        }
    }
1254377
public final WebsocketSender websocket(String subprotocols, int maxFramePayloadLength) {
		Objects.requireNonNull(subprotocols, "subprotocols");
		TcpClient tcpConfiguration = tcpConfiguration()
				.bootstrap(b -> HttpClientConfiguration.websocketSubprotocols(b, subprotocols))
				.bootstrap(b -> HttpClientConfiguration.websocketMaxFramePayloadLength(b, maxFramePayloadLength));
		return new WebsocketFinalizer(tcpConfiguration);
	}
145240
public void setLocalSubnet(String localSubnet) {
        IPAddressType currSubnetType = IPAddressCompare.getAddressType(localSubnet);
        this.currSubnetType = currSubnetType;
        this.localSubnetString = localSubnet;

        if (currSubnetType == IPAddressType.IPV4) {
            this.localSubnet = IPAddressCompare.addressToByteArrayV4(localSubnet);
        } else if (currSubnetType == IPAddressType.IPV6) {
            this.localSubnet = IPAddressCompare.addressToByteArrayV6(localSubnet);
        }
    }
5789
public void setAllowedPrefixesToDirectConnectGateway(java.util.Collection<RouteFilterPrefix> allowedPrefixesToDirectConnectGateway) {
        if (allowedPrefixesToDirectConnectGateway == null) {
            this.allowedPrefixesToDirectConnectGateway = null;
            return;
        }

        this.allowedPrefixesToDirectConnectGateway = new com.amazonaws.internal.SdkInternalList<RouteFilterPrefix>(allowedPrefixesToDirectConnectGateway);
    }
510081
def allow_ip(*ips: typing.Union[str, ipaddress.IPv4Network, ipaddress.IPv4Address]):
    
    for ip in ips:
        if isinstance(ip, ipaddress.IPv4Address):
            allowed_ips.add(ip)
        elif isinstance(ip, str):
            allowed_ips.add(ipaddress.IPv4Address(ip))
        elif isinstance(ip, ipaddress.IPv4Network):
            allowed_ips.update(ip.hosts())
        else:
            raise ValueError(f"Bad type of ipaddress: {type(ip)} ('{ip}')")
400891
public Proxy setType( String type )
    {
        if ( this.type.equals( type ) || ( type == null && this.type.length() <= 0 ) )
        {
            return this;
        }
        return new Proxy( type, host, port, auth );
    }
84627
public PublicIpMetadata sourceRestrictions(String... sourceRestrictions) {
        List<SourceRestriction> restrictions = new ArrayList<>(sourceRestrictions.length);
        Arrays.asList(sourceRestrictions).forEach(value -> restrictions.add(new SourceRestriction(value)));
        setSourceRestrictions(restrictions);
        return this;
    }
1245682
public SipStack initializeSipStack(String myPort, String outboundProxy) throws Exception {
		return initializeSipStack(null, null, myPort, outboundProxy, true, null, null, null);
	}
337776
protected void validate(String operationType) throws Exception
	{
		super.validate(operationType);

		MPSString bandwidth_validator = new MPSString();
		bandwidth_validator.setConstraintIsReq(MPSConstants.GENERIC_CONSTRAINT, true);
		bandwidth_validator.validate(operationType, bandwidth, "\"bandwidth\"");
		
		MPSString boostmode_validator = new MPSString();
		boostmode_validator.setConstraintIsReq(MPSConstants.GENERIC_CONSTRAINT, true);
		boostmode_validator.setConstraintMaxStrLen(MPSConstants.GENERIC_CONSTRAINT, 128);
		boostmode_validator.setConstraintMinStrLen(MPSConstants.GENERIC_CONSTRAINT, 1);
		boostmode_validator.validate(operationType, boostmode, "\"boostmode\"");
		
		MPSInt min_rate_validator = new MPSInt();
		min_rate_validator.setConstraintIsReq(MPSConstants.GENERIC_CONSTRAINT, true);
		min_rate_validator.validate(operationType, min_rate, "\"min_rate\"");
		
		MPSInt send_limit_validator = new MPSInt();
		send_limit_validator.setConstraintIsReq(MPSConstants.GENERIC_CONSTRAINT, true);
		send_limit_validator.validate(operationType, send_limit, "\"send_limit\"");
		
		MPSInt receive_limit_validator = new MPSInt();
		receive_limit_validator.setConstraintIsReq(MPSConstants.GENERIC_CONSTRAINT, true);
		receive_limit_validator.validate(operationType, receive_limit, "\"receive_limit\"");
		
		MPSIPAddress br_ip_address_arr_validator = new MPSIPAddress();
		br_ip_address_arr_validator.setConstraintIsReq(MPSConstants.GENERIC_CONSTRAINT, true);
		if(br_ip_address_arr != null)
		{
			for(int i=0; i<br_ip_address_arr.length; i++)
			{
				br_ip_address_arr_validator.validate(operationType, br_ip_address_arr[i], "br_ip_address_arr["+i+"]");
			}
		}
		
	}
546704
public static void addSipSubcontext(Context envCtx) {
		try {
			envCtx.createSubcontext(SIP_SUBCONTEXT);
		} catch (NamingException e) {
			logger.error(sm.getString("naming.bindFailed", e));
		}
	}
559342
public void setOutboundInterface(InetAddress inetAddress) {
		if(inetAddress == null) {
			throw new NullPointerException("outbound Interface param shouldn't be null");
		}
		String address = inetAddress.getHostAddress();
		List<SipURI> list = this.sipFactoryImpl.getSipNetworkInterfaceManager().getOutboundInterfaces();
		SipURI networkInterface = null;
		for(SipURI networkInterfaceURI : list) {
			if(networkInterfaceURI.toString().contains(address)) {
				networkInterface = networkInterfaceURI;
				break;
			}
		}
		
		if(networkInterface == null) throw new IllegalArgumentException("Network interface for " +
				inetAddress.getHostAddress() + " not found");
		
		outboundInterface = networkInterface;
	}
839773
public OvhReverseDelegation ip_delegation_POST(String ip, String target) throws IOException {
		String qPath = "/ip/{ip}/delegation";
		StringBuilder sb = path(qPath, ip);
		HashMap<String, Object>o = new HashMap<String, Object>();
		addBody(o, "target", target);
		String resp = exec(qPath, "POST", sb.toString(), o);
		return convertTo(resp, OvhReverseDelegation.class);
	}
986263
public Type type() {
    if (type == null) {
      synchronized (this) {
        if (type == null) {
          type = address() instanceof Inet6Address ? Type.IPV6 : Type.IPV4;
        }
      }
    }
    return type;
  }