Forward a call from outside to outside on demand

Hi, i’m in internship and my boss asked me to make asterisk able to call forward from outside to outside. I’m currently dealing with a huge problem… Please help me

My situation so far is :

call from outside (comes via sip1), asnwering it with localAccount1, the operator does a direct blind call transfer to outside (goes via sip2), that doesn’t work and its shows the logs below.

call from outside (comes via sip1), answering it with localAccount1, the operator does a direct blind call transfer to localAccount2, that works.

call from localAccount2, answering it with localAccount1, the operator does a direct blind call transfer to outside (goes via sip1), that works.

LOGS :

– Blind transferring SIP/sip1-00000058 to ‘outside2’ (context call-out) priority 1
– Stopped music on hold on SIP/trunk-ovh-out-fixe3-00000058
– Executing [0642399436@call-out:1] Dial(“SIP/sip1-00000058”, “SIP/sip2/outside2,20,tTkK”) in new stack
== Using SIP RTP CoS mark 5
– Called SIP/sip2/outside2
[Mar 12 13:53:40] WARNING[27975]: chan_sip.c:20366 handle_response_invite: Received response: “Forbidden” from ‘“outside1” sip:outside1@myasteriskserverip;tag=as1e0afcea’
== Everyone is busy/congested at this time (1:0/1/0)
– Executing [outside2@call-out:2] Hangup(“SIP/sip1-00000058”, “”) in new stack
== Spawn extension (call-out, outside2, 2) exited non-zero on ‘SIP/sip1-00000058’

MY ANALISIS :

The core of the problem is that my asterisk suppose that the calling number outside1 (“Forbidden” from '“outside1” sip:outside1@myasteriskserverip) is an asterisk internal number when it’s not. See the way it’s associated with the ip of my server.

Any help appreciated !

Your SIP carrier understood the request, but is refusing to fulfill it. You need to get a SIP trace from them, and also ask them why they are rejecting your request.

Thanks for your answer !

That’s what i thought, but then i did a test with a physical phone configured to connect directly to the sip trunk and i came to doubt hard about that.

This is the test i did :
receiving a call from outside1 (mobile phone calling the sip1) on the physical phone connected wth the sip trunk as account, directly to the provider (no asterisk involved !)
answering it, forwarding the call to outside2 (mobile phone number 2), that works, the physical phone hangup by itself, and the 2 mobile phones are in conversation.

I double checked : the sip trunks i use to get in and go out are both able to manage 2 channels at least

So, something’s wrong with my asterisk right? Or you still think i should contact my SIP carrier for further informations?

Without the dialplan it is difficult to understand exactly what you are doing, especially as there seems to have been inconsistent obfuscation of the numbers used.

However, a directly connected SIP phone will do a SIP transfers (which may well be refused by many ITSPs) whereas your dialplan is simply relaying the call.

To relay the call correctly you need to write the dialplan to correctly interpret the number dialed, and you may need to set a channel variable to override the default context.

Asterisk can do SIP blind transfers, but you need to use the Transfer application for that.

Note that some phones actually implement blind transfers as attended transfers, in which case getting the transfer application to run on the right channel may be rather difficult. I’m not even sure if it will be practicable for a blind transfer.

Typically the ITSP will remain in circuit between the two end points and will certainly charge as though the outgoing leg was a separate call.