How to register Stasis Application in asterisk and use it to control call by channel id

I have made the call using asterisk ARI and got Channel ID , But when i try to control call using channel is , response is -Channel is not a Stasis application. Please tell me how to register stasis application .

def make_call( caller_id='99999', app='my_stasis_app'):
    url = f'{ARI_BASE_URL}/channels'
    payload = {
        'endpoint': ENDPOINT,
        'extension': EXTENSION,
        'context': CONTEXT,
        'priority': PRIORITY,
        'callerId': caller_id,
        'channelId':'123465',
        'app':'my_stasis_app'
         
    }

    response = requests.post(
        url,
        json=payload,
        auth=HTTPBasicAuth(ARI_USERNAME, ARI_PASSWORD)
    )

    if response.status_code == 200:
        channel_id = response.json()['id']
        print(response.json())
       

        return channel_id

What are you actually trying to achieve?

I want to make an out bound call using ARI and if call is answered then i want to play some Sound file and gather DTMF and also want all call events like ringing ,answered ,dtmf_received . So i use Stasis Application to control my call.
But when i make call using this extension

[default]
exten => 1000,1,NoOp()
     same => n,Stasis(my_stasis_app)
    same => n,Hangup()

then CLI gives me Error : Stasis application not registered.
Please help me to solve this

You create an application by connecting the websocket for it, which will receive the events. The getting started[1] page uses wscat to demonstrate this, and shows the URL.

[1] Overview - Asterisk Documentation

Have you started the Stasis App yet?
You can use

to make things done.

Starting your event listener and specifying one or more application names causes those application names to be registered by Asterisk, if it doesn’t know about them already. You cannot put a channel into Stasis until the application name has been registered.

Thanks you for your support , I got the solution and fixed everything.

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