Asterisk cmd SetCIDNum

does any one know how to display ANI (Automatic Number Identification) in asterisk? been looking for the command line. thanks

been seeing only the called number and SIP while making a call.

how do I set the caller ID for it to be able to see all the calling number? I have this on my Config.

;sets the callerid of the device to that of the logged in user
[macro-user-callerid]
exten => s,1,GotoIf($["${CHANNEL:0:5}" = “Local”]?report)
exten => s,n,GotoIf($["${REALCALLERIDNUM:1:2}" != “”]?start)
exten => s,n,Set(REALCALLERIDNUM=${CALLERID(number)})
exten => s,n(start),NoOp(REALCALLERIDNUM is ${REALCALLERIDNUM})
exten => s,n,Set(AMPUSER=${DB(DEVICE/${REALCALLERIDNUM}/user)})
exten => s,n,Set(AMPUSERCIDNAME=${DB(AMPUSER/${AMPUSER}/cidname)})
exten => s,n,GotoIf($[“x${AMPUSERCIDNAME:1:2}” = “x”]?report)
exten => s,n,Set(CALLERID(all)=${AMPUSERCIDNAME} <${AMPUSER}>)
exten => s,n(report),NoOp(Using CallerID ${CALLERID(all)})

; overrides callerid out trunks
; arg1 is trunk
; macro-user-callerid should be called before using this macro
[macro-outbound-callerid]
exten => s,1,GotoIf($["${REALCALLERIDNUM:1:2}" != “”]?start)
exten => s,n,Set(REALCALLERIDNUM=${CALLERID(number)})
exten => s,n(start),NoOp(REALCALLERIDNUM is ${REALCALLERIDNUM})
exten => s,n,Set(USEROUTCID=${DB(AMPUSER/${REALCALLERIDNUM}/outboundcid)})
exten => s,n,Set(EMERGENCYCID=${DB(DEVICE/${REALCALLERIDNUM}/emergency_cid)})
exten => s,n,Set(TRUNKOUTCID=${OUTCID_${ARG1}})
exten => s,n,GotoIf($["${EMERGENCYROUTE:1:2}" = “”]?trunkcid) ; check EMERGENCY ROUTE
exten => s,n,GotoIf($["${EMERGENCYCID:1:2}" = “”]?trunkcid) ; empty EMERGENCY CID, so default back to trunk
exten => s,n,Set(CALLERID(all)=${EMERGENCYCID}) ; emergency cid for device
exten => s,n,Goto(report)
exten => s,n(trunkcid),GotoIf($["${TRUNKOUTCID:1:2}" = “”]?usercid) ;check for CID override for trunk (global var)
exten => s,n,Set(CALLERID(all)=${TRUNKOUTCID})
exten => s,n(usercid),GotoIf($["${USEROUTCID:1:2}" = “”]?report) ; check CID override for extension
exten => s,n,Set(CALLERID(all)=${USEROUTCID})
exten => s,n,GotoIf($[“x${USEROUTCID}” = “xhidden”]?hidecid:report) ; check CID blocking for extension
exten => s,n(hidecid),SetCallerPres(prohib_passed_screen) ; Only works with ISDN (T1/E1/BRI)
exten => s,n(report),NoOp(CallerID set to ${CALLERID(all)})

Hi Perry,

did you receive an answer for this? i was asked what my default ANI was and I am wondering where I find this. I am taking over a project for someone who built this previously and need to get this answer.

ANI is not standardized inside SIP2.0 and not supported actually by IPBX softwares.

ANI seems to be an old name. To avoid confusion, i think that the more actual SS7 names should be used instead :

ANI = charge number

Caller ID = Calling Party number

Charge Number is the field from which ANI is derived (ANI is a generic term, whilst Charge Number is the specific implementation in SS7 ISUP; the relationship between Charge Number and ANI appears to be similar to the relationship between Calling Party Number and Caller ID. Note that ANI is never transmitted across the network; only Charge Number is sent, and ANI is derived from that within the switch or AMA equipment).

In the ISUP IAM (Initial Address Message), there are the following fields for number delivery :

• Called Party Number
• Charge Number
• Originating Line Information Parameter
• Calling Party Number
• Original Called Number
• Redirecting Number

SIP is not able to deliver those numbers directly in its original form.

A possibility is to use P-asserted-Identity SIP headers, but the SS7 - SIP mapping here seems not standardized neither.

Caller ID in the “from” field seems the conventional use, but as soon as you mask it with the caller id name “anonymous”, there are chances that the caller id number will not be transmitted as an ANI (charge number) to the PSTN world.

I’ve seen a manufacturer using the “contact” field to put the ANI, or other informations like RDNIS. But this is not standard.

Another problem is that as there is no field inside SIP2.0 for ANI, you cannot define an ANI different from Caller ID.

There are some situations where the ANI is different from the caller ID :

  • when there are more than one DID on a site, it is better to have only one ANI to transmitt to urgency services.

  • if the caller ID is not present

This is a problem for full IP telephony where we need ANI for billing and urgency services delivery.

It would be better to use SIP-T instead of SIP for PSTN interfacing.

SIP-T is not a new protocol - it is a set of mechanisms for interfacing traditional telephone signaling with SIP. The purpose of SIP-T is to provide protocol translation and feature transparency across points of PSTN-SIP interconnection. It intended for use where a VoIP network interfaces with the PSTN.

See RFC 3372 for SIP-T
See RFC 3398 ISUP to SIP Mapping

You will see that a lot of things are not stanrdardized, ANI mapping is one of them. This explain why we have so much problems with VoIP providers doing what they think to be good.

It seems like an unfinished work, like ENUM is since about 7 years.

In the end each provider does not translate with the same mapping. This explain why the VoIP - PSTN signaling is so bad.

I think that those problems needs to be adressed fastly with a clear standard for SS7 - SIP mapping. It is certainly a work that need to be done by the opensource telephony world because the PSTN world does not have any interest to do it.

Olivier.

Olivier,

Thanks for a great post. Many users take for granted the ITU and Bellcore standards that support interoperability.

Manufacturers support all, subsets or none of any particular RFC. One look at a gateway manufacturers support list (take a look at SONUS for example) to see the mixed compliance.

3GPP has attempted to solve some of these issues in the Media Gateway Control Function (MGCF) plane.

The ITU has released some guidance in the form of Q.1912.5 and should provide some type of near term relief.

Voip carriers are more than just unregulated, it’s a high tech version of the wild west with many different levels of service provided by carriers with similar products.

The technology (in the form of Voip) is needlessly criticized due to poor carrier implementations.

It will be interesting to see how this all stabilizes.

Scott

is it possible to establish a random outbound callerID with ANI in freepbx?

Thanks