Asterisk 18 how to sync queue state between asterisks in cluster

We are building a system

  1. One pair of kamailio as SIP Proxy (active/standby). Kamailio distributes the call to asterisk by round-robin
  2. 6 asterisk GWs configured as cluster
  3. Using realtime DB
  4. We did configure the Device state sync: Exchanging Device and Mailbox State Using PJSIP - Asterisk Project - Asterisk Project Wiki
  5. Make an incoming call.

Issue#1. Please see the result of queue show below, the call is being distributed to Asterisk#01, the Device state (Ringing or Not in use) are updated properly on both asterisk GWs
However looking at Asterisk#02, line 9003, you can see “last was 19 secs ago” there but not on the line 9003 under queue show of Asterisk#01.
This “last was 19 secs ago” state reports how long this line has ide from last call.
This leads an issue “Leastrecent strategy works incorrectly in asterisk cluster”, becasue state of line 9003 is NOT updated to Asterisk#01 as shown below, Asterisk#01 doesn’t know when is last call on the line 9003 and how long it has idl.

Issue#2. You can see the Asterisk#01 shows “1. PJSIP/9000@2.collabos.com-00000000 (wait: 0:07, prio: 0)”, but not under Asterisk#02
This leads to an issue “QUEUE_WAITING_COUNT works incorrectly in asterisk cluster”. since Asterisk#02 doesn’t realize that there is a wait call being processed in Asterisk#01.

Question:
Is this Asterisk’s behavior or I am wrong at some configurations (step 4 above) for Device state sync ?
Any advice/recommendation you could provide would be high appreciated

Many thanks for your help.

Asterisk#01
ip-172-31-47-139*CLI> queue show 8888
8888 has 1 calls (max unlimited) in ‘rrmemory’ strategy (0s holdtime, 0s talktime), W:0, C:0, A:0, SL:0.0%, SL2:0.0% within 0s
Members:
9002 (PJSIP/9002@2.collabos.com) (ringinuse disabled) (realtime) (Ringing) has taken no calls yet
9003 (PJSIP/9003@2.collabos.com) (ringinuse disabled) (realtime) (Not in use) has taken no calls yet
9004 (PJSIP/9004@2.collabos.com) (ringinuse disabled) (realtime) (Not in use) has taken no calls yet
Callers:
1. PJSIP/9000@2.collabos.com-00000000 (wait: 0:07, prio: 0)

Asterisk#02
ip-172-31-40-250*CLI> queue show 8888
8888 has 0 calls (max unlimited) in ‘rrmemory’ strategy (5s holdtime, 1s talktime), W:0, C:1, A:1, SL:0.0%, SL2:0.0% within 0s
Members:
9002 (PJSIP/9002@2.collabos.com) (ringinuse disabled) (realtime) (Ringing) has taken no calls yet
9003 (PJSIP/9003@2.collabos.com) (ringinuse disabled) (realtime) (Not in use) has taken 1 calls (last was 19 secs ago)
9004 (PJSIP/9004@2.collabos.com) (ringinuse disabled) (realtime) (Not in use) has taken no calls yet
No Callers

Asterisk 1.8 is 7 years beyond end of life and didn’t include chan_pjsip. I assume you meant Asterisk 18.

Last used time is maintained locally, in the app_queue application, and is not part of the device state maintained by the core.

Many thanks for your reply David,

Is there anyway to sync the queue state between Asterisks in Cluster, so strategy (leastrecent) can work with Asterisk cluster model (multiple asterisk ) ?

or is there any solution for leastrecent strategy to work properly in Asterisk cluster model ?

Without rewriting app_queue or writing your own queue application, no. It is written to work on a single Asterisk. It is not written for clustering.

1 Like

The only think you can do, is use a different queue in each Asterisk or, maybe, configure Statistics Queue in Realtime to see if you have the right reports about Agents.

Regards

Thank you very much jcolp & annusfictus for your support,

  1. “Using a different queue in each Asterisk” doesn’t match our requirement now
  2. I would like to give a try with your second idea “configure Statistics Queue in Realtime” but I could not find relative documents, could please help to share me the link/doc for configuring Statistics Queue in Realtime ?

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