Illegal string offset 'value' response from GraphQL query

Hi

I’m trying to make the following GraphQL query on my FreePBX 15.0.16.22 (Asterisk 16.4.1)

mutation {
  addCoreDevice(input: {
    tech: "pjsip",
    dial: "PJSIP/605",
    devicetype: "fixed",
    id: 605
  }) {
    clientMutationId
  }
}

But when I do, I get this response:

{
  "errors": [
    {
      "debugMessage": "Illegal string offset 'value'",
      "message": "Internal server error",
      "category": "internal",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "addCoreDevice"
      ]
    }
  ],
  "data": {
    "addCoreDevice": null
  }
}

I really don’t know where to look for this “value”.

I know it’s pretty new this GraphQL API, but I would really like to have the oppurtunity to create extensions and users that way.

Thanks in advance.

I’m not in a position to test, but is it possible that you need to escape the / character for the dial string?

dial: "PJSIP\/605",

That doesn’t make any difference.

I fiddled a bit with the error handling yesterday, and managed to get a little further - a half extension got created. It was only visible under ?display=devices and where I have “fixed” in Device Type for my manually created extensions - this only had an “f”. Maybe that is useful info?

Is there any way that I can get some more info than this “debugMessage” ?

I’ve been doing some debugging, and found where the ‘value’ error came from.

The method “addDevice” in admin/modules/core/Core.class.php is using this format:
$settings['dial']['value'] = 'PJSIP/605'
but the settings array looks like this:
$settings['dial'] = 'PJSIP/605'

I made a copy of the file, and deleted all the ['value'] occurrences.
That got me a bit further, and now I get this error: Mailbox is not in the proper format.

So now I would like to know if I’m sending a malformed mutation object or the code in Core.class.php is faulty.

Looks like there’s definitely a bug or two there. Would you mind opening a ticket at https://issues.freepbx.org so that our developers can take a look and investigate it further?

1 Like

Thanks, I’ll do that.

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.