Skip to content

DIGIT_SUM()

Synopsis

Returns the sum of all the digits in a number.

Since

23.1.0, 22.7.0, 20.17.0

Description

Returns the numeric sum of all the individual digits in a number, summed up.

This can be useful for computing checksums based on the number, where errors are typically digits being off by one.

Example: Get the sum of digits in 859
same => n,Set(digitsum=${DIGIT_SUM(859)}) ; assigns digitsum=22
same => n,Set(checksum=$[${digitsum} % 10]) ; assigns checksum=2

Syntax

DIGIT_SUM(num)
Arguments
  • num

Generated Version

This documentation was generated from Asterisk branch 20 using version GIT