How i can call a agi script when a extension anwers acall ?

I need it to call a crm api to register this call anwers by this extension/user.
Using vitapbx 3.X

The easiest way without modifying the dialplan or dial options is to use an AMI app that listens for events.

You can create a file in the format “extensions__60-custom-agi.conf” in the path “/etc/asterisk/vitalpbx” and add the following content

[before-connecting-call-hook]
exten => s,1,NoOP(My AGI)
 same => n,System(/MY_AGI_PATH/MY_AGI_SCRIPT)
 same => n,Return()

If you want this for a tenant, then do the same but with the Tenant prefix.

[ABC_before-connecting-call-hook]
exten => s,1,NoOP(My AGI)
 same => n,System(/MY_AGI_PATH/MY_AGI_SCRIPT)
 same => n,Return()

Where “ABC_” is your tenant Prefix.

Keep in mind that if your context or AGI crash, your calls might get affected.

1 Like

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