Get availability status of pjsip contacts

I have a soft phone, and I would want to get the status of a user’s peers by using an equivalent of pjsip show contacts.

Is it possible and how. Is it also possible in ARI

Why would you not use the normal device state mechanism?

I would want to check if the device is online or if the use is connected.

I have discovered something:

Im using asterisk in realtime so i have noticed that every time a user is online there will be a record of the contact in the database in the PsContact table, as soon as the user becomes offline the record is automatically deleted.

Is it reliable though?

That’s what device state is for. It reflects the state of the device in an Asterisk protocol agnostic way and is usable over ARI. It will state whether a device is offline, online, in use, on hold, ringing, etc.

Insightful. Thank you. does ARI use the database to get this device state?

I might need to refresh the contacts on the sip client at an interval by quiring the database. Im considering the impact it may have on the database if the number of sip clients increase.

NB: Getting device state via ARI vs Database

The device state is internally managed in Asterisk. The database merely persists information. You can also subscribe over ARI or AMI to receive device state updates.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.