What is the best approach to implement Ring Groups along with AGI Script

I was using chan_sip with my asterisk server and recently shifted to chan_pjsip mainly for being able to get more than one contacts per endpoint.

I used to implement Ring Groups as follows

exten => 201,1,Dial(SIP/101&SIP/102&SIP/103&SIP/104&SIP/105&SIP/106
&SIP/107&SIP/108&SIP/109&SIP/110&SIP/111&SIP/112
&SIP/113&SIP/114&SIP/115&SIP/116)

So In my door phone camera, I set up 201 as the extension to be dialled when someone rings the bell. This worked properly with chan_sip as there is a single contact in chan_sip although there might have been a better way to implement it.

Now I have to modify this so that endpoint 115 and 116 calls all the contacts registered. Apart from this as both these endpoints are going to be registered from softphones I would require to send push notifications to all the devices that have contacts for these endpoints in order to bring up the app and let it register before the call is made. If 115 extension is registered on 3 different smartphones I want to invoke the AGI script to push Notification to all the contacts of 115 endpoints and then dial them.

I’d do something like

exten => 201,1,Dial(LOCAL/softphones&LOCAL/hardphones)

exten => hardphones,1,Ringing()
 same => n,Wait(5)
 same => n,StopRinging()
 same => n,Dial(${PJSIP_DIAL_CONTACTS(${hardphones})})
 same => n,Hangup()

exten => softphones,1,Ringing()
 same => n,AGI(Push.agi)
 same => n,Wait(4)
 same => n,StopRinging()
 same => n,Dial(${PJSIP_DIAL_CONTACTS(${softphones})})
 same => n,Hangup()
1 Like

@johnkiniston thanks for the tip.

So if there are 3 extensions in hardphones namely 101, 102, and 103 and two extensions in softphones 115 and 116 how would this be ?

Are the hardphones and softphones variables storing list of extensions?

They are not variables. They refer to extensions in the default context.

1 Like

If I have 115 and 116 on softphones requiring AGI script then should I implement that as follows or is there a better way ?

exten => softphones,1,Ringing()
 same => n,AGI(Push.agi)
 same => n,Wait(4)
 same => n,StopRinging()
 same => n,Dial(${PJSIP_DIAL_CONTACTS(115)}& ${PJSIP_DIAL_CONTACTS(116)})
 same => n,Hangup()

There is no need to stop ringing.

1 Like