Problem forwarding incoming external to external number

I use Asterisk 1.8.5 + FreePBX 1.9 with Voipbuster.
My idea is to automatically forward incoming phone calls to an external number after a certain amount of seconds of by forwaring all incoming calls to that number.

It works great when I forward an incoming external call to an internal extension, or when an internal extension gets forwarded to an external number. Sadly, I can’t get it to work for incoming external calls, and I don’t understand why.

  • With the single VoipBuster trunk, I can set up and use an incoming and an outgoing external call at the same time, so capacity doesn’t seem te be a problem.
  • With the dial plans in place, I can call the external number I want to forward to.
  • The external caller gets a normal calling tone. When the phone is picked up by the external telephone where the forward points to, the external caller still hears the dialing tone. The forwarded to external phone hears nothing aftehr picking up.

When I put the logging on Debug, I can see that the external phone (0351234567) is picked up:

-- SIP/VB-out-00000022 answered Local/0351234567@from-internal-b926;2 -- Local/0351234567@from-internal-b926;1 answered SIP/VB-out-00000020

Also in the logfiles, it looks like Voipbuster (IP 77.x.x.x) tries to transfer the call. Might that be a problem?

<--- Reliably Transmitting (NAT) to 77.72.169.129:5060 ---> SIP/2.0 200 OK Via: SIP/2.0/UDP 77.72.169.129:5060;branch=z9hG4bKafea502c577048dfbc47c93743f6439c;received=77.72.169.129;rport=5060 From: <sip:0031612345678@sip.voipbuster.com:5060>;tag=120313ac4e2d5d2d4c07f3 To: <sip:blablabla@192.168.123.50:5060>;tag=as1a2501aa Call-ID: b4ce200d34f349edb628c4f525d98761 CSeq: 1 INVITE Server: FPBX-2.9.0(1.8.5.0) Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH

To be complete, here are my trunk settings:

notransfer=yes canreinvite=no fromdomain=voipbuster.com host=sip.voipbuster.com fromuser=+31123456879 username=username secret=secret type=friend insecure=very promiscredir=yes disallow=all allow=ulaw&alaw&gsm

At this point I’m all out of ideas. Can someone point me in the right direction?

[quote=“epbogaard”]
Also in the logfiles, it looks like Voipbuster (IP 77.x.x.x) tries to transfer the call. Might that be a problem?[/quote]

Why do you think that an Answer from Asterisk indicates an attempt to transfer by the remote side?

I believe canreinvite has been removed from the code in 1.8, in favour of drectmedia.

In fact canreinvite is dfeprecated in favour of directmedia.
But the other thing - beside these mentioned by david55 - is this here from the INVITE:

If the IP-adress isn’t a fake, there seems IMHO to be a NAT-problem as this target-address is a internal IP from a private network.

About the transfer: maybe I’ve read the logfile wrong.

Yes, asterisk is behind a NAT router. Opened up the necessary ports and normal inbound and outbound calling works without any problems at all.

When you say that the invite is wrong, because it points to an internal IP (.50 is the Asterisk server), shouldn’t Asterisk reroute the call? So shouldn’t Asterisk answer the incoming external call and then set up a new outgoing external call to connect those two? I don’t think Voipbuster supports reinviting the new party (which isn’s a SIP client, but a ‘normal’ phone number).

Updated canreinvite=no to directmedia=no, but still the same problem.

Asterisk should indeed reroute the call itself, but: To connect the channels (where one comes from the outside) the outside leg (voipbuster) needs to know where to route it’s packets to. And if asterisk advices it’s internal IP this will never work as this private IP is not reachable for Voipbuster.
You may check this when issuing a rtp set debug on at the asterisk console and trying the scenario. I’m relatively sure, that there will me no media data when the calls are connected.
Thus You should check why asterisk is delivering it’s internal IP there instead of the external one.

Tried to make sense of the logfile and give a digest of it here, but halfway I concluded it was better to just supply you guys with the complete logfile. You can find it over here: ebogaard.nl/asteriskdebuglog.txt.

I removed all IP-addresses, usernames and phonenumbers and replaced them with a description between . Hope you guys are willing to read through the thing (it’s 45K) and are able to point me to the problem(s)

I’ve changed one thing since I made this logfile: force the outgoing CID to be my phone number, because this should resolve the 401 in the logfile.

I hope this isn’t asking too much.

Asking you to go throug the logfile is a bit much to ask. Is there something else I can help you with, so you can help me?

I saw nothing wrong in the log file. The 401 is normal, when authentication is enabled. An attempt is made without authentication. The rejection tells one how to authenticate, and a second attempt is made with authentication.

Thanks for taking a look at it.

When forwarding a call, everything seems te work OK: the externa phone rings, and when it’s answered, you can see that reflected in the logfile. When I call with my mobile phone, I even feel it buzzing, indicating that a call has been set up.
Problem is that it keeps ringing and you don’t hear the person answering the phone. When that person disconnects, I do hear the disconnected tone.

Do you know some things to test? Is it maybe a good idea to copy the trunk and u one for incoming and one for outgoing? Is it maybe a good idea to disable the ringing sound when forwarding? Or won’t these do anything to improve the sitiation?

The trace looked normal. At the moment I suspect a bug in your service provider’s system. However, sip show channels and core show channels, and possibly the corresponding individual channel displays, may help to exonerate Asterisk.

You have caused some confusion by talking about dial tone and ringing when I think you always mean ring back tone.

Sorry for the delay, but have been quite busy.
Took a look at sip show channels and core show channels, and saw that information is directly available in freepbx. So I used that to copy the stages. See the following log: ebogaard.nl/logfile-2011-08-25-edited.txt

Again, I edited out all private info and replaced it with easy recognizable text.

Looks okay to me (but what do I know). What do you think?

Someone any ideas?

Contact your service provider.

So you also don’t see anything going wrong in the SIP-connections?
In that case, I’ll contact my service provider.

Finally fixed it by using another SIP-trunk from another supplier.
So now it’s: incoming call on Voipbuster => Asterisk => SIP trunk other supplier

First I tried another Voipbuster clone (smsdiscounter) as a second trunk, buit still didn’t work. Guess Voipbuster and clones just don’t want to forward calls.

This method works for me, however, I’m using a lot of Freepbx stuff.

I created a custom extension, sending the call to LOCAL/8817778889999@from-internal. Then defined a route with the 88 and NX.and 88 and X.[/b] prefix, to use any available trunk but: force to use the trunk CID/ANI. The reason for that is that the incomming calls will come with invalid (for the trunk) CID/ANI and most SIP-Trunk providers will reject the outgoing call.

To make things even better, I created a ‘fake’ group, assigning the previous custom extension and the user physical phone, his external DID points to this group, so, the calls will go to his desk and his cell at the same time with a ‘ring all’.