Setup channel for Async AGI

Hello. Recently I was trying to use AGI but the following debug message appeared:

“res_agi.c:1583 add_agi_cmd: Channel PJSIP/default-00000006 is not setup for Async AGI.”

Is there any way where I can setup or give permissions to my channel in order to support Async AGI?
Thank you.

The channel has to be executing the AsyncAGI dialplan application.

Sorry for my ignorance, but how can i do that? In the dialplan?
What would be the line of code to add?

The dialplan controls how calls are routed and execute dialplan applications or logic. AsyncAGI is one of those. I can’t tell you what to add, because I have no idea what your dialplan is currently.

This is what my dialplan looks at the moment:



exten => _[a-zA-Z0-9=].,1,Set(INVITE_TO=${PJSIP_HEADER(read,To)})
;same => n,Answer(500)
;same => n,Wait(120)
same => n,Set(INVITE_FROM=${PJSIP_HEADER(read,From)})
same => n,Set(INVITE_URI=${CHANNEL(pjsip,request_uri)})
same => n,Set(CALL_ID=${PJSIP_HEADER(read,Call-ID)})
same => n,Stasis(App,${INVITE_TO},${INVITE_FROM},${INVITE_URI},${CALL_ID})
exten => s,1,Stasis(App,${INVITE_TO},${INVITE_FROM},${INVITE_URI},${CALL_ID})
exten => h,1,Hangup

And what is your intention… because you can’t have a channel both in Stasis being controlled, and also in AsyncAGI being controlled.

Basically I am using a wrapper that let me use some functions of the AMI inside my Stasis. One of them let me “add an AGI command to execute by Async AGI”. The problem resides when I tried to execute this function and the message “res_agi.c:1583 add_agi_cmd: Channel PJSIP/default-00000006 is not setup for Async AGI” appeared in the Asterisk CLI.

If the channel is inside Stasis, then you can’t use AsyncAGI.

I have a worked example of how to set up AsyncAGI in the ami+agi_audio_player_async script here. Basically, you set up an AMI listener that watches for AsyncAGIStart events. You might have several sources of such events going on at once. So what my example does is use the first AGI argument as an identifier for the event listener:

exten => _X.,n,AGI(agi:async,audio-player)

In this case, the identifier is “audio-player”. So my script looks for this:

    if evt.get("Event") == "AsyncAGIStart" :
        env = dict \
            l.split(": ", 1)
            for l in urllib.parse.unquote(evt["Env"]).rstrip("\x0a").split("\x0a")
        if env["agi_arg_1"] == "audio-player" :
            ... do my stuff...
    #end if

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