Today I was helping my colleague to find a reason why outgoing calls did not send out correct CallerID and all calls are shown as private on destination device.
First we checked the extensions.conf which does decent job and looks like this:
[forward]
exten => _X.,1,NoOp("going to do a forward to number")
exten => _X.,n,SetCallerPres(allowed)
exten => _X.,n,Set(CALLERID(num)=${IF($["${CALLERID(num):0:1}" = "0"]?"${CALLERID(num):1}":"${CALLERID(num)}")})
exten => _X.,n,Set(CALLERID(num)=${IF($["${CALLERID(num):0:1}" = "0"]?"${CALLERID(num):1}":"${CALLERID(num)}")})
exten => _X.,n,Set(CALLERID(num)=${IF($["${CALLERID(num):0:2}" = "31"]?"00${CALLERID(num)}":"${CALLERID(num)}")})
exten => _X.,n,Set(CALLERID(num)=${IF($["${CALLERID(num):0:4}" = "0031"]?"${CALLERID(num)}":"0031${CALLERID(num)}")})
exten => _X.,n,Set(CALLERID(name)=${CALLERID(num)})
exten => _X.,n,NoOp("************************ dialing ******************************************")
exten => _X.,n,NoOp(${CALLERID(all)})
exten => _X.,n,Dial(SIP/voipprovider/${DTNUM},25,r)
exten => _X.,n,Playback(silence/1)
exten => _X.,n,Dial(ZAP/r2/${DTNUM},15,r)
exten => _X.,n,NoOp("going to try once with backup number")
exten => _X.,n,Playback(silence/1)
exten => _X.,n,Dial(SIP/voipprovider/${DTBNUM},25,r)
exten => _X.,n,Playback(silence/1)
exten => _X.,n,Hangup
exten => s,1,NoOp("s 1 End")
exten => s,n,Hangup
exten => h,1,NoOp("h 1 End")
exten => h,n,DeadAGI(end_call.agi)
exten => h,n,Hangup
exten => t,1,NoOp("t 1 End")
exten => t,n,Hangup
Actual problem is setting in Sip.conf
[voipprovider]
username=***** <---- put your own stuff here
secret=****** <---- put your own stuff here
type=peer
qualify=no
nat=yes
insecure=very
host=sip.voicetrading.com
fromuser=someusername <--- problem is here
canreinvite=no
allow=alaw
dtmfmode=inband
realm=voicetrading.com
Due to this one line which sets the fromuser value all outgoing calls had hidden/private CallerID. After removing this line code in extensions started working properly and all calls started to have correct CallerID.