Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Callback doesn't work #8

Open
brightproject opened this issue Mar 14, 2016 · 4 comments
Open

Callback doesn't work #8

brightproject opened this issue Mar 14, 2016 · 4 comments

Comments

@brightproject
Copy link

I use plivo for linked two telephone numbers by callback function.
But code preview in example:
https://www.plivo.com/docs/getting-started/making-outbound-calls/

'+7926*******', # The phone numer to which the all has to be placed 'from' => '+7925*******', # The phone number to be used as the caller id 'answer_url' => "http://caringfarmer.ru/testing/answer.xml", # The URL invoked by Plivo when the outbound call is answered 'answer_method' => "GET" # The method used to call the answer_url ); // $response = $p->make_call($params); // echo "
";
// print_r ($response);
// echo "
"; ``` I use: "plivo/plivo-php": "^1.1", "guzzlehttp/guzzle": "^6.1" But when I started code in work, on my telephone arrived call from +7925, I take phone, but don't listen voice, and calling interrupted through 5 seconds. In debug on site plivo I found INFO - code 600 XML : response is empty from GET http://caringfarmer.ru/testing/answer.xml I use POST metod also. Did not help. What is it, and as I may resolve this problem?
@cachrisman
Copy link
Contributor

There are a couple of problems with the XML from http://caringfarmer.ru/testing/answer.xml (copied below):

<Response>
  <Speak language="en-GB" voice="MAN">
    This is a randomly generated text can be used in your layout
  </Speak>
  <Speak language="fr-FR">
    Ce texte généré aléatoirement peut-être utilisé dans vos maquettes
  </Speak>
  <Speak language="ru-RU" voice="MAN">
    Это случайно сгенерированный текст может быть использован в макете
  </Speak>
</Response>
  1. The Plivo-PHP library doesn't support russian and accented characters. To solve, try using
    mb_encode_numericentity("Это случайно сгенерированный текст может быть использован в макете", array(0x80, 0xffff, 0, 0xffff));
    or replace the russian in the XML with
    &#1069;&#1090;&#1086; &#1089;&#1083;&#1091;&#1095;&#1072;&#1081;&#1085;&#1086; &#1089;&#1075;&#1077;&#1085;&#1077;&#1088;&#1080;&#1088;&#1086;&#1074;&#1072;&#1085;&#1085;&#1099;&#1081; &#1090;&#1077;&#1082;&#1089;&#1090; &#1084;&#1086;&#1078;&#1077;&#1090; &#1073;&#1099;&#1090;&#1100; &#1080;&#1089;&#1087;&#1086;&#1083;&#1100;&#1079;&#1086;&#1074;&#1072;&#1085; &#1074; &#1084;&#1072;&#1082;&#1077;&#1090;&#1077;
  2. The second Speak element for French should have a voice="MAN" or voice="WOMAN" attribute.
  3. The text of the second Speak element should also be encoded properly using mb_encode_numericentity or replace it with Ce texte g&#233;n&#233;r&#233; al&#233;atoirement peut-&#234;tre utilis&#233; dans vos maquettes
  4. Russian TTS is only supported using a WOMAN voice. Please see Supported Voices and Languages for details.

@brightproject
Copy link
Author

I simple copied code from example.
Please delete wrong code from:
https://www.plivo.com/docs/getting-started/text-to-speech-on-a-call/
Too bad no wonder why your service does not support Unicode ...
I change my xml file:
http://site.ru/answer.xml
The call numbers entered with the "FROM" to the number "TO"
I picked up the phone, I heard the voice, and then the call was interrupted, the relationship with the number "FROM" not take place, but the money written off.
I have the following errors:
Message : http response failure
Status : 405
URL : http://site.ru/answer.xml
HTTP Type : response
Method: POST Headers : { date : Tue, 15 Mar 2016 18:31:09 GMT content-length : 583 content-type : text/html connection : close server : nginx/1.4.6 (Ubuntu) }
Why write method: POST if I use GET?
After callback should work according to the principle:
first there is a call to one number when you take the phone, the call goes to the caller's number, and there is a connection of two subscribers.
With me there is only one call from a subscriber, when you lift the handset, the call is interrupted after the wiretapping of voice.
Maybe I do not understand the process?
What are the names listed below?
I do not understand why these values are necessary to me, what meaning they carry?

  1. api_id
  2. request_uuid
  3. CallUUID

@algobasket
Copy link

my code not working
if(!function_exists('plivo_sms_send2')){

function plivo_sms_send2($src,$dst,$text){   
require APPPATH.'libraries'.DIRECTORY_SEPARATOR.'plivo-php'.DIRECTORY_SEPARATOR.'vendor'.DIRECTORY_SEPARATOR.'autoload.php';
//use Plivo\RestAPI;
$ci = get_instance();
$ci->load->model('Admin_model');
$data = $ci->Admin_model->providers(5);
foreach($data as $r){ 
    $AUTH_ID = $r['api_secret_key'];
    $AUTH_TOKEN = $r['api_token'];
}
$p = new RestAPI($AUTH_ID, $AUTH_TOKEN); 
$params = array( 
        'src' => $src, // Sender's phone number with country code
        'dst' => $dst, // Receiver's phone number with country code
        'text' => $text // Your SMS text message
    );
$response = $p->send_message($params);
echo "Response : ";
print_r($response['response']);
echo "<br> Api ID : {$response['response']['api_id']} <br>";
echo "Message UUID : {$response['response']['message_uuid'][0]} <br>";

 } 

@algobasket
Copy link

Error i get
`
Parse error: syntax error, unexpected 'use' (T_USE) in /var/www/sms.supreme-data.com/html/application/helpers/plivo_helper.php on line 37
A PHP Error was encountered

Severity: Parsing Error

Message: syntax error, unexpected 'use' (T_USE)

Filename: helpers/plivo_helper.php

Line Number: 37

Backtrace:`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants