diff --git a/app/dialplan_inbound/dialplan_inbound_add.php b/app/dialplan_inbound/dialplan_inbound_add.php index e01c5cf616..1e693dcb41 100644 --- a/app/dialplan_inbound/dialplan_inbound_add.php +++ b/app/dialplan_inbound/dialplan_inbound_add.php @@ -671,12 +671,32 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { else { echo "\n"; echo "\n"; - echo " Destination Number:\n"; + echo " Destination Number:\n"; echo "\n"; echo "\n"; - echo " \n"; - echo "
\n"; - echo "Please enter the destination number. In North America this is usually a 10 or 11 digit number.\n"; + + $sql = "select * from v_destinations "; + $sql .= "where domain_uuid = '$domain_uuid' "; + $sql .= "and destination_type = 'inbound' "; + $sql .= "order by destination_number asc "; + $prep_statement = $db->prepare(check_sql($sql)); + $prep_statement->execute(); + $result = $prep_statement->fetchAll(PDO::FETCH_ASSOC); + if (count($result) > 0) { + echo " \n"; + echo "
\n"; + echo "Select the inbound destination number.\n"; + } + else { + echo " \n"; + } + unset ($prep_statement); + echo "\n"; echo "\n"; }