Douglas Garstang
2005-Dec-27 10:26 UTC
[Asterisk-Users] Realtime Static/Dynamic Preference
It seems that Asterisk gives priority to extensions in the extensions.conf file over what's access in the db via the switch statement. For example, if you have an entry in extensions.conf and realtime for the same extension, Asterisk won't look in the db. Anyone know if there's a way to switch this around, and have Asterisk look in realtime first and then if it isn't accessible, use what's in extensions.conf? Reason is for availability. If database is down, still allow Asterisk to use what's in extensions.conf as a backup. Thanks, Doug.
On 12/27/05, Douglas Garstang <dgarstang@oneeighty.com> wrote:> It seems that Asterisk gives priority to extensions in the extensions.conf file over what's access in the db via the switch statement. For example, if you have an entry in extensions.conf and realtime for the same extension, Asterisk won't look in the db. > > Anyone know if there's a way to switch this around, and have Asterisk look in realtime first and then if it isn't accessible, use what's in extensions.conf? Reason is for availability. If database is down, still allow Asterisk to use what's in extensions.conf as a backup. >If it can't be done via config, it's probably not too hard to change the code to do it. Be careful with switch though as that is the most demanding (query wise) of all the realtime engines at the moment. It will query the database with every call coming through the dial plan. If you know when your DP is changing, you may opt to do static instead and just reload from DB when your DP changes. -- Bird's The Word Technologies, Inc. http://www.btwtech.com/
Douglas Garstang
2005-Dec-27 10:37 UTC
[Asterisk-Users] Realtime Static/Dynamic Preference
Thanks, but static isn't an option. Users will have the ability to make changes to their dialplan via a web portal. Doing a 'reload' every few seconds/minutes is even less viable especially when you consider that a reload deletes all the SIP subscriptions. -----Original Message----- From: BJ Weschke [mailto:bweschke@gmail.com] Sent: Tuesday, December 27, 2005 10:33 AM To: Asterisk Users Mailing List - Non-Commercial Discussion Subject: Re: [Asterisk-Users] Realtime Static/Dynamic Preference On 12/27/05, Douglas Garstang <dgarstang@oneeighty.com> wrote:> It seems that Asterisk gives priority to extensions in the extensions.conf file over what's access in the db via the switch statement. For example, if you have an entry in extensions.conf and realtime for the same extension, Asterisk won't look in the db. > > Anyone know if there's a way to switch this around, and have Asterisk look in realtime first and then if it isn't accessible, use what's in extensions.conf? Reason is for availability. If database is down, still allow Asterisk to use what's in extensions.conf as a backup. >If it can't be done via config, it's probably not too hard to change the code to do it. Be careful with switch though as that is the most demanding (query wise) of all the realtime engines at the moment. It will query the database with every call coming through the dial plan. If you know when your DP is changing, you may opt to do static instead and just reload from DB when your DP changes. -- Bird's The Word Technologies, Inc. http://www.btwtech.com/ _______________________________________________ --Bandwidth and Colocation provided by Easynews.com -- Asterisk-Users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Kevin P. Fleming
2005-Dec-27 10:58 UTC
[Asterisk-Users] Realtime Static/Dynamic Preference
Douglas Garstang wrote:> It seems that Asterisk gives priority to extensions in the extensions.conf file over what's access in the db via the switch statement. For example, if you have an entry in extensions.conf and realtime for the same extension, Asterisk won't look in the db.This is true in general for Asterisk dialplans, it has nothing to do with Realtime. Extensions defined in the context itself are always searched before any included contexts or switches. If you want to control the search order, you must put _all_ your extensions into separate contexts (by type or whatever other grouping you wish) and then use a 'master' context with include/switch statements in the order you wish them to be processed.
Take a look at the following page (you might be able to change the priority): http://www.voip-info.org/wiki-Asterisk+config+extensions.conf+sorting On 12/27/05, Douglas Garstang <dgarstang@oneeighty.com> wrote:> It seems that Asterisk gives priority to extensions in the extensions.conf file over what's access in the db via the switch statement. For example, if you have an entry in extensions.conf and realtime for the same extension, Asterisk won't look in the db. > > Anyone know if there's a way to switch this around, and have Asterisk look in realtime first and then if it isn't accessible, use what's in extensions.conf? Reason is for availability. If database is down, still allow Asterisk to use what's in extensions.conf as a backup. > > Thanks, > Doug. > _______________________________________________ > --Bandwidth and Colocation provided by Easynews.com -- > > Asterisk-Users mailing list > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users >
Douglas Garstang
2005-Dec-27 13:15 UTC
[Asterisk-Users] Realtime Static/Dynamic Preference
Yes, I tied something like this. I included the database context first (the one that has the realtime switch) followed by the context that has the extensions locally. I shut the database down and Asterisk returns fast busy when dialling the number. Doesn't appear to work. [OffNet] #include "inc/OffNet/master.conf" [OnNetFlat] exten => 3250071,1,Dial(SIP/a00090101,20,tr) exten => 3250072,1,Dial(SIP/a00090201,20,tr) exten => 3250073,1,Dial(SIP/a00090301,20,tr) [OnNetDB] switch => Realtime/OnNet@extensions [OffNet] #include "inc/OffNet/master.conf" [Master] include => OnNetDB include => OnNetFlat ; ; User enters here. ; [c_a00090101] include => a00090101 include => Company1 include => Master include => OffNet -----Original Message----- From: Kevin P. Fleming [mailto:kpfleming@digium.com] Sent: Tuesday, December 27, 2005 10:58 AM To: Asterisk Users Mailing List - Non-Commercial Discussion Subject: Re: [Asterisk-Users] Realtime Static/Dynamic Preference Douglas Garstang wrote:> It seems that Asterisk gives priority to extensions in the extensions.conf file over what's access in the db via the switch statement. For example, if you have an entry in extensions.conf and realtime for the same extension, Asterisk won't look in the db.This is true in general for Asterisk dialplans, it has nothing to do with Realtime. Extensions defined in the context itself are always searched before any included contexts or switches. If you want to control the search order, you must put _all_ your extensions into separate contexts (by type or whatever other grouping you wish) and then use a 'master' context with include/switch statements in the order you wish them to be processed. _______________________________________________ --Bandwidth and Colocation provided by Easynews.com -- Asterisk-Users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Douglas Garstang
2005-Dec-27 13:17 UTC
[Asterisk-Users] Realtime Static/Dynamic Preference
Actually, who says this is supposed to work anyways? When Asterisk fails to connect to the database when querying a number, does it have the logic to then fail over and try the same number in contexts that follow? If it doesn't, then there's no point. -----Original Message----- From: Douglas Garstang Sent: Tuesday, December 27, 2005 1:16 PM To: 'Asterisk Users Mailing List - Non-Commercial Discussion' Subject: RE: [Asterisk-Users] Realtime Static/Dynamic Preference Yes, I tied something like this. I included the database context first (the one that has the realtime switch) followed by the context that has the extensions locally. I shut the database down and Asterisk returns fast busy when dialling the number. Doesn't appear to work. [OffNet] #include "inc/OffNet/master.conf" [OnNetFlat] exten => 3250071,1,Dial(SIP/a00090101,20,tr) exten => 3250072,1,Dial(SIP/a00090201,20,tr) exten => 3250073,1,Dial(SIP/a00090301,20,tr) [OnNetDB] switch => Realtime/OnNet@extensions [OffNet] #include "inc/OffNet/master.conf" [Master] include => OnNetDB include => OnNetFlat ; ; User enters here. ; [c_a00090101] include => a00090101 include => Company1 include => Master include => OffNet -----Original Message----- From: Kevin P. Fleming [mailto:kpfleming@digium.com] Sent: Tuesday, December 27, 2005 10:58 AM To: Asterisk Users Mailing List - Non-Commercial Discussion Subject: Re: [Asterisk-Users] Realtime Static/Dynamic Preference Douglas Garstang wrote:> It seems that Asterisk gives priority to extensions in the extensions.conf file over what's access in the db via the switch statement. For example, if you have an entry in extensions.conf and realtime for the same extension, Asterisk won't look in the db.This is true in general for Asterisk dialplans, it has nothing to do with Realtime. Extensions defined in the context itself are always searched before any included contexts or switches. If you want to control the search order, you must put _all_ your extensions into separate contexts (by type or whatever other grouping you wish) and then use a 'master' context with include/switch statements in the order you wish them to be processed. _______________________________________________ --Bandwidth and Colocation provided by Easynews.com -- Asterisk-Users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users