Звонок с внешней линии SIP/3212257 приходит в контекст [from_external]. Если оператор SIP/101 (по плану их будет двое) свободен и поговорив со звонящим кладёт трубку, то выполнение диалплана продолжается в текущем контексте (это обеспечивает опция 'g' в команде Dial) и далее звонящий перебрасывается в контекст [ocenka]. Если оператор занят, то звонок ставится в очередь и далее после освобождения оператора позвонивший соединяется с оператором. Тут всё ОК. Но вот после того как оператор положит трубку выполнение диалплана прекращается и у позвонившего. У команды Queue нету опции 'g'. А мне для позвонившего нужно завершить запись его разговора с оператором и перебросить в контекст [ocenka].
Asterisk 1.8.28
Extension.conf
PRIME_BBCODE_SPOILER_SHOW PRIME_BBCODE_SPOILER:
[internal]
exten => 101,1,Dial(SIP/101,70,tTr)
exten => 101,n,GosubIf($["${DIALSTATUS}" = "CHANUNAVAIL"]?queue,101,1:)
exten => 102,1,Dial(SIP/102,70,tTr)
exten => 103,1,Dial(SIP/103,70,tTr)
exten => 110,1,Dial(SIP/110,70,tTr)
exten => _1XX,n,Hangup()
[queue]; контекст для очередей
exten => 101,1,Answer;
exten => 101,n,Wait(2));
exten => 101,n,Queue(queue_101,t,,);
[from_external]; сюда попадают входящие внешние звонки
exten => s,1,Answer()
exten => s,n,Background(voice/privetstvie); Вас приветствует контора
exten => s,n,WaitExten(1);
exten => s,n,Set(fname=${STRFTIME(${EPOCH},,%Y-%m-%d-%H-%M)}_${CALLERID(number)}-${EXTEN}); заносим в переменную дату и имя файла
exten => s,n,MixMonitor(/var/lib/asterisk/records/${fname}.wav); пишем разговор в файл
exten => s,n,Dial(SIP/101,,gTtr); опция g позволяет звонку пройти далее по диалплану
exten => s,n,GosubIf($["${DIALSTATUS}" = "CHANUNAVAIL"]?queue,101,1:)
exten => s,n,StopMixMonitor(); останавливаем запись
exten => s,n,Goto(ocenka,s,1)
exten => s,n,Hangup()
include=internal
[ocenka]
exten => s,1,Background(voice/ocenka)
exten => s,n,Read(myvar,ru/beep,,,1,7)
...
exten => 101,1,Dial(SIP/101,70,tTr)
exten => 101,n,GosubIf($["${DIALSTATUS}" = "CHANUNAVAIL"]?queue,101,1:)
exten => 102,1,Dial(SIP/102,70,tTr)
exten => 103,1,Dial(SIP/103,70,tTr)
exten => 110,1,Dial(SIP/110,70,tTr)
exten => _1XX,n,Hangup()
[queue]; контекст для очередей
exten => 101,1,Answer;
exten => 101,n,Wait(2));
exten => 101,n,Queue(queue_101,t,,);
[from_external]; сюда попадают входящие внешние звонки
exten => s,1,Answer()
exten => s,n,Background(voice/privetstvie); Вас приветствует контора
exten => s,n,WaitExten(1);
exten => s,n,Set(fname=${STRFTIME(${EPOCH},,%Y-%m-%d-%H-%M)}_${CALLERID(number)}-${EXTEN}); заносим в переменную дату и имя файла
exten => s,n,MixMonitor(/var/lib/asterisk/records/${fname}.wav); пишем разговор в файл
exten => s,n,Dial(SIP/101,,gTtr); опция g позволяет звонку пройти далее по диалплану
exten => s,n,GosubIf($["${DIALSTATUS}" = "CHANUNAVAIL"]?queue,101,1:)
exten => s,n,StopMixMonitor(); останавливаем запись
exten => s,n,Goto(ocenka,s,1)
exten => s,n,Hangup()
include=internal
[ocenka]
exten => s,1,Background(voice/ocenka)
exten => s,n,Read(myvar,ru/beep,,,1,7)
...
PRIME_BBCODE_SPOILER_SHOW PRIME_BBCODE_SPOILER:
[queue_101]
music = default
autofill = yes
strategy = ringall
context = from_external
member => SIP/101
member => SIP/102
music = default
autofill = yes
strategy = ringall
context = from_external
member => SIP/101
member => SIP/102
PRIME_BBCODE_SPOILER_SHOW PRIME_BBCODE_SPOILER:
us14x64*CLI> core set verbose 5
Verbosity was 3 and is now 5
== Using SIP RTP CoS mark 5
-- Executing [101@internal:1] Dial("SIP/110-0000001f", "SIP/101,70,tTr") in new stack
== Using SIP RTP CoS mark 5
-- Called SIP/101
-- SIP/101-00000020 is ringing
-- SIP/101-00000020 answered SIP/110-0000001f
== Using SIP RTP CoS mark 5
-- Executing [s@from_external:1] Answer("SIP/3212257-00000021", "") in new stack
-- Executing [s@from_external:2] BackGround("SIP/3212257-00000021", "voice/privetstvie") in new stack
-- <SIP/3212257-00000021> Playing 'voice/privetstvie.slin' (language 'ru')
-- Executing [s@from_external:3] WaitExten("SIP/3212257-00000021", "1") in new stack
-- Timeout on SIP/3212257-00000021, continuing...
-- Executing [s@from_external:4] Set("SIP/3212257-00000021", "fname=2016-02-07-20-32_0041849762-s") in new stack
-- Executing [s@from_external:5] MixMonitor("SIP/3212257-00000021", "/var/lib/asterisk/records/2016-02-07-20-32_0041849762-s.wav") in new stack
-- Executing [s@from_external:6] Dial("SIP/3212257-00000021", "SIP/101,,gTtr") in new stack
== Using SIP RTP CoS mark 5
[Feb 7 20:32:52] NOTICE[1771]: chan_sip.c:6258 update_call_counter: Call to peer '101' rejected due to usage limit of 1
-- Couldn't call SIP/101
== Everyone is busy/congested at this time (0:0/0/0)
-- Executing [s@from_external:7] GosubIf("SIP/3212257-00000021", "1?queue,101,1:") in new stack
-- Executing [101@queue:1] Answer("SIP/3212257-00000021", "") in new stack
-- Executing [101@queue:2] Wait("SIP/3212257-00000021", "2)") in new stack
== Begin MixMonitor Recording SIP/3212257-00000021
-- Executing [101@queue:3] Queue("SIP/3212257-00000021", "queue_101,t,,") in new stack
-- Started music on hold, class 'default', on SIP/3212257-00000021
== Spawn extension (internal, 101, 1) exited non-zero on 'SIP/110-0000001f'
== Using SIP RTP CoS mark 5
-- SIP/101-00000023 connected line has changed. Saving it until answer for SIP/3212257-00000021
-- SIP/101-00000023 is ringing
-- SIP/101-00000023 connected line has changed. Saving it until answer for SIP/3212257-00000021
-- SIP/101-00000023 answered SIP/3212257-00000021
-- Stopped music on hold on SIP/3212257-00000021
== Spawn extension (queue, 101, 3) exited non-zero on 'SIP/3212257-00000021'
== MixMonitor close filestream
== End MixMonitor Recording SIP/3212257-00000021
us14x64*CLI>
Verbosity was 3 and is now 5
== Using SIP RTP CoS mark 5
-- Executing [101@internal:1] Dial("SIP/110-0000001f", "SIP/101,70,tTr") in new stack
== Using SIP RTP CoS mark 5
-- Called SIP/101
-- SIP/101-00000020 is ringing
-- SIP/101-00000020 answered SIP/110-0000001f
== Using SIP RTP CoS mark 5
-- Executing [s@from_external:1] Answer("SIP/3212257-00000021", "") in new stack
-- Executing [s@from_external:2] BackGround("SIP/3212257-00000021", "voice/privetstvie") in new stack
-- <SIP/3212257-00000021> Playing 'voice/privetstvie.slin' (language 'ru')
-- Executing [s@from_external:3] WaitExten("SIP/3212257-00000021", "1") in new stack
-- Timeout on SIP/3212257-00000021, continuing...
-- Executing [s@from_external:4] Set("SIP/3212257-00000021", "fname=2016-02-07-20-32_0041849762-s") in new stack
-- Executing [s@from_external:5] MixMonitor("SIP/3212257-00000021", "/var/lib/asterisk/records/2016-02-07-20-32_0041849762-s.wav") in new stack
-- Executing [s@from_external:6] Dial("SIP/3212257-00000021", "SIP/101,,gTtr") in new stack
== Using SIP RTP CoS mark 5
[Feb 7 20:32:52] NOTICE[1771]: chan_sip.c:6258 update_call_counter: Call to peer '101' rejected due to usage limit of 1
-- Couldn't call SIP/101
== Everyone is busy/congested at this time (0:0/0/0)
-- Executing [s@from_external:7] GosubIf("SIP/3212257-00000021", "1?queue,101,1:") in new stack
-- Executing [101@queue:1] Answer("SIP/3212257-00000021", "") in new stack
-- Executing [101@queue:2] Wait("SIP/3212257-00000021", "2)") in new stack
== Begin MixMonitor Recording SIP/3212257-00000021
-- Executing [101@queue:3] Queue("SIP/3212257-00000021", "queue_101,t,,") in new stack
-- Started music on hold, class 'default', on SIP/3212257-00000021
== Spawn extension (internal, 101, 1) exited non-zero on 'SIP/110-0000001f'
== Using SIP RTP CoS mark 5
-- SIP/101-00000023 connected line has changed. Saving it until answer for SIP/3212257-00000021
-- SIP/101-00000023 is ringing
-- SIP/101-00000023 connected line has changed. Saving it until answer for SIP/3212257-00000021
-- SIP/101-00000023 answered SIP/3212257-00000021
-- Stopped music on hold on SIP/3212257-00000021
== Spawn extension (queue, 101, 3) exited non-zero on 'SIP/3212257-00000021'
== MixMonitor close filestream
== End MixMonitor Recording SIP/3212257-00000021
us14x64*CLI>