I am planning to preserve what caller id (origination) the client is sending and at the same time manipulate replace that caller id before going out, WITHOUT losing what caller id the client is sending let say on the cdr.
Store original callerid in a channel variable(and later on have original callerid stored in user field of CDR) and set different callerid for outgoing call.
same => n,Set(ORIGINALCIDNUM=${CALLERID(num)})
same => n,Set(ORIGINALCIDNAME=${CALLERID(name)})
… …
… …
same => n,Set(CALLERID(num)=987654321)
same => n,Set(CALLERID(name)=MyName)
same => n,Dial(… … …)
same => n,Set(ORIGINALCIDNUM=${CALLERID(num)})
same => n,Set(CDR(userfield)=${ORIGINALCIDNUM})
same => n,Set(ORIGINALCIDNAME=${CALLERID(name)})
… …
… …
same => n,Set(CALLERID(num)=987654321)
same => n,Set(CALLERID(name)=MyName)
same => n,Dial(… … …)
Another question will be regarding cid matching and replacing:
Let say an extension calling out with caller id = 12345 there’s a condition on the dial plan that search for cid = 12345 and if found it will be replaced with 00000.
There are 100+ cid that needs to be matched so there will be a possible need of file where a list of cid stored and their respective equivalent value to be replaced with.