PJSIP Device_state_busy_at, How Does This Work?

Home » Asterisk Users » PJSIP Device_state_busy_at, How Does This Work?
Asterisk Users 3 Comments

Hi Gang

According to:
https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Configuration_res_pjsip#Asterisk12Configuration_res_pjsip-endpoint_device_state_busy_at

And endpoint should return busy if this number is reached.

We have PBX Trunks registering to the Asterisk.

So we want to limit the number of concurrent calls to a PBX and return busy, if more than the configured number of channels are in use.

I set for example:

device_state_busy_at=4 to limit the trunk to 4 channels so 400kbit/s can be assured by QOS measure.

But when testing, I noticed caller don’t get busy.

pjsip show endpoints happily shows 5 of 4 channels in use.

Do I have to query the device state from the dialplan and manually return busy?

Mit freundlichen Grüssen

-Benoît Panizzon-

I m p r o W a r e A G – Leiter Commerce Kunden

3 thoughts on - PJSIP Device_state_busy_at, How Does This Work?

  • Hi Joshua

    Yes, I had a shot at GROUP and GROUP_COUNT but somehow did not manage to achieve efficient control of the channels.

    I have hacked together an ugly solution.

    I use an agi script for routing decision.

    If the call originates from a Customer Device:
    ($tech,$device,$callid) = $chan_vars{‘channel’} =~ m/([A-Za-z]*)\/(.*)?-(.*)/;

    So $device contains the part I need to use in:

    $AGI->get_variable(“DEVICE_STATE(PJSIP/$device)”);

    If this returns BUSY, I send the call to HangUp(17)

    On calls TO a Customer Device, I use the same $device to build the destination URI: Dial(PJSIP/$destination@$device) and therefore I can also query the state and figure out if I need to send the call to HangUp(17).

    One interesting observation. If the count of channels is not at the limit (eg 2 of 2 => busy), so for example 3 out of 2 channels, the status does not stay ab BUSY but goes back to IN_USE. Shouldn’t that still be busy? 🙂

    Mit freundlichen Grüssen

    -Benoît Panizzon-

    I m p r o W a r e A G – Leiter Commerce Kunden