2
0

rpc.cgi 844 B

12345678910111213141516171819202122232425262728
  1. #!/usr/bin/perl
  2. use Frontier::Responder;
  3. use Data::Dumper;
  4. require ESL;
  5. #For use with FreeSWITCH Dialer.scpt in applescripts
  6. #
  7. # Install FreeSWITCH Dialer.scpt into ~/Library/Address Book Plug-Ins/
  8. #
  9. sub MakeCall {
  10. my $hash = shift;
  11. my $c = new ESL::ESLconnection("localhost", "8021", "ClueCon");
  12. my $number = $hash->{phoneNumber};
  13. my $user = $hash->{userExtension};
  14. my $gateway = $hash->{useGateway};
  15. $number =~ s/\D//g; # Remove nasties.
  16. my $e = $c->sendRecv("bgapi originate {ignore_early_media=true,origination_caller_id_number=$number,effective_caller_id_number=19183029101}$user &bridge({ignore_early_media=false,sip_authorized=true}$gateway/$number)");
  17. $e->getBody();
  18. }
  19. my $res = Frontier::Responder->new(
  20. methods => {
  21. MakeCall => \&MakeCall,
  22. },
  23. );
  24. print $res->answer;