Page 1 of 1

suggestion or fix for extensions with dashes in it

PostPosted: Wed Jun 29, 2011 8:51 pm
by bobbymc
the dialer will not populate the live_sip_channel table if the exntesion in the phones table has a - in it..

here is a code suggestions update for AST_update.pl

#old code
#$extension =~ s/^SIP\/|-\S+$//gi;

#new code
$extension =~ s/^SIP\/|-[^-]*$//gi;


#old code
if ($SIP_client_count)
{
$channel_match=$channel;
$channel_match =~ s/-\S+$//gi;
$channel_match =~ s/^SIP\///gi;
$channel_match =~ s/\*/\\\*/gi;
# print "checking for SIP client: |$channel_match|\n";
if ($SIP_client_list =~ /\|$channel_match\|/i) {$line_type = 'CLIENT';}
}

#new code


if ($SIP_client_count)
{
$channel_match=$channel;
#$channel_match =~ s/-\S+$//gi;
$channel_match =~ s/-[^-]*$//gi;
$channel_match =~ s/^SIP\///gi;
$channel_match =~ s/\*/\\\*/gi;
# print "checking for SIP client: |$channel_match|\n";
if ($SIP_client_list =~ /\|$channel_match\|/i) {$line_type = 'CLIENT';}
}

PostPosted: Wed Jun 29, 2011 9:17 pm
by mflorell
That is generally not recommended for several reasons, but please post this to the Issue Tracker in case anyone else would like this.

PostPosted: Wed Jun 29, 2011 10:02 pm
by williamconley
Maybe it would be better to change the code to disallow dashes in the phones table 8)

PostPosted: Thu Jun 30, 2011 7:27 am
by mflorell
Are you offering to write a patch? :)

Honestly we've never had a problem with this, and this is the first I've heard of it being a potential problem.

PostPosted: Thu Jun 30, 2011 11:57 am
by williamconley
if at least ONE of my clients had ever experienced the issue ... i'd have written the patch and posted it already. but we have a policy about looking for problems without a client ... LOL 8)

PostPosted: Mon Jan 23, 2012 7:56 pm
by bobbymc
matt what are the reasons that this is not recommended?

PostPosted: Mon Jan 23, 2012 10:45 pm
by mflorell
That's an easy one, because Asterisk SIP channel names will have the extension with a dash then a unique id, so it's already used as a delimiter, and if you include it as a part of the extension it will cause problems.

Re: suggestion or fix for extensions with dashes in it

PostPosted: Tue Jul 10, 2012 6:08 am
by bobbymc
the reason for this is to have a multi tenant system where the extension can be used over and over but the sip lines register username will include the context in it. This way you can setup separate systems where one group cant access the other groups context and still have the ability to reuse extension 100 for example.

Just a though =)