[Asterisk-Users] RINGBACK then HANGUP

Gary Ruddock (Swift Drinks) garyruddock at hotmail.com
Wed Dec 29 07:47:26 MST 2004


I am using the manager API to sucessfully ORIGINATE a call.  I am using PHP. 
I connect to asterisk and then connect an internal SIP phone to an external 
phone.

<?php
          $timeout = 7500;
          $login_extension = "SIP/6001"; // agent extension
          $call_telephone = "97077777"; // customer's telephone
          $socket = fsockopen("10.0.0.3","5038", $errno, $errstr, $timeout);
          if ($socket)
          {
            $call_person = "Exten: " . $call_telephone . "\r\n";
            $call_extension = "Channel: " . $login_extension . "\r\n";
            fputs($socket, "Action: Login\r\n");
            fputs($socket, "UserName: user\r\n");
            fputs($socket, "Secret: password\r\n\r\n");
            fputs($socket, "Action: Originate\r\n");
            fputs($socket, $call_extension);
            fputs($socket, "Context: local\r\n");
            fputs($socket, $call_person);
            fputs($socket, "Priority: 1\r\n");
            fputs($socket, "Callerid: \r\n\r\n");
          }
?>

The above  code is used when I need to ringback a customer to tell them 
their driver is outside. Problem is the call centre agent initiates the 
call. The agent's SIP phone (SIP/6001) rings then he answers the call from 
asterisk, asterisk then dials the customer.

I want asterisk to dial the customer, ring twice and then hangup. This will 
save the agent's time and reduce our call costs. I don't want the agent to 
be involved. I have tried messing around with the code above but no result.

So my problem in summary is: I would like dial an external line, let it ring 
twice and then hangup all via PHP.

Thanks for your help.

Gary Ruddock
swiftdrinks





More information about the asterisk-users mailing list