C.5. CALLERID()

CALLERID(field)
Returns or sets information about the caller. The field is one of the following:
name
Name of the caller, as an alphanumeric string. Keeping this string short is recommended (e.g. 15 characters).
num
Number of the caller, digits only. (Sometimes also found in field number, perhaps depending on the Asterisk version)
all
Name and number with the number in angle brackets, e.g.: "Robert Cossack <2125558721>"
ani
ANI[79], for outgoing calls
dnid
DNID[80] number. Corresponds to the dialed number (Sometimes also found in field dnis, perhaps depending on the Asterisk version)
rdnis
RDNIS[81] number. The number which was forwarded to the current extension. (This is useful, for example, if the number of the active mailbox does not correspond to that of the dialed extension.)
The old channel variable ${CALLERIDNUM} is replaced by the function ${CALLERID(num)} as of Asterisk 1.4 (Similarly, ${RDNIS} is replaced by $(CALLERID(rdnis)) etc.). The application SetCIDName() is replaced by Set(CALLERID(name)=Name) (Similarly, SetCallerID() is replaced by Set(CALLERID(all)=Name <Number>) etc.).
; Set the variable foo to the complete caller ID:
exten => 123,1,Set(foo=${CALLERID(all)})

; Set the caller namer to "Robert Cossack":
exten => 123,1,Set(CALLERID(name)="Robert Cossack") 

Note

Internal help for this application in Asterisk 1.4:
  -= Info about function 'CALLERID' =- 

[Syntax]
CALLERID(datatype[,<optional-CID>])

[Synopsis]
Gets or sets Caller*ID data on the channel.

[Description]
Gets or sets Caller*ID data on the channel.  The allowable datatypes
are "all", "name", "num", "ANI", "DNID", "RDNIS".
Uses channel callerid by default or optional callerid, if specified.
diff output to internal help in Asterisk 1.2:
5c5
< CALLERID(datatype[,<optional-CID>])
---
> CALLERID(datatype)
13d12
< Uses channel callerid by default or optional callerid, if specified.


Automatic Number Identification
Dialed/Destination Number Identification Service
Redirected Dialed Number Identification Service