AMI / AJAM
Telnet (AMI)
Curl AJAM
Call file
Connect to the PBX via ssh. Run the command to connect to the AMI:
busybox telnet 127.0.0.1 5038
Perform authorization:
Action: Login
Username: phpagi
Secret: phpagi
Events: off
Perform Originate to call from 201 to 203:
Action: Originate
Channel: Local/[email protected]
Context: all_peers
Exten: 203
Priority: 1
Callerid: 201
Variable: SIPADDHEADER="Call-Info:\;answer-after=0",pt1c_cid=203,ALLOW_MULTY_ANSWER=1
- SIPADDHEADER - The header will be added to the INVITE for the internal number 201
- pt1c_cid - destination number
- ALLOW_MULTY_ANSWER - If there are multiple registrations on account 201, SIPADDHEADER will be sent to all contacts
Connect to the PBX via ssh. Run the command to connect to the AMI:
h='127.0.0.1';
u='phpagi';
p='phpagi';
port='8088';
from='201';
to='203';
# Login
tcookie="$(curl -I "http://${h}:${port}/asterisk/rawman?action=login&username=${u}&secret=${p}" | grep Cookie | awk -F': ' '{ print$2 }')";
# Send Originate command to call from ${from} to ${to}
curl --cookie "${tcookie}" "http://${h}:8088/asterisk/rawman?action=originate&channel=Local/${from}@internal-originate&exten=${to}&context=all_peers&priority=1&callerid=${from}&Variable=pt1c_cid=${to},SIPADDHEADER="Call-Info:\;answer-after=0"&ALLOW_MULTY_ANSWER=1";
Make new file
touch /tmp/originate.call;
Add command to file (call from 201 to 203):
Channel: Local/[email protected]
Context: all_peers
Extension:203
Priority: 1
Callerid: 201
Archive: yes
Setvar: SIPADDHEADER=Call-Info:\;answer-after=0
Setvar: pt1c_cid=203
Setvar: ALLOW_MULTY_ANSWER=1
Move file to asterisk spool dir:
mv /tmp/originate.call /storage/usbdisk1/mikopbx/astspool/outgoing
Forwarding without consultation
Telnet (AMI)
Action: Redirect
Channel: PJSIP/201-000001
Context: internal-transfer
Exten: 203
Priority: 1
- "PJSIP/201-000001" - Channel for forwarding
- "internal-transfer" - For all redirects, use only this context
- "203" - destination number
- The channel that was in bridge with PJSIP/201-000001 will be completed
Call forwarding with consultation
Telnet (AMI)
Action: Atxfer
Channel: PJSIP/201-000001
Context: internal-transfer
Exten: 203
Priority: 1
- "PJSIP/201-000001" - The channel that transfers the call it will be connected to the number 203 for consultation
- "internal-transfer" - For all redirects, use only this context
- "203" - destination number
- When the PJSIP/201-000001 channel is completed, the bridge channel will be connected to 203
Last modified 10mo ago