PJSIP multiple AOR: avoid calling other contacts when busy

Dear all,

In a PJSIP endpoint with multiple contacts (same person), I want to allow only 1 simoultaneous incomming call. Then if a second incoming call takes place it should give BUSY until all contacts are available again.

I think that asterisk is configured in that way but if a contact is talking, if a second incoming call takes place… it’s prompted to the 2 available endpoints.

Endpoint/aor configuration

[200]
type=endpoint

device_state_busy_at=1

[200]
type=aor
max_contacts=3

Endpoint state when 1 call is in conversation:

CLI> pjsip show endpoints

Endpoint: 200/200 Busy 1 of 1
InAuth: auth200/200
Aor: 200 3
Contact: 200/sip:200@192.168.75.102:5060 0e932ab7ac Avail 5.895
Contact: 200/sip:200@192.168.75.223:5060 0f1a573da7 Avail 50.227
Contact: 200/sip:200@192.168.75.107:37716;line=2whm 244d03abd3 Avail 18.477
Transport: transport-udp udp 0 0 0.0.0.0:5060
Channel: PJSIP/200-0000002b/AppDial Up 01:03:52
Exten: CLCID: “Juan” <201>

When a second incoming call takes place:

-- Executing [start@sub-internal-call:6] Dial("PJSIP/203-00000033", "PJSIP/200/sip:200@192.168.75.102:5060&PJSIP/200/sip:200@192.168.75.223:5060&PJSIP/200/sip:200@192.168.75.107:37716;line=2whmin3h,59") in new stack
-- Called PJSIP/200/sip:200@192.168.75.102:5060
-- Called PJSIP/200/sip:200@192.168.75.223:5060
-- Called PJSIP/200/sip:200@192.168.75.107:37716;line=2whmin3h
-- PJSIP/200-00000034 connected line has changed. Saving it until answer for PJSIP/203-00000033
-- PJSIP/200-00000035 connected line has changed. Saving it until answer for PJSIP/203-00000033
-- PJSIP/200-00000036 connected line has changed. Saving it until answer for PJSIP/203-00000033
-- PJSIP/200-00000034 is ringing
-- PJSIP/200-00000036 is ringing

CLI> pjsip show endpoints

Endpoint: 200/200 Busy 3 of 1
InAuth: auth200/200
Aor: 200 3
Contact: 200/sip:200@192.168.75.102:5060 0e932ab7ac Avail 38.742
Contact: 200/sip:200@192.168.75.223:5060 0f1a573da7 Avail 210.295
Contact: 200/sip:200@192.168.75.107:37716;line=2whm 244d03abd3 Avail 106.935
Transport: transport-udp udp 0 0 0.0.0.0:5060
Channel: PJSIP/200-0000002b/AppDial Up 01:08:52
Exten: CLCID: “Juan” <201>
Channel: PJSIP/200-00000034/AppDial Ringing 00:00:13
Exten: start CLCID: “Rodrigo” <203>
Channel: PJSIP/200-00000036/AppDial Ringing 00:00:13
Exten: start CLCID: “Rodrigo” <203>

Conclusion

If the endpoint state is ‘Busy’ it should return busy when Dial attempts to call this endpoint.
It may be an issue but I’m new to pjsip and I really not sure of the right behaviour with multiple aors.

Can someone help me with this?

Thanks

The option you mention is in regards to device state, not for dialling. You could use the DEVICE_STATE dialplan function[1] to check before dialling and act accordingly. There would still be a potential race condition where you check and they immediately go busy, but it would be minimal.

[1] https://wiki.asterisk.org/wiki/display/AST/Asterisk+16+Function_DEVICE_STATE

3 Likes

Understood, fixed in dialplan as your suggestion. I can live with this race condition, probably it will never happen.

Thank you very much jcolp for pointing me in the right way.

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