login | register
15 May 2008 [18:34 UTC]

AussieVoIP

FreePBX, Trixbox and Australian Voice over IP Information

Similar PagesHistoryPrint

How to change incoming CallerID

Created by: wiseoldowl,Last modification on 18 Mar 2007 [10:34 UTC]

How to change incoming CallerID


The following is an example of how to add a digit to incoming CallerID on a particular trunk - some people seem to want this because their phones will not do a proper callback if the leading digit(s) are missing.

Step 1: Go into the trunk for that provider (if not a Zap trunk-see below for Zap) and under Incoming Settings | USER details you will see a "context=" line - usually this will be "context=from-trunk". Note what is there now (if it is something other than "from-trunk") and change it to "from-trunk-custom", or add "-custom" to the end of whatever is there now

Step 2: Edit etc/asterisk/extensions_custom.conf (you can use nano, Midnight Commander's built-in editor, or other plain-text editor of your choice) and add the following at the bottom of the file:

[from-trunk-custom]
exten => _X.,1,Set(CALLERID(num)=0${CALLERID(num)})
exten => _X.,n,Goto(from-trunk,${EXTEN},1)

Again, change the "from-trunk" in the first and third lines if you originally had something else in your trunk context. In the SECOND line, the 0 (following the =) is the digit to be added - if you want to add something other than 0, you'll have to change that.

Step 3: Restart Asterisk
From CLI: restart now (or, restart when convenient if you don't want to drop calls)
OR, from command line: amportal restart

If you need to make this change for your Zap trunk, the procedure is slightly different:

Step 1: Edit etc/asterisk/zapata.conf (you can use nano, Midnight Commander's built-in editor, or other plain-text editor of your choice). You will see a "context=" line - usually this will be "context=from-zaptel". Note what is there now (if it is something other than "from-zaptel") and change it to "from-zaptel-custom", or add "-custom" to the end of whatever is there now.

Now continue with Steps 2 and 3 above, substituting "from-zaptel" (or whatever you found in the "context=" line in zapata.conf) in place of "from-trunk" in lines 1 and 3 of Step 2 (i.e., just replace "trunk" with "zaptel" in those lines).

Note that the variable ${CALLERID(num)} is only available in Asterisk 1.2 and later. If you need to manipulate it in other ways, see the section on String Handling Functions on the Asterisk variables page - for example, to always strip the first digit or character off of incoming Caller ID, you could probably use ${CALLERID(num):1} (adding the :1 to return all characters AFTER the character in the first position - this could also be used to strip a leading "+" if a provider adds that).

Here's another example, in which digits are both removed and added - in the FreePBX forum, colinjack wrote, "My SIP provider CallerID comes in the format +44123456789 but my database uses 0123456789 - so I needed to remove the '+44' and add a '0' to the callerid to allow it to query the user database." And he added this to extensions_custom.conf to accomplish this:

[from-trunk-custom]
exten => _X.,1,Set(CALLERID(num)=0${CALLERID(num):3:12})
exten => _X.,n,Goto(from-trunk,${EXTEN},1)

Then he changed his sip trunk context statement to context=from-trunk-custom

Just in case anyone wonders, you can use the same custom context (in extensions_custom.conf) for multiple trunks, as long as they originally had the same "context=" destination. Or, if you need to make different changes to the Caller ID from different trunks, then just make multiple custom contexts in extensions-custom.conf, and change the names slightly (e.g. you could call one from-trunk-add-0-custom and another from-trunk-strip-2-custom, or whatever - just make sure to use the same context name in the trunk "context=" line and in the header of your custom context).

Finally, for those using naftali5's Dialplan Injections module, you can place these code fragments in a Dialplan Injection instead of extensions_custom.conf. Simply enter the lines beginning with the "Set" or "Goto" command, like this:

Set(CALLERID(num)=0${CALLERID(num)})
Goto(from-trunk,${EXTEN},1)

Then note the number of the dialplan injection (it will be printed in angle brackets next to the injection name in the list of injections), and in your trunk use context=injection-number where number is the number of the injection. For example, let's say you named the injection as "Change Caller ID", and after you created it you saw this in the right hand column: Change Caller ID <15> - in your trunk, you'd then use context=injection-15

back to content

bitweaver

Powered by

  • Powered by bitweaver
  • Powered by Smarty
  • Powered by Adodb
  • Powered by MySQL
back to content

Site Navigation

back to content
Powered by bitweaver