If you have a two-line phone, you can register Line 1 to Company A and Line 2 to Company B in sip.conf. You can set the callerid for each line in sip.conf with:
[line1]
…normal stuff…
callerid=Company A <1800xxxxxxx>
then,
[incoming calls context]
exten => ,1,dial(sip/line1)
exten => ,1,dial(sip/line2)
Or, you can always use a dial mask (dial 9 first) for one of the companies
exten => _91NXXNXXXXXX,1,goto(CompanyB,${EXTEN:1},1)
exten => _1NXXNXXXXXX,1,goto(CompanyA,${EXTEN},1)
[CompanyA]
exten => _X.,1,Set(CALLERID(all)=“CompanyA” <1800xxxxxxx>)
exten => _X.,n,dial(sip/sip-gateway/${EXTEN})
exten => _X.,n,Congestion
[CompanyB]
exten => _X.,1,Set(CALLERID(all)=“CompanyB” <1800xxxxxxx>)
exten => _X.,n,dial(sip/sip-gateway/${EXTEN})
exten => _X.,n,Congestion