Grab an answered call

Well, I have a POC working. It’s essentially ONE line of dialplan… Nothing encourages you more than being told you can’t… :slight_smile:

Disclaimer, I tested this on FreePBX 14.

8791 = Principal
2547 = Valcom
6499 = Teacher

;8791 calls 2547
    --Executing [2547@from-internal:1] GotoIf("PJSIP/8791-00000043", "1?ext-local,2547,1:followme-check,2547,1") in new stack
...
    -- PJSIP/2547-0000004a is ringing
...

;2547 Answers

    -- PJSIP/2547-0000004a answered PJSIP/8791-00000049
    -- Channel PJSIP/2547-0000004a joined 'simple_bridge' basic-bridge <eb80c9ab-52a5-4e0e-b7d7-d87718467c58>
    -- Channel PJSIP/8791-00000049 joined 'simple_bridge' basic-bridge <eb80c9ab-52a5-4e0e-b7d7-d87718467c58>

Hers the magic: 6499 dials *372547 ad grabs the active call!

    -- Executing [*372547@from-internal:1] NoOp("PJSIP/6499-00000045", "Extnering custom context to seize call from 2547") in new stack
    -- Executing [*372547@from-internal:2] Bridge("PJSIP/6499-0000004b", "PJSIP/8791-00000049") in new stack
    
;8791 leaves the original bridge
    -- Channel PJSIP/8791-00000049 left 'simple_bridge' basic-bridge <eb80c9ab-52a5-4e0e-b7d7-d87718467c58>

;and then joins the new bridge along with 6499
    -- Channel PJSIP/8791-00000049 joined 'simple_bridge' basic-bridge <7fd1fe6d-93b0-4eb6-91cb-807a5cbac596>
    -- Channel PJSIP/6499-0000004b joined 'simple_bridge' basic-bridge <7fd1fe6d-93b0-4eb6-91cb-807a5cbac596>

;Since no one is in the original bridge, 2547 leaves the original bridge
    -- Channel PJSIP/2547-0000004a left 'simple_bridge' basic-bridge <eb80c9ab-52a5-4e0e-b7d7-d87718467c58>

Because of line updates, 8791 actually sees on their screen that they are now talking with 6499.

So, essentially, dialing *37 followed by a 4 digit extension will seize the call from them.

Obviously, this is a POC, and needs validation, restrictions etc etc.

Finally, here’s the dialplan that goes in extensions_custom.conf

[from-internal]
exten => _*37XXXX,1,Noop(Extnering custom context to seize call from ${EXTEN:3})
 same => n,Bridge(${IMPORT(${CHANNELS(${EXTEN:3})},BRIDGEPEER)})
 same => n,Hangup
5 Likes