#include "asterisk/cel.h"
#include "asterisk/data.h"
#include "asterisk/aoc.h"
-#include "asterisk/pval.h"
#include "sip/include/sip.h"
#include "sip/include/globals.h"
#include "sip/include/config_parser.h"
dialog->relatedpeer = ref_peer(peer, "create_addr: setting dialog's relatedpeer pointer");
unref_peer(peer, "create_addr: unref peer from find_peer hashtab lookup");
return res;
- } else if (is_int(peername)) {
+ } else if (ast_check_digits(peername)) {
/* Although an IPv4 hostname *could* be represented as a 32-bit integer, it is uncommon and
* it makes dialing SIP/${EXTEN} for a peer that isn't defined resolve to an IP that is
* almost certainly not intended. It is much better to just reject purely numeric hostnames */
}
)
+/*!
+ * \brief Check if a string is only digits
+ *
+ * \retval 1 The string contains only digits
+ * \retval 0 The string contains non-digit characters
+ */
+AST_INLINE_API(
+int ast_check_digits(char *arg),
+{
+ char *s;
+ for (s=arg; *s; s++) {
+ if (*s < '0' || *s > '9') {
+ return 0;
+ }
+ }
+ return 1;
+}
+)
+
/*!
* \brief Compute a hash value on a string
*