Unable to send call command using sim module

I have an esphome program that imports 3 phone numbers from the webserver into a text template. When I press the button, a call will be made to the 3 entered phone numbers, but in the uart.write part, I don’t know what’s wrong, but I can’t print out the phone number. someone please help me

uart:
  rx_pin: D2
  tx_pin: D1
  baud_rate: 115200
  
web_server:
  port: 80

http_request:
  useragent: esphome/device
  timeout: 60s

text:
  - platform: template
    id: phone_input_1
    name: "Phone Number 1"
    optimistic: true
    min_length: 0
    max_length: 100
    mode: text

  - platform: template
    id: phone_input_2
    name: "Phone Number 2"
    optimistic: true
    min_length: 0
    max_length: 100
    mode: text

  - platform: template
    id: phone_input_3
    name: "Phone Number 3"
    optimistic: true
    min_length: 0
    max_length: 100
    mode: text

switch:
  - platform: template
    name: "Call Phone"
    turn_on_action:
      - uart.write: "ATD {{ id(phone_input_1).state }};\r\n"
      - delay: 15s
      - uart.write: "AT+CHUP\r\n"
      - delay: 2s
      - uart.write: "ATD {{ id(phone_input_2).state }};\r\n"
      - delay: 15s
      - uart.write: "AT+CHUP\r\n"
      - delay: 2s
      - uart.write: "ATD {{ id(phone_input_3).state }};\r\n"
      - delay: 15s
      - uart.write: "AT+CHUP\r\n"

Try id(phone_input_1).state.c_str()