VIDEOCHAT  ::   FAQ  ::   Поиск  ::   Регистрация  ::   Вход

проблема с переадресацией входящих

Проблемы Asterisk без вэб-оболочек и их решения

Модераторы: april22, Zavr2008

Ответить
mad_antoxa
Сообщения: 2
Зарегистрирован: 16 июл 2014, 17:37

проблема с переадресацией входящих

Сообщение mad_antoxa »

Здравствуйте! Добрые люди подскажите! Настроено два транка через USB модемы и n-е количество внутренних абонентов, сделана простейшая IVR. Все сделано через FreePBX. Звонки ходят в обе стороны прекрасно. В GUI заводим виртуальный номер например 102 и руками в extensions_custom.conf прописываем ему
[from-internal-custom]
exten => 102,1,Answer()
exten => 102,n,Background(custom/vvedite_vash_nomer_dogovora)
exten => 102,n,Background(custom/vash_nomer_kvartiri)
exten => 102,n,Read(account,,5)
exten => 102,n,Read(flat,,3)
exten => 102,n,Wait(10)
exten => 102,n,AGI(/opt/ria-link/balance.agi,${account},${flat})
exten => 102,n,Background(custom/summa_na_vashem_schetu_sostovlyaet)
exten => 102,n,AGI(d2ms.agi,${balance},rur)
exten => 102,n,Hangup()

при звонке на номер 102 например с номера 116 или любого другого локального номера меня просят ввести нужную информацию и по ней выдают мне другую информацию согласно тому что ввел.
Проблема заключается в том что при звонке из вне, то есть когда звонок поступает с транка, мне говорят что либо сип не зарегистрирован, либо ни кто не ответил. В разных вариациях изменения в GUI два варианта.

Это ошибка при звонке с транка:

Код: Выделить всё

Connected to Asterisk 11.10.2 currently running on sip (pid = 1563)
    -- Executing [МОЙНОМЕР@ext-did-0002:1] Set("Dongle/dongle1-0100000003", "__FROM_DID=МОЙНОМЕР") in new stack
    -- Executing [МОЙНОМЕР@ext-did-0002:2] Gosub("Dongle/dongle1-0100000003", "app-blacklist-check,s,1()") in new stack
    -- Executing [s@app-blacklist-check:1] GotoIf("Dongle/dongle1-0100000003", "0?blacklisted") in new stack
    -- Executing [s@app-blacklist-check:2] Set("Dongle/dongle1-0100000003", "CALLED_BLACKLIST=1") in new stack
    -- Executing [s@app-blacklist-check:3] Return("Dongle/dongle1-0100000003", "") in new stack
    -- Executing [МОЙНОМЕР@ext-did-0002:3] Set("Dongle/dongle1-0100000003", "CDR(did)=МОЙНОМЕР") in new stack
    -- Executing [МОЙНОМЕР@ext-did-0002:4] ExecIf("Dongle/dongle1-0100000003", "0 ?Set(CALLERID(name)=МОЙНОМЕР)") in new stack
    -- Executing [МОЙНОМЕР@ext-did-0002:5] Set("Dongle/dongle1-0100000003", "CHANNEL(musicclass)=default") in new stack
    -- Executing [МОЙНОМЕР@ext-did-0002:6] Set("Dongle/dongle1-0100000003", "__MOHCLASS=default") in new stack
    -- Executing [МОЙНОМЕР@ext-did-0002:7] Set("Dongle/dongle1-0100000003", "__CALLINGPRES_SV=allowed_not_screened") in new stack
    -- Executing [МОЙНОМЕР@ext-did-0002:8] Set("Dongle/dongle1-0100000003", "CALLERPRES()=allowed_not_screened") in new stack
    -- Executing [МОЙНОМЕР@ext-did-0002:9] Goto("Dongle/dongle1-0100000003", "from-did-direct,102,1") in new stack
    -- Goto (from-did-direct,102,1)
    -- Executing [102@from-did-direct:1] Set("Dongle/dongle1-0100000003", "__RINGTIMER=15") in new stack
    -- Executing [102@from-did-direct:2] Macro("Dongle/dongle1-0100000003", "exten-vm,novm,102,0,0,0") in new stack
    -- Executing [s@macro-exten-vm:1] Macro("Dongle/dongle1-0100000003", "user-callerid,") in new stack
    -- Executing [s@macro-user-callerid:1] Set("Dongle/dongle1-0100000003", "TOUCH_MONITOR=1405516520.3") in new stack
    -- Executing [s@macro-user-callerid:2] Set("Dongle/dongle1-0100000003", "AMPUSER=МОЙНОМЕР") in new stack
    -- Executing [s@macro-user-callerid:3] GotoIf("Dongle/dongle1-0100000003", "0?report") in new stack
    -- Executing [s@macro-user-callerid:4] ExecIf("Dongle/dongle1-0100000003", "1?Set(REALCALLERIDNUM=МОЙНОМЕР)") in new stack
    -- Executing [s@macro-user-callerid:5] Set("Dongle/dongle1-0100000003", "AMPUSER=") in new stack
    -- Executing [s@macro-user-callerid:6] GotoIf("Dongle/dongle1-0100000003", "0?limit") in new stack
    -- Executing [s@macro-user-callerid:7] Set("Dongle/dongle1-0100000003", "AMPUSERCIDNAME=") in new stack
    -- Executing [s@macro-user-callerid:8] GotoIf("Dongle/dongle1-0100000003", "1?report") in new stack
    -- Goto (macro-user-callerid,s,15)
    -- Executing [s@macro-user-callerid:15] GotoIf("Dongle/dongle1-0100000003", "0?continue") in new stack
    -- Executing [s@macro-user-callerid:16] Set("Dongle/dongle1-0100000003", "__TTL=64") in new stack
    -- Executing [s@macro-user-callerid:17] GotoIf("Dongle/dongle1-0100000003", "1?continue") in new stack
    -- Goto (macro-user-callerid,s,28)
    -- Executing [s@macro-user-callerid:28] Set("Dongle/dongle1-0100000003", "CALLERID(number)=МОЙНОМЕР") in new stack
    -- Executing [s@macro-user-callerid:29] Set("Dongle/dongle1-0100000003", "CALLERID(name)=dongle1") in new stack
    -- Executing [s@macro-user-callerid:30] Set("Dongle/dongle1-0100000003", "CDR(cnum)=МОЙНОМЕР") in new stack
    -- Executing [s@macro-user-callerid:31] Set("Dongle/dongle1-0100000003", "CDR(cnam)=dongle1") in new stack
    -- Executing [s@macro-user-callerid:32] Set("Dongle/dongle1-0100000003", "CHANNEL(language)=ru") in new stack
    -- Executing [s@macro-exten-vm:2] Set("Dongle/dongle1-0100000003", "RingGroupMethod=none") in new stack
    -- Executing [s@macro-exten-vm:3] Set("Dongle/dongle1-0100000003", "__EXTTOCALL=102") in new stack
    -- Executing [s@macro-exten-vm:4] Set("Dongle/dongle1-0100000003", "__PICKUPMARK=102") in new stack
    -- Executing [s@macro-exten-vm:5] Set("Dongle/dongle1-0100000003", "RT=") in new stack
[2014-07-16 17:15:20] WARNING[1832][C-00000003]: chan_sip.c:22066 func_header_read: This function can only be used on SIP channels.
    -- Executing [s@macro-exten-vm:6] ExecIf("Dongle/dongle1-0100000003", "0?Macro(vm,novm,DIRECTDIAL,)") in new stack
[2014-07-16 17:15:20] WARNING[1832][C-00000003]: chan_sip.c:22066 func_header_read: This function can only be used on SIP channels.
[2014-07-16 17:15:20] WARNING[1832][C-00000003]: chan_sip.c:22066 func_header_read: This function can only be used on SIP channels.
    -- Executing [s@macro-exten-vm:7] ExecIf("Dongle/dongle1-0100000003", "0?MacroExit()") in new stack
[2014-07-16 17:15:20] WARNING[1832][C-00000003]: chan_sip.c:22066 func_header_read: This function can only be used on SIP channels.
    -- Executing [s@macro-exten-vm:8] Gosub("Dongle/dongle1-0100000003", "sub-record-check,s,1(exten,102,)") in new stack
    -- Executing [s@sub-record-check:1] Set("Dongle/dongle1-0100000003", "REC_POLICY_MODE_SAVE=") in new stack
    -- Executing [s@sub-record-check:2] GotoIf("Dongle/dongle1-0100000003", "1?check") in new stack
    -- Goto (sub-record-check,s,7)
    -- Executing [s@sub-record-check:7] Set("Dongle/dongle1-0100000003", "__MON_FMT=wav") in new stack
    -- Executing [s@sub-record-check:8] GotoIf("Dongle/dongle1-0100000003", "1?next") in new stack
    -- Goto (sub-record-check,s,11)
    -- Executing [s@sub-record-check:11] ExecIf("Dongle/dongle1-0100000003", "0?Return()") in new stack
    -- Executing [s@sub-record-check:12] ExecIf("Dongle/dongle1-0100000003", "0?Set(__REC_POLICY_MODE=)") in new stack
    -- Executing [s@sub-record-check:13] GotoIf("Dongle/dongle1-0100000003", "0?exten,1") in new stack
    -- Executing [s@sub-record-check:14] Set("Dongle/dongle1-0100000003", "__REC_STATUS=INITIALIZED") in new stack
    -- Executing [s@sub-record-check:15] Set("Dongle/dongle1-0100000003", "NOW=1405516520") in new stack
    -- Executing [s@sub-record-check:16] Set("Dongle/dongle1-0100000003", "__DAY=16") in new stack
    -- Executing [s@sub-record-check:17] Set("Dongle/dongle1-0100000003", "__MONTH=07") in new stack
    -- Executing [s@sub-record-check:18] Set("Dongle/dongle1-0100000003", "__YEAR=2014") in new stack
    -- Executing [s@sub-record-check:19] Set("Dongle/dongle1-0100000003", "__TIMESTR=20140716-171520") in new stack
    -- Executing [s@sub-record-check:20] Set("Dongle/dongle1-0100000003", "__FROMEXTEN=МОЙНОМЕР") in new stack
    -- Executing [s@sub-record-check:21] Set("Dongle/dongle1-0100000003", "__CALLFILENAME=exten-102-МОЙНОМЕР-20140716-171520-1405516520.3") in new stack
    -- Executing [s@sub-record-check:22] Goto("Dongle/dongle1-0100000003", "exten,1") in new stack
    -- Goto (sub-record-check,exten,1)
    -- Executing [exten@sub-record-check:1] GotoIf("Dongle/dongle1-0100000003", "0?callee") in new stack
    -- Executing [exten@sub-record-check:2] Set("Dongle/dongle1-0100000003", "__REC_POLICY_MODE=dontcare") in new stack
    -- Executing [exten@sub-record-check:3] GotoIf("Dongle/dongle1-0100000003", "1?caller") in new stack
    -- Goto (sub-record-check,exten,10)
    -- Executing [exten@sub-record-check:10] Set("Dongle/dongle1-0100000003", "__REC_POLICY_MODE=") in new stack
    -- Executing [exten@sub-record-check:11] GosubIf("Dongle/dongle1-0100000003", "0?record,1(exten,102,МОЙНОМЕР)") in new stack
    -- Executing [exten@sub-record-check:12] Return("Dongle/dongle1-0100000003", "") in new stack
    -- Executing [s@macro-exten-vm:9] GotoIf("Dongle/dongle1-0100000003", "1?macrodial") in new stack
    -- Goto (macro-exten-vm,s,15)
    -- Executing [s@macro-exten-vm:15] GosubIf("Dongle/dongle1-0100000003", "0?clrheader,1()") in new stack
    -- Executing [s@macro-exten-vm:16] Macro("Dongle/dongle1-0100000003", "dial-one,,Ttr,102") in new stack
    -- Executing [s@macro-dial-one:1] Set("Dongle/dongle1-0100000003", "DEXTEN=102") in new stack
    -- Executing [s@macro-dial-one:2] Set("Dongle/dongle1-0100000003", "DIALSTATUS_CW=") in new stack
    -- Executing [s@macro-dial-one:3] GosubIf("Dongle/dongle1-0100000003", "0?screen,1()") in new stack
    -- Executing [s@macro-dial-one:4] GosubIf("Dongle/dongle1-0100000003", "0?cf,1()") in new stack
    -- Executing [s@macro-dial-one:5] GotoIf("Dongle/dongle1-0100000003", "1?skip1") in new stack
    -- Goto (macro-dial-one,s,8)
    -- Executing [s@macro-dial-one:8] GotoIf("Dongle/dongle1-0100000003", "0?nodial") in new stack
    -- Executing [s@macro-dial-one:9] GotoIf("Dongle/dongle1-0100000003", "0?continue") in new stack
    -- Executing [s@macro-dial-one:10] Set("Dongle/dongle1-0100000003", "EXTHASCW=ENABLED") in new stack
    -- Executing [s@macro-dial-one:11] GotoIf("Dongle/dongle1-0100000003", "0?next1:cwinusebusy") in new stack
    -- Goto (macro-dial-one,s,23)
    -- Executing [s@macro-dial-one:23] GotoIf("Dongle/dongle1-0100000003", "1?next3:continue") in new stack
    -- Goto (macro-dial-one,s,24)
    -- Executing [s@macro-dial-one:24] ExecIf("Dongle/dongle1-0100000003", "0?Set(DIALSTATUS_CW=BUSY)") in new stack
    -- Executing [s@macro-dial-one:25] GotoIf("Dongle/dongle1-0100000003", "0?nodial") in new stack
    -- Executing [s@macro-dial-one:26] GosubIf("Dongle/dongle1-0100000003", "1?dstring,1():dlocal,1()") in new stack
    -- Executing [dstring@macro-dial-one:1] Set("Dongle/dongle1-0100000003", "DSTRING=") in new stack
    -- Executing [dstring@macro-dial-one:2] Set("Dongle/dongle1-0100000003", "DEVICES=") in new stack
    -- Executing [dstring@macro-dial-one:3] ExecIf("Dongle/dongle1-0100000003", "1?Return()") in new stack
    -- Executing [s@macro-dial-one:27] GotoIf("Dongle/dongle1-0100000003", "1?nodial") in new stack
    -- Goto (macro-dial-one,s,48)
    -- Executing [s@macro-dial-one:48] ExecIf("Dongle/dongle1-0100000003", "1?Set(DIALSTATUS=NOANSWER)") in new stack
    -- Executing [s@macro-dial-one:49] NoOp("Dongle/dongle1-0100000003", "Returned from dial-one with nothing to call and DIALSTATUS: NOANSWER") in new stack
    -- Executing [s@macro-dial-one:50] MacroExit("Dongle/dongle1-0100000003", "") in new stack
    -- Executing [s@macro-exten-vm:17] Set("Dongle/dongle1-0100000003", "SV_DIALSTATUS=NOANSWER") in new stack
    -- Executing [s@macro-exten-vm:18] GosubIf("Dongle/dongle1-0100000003", "0?docfu,1()") in new stack
    -- Executing [s@macro-exten-vm:19] GosubIf("Dongle/dongle1-0100000003", "0?docfb,1()") in new stack
    -- Executing [s@macro-exten-vm:20] Set("Dongle/dongle1-0100000003", "DIALSTATUS=NOANSWER") in new stack
    -- Executing [s@macro-exten-vm:21] ExecIf("Dongle/dongle1-0100000003", "0?MacroExit()") in new stack
    -- Executing [s@macro-exten-vm:22] GotoIf("Dongle/dongle1-0100000003", "1?s-NOANSWER,1") in new stack
    -- Goto (macro-exten-vm,s-NOANSWER,1)
    -- Executing [s-NOANSWER@macro-exten-vm:1] GotoIf("Dongle/dongle1-0100000003", "0?exit,1") in new stack
    -- Executing [s-NOANSWER@macro-exten-vm:2] PlayTones("Dongle/dongle1-0100000003", "congestion") in new stack
    -- Executing [s-NOANSWER@macro-exten-vm:3] Congestion("Dongle/dongle1-0100000003", "10") in new stack
  == Spawn extension (macro-exten-vm, s-NOANSWER, 3) exited non-zero on 'Dongle/dongle1-0100000003' in macro 'exten-vm'
  == Spawn extension (from-did-direct, 102, 2) exited non-zero on 'Dongle/dongle1-0100000003'
    -- Executing [h@from-did-direct:1] Macro("Dongle/dongle1-0100000003", "hangupcall,") in new stack
    -- Executing [s@macro-hangupcall:1] GotoIf("Dongle/dongle1-0100000003", "1?theend") in new stack
    -- Goto (macro-hangupcall,s,3)
    -- Executing [s@macro-hangupcall:3] ExecIf("Dongle/dongle1-0100000003", "0?Set(CDR(recordingfile)=)") in new stack
    -- Executing [s@macro-hangupcall:4] Hangup("Dongle/dongle1-0100000003", "") in new stack
  == Spawn extension (macro-hangupcall, s, 4) exited non-zero on 'Dongle/dongle1-0100000003' in macro 'hangupcall'
  == Spawn extension (from-did-direct, h, 1) exited non-zero on 'Dongle/dongle1-0100000003'
sip*CLI>
Это то что хотелось бы получить при звонке с транка и то что нормально работает с локальных номеров:

Код: Выделить всё

Connected to Asterisk 11.10.2 currently running on sip (pid = 1563)
  == Using SIP RTP TOS bits 184
  == Using SIP RTP CoS mark 5
    -- Executing [102@from-internal:1] Answer("SIP/116-00000000", "") in new stack
    -- Executing [102@from-internal:2] BackGround("SIP/116-00000000", "custom/vvedite_vash_nomer_dogovora") in new stack
[2014-07-16 17:18:42] WARNING[1843][C-00000004]: mp3/interface.c:216 decodeMP3: Junk at the beginning of frame 49443303
    -- <SIP/116-00000000> Playing 'custom/vvedite_vash_nomer_dogovora.slin' (language 'ru')
       > 0x7fc59001cb30 -- Probation passed - setting RTP source address to 91.215.188.140:62556
       > 0x7fc59001cb30 -- Probation passed - setting RTP source address to 91.215.188.140:62556
[2014-07-16 17:18:44] NOTICE[1843][C-00000004]: res_rtp_asterisk.c:3944 ast_rtp_read: Unknown RTP codec 126 received from '91.215.188.140:62556'
[2014-07-16 17:18:45] WARNING[1843][C-00000004]: mp3/interface.c:216 decodeMP3: Junk at the beginning of frame 54414700
    -- Executing [102@from-internal:3] BackGround("SIP/116-00000000", "custom/vash_nomer_kvartiri") in new stack
[2014-07-16 17:18:45] WARNING[1843][C-00000004]: mp3/interface.c:216 decodeMP3: Junk at the beginning of frame 49443303
    -- <SIP/116-00000000> Playing 'custom/vash_nomer_kvartiri.slin' (language 'ru')
[2014-07-16 17:18:47] WARNING[1843][C-00000004]: mp3/interface.c:216 decodeMP3: Junk at the beginning of frame 54414700
    -- Executing [102@from-internal:4] Read("SIP/116-00000000", "account,,5") in new stack
    -- Accepting a maximum of 5 digits.
    -- User entered '01458'
    -- Executing [102@from-internal:5] Read("SIP/116-00000000", "flat,,3") in new stack
    -- Accepting a maximum of 3 digits.
    -- User entered '45'
    -- Executing [102@from-internal:6] Wait("SIP/116-00000000", "10") in new stack
    -- Executing [102@from-internal:7] AGI("SIP/116-00000000", "/opt/XXX/balance.agi,01458,45") in new stack
    -- Launched AGI Script /opt/XXX/balance.agi
    -- <SIP/116-00000000>AGI Script /opt/XXX/balance.agi completed, returning 0
    -- Executing [102@from-internal:8] BackGround("SIP/116-00000000", "custom/summa_na_vashem_schetu_sostovlyaet") in new stack
[2014-07-16 17:19:07] WARNING[1843][C-00000004]: mp3/interface.c:216 decodeMP3: Junk at the beginning of frame 49443303
    -- <SIP/116-00000000> Playing 'custom/summa_na_vashem_schetu_sostovlyaet.slin' (language 'ru')
[2014-07-16 17:19:10] WARNING[1843][C-00000004]: mp3/interface.c:216 decodeMP3: Junk at the beginning of frame 54414700
    -- Executing [102@from-internal:9] AGI("SIP/116-00000000", "d2ms.agi,,rur") in new stack
    -- Launched AGI Script /var/lib/asterisk/agi-bin/d2ms.agi
    -- Playing 'moneystr/0' (escape_digits=) (sample_offset 0)
    -- Playing 'moneystr/Rubles' (escape_digits=) (sample_offset 0)
    -- <SIP/116-00000000>AGI Script d2ms.agi completed, returning 0
    -- Executing [102@from-internal:10] Hangup("SIP/116-00000000", "") in new stack
  == Spawn extension (from-internal, 102, 10) exited non-zero on 'SIP/116-00000000'
    -- Executing [h@from-internal:1] Hangup("SIP/116-00000000", "") in new stack
  == Spawn extension (from-internal, h, 1) exited non-zero on 'SIP/116-00000000'
sip*CLI>
Помогите пожалуйста, я уже голову точно сломал.
virus_net
Сообщения: 2337
Зарегистрирован: 05 июн 2013, 08:12
Откуда: Москва

Re: проблема с переадресацией входящих

Сообщение virus_net »

А зачем тут что то ломать, тем более голову. Входящий извне просто не попадает в диаплане в from-internal-custom
У вас при входящем извне исполняется контекст:
-- Goto (from-did-direct,102,1)
А изнутри:
-- Executing [102@from-internal:1] Answer("SIP/116-00000000", "") in new stack
Что собственно будет видно по:

Код: Выделить всё

CLI> dialplan show 102@from-did-direct

Код: Выделить всё

CLI> dialplan show 102@from-internal
мой SIP URI sip:virus_net@asterisk.ru
bitname.ru - Домены .bit (namecoin) .emc .coin .lib .bazar (emercoin)

ENUMER - звони бесплатно и напрямую.
mad_antoxa
Сообщения: 2
Зарегистрирован: 16 июл 2014, 17:37

Re: проблема с переадресацией входящих

Сообщение mad_antoxa »

Что самое интересное я вчера пробовал добавлять этот кусов в custom'е к [from-did-direct] ни чего не работало, сейчас на свежую голову еще раз это сделал и УРА)))
Спасибо огромное направили на путь истинный))))
Что и должно было быть с этой поправкой, сегодня заработало)))
Ответить
© 2008 — 2025 Asterisk.ru
Digium, Asterisk and AsteriskNOW are registered trademarks of Digium, Inc.
Design and development by PostMet-Netzwerk GmbH