I
I
Igor2021-11-03 11:43:12
PHP
Igor, 2021-11-03 11:43:12

How to determine that the operator is talking?

Greetings colleagues!

The task before me is very simple at first glance.
It is necessary to determine the fact that the operator is busy.

Where do I need this information?
I need information about the state in some kind of automatic call mechanism, which is written in PHP
. When sorting through the list of operators, I could definitely tell that this operator is currently busy.

The opinions of my colleagues were divided on the choice of method.
Some say, use AMI
Others just define it in the browser (bind to WebRTC technology events)

In the case of AMI, if I do this in PHP, my script will choke on the flow of information, since there will be no asynchrony and I will have to process each line of the stream in turn information.

In the second case, everything seems to be fine, but until the second tab opens, because when I open the tab, I planned to refresh the status state.

Plz drop an idea.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Drill, 2021-11-03
@IgorPI

Igor ,

In the case of AMI, if I do this in PHP, my script will choke on the flow of information

In the case of AMI, during authentication, you must specify Events: off , and then no one will choke, the asterisk will generally be mute, like a fish ...
Action: Login
ActionID: 1
Username: ВАШ_ЛОГИН
Secret: ВАШ_ПАРОЛЬ
Events: off

and then just send one command:
Action: Command
Command: core show hints

In response, you will receive a couple of dozen lines (or how many peers you have) of this form:
[email protected]           : SIP/240,CustomPresen  State:Idle            Watchers  0
[email protected]           : SIP/241,CustomPresen  State:InUse           Watchers  0
[email protected]           : SIP/242,CustomPresen  State:Unavailable     Watchers  0

It remains to parse two fields:
1. in the first, the number of the peer (operator) - for example, 241
2. in the third field, its state - InUse (busy)

R
Rsa97, 2021-11-03
@Rsa97

You can get a list of endpoints (/enpoints) via ARI and see which of them have active channels.
You can get active channels (/channels) and see which endpoints are associated with them.
You can iterate over all devices (/deviceStates/{deviceName}) and see their status.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question