Realtime Queue member status sharing

I have setup of one Kamailio server and two Asterisk servers. Kamailio handles PJSIP registration and forwards register request to one Asterisk node. Both Asterisk servers are using Realtime mysql configuration for pjsip endpoints, queues and all, and sharing single database so both have same Endpoints available.
Incoming calls are getting dispatched to both Asterisk servers in round robin fashion fine.

Now when call comes to one of Asterisk server and goes to queue, it rings the endpoint of that queue and it’s queue member status showing Busy on that server only BUT same status not showing on another server, it is showing available. So when second call goes to another server and into queue the same endpoint is getting call even though it is busy on call.

So, when I so “queue show queue_name” the queue member status not updating on both servers and that is causing issue to scale the infrastructure. I have uploaded screen shot for the status of queue member on both servers. On one server it is “Not in use” and on another server it is “In use”. Please help us for this. Thanks!

1 Like

Even though both asterisks get the endpoint info from the same db, i guess they create each their own instance of that endpoint.
I believe using AMI, you should be able to write some logic to get/set the status of an endpoint before deciding whether to call it or not.

Yes, Right that way simple Dial() application possible but if we want to use Queue() application then it will not be possible. Before dial we can make some logic to check availability of endpoint but if we want to use Queue then it will be not useful.

Try create a logic with “gosub” and “F” Queue options.
You’ll be able to upgrade your own member table state with this.

gosub - Will run a gosub on the called party’s channel (the queue member) once the parties are connected. The subroutine execution starts in the named context at the s exten and priority 1.

F( context^exten^priority ) - When the caller hangs up, transfer the called member to the specified destination and start execution at that location.
NOTE: Any channel variables you want the called channel to inherit from the caller channel must be prefixed with one or two underbars (’_’).
•context
•exten
•priority

F - When the caller hangs up, transfer the called member to the next priority of the current extension and start execution at that location.
NOTE: Any channel variables you want the called channel to inherit from the caller channel must be prefixed with one or two underbars (’_’).
NOTE: Using this option from a Macro() or GoSub() might not make sense as there would be no return points.

With PJSIP you can distribute a device state across multiple instances.

Once you do that and enable skip busy in the queue config, I think it’ll work.

If you are having the exact same queue on two asterisk servers, you COULD end in a situation where only calls on one server will ever get distributed to agents. It’s better to make sure that a queue only ever resides on ONE asterisk server.

This is especially true, if you use things like position announcements or expected hold time, as these will vary between the servers.

Yes, this worked for me. I tried with following link,
https://wiki.asterisk.org/wiki/display/AST/Exchanging+Device+and+Mailbox+State+Using+PJSIP

1 Like

If you don’t mind. Please share your final working config.
Thanks

Sure, I have attached sample configuration for Device state sharing. The configurations done in pjsip.conf on both Asterisk
server1_pjsip.txt (673 Bytes)
server2_pjsip.txt (675 Bytes)
servers

Sure, I have attached sample configuration for Device state sharing. The configurations done in pjsip.conf on both Asterisk
server1_pjsip.txt (673 Bytes)
server2_pjsip.txt (675 Bytes)

1 Like

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