Asterisk ARI or AMI

Hi everyone!

I am writing a client application to work with an asterisk. Operator shall record the personal information and phone number. Can you please tell how to get phone number when someone calls. I have been programming in Delphi (freepascal) and there are no bindings for ARI and, so I use get and post through http for JSON response.

for example:
S:= Get(‘http://some_login:some_password@some_ip:8088/ari/channels/some_ch’);

Please, show me a simple example (ARI), how to get the phone number and redirect the call to another operator.

Thanks in advance!
Regards, Sergey

Start by learning Asterisk+Standard+Channel+Variables , If you want to get the caller number use ${CALLERID(num)} variable, I also suggest you use AMI or AGI for this type of development

Anyway you can check this links for more information

https://wiki.asterisk.org/wiki/pages/viewpage.action?pageId=29395573
https://wiki.asterisk.org/wiki/display/AST/Asterisk+Standard+Channel+Variables

Thanks for the help, I appreciate it!
Now I train in asterisk Swagger and try to redirect channel to another number and get an answer:
“message”: “Channel not in Stasis application”

On the Internet, information about this quite fragmented. Help please understand.

Thanks in advance!

ARI does not allow you to arbitrarily do things to channels unless they are under its control. This is the opposite of AMI which allows you to redirect anything. What exactly are you trying to accomplish? AMI may be the better option.

I’m not sure what information you’re referring to, but the documentation on the wiki should be correct:

https://wiki.asterisk.org/wiki/pages/viewpage.action?pageId=29395573

You can read about the differences between ARI and AMI here:

https://wiki.asterisk.org/wiki/pages/viewpage.action?pageId=29395573#AsteriskRESTInterface(ARI)-ARI:AnInterfaceforCommunicationsApplications

And this section here describes @jcolp’s point about handing channels over to ARI via the Stasis dialplan application:

https://wiki.asterisk.org/wiki/display/AST/Introduction+to+ARI+and+Channels#IntroductiontoARIandChannels-ChannelsinaStasisApplication

Now I try to connect to the asterisk via telnet and get an answer:
Trying 127.0.0.1…
Connected to 127.0.0.1.
Escape character is ‘^]’.
Asterisk Call Manager/2.8.0

How to enter now my login and password?

Thanks in advance!

http://www.asteriskdocs.org/en/3rd_Edition/asterisk-book-html-chunk/AMI-quickstart.html#AMI-quickstart-TCP

http://www.asteriskdocs.org/en/3rd_Edition/asterisk-book-html-chunk/AMI_id248378.html

CLI> manager show command login