Arduino Yún: Temboo Nexmo choreo: only works without YunClient client. HELP

Hi all,

I have an Arduino Yún, on the code side I'm trying to set up a yun server so that when I use a rest comment (for example to set a pin high) that via the Nexmo choreo a call will be placed to my cell phone.

It works fine if I leave out this part of the code:

YunClient client = server.accept();

  // There is a new client?
  if (client) {
    // read the command
    String command = client.readString();
    command.trim();        //kill whitespace
    
   //is the command digital/13/1?
      if (command == "digital/13/1") {
      client.println("The Alarm has been Triggered ");
      Console.println("The Alarm has been Triggered");
    if (numRuns < maxRuns) {
    Console.println("Calling: " + PHONE_NUMBER + "...\n");
    if (makeNexmoCall() == 1) {
      Console.println("Blinking the LED on 13!\n");

    }

As soon as I add If client somewhere in the code It will call the if statement just fine, but will not call my phone and jump to the else statement of the code. This is driving me absolutely nuts. I've tried to look all over on the internet but can' seem to find anything and as you can probably tell I have no formal experience in coding (pure hobby).

Can someone please explain to me why this is?

Thank you very much.

I've added in the sketch that does work: Alarmnexmoworkingpost (without the temboo account page)
and the full sketch that does not work: yardalarmpost (without the temboo account page)

Yardalarmv1post.ino (13.3 KB)

alarmnexmoworkingpost.ino (7.83 KB)

Since you run it at Arduino Yún, then you don't need Temboo to call VOIP provider.

I posted "Let Yun make a phone call".

http://forum.arduino.cc/index.php?topic=216267

All the heave lift takes place at linux side, Arduino only trigger the call via bridge.

Nexmo has Pre-built Libraries as well, you could use them.

https://docs.nexmo.com/index.php/pre-built-libraries