Aleksandar's computer workshop

Let's see what Aleksandar was fixing today.
My findings, tips & tricks related to computers, internet, programming and other stuff I was working with.

How to solve mystery of not sent CallerID via SIP in Asterisk

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:

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

username=***** <---- put your own stuff here
secret=****** <---- put your own stuff here
fromuser=someusername  <--- problem is here


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.