Set outbound DID and inbound display name based on CALLER ID

Hi i am using a PRI that has the DIDs from 012221300 to 012221327. It is working and i would like to extend to do two extra things:

  1. When a DID number is called, i would like to change the displayed number on the SIP operators phone (i.e. map certain DID numbers to certain company names, if 012221306 is called, i would like CompanyB to come up on the softphone display).

  2. For outbound calls, i would like to set the DID extension to the operator who is making the call, i.e. for the example below i would like to set SIP extension 105 to use the DID so it displays on the recepients mobile phone as coming from that number, 012221305.

The PRI setup is working and able to make and receive calls. I have tried to do this with a shortcode ‘8’, but the set number is not being accepted/honoured/shown by the telco, only the main trunk DID comes up on the recepipients phone (012221300). I greatly appreciate the help, my config is below.

Many thanks in advance,

Chris

[general]
static=yes
writeprotect=no

[globals]
TRUNK=Dahdi/g0
TRUNKMSD=1

[outgoing]
exten => _8./106,1,Set(CALLERID(all)=012221305)
exten => _8.,n,Dial(${TRUNK}/${EXTEN:${TRUNKMSD}}) ;if we dial 8, includ extension DID (if any)

exten => _9.,1,Dial(${TRUNK}/${EXTEN:${TRUNKMSD}}) ;if we dial 9,
; send to trunk

[local]
exten => _1XX,1,Dial(SIP/${EXTEN},30,Tt)

exten => _1XX,n,HangUp()
exten => 600,1,VoiceMailMain()
include => outgoing

[from-pstn]

exten => 12221300,1,Queue(Operators,Tt) ; call everyone in operator queue

exten => 12221305,1,Dial(SIP/105,60,Tt)
exten => 12221305,n,Hangup()

exten => 12221306,1,Dial(SIP/106,60,Tt)
exten => 12221306,n,Hangup()

You will need to check with your telco and see if they have it setup for you to change the outgoing number. Many have it fixed.

As far as the name goes, change the callerID upon receiving the call.

exten => 12221305,1,set(CALLERID(name)=CompanyA)
exten => 12221305,n,Dial(SIP/105,60,Tt)
exten => 12221305,n,Hangup()

exten => 12221306,1,set(CALLERID(name)=CompanyB)
exten => 12221306,n,Dial(SIP/106,60,Tt)
exten => 12221306,n,Hangup()