I don't really understand what you are trying to achieve here.
`setTimeout` returns an internal timer id, it doesn't make much sense to pass this value to second `setTimeout` argument.

If I followed correctly what you are trying to implement, we would do something similar to this:
```
    var inputTimeOut = null;
    if (options.duration) {
      inputTimeout = setTimeout(function() {
        debug('No response from user (Timeout)');
        responseSTKCommand({
          resultCode: icc.STK_RESULT_NO_RESPONSE_FROM_USER
        });
      }, calculateDurationInMS(options.duration));
  }
```
That will add a timeout only when options.duration is non-null.