1

I'm trying to send an SMS to Plivo using Orion notifications. This is how I subscribe my notification:

curl localhost:1026/v2/subscriptions -s -S --header 'Content-Type: application/json' --header 'Accept: application/json'  -d @- <<EOF
{
  "description": "A subscription to get info about WS_UPPA_Sensor2",
  "subject": {
    "entities": [
      {
        "id": "Sensor1",
        "type": "SensingDevice"
      }
    ],
    "condition": {
      "attrs": [
        "temperature"
      ]
    }
  },
  "notification": {
    "httpCustom": {
      "url": "https://api.plivo.com/v1/Account/MAMDA5ZDJIMDM1NZVMZD/Message/",
      "headers": {
         "Authorization": "Basic TUFNREE1WkRKSU1ETTFOWlZNWkQ6WXpoaU5ESmpPRE5oTkRreE1qaGlZVGd4WkRkaE5qYzNPV1ZsTnpZMA=="
      },
      "payload": "{%22src%22%3A%2200393806412092%22%2C%22dst%22%3A%2200393806412093%22%2C%22text%22%3A%22test%20SMS%20from%20Waziup%22}"

    },
    "attrs": [
      "temperature"
    ]
  },
  "expires": "2040-01-01T14:00:00.00Z",
  "throttling": 5
}
EOF

I receive this error:

{"error":"BadRequest","description":"forbidden characters in custom notification httpCustom headers"}

The basic authentication header contains an "=", which is forbidden in Orion. How to do? Thanks!

cdupont
  • 1,138
  • 10
  • 17
  • Have you tried to encode `=` in the headers key-map in the same way you encode in `payload` field? I mean, using `%3D` for each `=` (according to this http://www.degraeve.com/reference/urlencoding.php)? Looking to the code, I think is not going to work, but I would like to discard that completely before continue, please. Thx! – fgalan May 18 '17 at 18:50
  • @fgalan It doesn't seem to work. Orion accepts the notification, but Plivo doesn't send the SMS. How to see the error returned by Plivo in Orion? I don't see it in the logs. – cdupont May 19 '17 at 09:13
  • I guess you mean that "Orion accetps the *subscription*". Is that correct? – fgalan May 19 '17 at 17:19
  • I'm not fully sure how to check that in the logs (it should be done using a given tracelevel with `-t` but looking to the `startSenderThread()` code I'm not so sure). However, you could use an external tool (e.g. Wireshark) to get that response. – fgalan May 19 '17 at 17:29
  • My theory here (but you test is important to confirm) is that Orion will not decode. I mean, it will use `%3D` in the header in the outgoing HTTP request. – fgalan May 19 '17 at 17:30
  • Side-node: after looking `startSenderThread()`, my conclusion is that current Orion version is unable to log notification request/response payload (although modifying the source code to do so would be easey, see https://github.com/telefonicaid/fiware-orion/issues/2895). – fgalan May 19 '17 at 18:24

0 Answers0