How to Add Prefix 0 to Incoming Caller ID


By default, you cannot add prefixs to incoming caller ID  on Yeastar N-Series analog phone system. This article introduces how to add prefix to incoming caller ID via SSH.

This article is tested on Yeastar N-Series version We demonstrate how to add prefix 0 to the incoming caller ID.

How to Add Prefix 0 to Incoming Caller ID

Step 1. Create an inbound route, choose the desired trunks and set the destination. Here we name the inbound route as "froms100".


Step 2. Navigate to System > Network Preference > Service, Enable SSH.

Step 3. Log in Yeastar N-Series via SSH using Putty software.

  • Username: root
  • Password: ys123456


Step 4. Enter the extensions.conf file by the command:

vi /etc/asterisk/extensions.conf 

Step 5. Find the context of the new created inbound route "froms100".

 Step 6. Add the following sentence behind the sentence "exten = s,n,Set(CALLERID(num)=$ {IF($ {LEN($ {CALLERID(num)})>0}?${CALLERID(num)}:Unknown)})".

exten = s,n,Set(CALLERID(num)=0${CALLERID(num)})

Step 7. Copy the new [macro-incoming_froms100] context. 

exten = s,1,Set(CDR(userfield)=Inbound)
exten = s,n,Set(FAXOPT(faxdetect)=no)
exten = s,n,Set(CALLERID(num)=${IF(${LEN(${CALLERID(num)})>0}?${CALLERID(num)}:Unknown)})
exten = s,n,Set(CALLERID(num)=0${CALLERID(num)})
exten = s,n,GotoIf(${DB_EXISTS(blacklist/${CALLERID(num)})}?Blacklist-Handle,s,1)
exten = s,n,Gotoif($[${ENABLECLIP}=1]?s,get:s,clip)
exten = s,n(get),AGI(/bin/autoclip,get,${CALLERID(num)})
exten = s,n(clip),GotoIf($[${LEN(${CLIPEXTENSION})}>1]?from-outside,${CLIPEXTENSION},1)
exten = s,n,Set(TRUNKDID=${IF($[${ARG2}=s]?${CALLERID(name)}:${ARG2})})
exten = s,n,GotoByTimeCondition(default,from-outside,601,1,,from-outside,601,1,,from-outside,601,1,)
exten = s,102,Goto(Blacklist-Handle,s,1)

Step 8. Quit the extensions.conf file, create a custom file by the following command:

vi /persistent/customcfg/extensions_custom.conf

Step 9. Paste the [macro-incoming_froms100] context into the custom file, like the figure below shows.

Step 10. Save and quit the custom configuration file.

Step 11. Execute the two commands to make the custom configuration take effect.

asterisk -rx 'module reload'

Step 12. Make an inbound call to the selected SIP trunk in the inbound route "froms100", you can see the incoming caller ID has a prefix 0.


Have more questions? Submit a request


Please sign in to leave a comment.