First time AMI setup
vi /etc/asterisk/manager.conf minimal configuration required:
[general]
enabled = yes ;AMI
webenabled = no ;AJAM
httptimeout=120
port = 5038
bindaddr = 0.0.0.0
enabled = yes ;AMI
webenabled = no ;AJAM
httptimeout=120
port = 5038
bindaddr = 0.0.0.0
tlsenable=no
[admin]
secret=My$ecr3t
read=all
write=all
secret=My$ecr3t
read=all
write=all
Test over telnet:
Wait till connected:
telnet 127.0.0.1 5038
Send below commands:
Action: Login
Username: admin
Secret: My$ecr3t
Events: off
Username: admin
Secret: My$ecr3t
Events: off
"Enter" twice to get:
Response: Success
Message: Authentication accepted
Message: Authentication accepted
To logoff:
Action: logoff
AstDB
To view needed permissions:
CLI> manager show commands
To write into astdb:
Action: DBPut
Family: TEST
Key: WhatEverYouWant
DBDel and DBGet are working in the same manner as DBPut above.
Learn name of the table and its structure:
connector = sqlite3.connect("/var/lib/asterisk/astdb.sqlite3")
cursor = connector.cursor()
cursor.execute("select sql from sqlite_master where type = 'table'")
print(cursor.fetchall())
cursor.close()
con.close()
DBDel and DBGet are working in the same manner as DBPut above.
Python to AstDB connect
import sqlite3 # it's standard libraryLearn name of the table and its structure:
connector = sqlite3.connect("/var/lib/asterisk/astdb.sqlite3")
cursor = connector.cursor()
cursor.execute("select sql from sqlite_master where type = 'table'")
print(cursor.fetchall())
cursor.close()
con.close()
No comments:
Post a Comment