How to setup call forwarding?

I need to redirect incoming calls to a specific cell number if 100 and 101 sip phones are disconnected or busy in other case both 100 and 101 should ring.
How can I do that?

Now extensions.conf looks like that (all call are going to 100, I also have 101, 102 and 103)

exten => 17778969956,1,Dial(PJSIP/100)

exten => _X.,1,Dial(PJSIP/${EXTEN}@callcentric)

Check out the DEVICE_STATE function.

You can test for states like “NOT_INUSE”, “BUSY”, “ONHOLD”, “INUSE”, etc.

1 Like

Put the Dial for the cell number after the Dial to the two SIP devices… Asterisk will fall through to the second Dial if the first fails.

Please note you are confusing extensions and device names, a common problem. The number that appears after => is an extension. The one that appears after / is a device (end point) name.

Although the example configuration only shows calling multiple devices in parallel for paging, the same syntax works for Dial.

1 Like

The last part does’t work. I cannot figure out how to redirect to an external phone number.

exten => 17778969956,1,GotoIf($["${DEVICE_STATE(PJSIP/100)}" = "NOT_INUSE"]?dial100:check101)
same => n(dial100),Dial(PJSIP/100)
same => n(check101),GotoIf($["${DEVICE_STATE(PJSIP/101)}" = "NOT_INUSE"]?dial101:checkcell)
same => n(dial101),Dial(PJSIP/101)
**same => n(checkcell),Dial(Local/${17771234567}@callcentric,25)**

exten => _X.,1,Dial(PJSIP/${EXTEN}@callcentric)

17771234567 is a literal, not the name of a variable.

If you have an extension defined to allow you to call that number, you can also GoTo that extension.

1 Like

Thanks, it finaly worked :slight_smile:
same => n(checkcell),Dial(Local/17771234567@to-callcentric,25,Ttr)