How to Change Incoming CallerID in TE

Introduction

In this guide, we give examples to describe how to change Caller ID for calls from E1 to SIP.

  • When 4XXX calls in, change the caller ID to 1234XXX.
  • When 6XXXX calls in, change the caller ID to 9876XXXX.
  • For other numbers, change the caller ID to 123456789.

Steps to Change Caller ID

  1. Go to your TE to set three Routes for these three rules:


  2. Login Yeastar TE gateway via SSH
  3. Edit the configuration file extensions.conf. <b>root@MyPBX:~# vi etc/asterisk/extensions.conf
  4. Search route 4XXX by typing “/4XXX” on your keyboard. If the first result is not the one you want, type "n" to find the next one until you find it. 
  5. You will find the three rules as below. [macro-Routein_4XXX] exten = s,1,Set(CDR(userfield)=Inbound) exten = s,n,GotoIf(${DB_EXISTS(blacklist/${CALLERID(num)})}?Blacklist-Handle,s,1) exten = s,n,Set(TRUNKDID=${IF($[${ARG2}=s]?${CALLERID(name)}:${ARG2})}) exten = s,n,Goto(Routeout_4XXX,${ARG2},1) exten = s,102,Goto(Blacklist-Handle,s,1) [macro-Routein_6XXXX] exten = s,1,Set(CDR(userfield)=Inbound) exten = s,n,GotoIf(${DB_EXISTS(blacklist/${CALLERID(num)})}?Blacklist-Handle,s,1) exten = s,n,Set(TRUNKDID=${IF($[${ARG2}=s]?${CALLERID(name)}:${ARG2})}) exten = s,n,Goto(Routeout_6XXXX,${ARG2},1) exten = s,102,Goto(Blacklist-Handle,s,1) [macro-Routein_Others] exten = s,1,Set(CDR(userfield)=Inbound) exten = s,n,GotoIf(${DB_EXISTS(blacklist/${CALLERID(num)})}?Blacklist-Handle,s,1) exten = s,n,Set(TRUNKDID=${IF($[${ARG2}=s]?${CALLERID(name)}:${ARG2})}) exten = s,n,Goto(Routeout_Others,${ARG2},1) exten = s,102,Goto(Blacklist-Handle,s,1)
  6. Copy the 3 rules to your notepad and add the following contents in red.
    [macro-Routein_4XXX]
    exten = s,1,Set(CDR(userfield)=Inbound)
    exten = s,n,Set(CALLERID(num)=123${CALLERID(num)})
    exten = s,n,GotoIf(${DB_EXISTS(blacklist/${CALLERID(num)})}?Blacklist-Handle,s,1)
    exten = s,n,Set(TRUNKDID=${IF($[${ARG2}=s]?${CALLERID(name)}:${ARG2})})
    exten = s,n,Goto(Routeout_4XXX,${ARG2},1)
    exten = s,102,Goto(Blacklist-Handle,s,1)
    
    [macro-Routein_6XXXX]
    exten = s,1,Set(CDR(userfield)=Inbound)
    exten = s,n,Set(CALLERID(num)=987${CALLERID(num)})
    exten = s,n,GotoIf(${DB_EXISTS(blacklist/${CALLERID(num)})}?Blacklist-Handle,s,1)
    exten = s,n,Set(TRUNKDID=${IF($[${ARG2}=s]?${CALLERID(name)}:${ARG2})})
    exten = s,n,Goto(Routeout_6XXXX,${ARG2},1)
    exten = s,102,Goto(Blacklist-Handle,s,1)
    
    [macro-Routein_Others]
    exten = s,1,Set(CDR(userfield)=Inbound)
    exten = s,n,Set(CALLERID(num)=123456789)
    exten = s,n,GotoIf(${DB_EXISTS(blacklist/${CALLERID(num)})}?Blacklist-Handle,s,1)
    exten = s,n,Set(TRUNKDID=${IF($[${ARG2}=s]?${CALLERID(name)}:${ARG2})})
    exten = s,n,Goto(Routeout_Others,${ARG2},1)
    exten = s,102,Goto(Blacklist-Handle,s,1)
    
  7. Press the Esc key to exit the modified mode. Type ":q!" to quit and not save this configuration file.
  8. Create a custom configuration file under path: /persistent/custom-cfg/ 
    Enter command ” vi /persistent/custom-cfg/extensions_custom.conf ” to creat a new custom file. root@MyPBX:~#vi /persistent/custom-cfg/extensions_custom.conf
  9. Paste the contents in the configuration file. If you can’t edit or input any word, you could enter “ i ” to swap to Modified mode.
  10. Press to Esc key to exit and swap to Command mode. Enter “:wq” to save and quit the custom file.
  11. Then enter command “ mypbxconf ”&” asterisk –rx ”module reload” ” to reload all configuration files.
Have more questions? Submit a request

2 Comments

  • 0
    Avatar

    Dear , please pay attention.

    In the screenshot in section 10 there is a typo: for the VI-editor instead of the command "wq" the command "wq!" was used.

  • 0
    Avatar

    Dear , please pay attention.

    In another of your articles on the page
    https://support.yeastar.com/hc/en-us/articles/219795567-How-to-Add-0-on-Incoming-Caller-ID
    You forgot to specify that the whole action should be done with the file /persistent/custom-cfg/extensions_custom.conf instead of /etc/asterisk/extensions.conf
    And you were informed about it in the commentary to the article.

Please sign in to leave a comment.