001/*
002 *   Copyright 2024 Vonage
003 *
004 *   Licensed under the Apache License, Version 2.0 (the "License");
005 *   you may not use this file except in compliance with the License.
006 *   You may obtain a copy of the License at
007 *
008 *        http://www.apache.org/licenses/LICENSE-2.0
009 *
010 *   Unless required by applicable law or agreed to in writing, software
011 *   distributed under the License is distributed on an "AS IS" BASIS,
012 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 *   See the License for the specific language governing permissions and
014 *   limitations under the License.
015 */
016package com.vonage.client.voice;
017
018import com.fasterxml.jackson.annotation.JsonProperty;
019import com.vonage.client.JsonableBaseObject;
020
021public class PhoneEndpoint extends JsonableBaseObject implements Endpoint {
022    private String number, dtmfAnswer;
023
024    PhoneEndpoint() {}
025
026    /**
027     * Constructor.
028     *
029     * @param number The phone number to connect to in E.164 format.
030     */
031    public PhoneEndpoint(String number) {
032        this.number = number;
033    }
034
035    /**
036     * Constructor.
037     *
038     * @param number The phone number to connect to in E.164 format.
039     *
040     * @param dtmfAnswer Set the digits that are sent to the user as soon as the Call is answered.
041     * The * and # digits are respected. You create pauses using p. Each pause is 500ms.
042     */
043    public PhoneEndpoint(String number, String dtmfAnswer) {
044        this.number = number;
045        this.dtmfAnswer = dtmfAnswer;
046    }
047
048    @Override
049    public String getType() {
050        return EndpointType.PHONE.toString();
051    }
052
053    @Override
054    public String toLog() {
055        return number;
056    }
057
058    /**
059     * The phone number to connect to in E.164 format.
060     *
061     * @return The phone number as a string.
062     */
063    @JsonProperty("number")
064    public String getNumber() {
065        return number;
066    }
067
068    /**
069     * Set the digits that are sent to the user as soon as the Call is answered.
070     * The * and # digits are respected. You create pauses using p. Each pause is 500ms.
071     *
072     * @return The DTMF digits as a string.
073     */
074    @JsonProperty("dtmfAnswer")
075    public String getDtmfAnswer() {
076        return dtmfAnswer;
077    }
078}