[Astpp-commit] SF.net SVN: astpp:[2247] trunk
Brought to you by:
darrenkw
From: <dar...@us...> - 2009-04-29 15:29:51
|
Revision: 2247 http://astpp.svn.sourceforge.net/astpp/?rev=2247&view=rev Author: darrenkw Date: 2009-04-29 15:29:46 +0000 (Wed, 29 Apr 2009) Log Message: ----------- Updated FreeSwitch DID handling support. Modified Paths: -------------- trunk/freeswitch/astpp-fs-xml.pl trunk/modules/ASTPP/lib/ASTPP.pm Modified: trunk/freeswitch/astpp-fs-xml.pl =================================================================== --- trunk/freeswitch/astpp-fs-xml.pl 2009-04-18 17:25:14 UTC (rev 2246) +++ trunk/freeswitch/astpp-fs-xml.pl 2009-04-29 15:29:46 UTC (rev 2247) @@ -68,9 +68,6 @@ DID => $didinfo->{number} ); - - - if ( !$params->{variable_accountcode} ) { # First we strip off X digits to see if this account is prepending numbers Modified: trunk/modules/ASTPP/lib/ASTPP.pm =================================================================== --- trunk/modules/ASTPP/lib/ASTPP.pm 2009-04-18 17:25:14 UTC (rev 2246) +++ trunk/modules/ASTPP/lib/ASTPP.pm 2009-04-29 15:29:46 UTC (rev 2247) @@ -133,7 +133,7 @@ # Return the dialplan code for an incoming call to a DID. { my ($self, %arg) = @_; - my ( $sql, $trunkdata, $dialstring,$data ); + my ( $xml,$sql, $trunkdata, $dialstring,$data ); my $tmp = "SELECT * FROM dids WHERE number = " . $self->{_astpp_db}->quote( $arg{did} ) . " LIMIT 1"; @@ -142,7 +142,21 @@ $sql->execute; my $diddata = $sql->fetchrow_hashref; $sql->finish; - return $diddata->{variables}; + my @variables = split /,(?!(?:[^",]|[^"],[^"])+")/, $diddata->{variables}; + foreach my $variable (@variables) { + $xml .= "<action application=\"set\" data=\"" . $variable . "\"/>\n"; + } + if ($diddata->{extensions} =~ m/^("|)(L|l)ocal.*/m) { + my ($junk,$ext,$context) = split /,(?!(?:[^",]|[^"],[^"])+")/, $diddata->{extensions}; + #jump to local dialplan +$ext =~ s/"//mg; +$context =~ s/"//mg; + $xml .= "<action application=\"execute_extension\" data=\"" . $ext ." XML " .$context . "\"/>\n"; + } else { + $xml .= "<action application=\"bridge\" data=\"" . $diddata->{extensions} . "\"/>\n"; + } + + return $xml; } sub fs_dialplan_xml_bridge This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |