<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Hello,</p>
    <p>I recently opened a issue regarding SIP headers handling in
      inbound messages
      (<a class="moz-txt-link-freetext" href="https://issues.asterisk.org/jira/browse/ASTERISK-28755">https://issues.asterisk.org/jira/browse/ASTERISK-28755</a>).</p>
    <p>Besides that problem, I think there are inconsistencies in the
      data format provided by ARI for sending or receiving text
      messages, and also in the documentation. Actually there are 3
      different data formats for message variables:<br>
    </p>
    <p>1- to send a message, additional variables may be provided in a
      "variables" field. Its value must be a JSON object whose keys are
      the variable names, and values are the variable values, i.e:</p>
    <p><tt>...<br>
        "variables": { </tt><tt><tt>"My-Custom-Header": "the_value", </tt></tt><tt><tt>"Another-header":
          "another_value"</tt> }<br>
      </tt></p>
    <p>2- when a message is received, a TextMessageReceived is emitted,
      which contains a TextMessage which then contains a "variable"
      field. This field is a list of JSON objects, each one containing a
      single key (the variable name) with its value :</p>
    <p><tt>...<br>
        "variables": [{ "My-Custom-Header": "the_value" }, {
        "Another-header": "another_value" }]</tt><br>
    </p>
    <p>(This is what I saw after quick-fixing the issue stated above)</p>
    <p>3- the behaviour described in (2) is not consistent with the ARI
      documentation, which states:</p>
    <p>TextMessageVariable: A key/value pair variable in a text message.<br>
      <br>
          key: string - A unique key identifying the variable.<br>
          value: string - The value of the variable.<br>
    </p>
    <p>So I would expect the variable field to look like the following:</p>
    <p><tt>...<br>
        "variables": [{ "key": "My-Custom-Header", "value": "the_value"
        }, { "key": "Another-header", "value": "another_value" }]</tt></p>
    <p>I personally think formats (1) and (3) both make sense, but I
      find format (2) not very practical to use. Any thoughts on the
      subject ?</p>
    <p>Regards,<br>
      <tt></tt></p>
    <div class="moz-signature">-- <br>
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <title></title>
      <p><span style="mso-bookmark: _MailAutoSig"><span
            style="mso-fareast-font-family: "Times New Roman";
            mso-fareast-theme-font: minor-fareast; mso-fareast-language:
            FR; mso-bidi-font-weight: bold; mso-no-proof: yes"><br>
          </span></span> </p>
      <div class="moz-signature">
        <div class="moz-signature">
          <div class="moz-signature">
            <div class="moz-signature">
              <div class="moz-signature">
                <table class="ng-scope" style="box-sizing: border-box;
                  border-collapse: collapse; border-spacing: 0px;
                  background-color: rgb(255, 255, 255); font-size: 12px;
                  color: rgb(68, 68, 68); font-style: normal;
                  font-variant-ligatures: normal; font-variant-caps:
                  normal; font-weight: 400; letter-spacing: normal;
                  text-align: start; text-indent: 0px; text-transform:
                  none; white-space: normal; word-spacing: 0px;
                  -webkit-text-stroke-width: 0px; text-decoration-style:
                  initial; text-decoration-color: initial;"
                  cellspacing="0" cellpadding="0">
                  <tbody style="box-sizing: border-box;">
                    <tr style="box-sizing: border-box;">
                      <td style="box-sizing: border-box; padding: 0px
                        15px 0px 0px; border-right: 2px solid rgb(15,
                        77, 188); text-align: right; vertical-align:
                        top;" valign="top">
                        <table style="box-sizing: border-box;
                          border-collapse: collapse; border-spacing:
                          0px; background-color: transparent; font-size:
                          12px; margin-right: 0px; margin-left: auto;"
                          width="172" height="125" cellspacing="0"
                          cellpadding="0">
                          <tbody style="box-sizing: border-box;">
                            <tr style="box-sizing: border-box;"
                              align="left">
                              <td style="box-sizing: border-box;
                                padding: 0px; height: 55px;
                                vertical-align: top; text-align: right;"
                                valign="top"><font size="+2"
                                  face="Roboto"><span class="ng-binding"
                                    style="box-sizing: border-box;
                                    font-size: 12pt; font-weight: bold;">Jean
                                    AUNIS </span></font><font size="-2"
                                  face="Roboto"><span class="ng-binding"
                                    style="box-sizing: border-box;
                                    font-size: 14pt; font-weight: bold;"><span
                                      class="ng-scope"
                                      style="box-sizing: border-box;"><br
                                        style="box-sizing: border-box;">
                                    </span></span></font><font size="-2"
                                  face="Roboto"><span class="ng-binding"
                                    style="box-sizing: border-box;
                                    font-size: 14pt; font-weight: bold;"><span
                                      class="ng-scope"
                                      style="box-sizing: border-box;"></span></span><span
                                    class="ng-binding ng-scope"
                                    style="box-sizing: border-box;
                                    font-size: 8pt;"><br>
                                    Ingénieur R&D<br>
                                    R&D engineer</span></font><font
                                  size="-2" face="Roboto"><span
                                    class="ng-binding ng-scope"
                                    style="box-sizing: border-box;
                                    font-size: 8pt;"><br>
                                  </span></font></td>
                            </tr>
                            <tr class="ng-scope" style="box-sizing:
                              border-box;" align="left">
                              <td style="box-sizing: border-box;
                                padding: 0px; height: 40px;
                                vertical-align: top; text-align: right;"
                                valign="top"><font size="-2"
                                  face="Roboto"><span class="ng-binding
                                    ng-scope" style="box-sizing:
                                    border-box; font-size: 8pt;"><br>
                                    Tel : +33 1 30 85 90 22<span
                                      class="ng-scope"
                                      style="box-sizing: border-box;"><br
                                        style="box-sizing: border-box;">
                                    </span></span><span
                                    class="ng-binding ng-scope"
                                    style="box-sizing: border-box;
                                    font-size: 8pt;">Standard: +33 1 30
                                    85 55 55<br>
                                  </span></font></td>
                            </tr>
                          </tbody>
                        </table>
                      </td>
                      <td style="box-sizing: border-box; padding: 0px
                        0px 0px 15px; font-size: 1pt; vertical-align:
                        top;" valign="top">
                        <table style="box-sizing: border-box;
                          border-collapse: collapse; border-spacing:
                          0px; background-color: transparent; font-size:
                          12px;" cellspacing="0" cellpadding="0">
                          <tbody style="box-sizing: border-box;">
                            <tr style="box-sizing: border-box;"
                              align="center">
                              <td style="box-sizing: border-box;
                                padding: 0px; height: 55px;
                                vertical-align: top;" valign="top"><img
src="cid:part1.05A1734C.7B4EAEF5@prescom.fr" alt=""></td>
                            </tr>
                            <tr class="ng-scope" style="box-sizing:
                              border-box;">
                              <td style="box-sizing: border-box;
                                padding: 0px; height: 40px;
                                vertical-align: top;" valign="top"><font
                                  size="-2" face="Roboto"><span
                                    class="ng-binding ng-scope"
                                    style="box-sizing: border-box;
                                    font-size: 8pt;">   Rue de Broglie <br>
                                       22300 LANNION<span
                                      class="ng-scope"
                                      style="box-sizing: border-box;"><br
                                        style="box-sizing: border-box;">
                                    </span></span><span
                                    class="ng-binding ng-scope"
                                    style="box-sizing: border-box;
                                    font-size: 8pt;">   FRANCE<br>
                                  </span></font></td>
                            </tr>
                            <tr class="ng-scope" style="box-sizing:
                              border-box;">
                              <td style="box-sizing: border-box;
                                padding: 0px; height: 20px;
                                vertical-align: middle;" valign="middle"><font
                                  size="-2" face="Roboto"><a
                                    href="http://www.prescom.fr/"
                                    target="_blank" class="ng-binding"
                                    style="box-sizing: border-box;
                                    background-color: transparent;
                                    color: rgb(15, 77, 188);
                                    text-decoration: none; font-size:
                                    8pt;"><font face="Roboto"><span
                                        class="ng-binding ng-scope"
                                        style="box-sizing: border-box;
                                        font-size: 8pt;"><font
                                          face="Roboto"><span
                                            class="ng-binding ng-scope"
                                            style="box-sizing:
                                            border-box; font-size: 8pt;"><font
                                              face="Roboto"><span
                                                class="ng-binding
                                                ng-scope"
                                                style="box-sizing:
                                                border-box; font-size:
                                                8pt;"><font
                                                  face="Roboto"><span
                                                    class="ng-binding
                                                    ng-scope"
                                                    style="box-sizing:
                                                    border-box;
                                                    font-size: 8pt;"><font
                                                      face="Roboto"><span
class="ng-binding ng-scope" style="box-sizing: border-box; font-size:
                                                        8pt;">   </span></font></span></font></span></font></span></font></span></font>www.prescom.fr</a></font></td>
                            </tr>
                          </tbody>
                        </table>
                      </td>
                    </tr>
                  </tbody>
                </table>
              </div>
            </div>
          </div>
          <span style="mso-bookmark: _MailAutoSig"><span
              style="mso-fareast-font-family: "Times New
              Roman"; mso-fareast-theme-font: minor-fareast;
              mso-fareast-language: FR; mso-no-proof: yes"></span></span><span
            style="mso-bookmark: _MailAutoSig"></span>
          <div class="moz-signature">
            <div class="moz-signature">
              <div class="moz-signature">
                <p class="MsoNormal"><span style="mso-bookmark:
                    _MailAutoSig"><span style="mso-fareast-font-family:
                      "Times New Roman";
                      mso-fareast-theme-font: minor-fareast;
                      mso-fareast-language: FR; mso-no-proof: yes"> <font
                        size="-2"><i>"Les informations contenues dans ce
                          courrier sont données à titre purement
                          informatif et ne peuvent être considérées
                          comme contractuelles entre les récipiendaires,
                          <br>
                          la société PRESCOM." </i></font></span></span><font
                    size="-2"><span style="mso-bookmark: _MailAutoSig"><i><span
                          style="mso-fareast-font-family: "Times
                          New Roman"; mso-fareast-theme-font:
                          minor-fareast; mso-fareast-language: FR;
                          mso-no-proof: yes; mso-ansi-language: EN-US"
                          lang="EN-US">"The content of this e-mail is
                          purely for information and may not be
                          considered as contractual between the
                          recipients, PRESCOM company."</span></i></span></font></p>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </body>
</html>