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:

[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.

Asterisk@Home VoipBuster dial in account

Trunk name:


voipstunt


Peer details:


allow=alaw&ulaw&gsm
auth=md5
canreinvite=no
context=from-pstn
disallow=all
dtmfmode=inband
fromdomain=voipstunt.com
fromuser=###USER###
host=sip.voipstunt.com
insecure=very
nat=yes
progressinband=yes
realm=voipstunt.com
regseconds=3600
secret=###PASSWORD###
type=peer
username=###USER###


User Context:


###USER###


User Details:


allow=alaw&ulaw&gsm
canreinvite=no
context=from-pstn2
dtmfmode=inband
insecure=very
qualify=yes
secret=###PASSWORD###
type=friend


Register string:


###USER###:###PASSWORD###@sip.voipstunt.com/###DEFAULTEXTENSION###

FreePBX Music on Hold troubleshooting

To add custom MP3 files to Music on Hold folder you can use FTP, SCP 
or any other file transfer method.
Upload the file to this location:
/var/lib/asterisk/mohmp3
After that yo have to "fix" the security rights with:
chown -vR asterisk.asterisk /var/lib/asterisk/mohmp3
chmod -v 775 /var/lib/asterisk/mohmp3
chmod -v 664 /var/lib/asterisk/mohmp3/*
In case you still want to use web interface and plan to upload larger mp3 music on hold files, change the “max filesize” from 2M to 20M in
nano /etc/php.ini
More details related to FreePBX Production Install Guide (CentOS v5.x, Asterisk v1.4.x, FreePBX v2.4.x) visit this URL: