asterisk / aeap-speech-to-text

Asterisk external speech to text application
Apache License 2.0
41 stars 26 forks source link

Asterisk Crash after script restart #7

Open mohsentaheris opened 7 months ago

mohsentaheris commented 7 months ago

thanks for your source code, there is only one example how to use aeap with google speech api and its yours. my problem is that when I stop and restart the index script and try to call again, the asterisk crash with segmentation fault. My Asterisk Version is 20.4.0 my dial plan:

exten => 550,1,NoOp()
        same => n,Answer()
        same => n,SpeechCreate(my-speech-to-text)
        same => n,NoOp(${ERROR})
        same => n,GotoIf($["${ERROR}" = "1"]?fail:next)
        same => n(next),SpeechStart()
        same => n,SpeechBackground(tt-monkeys)
        same => n,Verbose(0,${SPEECH_TEXT(0)})
        same => n,SpeechDestroy()
        same => n(fail),Hangup()

this is my aeap.conf:

[my-speech-to-text]
type=client
codecs=!all,ulaw
url=ws://127.0.0.1:9099/filestream
protocol=speech_to_text

it works perfectly but after I stop index.js and start it again, this is what I got:

       > 0x7fb57000e350 -- Strict RTP learning after remote address set to: 192.168.97.12:40048
    -- Executing [550@tgui-out:1] NoOp("SIP/121-00000003", "") in new stack
    -- Executing [550@tgui-out:2] Answer("SIP/121-00000003", "") in new stack
       > 0x7fb57000e350 -- Strict RTP switching to RTP target address 192.168.97.12:40048 as source
    -- Executing [550@tgui-out:3] SpeechCreate("SIP/121-00000003", "my-speech-to-text") in new stack
[Nov 11 15:18:09] ERROR[2736897]: res_aeap/transaction.c:148 transaction_end: AEAP transaction (0x7fb57001ec20): message 'setup' timed out
    -- Executing [550@tgui-out:4] NoOp("SIP/121-00000003", "1") in new stack
    -- Executing [550@tgui-out:5] GotoIf("SIP/121-00000003", "1?fail:next") in new stack
    -- Goto (tgui-out,550,10)
    -- Executing [550@tgui-out:10] Hangup("SIP/121-00000003", "") in new stack
  == Spawn extension (tgui-out, 550, 10) exited non-zero on 'SIP/121-00000003'
    -- Executing [h@tgui-out:1] Set("SIP/121-00000003", "COUNT=0") in new stack
    -- Executing [h@tgui-out:2] NoOp("SIP/121-00000003", "Hangup Cause: 16") in new stack
    -- Executing [h@tgui-out:3] NoOp("SIP/121-00000003", "") in new stack
    -- Executing [h@tgui-out:4] NoOp("SIP/121-00000003", "Who Hangup: ") in new stack
    -- Executing [h@tgui-out:5] AGI("SIP/121-00000003", "agi://127.0.0.1/tgui.agi?status=end") in new stack
 agi://127.0.0.1/tgui.agi?status=end: No script configured for URL 'agi://127.0.0.1/tgui.agi?status=end' (script 'tgui.agi')
    -- <SIP/121-00000003>AGI Script agi://127.0.0.1/tgui.agi?status=end completed, returning 0
    -- Executing [h@tgui-out:6] Set("SIP/121-00000003", "COUNT=1") in new stack
    -- Executing [h@tgui-out:7] GotoIf("SIP/121-00000003", "0?retry:checkstate") in new stack
    -- Goto (tgui-out,h,10)
    -- Executing [h@tgui-out:10] GotoIf("SIP/121-00000003", "0?reset:success") in new stack
    -- Goto (tgui-out,h,15)
    -- Executing [h@tgui-out:15] NoOp("SIP/121-00000003", "Agi-Success") in new stack
Segmentation fault (core dumped)

this is the dump info:

Stack trace of thread 2737132:
                #0  0x0000559352315ef4 ast_format_get_codec_name (asterisk + 0xf3ef4)
                #1  0x00007fb559cafc44 handle_response_setup (res_speech_aeap.so + 0x2c44)
                #2  0x00007fb559cbd4c9 aeap_receive (res_aeap.so + 0x84c9)
                #3  0x00005593523e917f dummy_start (asterisk + 0x1c717f)
                #4  0x00007fb57a69f802 start_thread (libc.so.6 + 0x9f802)
                #5  0x00007fb57a63f450 __clone3 (libc.so.6 + 0x3f450)
N4ch2 commented 5 months ago

Hello!, I dont know wich is the leak because of the code is soo huge. But I want to ask you, how you handle with the function SpeechBackground?. The default arg is hello-world, tt-monkey is default too?. If the answer is no, where you configure it?

Thank you so much!