Caller ID change from Internal->Internal (only when it rolls to Follow-me)

I would like to be able to selectively change the caller ID #, when an internal user calls another internal user, but only when it rolls to the follow-me.

For example:
Ext201 calls Ext202
Ext202 is out of office, so it rolls to the follow-me (external cell phone in this example)
Instead of the default system caller ID being pased to the cell phone (that rolled from Ext200), I’d like to be able to change it to
xxx-xxx-x201 instead of the system default xxx-xxx-x200. Basically, if it’s a follow-me call from an internal extension, I’d like to know it, verses an external call (As the caller id ends up being the remote id, which is perfect)… just internal calls get our main number, which also happens on unknown callers, and I’d like to distinguish.

Currently, the follow me settings are in the database (put there by freepbx), so I am thinking it must be something similar:
(but may need to write an override dialplan to accomidate)…
And I am having a hard time finding docs to clarify this, and a quick test didn’t work.

Can someone help lead me down the correct road on this concept?

This is UNTESTED but I think it may work…

Let’s say you have written a custom dialplan in extensions_custom.conf to mung the Caller-ID before sending it to your cell phone. If you only need this to work when it goes to YOUR cell phone (in other words this is a one-shot thing for a specific destination), you can use the Custom Destinations module (under Tools) to create a link to your custom dialplan - in the Custom Destination textbox you’d use something like custom-my-dialplan,${EXTEN},1 where custom-my-dialplan is the name of the dialplan fragment you’ve put in extensions_custom.conf.

Then you create a Misc Application to assign a number to that Custom Destination (you can make this something no one would ever dial, such as 0000123, just so long as it doesn’t conflict with anything else in your dialplan. Or, you could use something more in line with your existing numbering plan and make it a speed dial number for your cell, for use from internal extensions only - it’s up to you). Now you have a number you can put in the follow-me (instead of your cell phone number).

The last thing to do (well, actually, probably the first thing, but it makes more sense to explain it last) is write the code to mung the outgoing Caller ID before sending the call to the outbound-allroutes context. You will probably get some ideas of how this might be done by looking at the sample dialplan fragments here:

The only difference is that you are changing the outgoing caller ID, not the incoming. So, instead of sending the call to from-trunk,${EXTEN},1 (in the final Goto) you’d send it to something like outbound-allroutes,yourcellnumber,1 (replace yourcellnumber with the actual number of your cell phone).

In other words, without testing it, your dialplan in extensions_custom.conf might look like this:

exten => _X.,1,Set(CALLERID(num)=1xxxxxxx${CALLERID(num)})   ;(substitute the xxxxxxx part from your phone number)
exten => _X.,n,Goto(outbound-allroutes,1yyyyyyyyyy,1   ;(replace the yyyyyyyyyy with your cell number)

(Omit the 1 before the yyyyyyyyyy if your system supports 10 digit dialing)

This is just off the top of my head, I have not actually tested any of this. Also the limitation is that you have to create a separate custom dialplan fragment (and the pointers to it) for each cell phone you want to send a call to. Let us know if this actually works.


All of that makes sense, and I agree, it would work, except for one thing…
If the callerid WAS 10 digits (an outside call being forwarded), the new made up number would be wrong. 1xxxxxxx1234567890

So, should I instead write an AGI script to be executed from the custom-my-dialplan example, to only munge it if it’s 3 digits, but leave it as it is if it’s longer, or unknown, etc, or would the below concept work (at least for me to test further with)

exten => _X.,1,GotoIf(LEN(CALLERID(num)) = 3?2:n)
exten => _X.,2,Set(CALLERID(num)=1xxxxxxx${CALLERID(num)}) ;(substitute the xxxxxxx part from your outgoing phone number)
exten => _X.,n,Goto(outbound-allroutes,1yyyyyyyyyy,1 ;(replace the yyyyyyyyyy with your destination cell number)

ok, it was so easy to test, I thought I’d just test that…

So, I setup the Custom Destination, and Misc Application, (I had to use a phone # that didn’t start with a 0, such as 123456789 as 0 was getting into my operator system… didn’t care to figure out why)

And it didn’t work… until I looked at the log and found it used my dest… oh, a trunk caller id was in place…
when I removed that, IT WORKED PERFECTLY.

I see why they call you wiseoldowl, lol

I think one of these days soon, I’ll write a bit more detailed dialplan for this, to handle more possiblities and variations (and submit it here of cours), but for now this worked great.
TY much!

Plaese do submit anything you build off of this - ultimately it would make a great How-To!

You’re quite welcome, just glad I wasn’t too far off base considering I hadn’t tested any of that.