AGI cannot be started

I created an AGI script and defined it in extensions.conf. However, I get the following error in the Asterisk CLI. I have tried many methods but it hasn’t been resolved. What could be the problem?

ag2_script.py

import sys
import os

def main():
    print('AGI START')
    agi_env = {}
    for line in sys.stdin:
        line = line.strip()
        if not line:
            break
        key, value = line.split(': ')
        agi_env[key] = value
        print(f"AGI Variable: {line}", file=sys.stderr)

    print('ANSWER')
    print('STREAM FILE hello-world ""')
    print('HANGUP')

if __name__ == '__main__':
    main()

[from-trunk]
; Incoming Calls
exten => s,1,NoOp(Received incoming call x from ${CALLERID(num)})
same => n,Answer()
same => n,AGI(agi-bin/ag2_script.py)
same => n,Hangup()


ERROR:

Connected to Asterisk 20.9.0 currently running on 78 (pid = 58647)
– Executing [s@from-trunk:1] NoOp(“PJSIP/inbound endpoint-00000000”, “Received incoming call x from 05***********”) in new stack
– Executing [s@from-trunk:2] Answer(“PJSIP/inbound endpoint-00000000”, “”) in new stack
[Jul 26 08:59:54] WARNING[61070][C-00000001]: translate.c:495 ast_translator_build_path: No translator path: (ending codec is not valid)
[Jul 26 08:59:54] WARNING[61070][C-00000001]: translate.c:495 ast_translator_build_path: No translator path: (ending codec is not valid)
[Jul 26 08:59:54] WARNING[61070][C-00000001]: pbx.c:2928 pbx_extension_helper: No application ‘AGI’ for extension (from-trunk, s, 3)
== Spawn extension (from-trunk, s, 3) exited non-zero on ‘PJSIP/inbound endpoint-00000000’

Additionally, is this normal?

module show like agi
Module Description Use Count Status Support Level
res_pjsip_messaging.so PJSIP Messaging Support 0 Running core
1 modules loaded

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.