Store your credential as an environment variable. Never hard-code
hk_live_… tokens in
source files, dialplans, or configuration files committed to version control. Use an environment
variable (HUMAIN_CREDENTIAL) or a secrets manager and inject the value at runtime.1
Install the PJSIP trunk
Configure the Humain SIP trunk in PJSIP. Add the following to Then reload:
/etc/asterisk/pjsip.conf:2
Install the Python AGI library
pyst2 provides the asterisk.agi module for reading channel variables and controlling
call flow from Python. requests is used to call the Humain REST API.3
Create the AGI script
Create Paste the following:
/usr/share/asterisk/agi-bin/humain_kiosk.py and make it executable:4
Add the dialplan extension
In Point your inbound SIP trunk (or DID routing) at the
/etc/asterisk/extensions.conf, add a context that routes inbound calls through the
AGI script:[humain-kiosk] context.Reload the dialplan:5
Test the call
Dial the DID number routed to You should see:
[humain-kiosk]. Watch the Asterisk console and your log
file:humain_kiosk: session hk_sess_… opened- The Humain AI greeting playing to the caller
humain_kiosk: session hk_sess_… closedon hang-up
Handling DTMF before connecting
Pass caller metadata to the session
Pass caller metadata to the session
The AGI script has access to all Asterisk channel variables. You can pass caller ID and DID
information to the session by extending Then in The metadata is available in your kiosk’s action endpoints as
open_session() with a metadata payload:main():session.metadata.