[Astpp-commit] SF.net SVN: astpp: [2163] trunk
Brought to you by:
darrenkw
From: <dar...@us...> - 2007-11-18 03:13:11
|
Revision: 2163 http://astpp.svn.sourceforge.net/astpp/?rev=2163&view=rev Author: darrenkw Date: 2007-11-17 19:13:07 -0800 (Sat, 17 Nov 2007) Log Message: ----------- Added call hangup capabilities. Modified Paths: -------------- trunk/astpp-common.pl trunk/templates/booths-list.tpl Modified: trunk/astpp-common.pl =================================================================== --- trunk/astpp-common.pl 2007-11-18 03:12:44 UTC (rev 2162) +++ trunk/astpp-common.pl 2007-11-18 03:13:07 UTC (rev 2163) @@ -3488,6 +3488,18 @@ return (1, $maxlength); } +sub hangup_call() { + my ($astpp_db,$config,$channel) = @_; + use Asterisk::Manager; + my $astman = new Asterisk::Manager; + $astman->user($config->{astman_user}); + $astman->secret($config->{astman_secret}); + $astman->host($config->{astman_host}); + $astman->connect || die $astman->error . "\n"; + my %callout = ( Action => 'Hangup', Channel => $channel); + print STDERR $astman->sendcommand(%callout); +} + # Perfrom callout using the Asterisk Manager Interface. sub perform_callout() { my ($astpp_db,$config,$number,$lcrcontext,$accountcode,$maxretries,$waittime,$retrytime,$clidname,$clidnumber,$context,$extension,%variables) = @_; @@ -3522,36 +3534,11 @@ ActionID => $actionid, Variable => "ACTIONID=$actionid", Priority => '1' ); -# foreach my $variable (@variables) { -# print STDERR "SET: $variable->{name} - $variable->{value} \n"; -# %callout->{Variable} = "$variable->{name}=$variable->{value}"; -# } foreach my $key (keys %callout) { - print STDERR "Key: $key Value: " . $callout{$key} . "\n"; + print STDERR "Key: $key Value: " . $callout{$key} . "\n"; } -print STDERR $astman->sendcommand(%callout); - - -# use Asterisk::Outgoing; -# my $out = new Asterisk::Outgoing; -# my $channel = "Local\/" . $number . "\@$lcrcontext"; -# $out->setvariable( 'Channel', $channel ); -# $out->setvariable( 'MaxRetries', $maxretries ); -# $out->setvariable( 'RetryTime', $retrytime ); -# $out->setvariable( 'WaitTime', $waittime ); -# $out->setvariable( "context", $context ); -# $out->setvariable( "extension", $extension ); -# $out->setvariable( "CallerID", "<$clidname> $clidnumber" ); -# $out->setvariable( "SetVar", "ACCOUNTCODE = $accountcode "); -# foreach my $variable (@variables) { -# print STDERR "SET: $variable->{name} - $variable->{value} /n"; -# $out->setvariable( "Set", "$variable->{name} = $variable->{value}" ); -# $out->setvariable( "SetVar", "$variable->{name} = $variable->{value}" ); -# } -# $out->outtime( time() + 15 ); -# $out->create_outgoing; -# print STDERR "Created Call to: $number\n"; + print STDERR $astman->sendcommand(%callout); } # Check to see if a calling card is ok to use. Modified: trunk/templates/booths-list.tpl =================================================================== --- trunk/templates/booths-list.tpl 2007-11-18 03:12:44 UTC (rev 2162) +++ trunk/templates/booths-list.tpl 2007-11-18 03:13:07 UTC (rev 2163) @@ -25,7 +25,8 @@ <TD><TMPL_VAR NAME="callstart"></TD> <TD><TMPL_VAR NAME="number"></TD> <TD><TMPL_VAR NAME="status"></TD> - <TD> <a href="astpp-admin.cgi?mode=List Booths&action=Deactivate Booth&booth_name=<TMPL_VAR NAME="name">">Deactivate Booth</a> + <TD> <a href="astpp-admin.cgi?mode=List Booths&action=Hangup Call&channel=<TMPL_VAR NAME="channel">">Hangup Call</a> + <a href="astpp-admin.cgi?mode=List Booths&action=Deactivate Booth&booth_name=<TMPL_VAR NAME="name">">Deactivate Booth</a> <a href="astpp-admin.cgi?mode=List Booths&action=Restore Booth&booth_name=<TMPL_VAR NAME="name">">Restore Booth</a> </TD> </TR> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |