[asterisk-dev] ARI Text messaging : inconsistencies in the API ?

Jean Aunis jean.aunis at prescom.fr
Tue Feb 25 04:43:42 CST 2020


Hello,

I recently opened a issue regarding SIP headers handling in inbound 
messages (https://issues.asterisk.org/jira/browse/ASTERISK-28755).

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:

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:

...
"variables": { "My-Custom-Header": "the_value", "Another-header": 
"another_value" }

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 :

...
"variables": [{ "My-Custom-Header": "the_value" }, { "Another-header": 
"another_value" }]

(This is what I saw after quick-fixing the issue stated above)

3- the behaviour described in (2) is not consistent with the ARI 
documentation, which states:

TextMessageVariable: A key/value pair variable in a text message.

     key: string - A unique key identifying the variable.
     value: string - The value of the variable.

So I would expect the variable field to look like the following:

...
"variables": [{ "key": "My-Custom-Header", "value": "the_value" }, { 
"key": "Another-header", "value": "another_value" }]

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 ?

Regards,

-- 


Jean AUNIS

Ingénieur R&D
R&D engineer

Tel : +33 1 30 85 90 22
Standard: +33 1 30 85 55 55

	
    Rue de Broglie
    22300 LANNION
    FRANCE
www.prescom.fr <http://www.prescom.fr/>

/"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,
la société PRESCOM." //"The content of this e-mail is purely for 
information and may not be considered as contractual between the 
recipients, PRESCOM company."/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20200225/b3044698/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: acdablmkfjjojald.png
Type: image/png
Size: 5275 bytes
Desc: not available
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20200225/b3044698/attachment.png>


More information about the asterisk-dev mailing list