newspaint

Documenting Problems That Were Difficult To Find The Answer To

Voipfone Peer With Asterisk Reports No Funds

I had set up Voipfone (a VoIP provider) as a peer to my Asterisk server. It registered fine and my extensions could call the Voipfone test numbers without any problems (155 the confirmation test, 152 the echo test).

But whenever I tried to call a real phone number (my mobile or a local store) I got the following message in a British female voice:

Sorry your call can't be connected. Please try again.

I turned on SIP debugging in Asterisk:

myuser@myhost:~# asterisk -r
myhost*CLI> sip set debug on
myhost*CLI>

Note that in this example my Asterisk server is on 192.168.1.2. The Voipfone SIP server is at 195.189.173.27. My extension is 234 that I’m making the call from.

Next I tried making a call (to Pizza Hut at Thorpe Park) to 01932567159. Of interest were the following two entries:

Reliably Transmitting (NAT) to 195.189.173.27:5060:
INVITE sip:01932567159@sip.voipfone.net SIP/2.0
Via: SIP/2.0/UDP 192.168.1.2:5060;branch=z9hG4bK3700cafe;rport
From: "234" <sip:234@sip.voipfone.net>;tag=as36249d34
To: <sip:01932567159@sip.voipfone.net>
CSeq: 102 INVITE
User-Agent: Asterisk PBX 1.8.10.1~dfsg-1ubuntu1

...

<--- SIP read from UDP:195.189.173.27:5060 --->
SIP/2.0 183 Session Progress
Via: SIP/2.0/UDP 192.168.1.2:5060;branch=z9hG4bK3700cafe;received=86.157.212.100;rport=5060
From: "234" <sip:234@sip.voipfone.net>;tag=as36249d34
To: <sip:01932567159@sip.voipfone.net>;tag=VFa4bb2530035671ac22635ffaface
CSeq: 102 INVITE
User-Agent: Voipfone Sip Network

At this point I’m hearing the message on the phone to please try again. Now when the phone call ends I get:

<--- SIP read from UDP:195.189.173.27:5060 --->
SIP/2.0 603 No Funds
Via: SIP/2.0/UDP 192.168.1.2:5060;branch=z9hG4bK3700cafe;received=86.157.212.100;rport=5060
From: "234" <sip:234@sip.voipfone.net>;tag=as36249d34
To: <sip:01932567159@sip.voipfone.net>;tag=VFa4bb2530035671ac22635ffaface
CSeq: 102 INVITE
User-Agent: Voipfone Sip Network

Now I know I have funds. I logged into Voipfone and discovered I had plenty of funds in my account. So what was going wrong?

Well turns out Voipfone wasn’t keen on the user (From: e-mail address) being something other than my Voipfone account number.

I needed to add the following line to my sip.conf file under my peer block:

[voipfone]
type=friend
fromdomain=sip.voipfone.net
fromuser=account_number

and re-loading the SIP configuration:

myuser@myhost:~# asterisk -r
myhost*CLI> sip reload
myhost*CLI>

So my sip.conf now looks like:

[general]
register => 31234567:123456@sip.voipfone.net/voipfone
transport=udp

[voipfone]
type=friend
insecure=invite
dtmfmode=rfc2833
context=fromvoipfone
deny=0.0.0.0/0.0.0.0
permit=195.189.173.27/255.255.255.255
defaultuser=31234567
secret=123456
fromdomain=sip.voipfone.net
fromuser=31234567
host=sip.voipfone.net

Now, when I dial, I see the following sent to Voipfone from Asterisk:

Reliably Transmitting (NAT) to 195.189.173.27:5060:
INVITE sip:01932567159@sip.voipfone.net SIP/2.0
Via: SIP/2.0/UDP 192.168.1.2:5060;branch=z9hG4bK2a703134;rport
From: "234" <sip:31234567@sip.voipfone.net>;tag=as6b9ff512
To: <sip:01932567159@sip.voipfone.net>;tag=VFa4bb2530035671ac22635ffadefa
CSeq: 102 INVITE

… and I get dialtone.

One response to “Voipfone Peer With Asterisk Reports No Funds

  1. Gav February 21, 2016 at 11:31 am

    Thanks, this solved a problem that was driving me nuts!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: