I have some problems with Directed call Pickup function that is not working in my dialplan, which is rather simple, but includes 2 separate contexts.
This is the basic dialplan:
[internal-calls]
exten => 105,1,Dial(SIP/105,10,tT)
exten => 106,1,Dial(SIP/106,10,tT)
exten => 197,1,Dial(SIP/197,10,tT)
[from-trunk]
exten => 100288506,1,Dial(SIP/197,30,tT)
The “internal-calls” context is used for all inter-extension calls, “from-trunk” context is used for all calls to and from the VoIP provider. All the extensions have defined the same callgroup and pickupgroup parameters in sip.conf.
Group call pickup is defined in features.conf as ** and works perfectly for internal (between extension) and incomming (from VoIP provider) calls.
Directed call pickup feature is defined in extensions.conf like:
[custom_features]
exten => _**.,1,Pickup(${EXTEN:2}@internal-calls)
exten => _**.,n,Pickup(${EXTEN:2}@from-trunk)
The idea is when I see a ringing extension, I can use Directed call pickup feature by dialing **exten_num. I do not want to use Group call pickup.
Directed call pickup works perfectly for internal calls (between extensions), but for incomming calls (from VoIP provider) I get a following error (I dial **197 from ext. 106):
-- Executing [**197@internal-calls:1] Pickup("SIP/106-000013dd", "197@internal-calls") in new stack
[Feb 16 18:31:35] NOTICE[16177]: app_directed_pickup.c:297 pickup_exec: No target channel found for 197.
-- Executing [**197@internal-calls:2] Pickup("SIP/106-000013dd", "197@from-trunk") in new stack
[Feb 16 18:31:35] NOTICE[16177]: app_directed_pickup.c:297 pickup_exec: No target channel found for 197.
-- Auto fallthrough, channel 'SIP/106-000013dd' status is 'UNKNOWN'
I really do not uderstand why is this happening.
I have browsed the internet and that was one of the solutions that should be working as expected.
Alternative 1
One more solutions would be re-defining the Directed pickup extension to:
[custom_features]
exten => _**.,1,Set(GLOBAL(PICKUPMARK)=${EXTEN:2})
exten => _**.,n,Pickup(${EXTEN:2}@PICKUPMARK)
This solution works for internal and incomming calls, but behaves like Group pickup. It does not matter which extension you put after **, it picks up the ringing extension either way. For instance, I can pick up a ringing extension 197 by dialing **103. This is not a good solution.
Alternative 2
One more option to use PICKUPMARK in a different way:
[internal-calls]
exten => 105,1,Dial(SIP/105,10,tT)
exten => 106,1,Dial(SIP/106,10,tT)
exten => 197,1,Dial(SIP/197,10,tT)
[from-trunk]
exten => 100288506,1,Set(__PICKUPMARK=197)
exten => 100288506,n,Dial(SIP/197,30,tT)
[custom_features]
exten => _**.,1,Pickup(${EXTEN:2}@PICKUPMARK)
With this code, Direct call pickup also works. But it also means defining PICKUPMARK for every DID, which is not very cool for me. I would prefer a different solution.
Alternative 3
One more thing is that the Direct call pickup is working fine if I have this dialplan:
[internal-calls]
exten => 105,1,Dial(SIP/105,30,tT)
exten => 106,1,Dial(SIP/106,30,tT)
exten => 197,1,Dial(SIP/197,30,tT)
[from-trunk]
exten => 100288506,1,Goto(internal-calls,197,1)
[custom_features]
exten => _**.,1,Pickup(${EXTEN:2}@internal-calls)
Since I want 2 different behaviors for incomming calls for a DID (from PSTN) and for and extension (internal call), this solutions is also not an option.
My wish is to use this dialplan and have Directed call pickup working:
[internal-calls]
exten => 105,1,Dial(SIP/105,30,tT)
exten => 106,1,Dial(SIP/106,30,tT)
exten => 197,1,Dial(SIP/197,30,tT)
[from-trunk]
exten => 100288506,1,Dial(SIP/197,30,tT)
[custom_features]
exten => _**.,1,Pickup(${EXTEN:2}@internal-calls)
In all logic this should work, but it does not. Is this a software bug or am I missing something?
I am seeing the same behaviour on Asterisk 1.8.7.0 and 1.8.9.0.