[Home]

Summary:ASTERISK-07404: Asterisk cannot find the 'hint' priority when using realtime extensions
Reporter:Adam Simpson (asimpson)Labels:
Date Opened:2006-07-26 16:38:29Date Closed:2011-06-07 14:03:12
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Core/NewFeature
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:When a SIP phone registers with an asterisk server and the context is in the realtime extensions table rather than extensions.conf, it tries to find the hint priority but responds with this instead:

Jul 26 17:20:05 ERROR[23735]: chan_sip.c:10990 handle_request_subscribe: Got SUBSCRIBE for extension 288@internal-1 from 69.157.25.130, but there is no hint for that extension

I tried changing the priority column to a VARCHAR(20) and using 'hint' and also trying the column as a TINYINT and using '-1' for the hint but neither seem to the work.
Comments:By: Adam Simpson (asimpson) 2006-07-26 17:26:45

I would be happy to work on a patch for this if this really is a bug (I couldn't find anything that describes how to use hints in dialplans within a database).  If anyone knows what the problem is and where to begin looking that would be helpful too.

I have rtcachefriends=yes in sip.conf.  

When I looked at the debug log file, I noticed the following calls to the mysql database when I tried to register my grandstream IP phone.  What is extension 10112?  Priority=1?  

ul 26 22:08:11 DEBUG[23735] res_config_mysql.c: MySQL RealTime: Everything is fine.
Jul 26 22:08:11 DEBUG[23735] res_config_mysql.c: MySQL RealTime: Retrieve SQL: SELECT * FROM extensions_table WHERE exten = '10112' AND context = 'internal-1' AND priority = '1'
Jul 26 22:08:11 DEBUG[23735] res_config_mysql.c: MySQL RealTime: Everything is fine.
Jul 26 22:08:11 DEBUG[23735] res_config_mysql.c: MySQL RealTime: Retrieve SQL: SELECT * FROM extensions_table WHERE exten LIKE '\_%' AND context = 'internal-1' AND priority = '1' ORDER BY exten
Jul 26 22:08:11 DEBUG[23735] res_config_mysql.c: MySQL RealTime: Everything is fine.
Jul 26 22:08:11 DEBUG[23735] res_config_mysql.c: MySQL RealTime: Retrieve SQL: SELECT * FROM extensions_table WHERE exten LIKE '10112%' AND context = 'internal-1' AND priority = '1'
Jul 26 22:08:11 DEBUG[23735] res_config_mysql.c: MySQL RealTime: Everything is fine.
Jul 26 22:08:11 DEBUG[23735] res_config_mysql.c: MySQL RealTime: Retrieve SQL: SELECT * FROM extensions_table WHERE exten LIKE '\_%' AND context = 'internal-1' AND priority = '1' ORDER BY exten
Jul 26 22:08:11 DEBUG[23735] res_config_mysql.c: MySQL RealTime: Everything is fine.
Jul 26 22:08:21 DEBUG[23735] chan_sip.c: Stopping retransmission on '48a2f6961d754a591b882d6c16da1a9a@64.15.136.207' of Request 102: Match Found



By: Joshua C. Colp (jcolp) 2006-07-28 14:05:12

Right now there is no capacity for storing hints in a database. Internally they are stored in a different manner and work differently. Off the top of my head I don't even know if it would be worth making them realtime capable... what's your reasoning/ideas behind it?

By: Adam Simpson (asimpson) 2006-07-28 20:45:01

It seems to be trying to look in the database for the hint, I think from looking at the code the functionality is there?  For instance when I use internal-1 for the context for a sip phone it does a lookup in the database for the hint but does not find it because it seems to be looking for priority=1 rather than perhaps priority=-1 which is what PRIORITY_HINT is defined as.  I would think that if people want to move their entire dialplans into the database they would need this function.  I assume that the realtime extensions table is designed to handle all the functions of the extensions.conf file?  For instance I have 6 asterisk servers which are pulling their dialplan from the database and phones are added everyday, so to add a hint to extensions.conf and reload 6 servers is not really practical.  Since the internal extensions change all the time through our web interface I really don't want hints in a flat file because then I have to move the internal extensions to flat files as well.  I assume many people want to use the database solely without relying on the .conf files at all so that changes can occur dynamically and all servers will see the change immediately.  Again I don't mind looking into adding this functionality but I am not exactly sure where the problem might be.

By: jogi (jogi) 2006-08-02 05:09:15

Hints in the database would make life easier especially for virtual pbx applications. Right now the extensions.conf still contains information, which can not be stored in the database. Therefore changes in the database are not automatically active. I see that at least reading the hint extensions from realtime during a restart of asterisk would solve the manual task.

By: Tilghman Lesher (tilghman) 2006-08-03 08:30:35

A priority of -1 is exactly what you need to do for a hint of a realtime extension.  I'm not sure why you think registering a SIP phone would activate the HINT, however.

By: Tilghman Lesher (tilghman) 2006-08-03 08:32:26

I suspect the missing piece is that you need a Realtime switch statement within extensions.conf for the associated context in order to use hints for that context.

By: Adam Simpson (asimpson) 2006-08-03 09:09:49

Yes, I have a realtime switch for the appropriate context, but using a hint of -1 does not work as you can see from the following errors:

Aug  3 10:06:45 ERROR[25806]: chan_sip.c:10990 handle_request_subscribe: Got SUBSCRIBE for extension 289@internal-1 from 65.92.51.215, but there is no hint for that extension
Aug  3 10:06:45 ERROR[25806]: chan_sip.c:10990 handle_request_subscribe: Got SUBSCRIBE for extension 288@internal-1 from 65.92.51.215, but there is no hint for that extension
Aug  3 10:06:45 ERROR[25806]: chan_sip.c:10990 handle_request_subscribe: Got SUBSCRIBE for extension 344@internal-1 from 65.92.51.215, but there is no hint for that extension

Have you tried this?  Did it work for you?  As you can see from my first note, the database calls seem to be incorrect.

By: Werner Rades (lordzero) 2006-08-03 09:42:54

In my opinion I'm with jogi an asimpson about the posibility to use the dialplan from a realtime database. I would move all our dialplans into the database if we could have the same features as in the .conf file.
Till now I have found no possibility to to use the hint and include feature (also timebased include features would be nice) from the database. In addition to that I think, that it would be more better to read the contexts from the database without the need to add for each database context also the same context within the extensions.conf file with the switch statement in it.
I'm unfortunately not a programmer to do this task.
What do you think about this idea?

By: Tilghman Lesher (tilghman) 2006-08-03 11:12:44

lordzero:  that's fine as a wishlist item or a feature request, but until we have proposed code in hand, that's as far as it will go.

By: Tilghman Lesher (tilghman) 2006-08-03 11:28:13

asimpson:  the database calls you have shown are irrelevant to the issue at hand.  I would suggest that you try using res_config_odbc.

By: Tilghman Lesher (tilghman) 2006-08-03 13:30:05

Okay, after much digging through the code, I've found that realtime hints won't work without an API change (and a fairly major one at that).  The interesting thing is that the code DOES find the hint currently; it just ignores the fact that it found it and continues along as if it didn't.

By: Adam Simpson (asimpson) 2006-08-03 13:53:58

That's too bad because otherwise the realtime extensions feature is quite useful, but having to reload the extensions file on many servers each time a new phone is added is a bit of pain but I guess it could be done but it isn't as pretty as using the database for everything.

By: Olle Johansson (oej) 2006-08-07 03:42:26

We preload the hints in memory, shown by "show hints", which is where we do look for the hint to activate the subscription in addition to the dial plan lookup. Preloading of anything does not work with realtime at all at it is not designed that way. In order for this to work, we need to add an implementation for realtime hints.

As of now, this is a feature request and not a bug report. I see the need for this at some point, but as file and corydon says, it requires quite a lot of code and some redesign.

By: Tilghman Lesher (tilghman) 2006-08-07 10:36:59

Suspending, as this is a feature request.  We encourage you to post feature requests in the bounty section of voip-info.org.