В Asterisk реалізований механізм перехвату усіх викликів.
Для цього потрібно до мінімальних налаштувань додати файл конфігурації features.conf і в ньому вказати:
pickupexten = *8
pickupsound=beep
pickupfailsound = beeperr
І у файлі sip.conf
pickupgroup
callgroup
або
namedpickupgroup
namedcallgroup
Але такий режим у великому офісі не дуже гарний.
Краще налаштувати перехват конкретного виклику (directed pickup).
Різні варіанти налаштування файлу extension.sconf вказані тут
This is the basic dialplan:
CODE: SELECT ALL
[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)
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:
CODE: SELECT ALL
[custom_features]
exten => _**.,1,Pickup(${EXTEN:2}@internal-calls)
exten => _**.,n,Pickup(${EXTEN:2}@from-trunk)
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):
CODE: SELECT ALL
-- 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'
[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:
CODE: SELECT ALL
[custom_features]
exten => _**.,1,Set(GLOBAL(PICKUPMARK)=${EXTEN:2})
exten => _**.,n,Pickup(${EXTEN:2}@PICKUPMARK)
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:
CODE: SELECT ALL
[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)
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:
CODE: SELECT ALL
[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)
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.
Найкращий працюючий варіант, це вказати комбінацію кнопок для кожного context, на кшталт
exten => _**.,1,Pickup(${EXTEN:2}@internal-calls)
same => n,Pickup(${EXTEN:2}@from-trunk)
same => n,Pickup(${EXTEN:2}@from-trunk)
Команда pickup описана тут
Коментарі
Дописати коментар