Ticket #5 (closed Patches: Accepted)

Opened 4 years ago

Last modified 2 years ago

Adds codec 'allow'/'disallow' fields via Advance Edit

Reported by: lethol Assigned to: nobody
Priority: minor Milestone:
Component: Web interface Version: 1.10.006
Keywords: Cc:
Confirmation: SVN Revision (if applicable):
Backend Engine: All Backend Engine Version:

Description

This will add allow/disallow fields via the Extensions
'Advance Edit' form in AMP.

I have been running AMP for a while and I love it.  I
needed to add other codec support besides ulaw and alaw
to my sip extensions so I added the necessary fields to
the Extension form so that they appear in the Advance
Edit part once the extension is created.   Creating a
new extension will default to ulaw just as AMP does, so
adding this patch will not hurt you and it will let you
modify any particular extension to use the codec of
your choice using the allow/disallow values asterisk
obeys.  This chage will store the values in mysql so
that they can be restored to the sip_additional.conf
file AMP writes to.

My modifications are for AMP release 1.10.003 

Open sip.conf
Find the line
allow=alaw

Add right after
allow=gsm
allow ilbc

Open extensions.php
Around line 239 find
<input type="hidden" name="type" value="<? echo $type;
?>"/>

Add right after
<!-- codec default values -->
<input type="hidden" name="allow" value="<? echo
($allow==null) ? 'ulaw' : $allow; ?>"/>
<input type="hidden" name="disallow" value="<? echo
($disallow==null) ? 'all' : $disallow; ?>"/>
<!-- codec default values -->

Around line 385
Find the line
<input type="hidden" name="port" value="5060"/>

Add right after
<!-- codec fields -->                
<input type="hidden" name="allow" value="ulaw"/>      
                                                 
<input type="hidden" name="disallow" value="all"/>    
                                                         
<!-- codec fields -->

Open functions.php
Around line 204
Find the line
array($account,'type',$_REQUEST['type']),

Add right after
//codec insert
array($account,'allow',$_REQUEST['allow']),
array($account,'disallow',$_REQUEST['disallow']),
//codec insert

Around line 277
Find the line
array($_REQUEST['type'],$account,'type'),

Add right after
//codec update        
array($_REQUEST['allow'],$account,'allow'),
array($_REQUEST['disallow'],$account,'disallow'),
//codec update 

Open retrieve_sip_conf_from_mysql.pl
Around line 70
Find the line
$statement = "SELECT keyword,data from $table_name
where id=$id and keyword <> 'account' and flags <> 1
order by keyword"; 

Replace with
$statement = "SELECT keyword,data from $table_name
where id=$id and keyword <> 'account' and flags <> 1
order by keyword DESC";

This last change in retrieve_sip_conf_from_mysql.pl is
needed because it is important for asterisk to get the
'allow' value after the 'disallow=all' one.  This gave
me headache because I was not aware asterisk read these
values in order.

Once you are finished go create a new SIP extension via
AMP.  After creating and clicking on the 'apply
changes' red bar, you can select the extension you just
created and edit  the allow/disallow fields in it.  For
remote extensions I am currently using ilbc so changing
ulaw for ilbc will set tell asterisk to use that codec
for that particular extension.

I will continue to work on this feature and hope it
gets added to AMP.  (maybe some drop down fields for
codec selection) in the near future.

Change History

01/23/05 12:48:55 changed by rcourtna

Logged In: YES 
user_id=1019629


to be included in AMP 1.10.006

03/02/05 07:27:59 changed by rcourtna

  • status changed from assigned to closed.