[Home]

Summary:ASTERISK-04180: codecs (allow/disallow) specified in database do not work with realtime
Reporter:laureen (laureen)Labels:
Date Opened:2005-05-15 19:33:31Date Closed:2011-06-07 14:09:59
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Channels/chan_iax2
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) debug1.txt
( 1) debug2.txt
( 2) iax.conf
Description:Hello,

I've tried to use the database fields "allow" and "disallow" in iaxusers/iaxpeers. when i set (for example) disallow="all" and allow="alaw" at the users row, console gives the following error:

*CLI> May 16 02:16:48 WARNING[15627]: channel.c:321 ast_best_codec: Don't know any of 0xf800 formats
May 16 02:16:48 ERROR[15627]: chan_iax2.c:7078 socket_read: No best format in 0xf800???
May 16 02:16:48 NOTICE[15627]: chan_iax2.c:7083 socket_read: Rejected connect attempt from 10.0.0.3, requested/capability 0x8/0xf808 incompatible with our capability 0xf800.

(find debug output in attached debug1.txt)

when setting both fields to "", everything works ok
(find debug output in attached debug2.txt)

i've also set disallow and allow in [general] section in iax.conf (iax.conf is also attached.

Thank you in advance,
Roland



****** ADDITIONAL INFORMATION ******

- i've tried to set type to "friend", which gives me same result

- using Fedora Core 3, MySQL 3.23.58

- version of chan_iax2.c is 1.285 of today (with fixed bug 4266)
Comments:By: Kevin P. Fleming (kpfleming) 2005-05-15 19:44:28

You need to provide the output of 'iax2 show user' for this user, so we can see what codecs are allowed/disallowed after it has been loaded from the database. The code path for realtime/non-realtime loading is the same here, so it should be working as expected.

By: laureen (laureen) 2005-05-16 02:09:56

i'm sorry, but there is no command "iax2 show user roland", and with "iax2 show users" nothing is shown as i configured rtcachefriends to "no".

the output of "realtime load iaxusers name roland" gives for the realtime (non-working) definition:

*CLI> realtime load iaxusers name roland
                  Column Name  Column Value                  
         --------------------  --------------------          
                           id  2                            
                         name  roland                        
                      context  test                          
                         host  dynamic                      
                       permit  10.0.0.3/255.255.255.255      
                         deny  0.0.0.0/0.0.0.0              
                       secret  <pw cut>                        
                         type  user                          
                     username  roland                        
                        allow  alaw                          
                     disallow  all                          
                   regseconds  0                            

the output when defining no codecs in the database (then it is working) is:

*CLI> realtime load iaxusers name roland
                  Column Name  Column Value                  
         --------------------  --------------------          
                           id  2                            
                         name  roland                        
                      context  test                          
                         host  dynamic                      
                       permit  10.0.0.3/255.255.255.255      
                         deny  0.0.0.0/0.0.0.0              
                       secret  <pw cut>                        
                         type  user                          
                     username  roland                        
                   regseconds  0                            

btw: if i define the same properties in iax.conf and disable realtime for iaxusers/iaxpeers, everything works fine.

Thanx for help,
Roland



By: Kevin P. Fleming (kpfleming) 2005-05-16 10:07:04

You are correct, there is not an 'iax2 show user' command... I was thinking of SIP.

However, that output shows what is wrong: your database is returning the 'disallow' column _after_ the 'allow' column, so it's turning off all the codecs you have enabled in the 'allow' column. This is an artifact of how Realtime works, it processes the columns in the order the database supplies them.

Unfortunately there is no easy fix for this, other than to recreate your database table with the columns in the proper order, or, if your database allows, create a view on top of the table that re-orders the columns into the correct order. You may have the same problem with permit/deny, depending on the values you put into them.

By: Brian West (bkw918) 2005-05-16 10:18:36

Well in res_config_odbc you can do ulaw;gsm;g726 and it will work....  Sounds like a res_mysql_config issue.

/b

By: Kevin P. Fleming (kpfleming) 2005-05-16 10:40:41

How is that relevant? :-)

The issue here is that the 'disallow' column is being processed _after_ the 'allow' column, so it's having the same effect that it would if they were in that order in the text based config file (i.e. disabling all codecs).

By: Tilghman Lesher (tilghman) 2005-05-16 10:59:56

Perhaps it would be helpful to change the codec options for sip/iax/etc such that we can specify the order in a single field:

i.e. codecs=disallow:all;allow:gsm,ulaw,ilbc

because it's useful in the general case to have both orders:

i.e. codecs=allow:all;disallow:ulaw,lpc10

By: Kevin P. Fleming (kpfleming) 2005-05-16 11:18:35

That's a darn fine idea :-) You could even use a simpler syntax, like:

codecs=!all,gsm,ulaw

codecs=all,!ilbc,!g729

By: laureen (laureen) 2005-05-16 11:21:20

Hi kpfleming,

committed, works now with putting database field "disallow" in front of "allow"

thanks a lot!

roland

By: Kevin P. Fleming (kpfleming) 2005-05-16 11:52:22

OK, then we'll close this one, but there is a definite need for either some explicit documentation about this problem, or better yet a solution like the one Corydon proposed where the column order does not matter... Even if you create the database table with the columns in the 'proper' order, SQL does not guarantee they will come back that way when you do a 'SELECT * FROM ...', and we can't do a column-by-column SELECT because the user doesn't have to necessarily have any particular set of columns defined (only the ones they want to use).

In general, I think relying on the order of entries in a config file/database is too fragile, and there should be methods to accomplish what is needed without it :-)