Upgrade 3CX to v18 and get it hosted free!

Asterisk func callerid

Author image

Synopsis:

CALLERID(<item>)

Description:

CALLERID(<item>)

The allowed values for <item> are:

  • name: alphanumeric string
  • num or number: number at which caller prefers to be called back (digits only in the POTS/ISDN world)
  • all: a Caller*ID string with the number specified between angle-brackets, e.g. “Some User <123>”
  • ani: “automatic number identifaction” – billing number (digits only in the POTS/ISDN world)
  • dnid: dialed number (digits only in the POTS/ISDN world), don’t confuse with DNIS
  • rdnis: redirected dialed number information service (digits only in the POTS/ISDN world)
  • pres: call presentation/screening (textual representation, 1.6)
  • ton: type of number (digits only, 1.6)

Notes

  • This function may be both read from and written to.
  • ton can be 0(unknown — i.e., includes dial prefixes), 1(international), 2(national), 4(subscriber)
  • number is deprecated and doesn’t work in 1.6.
  • CALLERID(num) and CALLERID(name) control the parts of the SIP address before the @ in the ‘From’ header under normal conditions.
  • AASTRA CID BUG: Setting CID (under sip.conf) to something other than the default (asterisk) with spaces in it (ex: Unknown Caller) when no CID is available will cause asterisk to Dial the Aastra phone, but it will not “ring”.(tested with 480i ct firmware 1.4.2.3000)

ISDN (Q.931) only permits ASCII characters (more precisely: the IA5 character set) as CallerID name, see also Asterisk func filter. If indeed you would like to present special characters on an IP phone’s display you will most probably have to turn to UTF-8 enconding:

NAME=`echo $NAME | iconv -f ISO-8859-1 -t UTF-8`

Asterisk 1.8

Asterisk 1.8 has an expanded CALLERID function. <item> can be one of:

  • all
  • name
  • name-valid
  • name-charset
  • name-pres
  • num
  • num-valid
  • num-plan
  • num-pres
  • subaddr
  • subaddr-valid
  • subaddr-type
  • subaddr-odd
  • tag
  • ANI-all
  • ANI-name
  • ANI-name-valid
  • ANI-name-charset
  • ANI-name-pres
  • ANI-num
  • ANI-num-valid
  • ANI-num-plan
  • ANI-num-pres
  • ANI-tag
  • RDNIS
  • DNID
  • dnid-num-plan
  • dnid-subaddr
  • dnid-subaddr-valid
  • dnid-subaddr-type
  • dnid-subaddr-odd

and you can set these to one of:

  • allowed_not_screened
  • allowed_passed_screen
  • allowed_failed_screen
  • allowed
  • prohib_not_screened
  • prohib_passed_screen
  • prohib_failed_screen
  • prohib
  • unavailable

e.g. to hide your caller id, use: Set(CALLERID(num-pres)=prohib)

When using ISDN, some systems may reject certain information elements (IEs) of the SETUP message and respond with error 100. It is possible to suppress the unwanted elements of the SETUP message as follows:

SETUP IE Suppress Call
Display Set(CALLERID(name-valid)=no)
Calling Party Number Set(CALLERID(num-valid)=no)

Upgrading to Asterisk 1.4

The behavior of the “clid” field of the CDR has always been that it will
contain the callerid ANI if it is set, or the callerid number if ANI was not
set. When using the “callerid” option for various channel drivers, some
would set ANI and some would not. This has been cleared up so that all
channel drivers set ANI. If you would like to change the callerid number
on the channel from the dialplan and have that change also show up in the
CDR, then you *must* set CALLERID(ANI) as well as CALLERID(num).

Example

; Retrieve the Caller*ID string and save it off for later use
exten => s,1,Set(CallerIDString=${CALLERID(all)})

; Set our Caller*ID before we dial out
exten => s,1,Set(CALLERID(name)=Asterisk PBX)

From Domain

If you are trying to change the part that is to the right of the @ sign, then you want fromdomain, in your sip.conf

Security advisory

Asterisk Project Security Advisory – AST-2011-001
Summary: Stack buffer overflow in SIP channel driver
Reported on January 11, 2011

The issue was fixed in Asterisk versions:

  • 1.4.38.1
  • 1.4.39.1
  • 1.6.1.21
  • 1.6.2.15.1
  • 1.6.2.16.1
  • 1.8.1.2
  • 1.8.2.1

Description

When forming an outgoing SIP request while in pedantic mode, a stack buffer can be made to overflow if supplied with carefully crafted caller ID information. This vulnerability also affects the URIENCODE dialplan function and in some versions of asterisk, the AGI dialplan application as well. The ast_uri_encode function does not properly respect the size of its output buffer and can write past the end of it when encoding URIs.

Resolution

The size of the output buffer passed to the ast_uri_encode function is now properly respected.

In asterisk versions not containing the fix for this issue, limiting strings originating from remote sources that will be URI encoded to a length of 40 characters will protect against this vulnerability.

exten => s,1,Set(CALLERID(num)=${CALLERID(num):0:40})
exten => s,n,Set(CALLERID(name)=${CALLERID(name):0:40})
exten => s,n,Dial(SIP/channel)

The CALLERID(num) and CALLERID(name) channel values, and any strings passed to the URIENCODE dialplan function should be limited in this manner.

See also


Article Reviews

Write a Review

Your email address will not be published. Required fields are marked *

Required Field. Minimum 5 characters.

Required Field. Minimum 5 characters, maximum 50.

Required field.There is an error with this field.

Required Field.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

There are no reviews for this article. Be the first one to write a review.

Related Posts:

Get 3CX - Absolutely Free!
Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.