title: Direct method failing when using Azure IOT Direct methods
body: <p>I am currently using the azure-iot-sdk-c on the TI CC-3235 microcontroller. I tried using the Azure Direct methods to invoke a method (blinkLED1) on the microcontroller. Azure IoT hub gives me an error saying &quot;not registered&quot; like below:
  <code>{&quot;message&quot;:&quot;Device {\&quot;Message\&quot;:\&quot;{\\\&quot;errorCode\\\&quot;:404103,\\\&quot;trackingId\\\&quot;:\\\&quot;c1763a63a5b54381aa555198de1e884c-TimeStamp:07/01/2020 12:03:39\\\&quot;,\\\&quot;message\\\&quot;:\\\&quot;Timed out waiting for device to connect.\\\&quot;,\\\&quot;info\\\&quot;:{\\\&quot;timeout\\\&quot;:\\\&quot;00:03:45\\\&quot;},\\\&quot;timestampUtc\\\&quot;:\\\&quot;2020-07-01T12:03:39.1927271Z\\\&quot;}\&quot;,\&quot;ExceptionMessage\&quot;:\&quot;\&quot;} not registered&quot;}</code></p>
  <p>The code below is a modification of the example code from TI/Microsoft. The microcontroller C code is below:</p>
  <pre><code>{
      (void)userContextCallback;
      (void)payload;
      Display_printf(display, 0, 0, &quot;\r\nDevice Method called&quot;);
      Display_printf(display, 0, 0, &quot;Device Method name:    %s&quot;, method_name);
      Display_printf(display, 0, 0, &quot;Device Method payload: %.*s&quot;, (int)size, (const char*)payload);
  
      int status = 200;
      char* RESPONSE_STRING = &quot;{ \&quot;Response\&quot;: \&quot;This is the response from the device\&quot; }&quot;;
      Display_printf(display, 0, 0, &quot;\r\nResponse status: %d&quot;, status);
      Display_printf(display, 0, 0, &quot;Response payload: %s\r\n&quot;, RESPONSE_STRING);
      if(strcmp(&quot;blinkLED1&quot;,method_name)==0){
          const char deviceMethodResponse[] = &quot;{\&quot;Response\&quot;:\&quot;LED Blink1 Received\&quot;}&quot;;
          Display_printf(display, 0, 0, &quot;\r\nDevice Method called&quot;);
          *resp_size = sizeof(deviceMethodResponse)-1;
          *response = malloc(*resp_size);
          (void)memcpy(*response, deviceMethodResponse, *resp_size);
          status = 200;
      }
      *resp_size = strlen(RESPONSE_STRING);
      if ((*response = malloc(*resp_size)) == NULL)
      {
          status = -1;
      }
      else
      {
          (void)memcpy(*response, RESPONSE_STRING, *resp_size);
      }
      g_continueRunning = false;
      return status;
  }
  </code></pre>
  <p>TI Example reference:<a href="https://dev.ti.com/tirex/explore/node?node=ANXoNQGeQjExMVJXpE5vjg__9QUeYYT__LATEST" rel="nofollow noreferrer">iothub_client_sample_device_method</a></p>
  <p>Azure IoT SDK C Reference :<a href="https://github.com/Azure/azure-iot-sdk-c/tree/master/iothub_client/samples/iothub_client_device_twin_and_methods_sample" rel="nofollow noreferrer">Run a simple device Twin C sample on Windows</a></p>