CID and PAI

Need some guidance.

FreePBX Distro 6.12.65-26
Asterisk 11.16

SIP trunk with 50 or so DIDs. Want to be able to present a few different Caller IDs when dialing depending on who’s placing the call. For most people, we want the published 1-800 number to show in the Caller ID. For a few of the sales reps, we want their DID to show in the Caller ID.

If I change the caller ID at the trunk, it is rejected by the SIP provider. Spoke to the provider and was told if we used P-Asserted-Identity we should be able to pass any DID listed on the trunk as the CID. Worked with them for a while yesterday and into last night with no luck.

I used this post as a guide -

SIP sendrpid is set to pai and I’ve added the following to extensions_override_freepbx.conf -

[macro-dialout-trunk-predial-hook]
;exten => s,1,SipAddHeader(P-Asserted-Identity:sip:[email protected])
exten => s,1,SipAddHeader(P-Asserted-Identity:sip:${CALLERID(CID)}@oursipprovider.com)
exten => s,n,MacroExit()

I have tried each of the 2 formats above, one at a time, while remarking out the other. For CID - I’ve tried using both the main trunk number and the CID we want to present to people called. I use the opposite as the CID in the trunk setup. Doesn’t seem to matter either way, the called party always sees the default number - the main number on the trunk - or, I receive an “all circuits are busy now” message as the number is refused at the SIP provider.

I am sure I am missing (and not understanding) something but don’t know what it is. Thanks for any help in advance!

Doug