Call forward / redirect / transfer to external number

My setup-
Asterisk version 15 on my home router with openwrt 15 variant.
My experience level - novice.
Usage- basic 1 home phone, 1 cell (mobile) phone for non commercial use.

Hi,
I am trying to make an incoming external call transfer to an external cell (mobile) while carrying the caller ID. I have seen this question asked lots of times on this and other forums in many different ways but have not found an answer yet.

My understanding is that if it is done by sending the call through asterisk and using the DIAL command that the sip provider will not allow you to use any callerID except our own.
I have tested this and found it to be true with my sip provider. However-

I previously owned a Tp-Link Archer VR600V gateway router and this device had a feature to forward calls to an external number after a specified number of rings if not answered.
I tested this with my cell (mobile) phone and it sent the callerID of the inbound caller to the cell (mobile) phone.
I am using the same sip provider as I did when I had the Tp-Link Archer VR600V so it has nothing to do with the service provider.
I am not sure how the Tp-Link Archer VR600V is doing this or if Asterisk is able to do the same but I know it is possible somehow.
Maybe there is another commend to send the call through asterisk other than ‘DIAL’ the sip provider?
I see there are commands ‘redirect’ and ‘transfer’ but I do not fully understand the functions enough to know if these are usable.

Below is my extensions.conf-

; # Incoming #
[Sip provider 1]
exten => 123456789,1,Goto(phones,333,1)             ;House phone number

; # Internal Devices #
[phones]
exten => 111,1,Dial(SIP/home)                       ;House phone
same => n,Hangup


; # Block caller list #
exten => 333,1,NoOp(${CALLERID(num)})
same => n,GotoIf($["${DB(blockcaller/${CALLERID(num)})}" != "1"]?allowed)
same => n,Playback(Number_not_avaliable)
same => n,Hangup()
same => n(allowed),Dial(SIP/home,8)                  ;call House phone for 8 seconds
; # Forward to Mobile #
same => n,Dial(SIP/Sip_provider_1/987654321)       ;forward number to mobile phone
same => n,Hangup()

; # Outgoing Dials #
                                 
; # Dial Extension Sip provider 1 #
exten => _X.,1,NoOp(${CALLERID(num)})
same => n,Set(CALLERID(num)=123456789)
same => n,Goto(outgoing,${EXTEN},1)


; # Outgoing Providers #
[outgoing]
exten => _X.,1,Dial(SIP/Sip_provider_1/${EXTEN})

The line same => n,Dial(SIP/Sip_provider_1/987654321) was the only way I could get it to ring through to the sip provider and even then it got disconnected, so more work is needed here as I thought it would at least call with the home phone as the caller ID.

I also tried -

same => n,Dial(SIP/${Sip_provider_1}/${0450442958})  
same => n,Dial(SIP/Sip_provider_1/${0450442958})

but they were less effective.

If anyone knows if the ‘redirect’ or ‘transfer’ commands can be used to accomplish this or any other way this can be done please reply.

Thanks for reading, any help is appreciated.

It is, possibly, actually transferring the call, rather than relaying it. I’m not sure many providers support this, but you may have the exception.

Asterisk can do blind transfers, and redirections, using the Transfer application, although this isn’t as well tested as Dial.

Also the exact rules for caller ID on relayed calls may differ between providers; there may be ways of doing it where t hey are prepared to give a B attestation (assuming the USA). You really need to ask them. Otherwise it is a case of trying things until one works, with the risk that it was a bug in the provider’s system that made it work.

Did you somewhere Answer() the incoming call ?

No it checks if the call is blocked in the database, then calls the house phone for 8 seconds, then tries to call the cell (mobile) phone. The user can pick up the phone in the 8 seconds it is ringing if home. Should I add the Answer() command somewhere?

I believe this may be the key. If anyone on the boards has knowledge of using the transfer application, please chime in.

My brain keeps saying if the call came in through the sip provider asterisk should not have to DIAL out but just tell the sip provider to pass the call on.

The Tp-Link Archer VR600V has this option so I am assuming it has been designed to be used by the majority of providers (I was using the EU version in Australia) of course some sip international providers may differ. In Australia they would not be allowed to advertise the feature if is does not work.
I think the sip provider has less to do with the issue and the problem is how asterisk is handling the transfer, but I may be wrong.

I do

Can you show me where I should add the Answer() command in my extensions.conf please and I will try it out.
Thanks. :slight_smile:

I think you almost certainly do not want to put an Answer() into your
dialplan, because if you do, you will lose any ability to send a redirect to
the service provider (which is my understanding of what you are trying to
achieve).

You simply want to use a Dial() command to the house phone with an 8 second
timeout. If the phone answers the call, the Answer() is implicit.

If the house phone does not answer the call, it remains “unanswered” and you
still have complete flexibility then to send a redirect request to the upstream
service provider.

Antony.

You can send a redirect but it is a different type of redirect, and less likely to be honoured (REFER request, as against 302 response).

Generally early answering is overused.