https://wiki.asterisk.org/wiki/display/ ... on+Example
Поскольку я храню пользователей в mysql, добавил поля cc_agent_policy и cc_monitor_policy со значением generic в базу.
В extensions.ael добавил следующий код:
Код: Выделить всё
_30 => {
CallCompletionRequest();
Hangup();
};
_31 => {
CallCompletionCancel();
Hangup();
};
Звоню с телефона 1 на телефон 2 (занятый), ложу трубку, поднимаю, набираю 30, ложу.
Ложу трубку на телефоне 2 -- начинает звонить телефон 1, беру трубку на телефоне 1, звонок рвётся.
В логах вот что:
Код: Выделить всё
[Feb 7 15:56:05] VERBOSE[1856] pbx.c: -- Executing [~~s~~@wrapdial:1] MSet("SIP/8899-00000d87", "LOCAL(to)=") in new stack
[Feb 7 15:56:05] ERROR[1856] app_stack.c: Tried to set LOCAL(to), but we aren't within a Gosub routine
[Feb 7 15:56:05] VERBOSE[1856] pbx.c: -- Executing [~~s~~@wrapdial:2] MSet("SIP/8899-00000d87", "LOCAL(timeout)=") in new stack
[Feb 7 15:56:05] ERROR[1856] app_stack.c: Tried to set LOCAL(timeout), but we aren't within a Gosub routine
[Feb 7 15:56:05] VERBOSE[1856] pbx.c: -- Executing [~~s~~@wrapdial:3] MSet("SIP/8899-00000d87", "LOCAL(roc)=") in new stack
[Feb 7 15:56:05] ERROR[1856] app_stack.c: Tried to set LOCAL(roc), but we aren't within a Gosub routine
[Feb 7 15:56:05] VERBOSE[1856] pbx.c: -- Executing [~~s~~@wrapdial:4] Set("SIP/8899-00000d87", "NEWTO=") in new stack
[Feb 7 15:56:05] VERBOSE[1856] pbx.c: -- Executing [~~s~~@wrapdial:5] AGI("SIP/8899-00000d87", "distchange.php,") in new stack
[Feb 7 15:56:05] VERBOSE[1856] res_agi.c: -- Launched AGI Script /var/lib/asterisk/agi-bin/distchange.php
[Feb 7 15:56:05] VERBOSE[1856] res_agi.c: -- <SIP/8899-00000d87>AGI Script distchange.php completed, returning 0
[Feb 7 15:56:05] VERBOSE[1856] pbx.c: -- Executing [~~s~~@wrapdial:6] Set("SIP/8899-00000d87", "to=") in new stack
[Feb 7 15:56:05] WARNING[1856] ast_expr2.fl: ast_yyerror(): syntax error: syntax error, unexpected '=', expecting $end; Input:
[Feb 7 15:56:05] WARNING[1856] ast_expr2.fl: If you have questions, please refer to https://wiki.asterisk.org/wiki/display/AST/Channel+Variables
[Feb 7 15:56:05] VERBOSE[1856] pbx.c: -- Executing [~~s~~@wrapdial:7] GotoIf("SIP/8899-00000d87", "?8:10") in new stack
[Feb 7 15:56:05] VERBOSE[1856] pbx.c: -- Goto (wrapdial,~~s~~,10)
[Feb 7 15:56:05] VERBOSE[1856] pbx.c: -- Executing [~~s~~@wrapdial:10] Dial("SIP/8899-00000d87", ",,Ttr") in new stack
[Feb 7 15:56:05] WARNING[1856] app_dial.c: Dial requires an argument (technology/number)
[Feb 7 15:56:05] VERBOSE[1856] pbx.c: == Spawn extension (wrapdial, ~~s~~, 10) exited non-zero on 'SIP/8899-00000d87'
[Feb 7 15:56:05] VERBOSE[1856] pbx.c: -- Executing [h@wrapdial:1] Goto("SIP/8899-00000d87", "9991") in new stack
[Feb 7 15:56:05] VERBOSE[1856] pbx.c: -- Goto (wrapdial,h,9991)
[Feb 7 15:56:05] VERBOSE[1856] pbx.c: -- Executing [h@wrapdial:9991] Set("SIP/8899-00000d87", "~~parentcxt~~=") in new stack
[Feb 7 15:56:05] VERBOSE[1856] pbx.c: -- Executing [h@wrapdial:9992] GotoIf("SIP/8899-00000d87", "1?9996") in new stack
[Feb 7 15:56:05] VERBOSE[1856] pbx.c: -- Goto (wrapdial,h,9996)
[Feb 7 15:56:05] VERBOSE[1856] pbx.c: -- Executing [h@wrapdial:9996] NoOp("SIP/8899-00000d87", "") in new stack
Прошу помощи - что я делаю не так?