Пример #1
0
    $MSG = "Nous allons vous appeler dans quelques instants..";
    if (!isset($ERR)) {
        //## Code plivo pour le controle de Freeswitch
        require "lib/plivo/plivohelper.php";
        //instanciation du client plivo
        $client = new PlivoRestClient($REST_API_URL, $AccountSid, $AuthToken, $ApiVersion);
        //$bridge_id = genBridgeUUID(1);
        //$bridge_id = '1234';
        //cree un nouvel uuid dans freeswitch
        $params = array();
        $response = $client->create_uuid($params);
        $bridge_id = $response->Response->Message;
        $params = array('command' => "luarun bridge.lua {$bridge_id} sofia/gateway/{$sipconf}/{$cn} sofia/gateway/{$sipconf2}/{$callto} sofia/gateway/{$sipconf}/{$cn} sofia/gateway/{$sipconf2}/{$callto} lqdn_itre_acta.wav", 'bg' => 'true');
        try {
            // Initiate bridge
            $response = $client->command($params);
        } catch (Exception $e) {
            echo 'Caught exception: ', $e->getMessage(), "\n";
            exit(0);
        }
        //##
    }
}
?>

<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>	
    <meta http-equiv="cache-control" content="no-cache" />
    <meta http-equiv="pragma" content="no-cache" />
    <link rel="shortcut icon" type="image/png" href="images/favicon.png" />
Пример #2
0
 /** This function uses plivo API to make the callback
  */
 private function _callback($from, $to, $wavfile, $lang)
 {
     //## Code plivo pour le controle de Freeswitch
     require_once "plivo/plivohelper.php";
     //instanciation du client plivo
     $client = new PlivoRestClient(REST_API_URL, AccountSid, AuthToken, ApiVersion);
     //cree un nouvel uuid dans freeswitch
     $params = array();
     $response = $client->create_uuid($params);
     $bridge_id = $response->Response->Message;
     // Search for the wav file for this campaign :
     if (!$wavfile || !file_exists("/usr/local/freeswitch/sounds/" . $wavfile)) {
         $wavfile = "lqdn_ann.wav";
     }
     // Search for a local language wav file
     if (file_exists("/usr/local/freeswitch/sounds/" . str_replace(".wav", "-" . $lang . ".wav", $wavfile))) {
         $wavfile = str_replace(".wav", "-" . $lang . ".wav", $wavfile);
     }
     //    $this->log($bridge_id."/".$from."/".$to."/".$wavfile);
     // WARNING : I don't use wintermew bridge.lua anymore, modified for SIP trunk on nnx ...
     $params = array('command' => "luarun bridge.lua {$bridge_id} {$from} {$to} {$wavfile}", 'bg' => 'true');
     try {
         // Initiate bridge
         $response = $client->command($params);
         return $bridge_id;
     } catch (Exception $e) {
         echo 'Caught exception: ', $e->getMessage(), "\n";
         return false;
     }
     //##
 }