[asterisk-users] Modification of Caller ID based on context
Matthew Brothers
matthew at brothersfamily.net
Tue Jun 26 17:02:35 CDT 2007
> Hi,
>
> I have been looking for an example of accomplishing this, but
> I've been unable to locate something similar to what I'm trying
> to do.
>
> Here's the scenario:
>
> Users caller ID is set to their internal extension (200-250).
> This is set in sip.conf for each user. Each user has a local DID
> as well (hosted through Vitelity, for example (555)111-2222). The
> problem is that this extension was being passed to the outside
> world. I currently have a SetCallerID command changing the
> CallerID to our main office number, but some users want their DID
> sent, not the general number.
>
> The problem is that if their caller ID is set to their DID, when
> users hit redial on their phones internally they dial out and
> back in. I corrected this by putting each DID in extensions.conf
> under their three digit extension, but that seems a bit like a
> kludge obviously.
>
> I'm looking for a method of sending the internal three digit
> extension only when a user is dialing another user internally,
> otherwise it will send their DID. Is their a method to do this in
> the dial plan? Anyone have an example of how to accomplish this?
>
>
> Thanks in advance.
Mike,
I have a similar setup (I even use Vitel) and the easiest and
cleanest method that I have found to accomplish this is with the
AstDB. You can simply create a cross-reference of DIDs and Internal
extensions similar to extdid/200 => 5551112222 ... extdid/250 =>
5551112272 in the AstDB. Then you can change your outgoing dialplan
to change the caller id based upon this cross reference. Example:
exten => NXXNXXXXXX,n,Set(outgoingCID=<MAINNUMBER>)
exten => NXXNXXXXXX,n,
GotoIf($[ ${DB_EXISTS(extdid/${CALLERID(num)})} = 0 ]?makecall)
exten => NXXNXXXXXX,n,
Set(outgoingCID=${DB(extdid/${CALLERID(num)})})
exten => NXXNXXXXXX,n(makecall),Set(CALLERID(num)=${outgoingCID})
...
You could even simplify your incoming context by cross-referencing
in the other direction. That is didext/5551112222 => 200 ...
didext/5551112272 => 250.
exten => NXXNXXXXXX,n,
Goto(internal-extensions,${DB(didext/${EXTEN})},1)
OR you could do something similar with LOCAL channels or with a Dial
command.
-Matthew
More information about the asterisk-users
mailing list