ARI config/dynamic/

Hi,

I’m learning ARI in Asterisk, I manage to run it and get a response successfully. However, their some requests that I don’t understand what it is for, or how can I use it. I hope someone will guide me through it either by giving example or tell me which chapter of the asterisk guide book 5th edition I can look for the answer.

get /asterisk/config/dynamic/{configClass}/{objectType}/{id}
put /endpoints/sendMessage

Linux aasterisk 3.10.0-1062.9.1.el7.x86_64 #1 SMP Fri Dec 6 15:49:49 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

I'm Using Asterisk 16 cert

Routes are documented on the wiki[1][2]. The first one being for getting the configuration of an object configured using ARI push configuration. The second one being for sending a text message to an endpoint.

[1] https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Asterisk+REST+API#Asterisk13AsteriskRESTAPI-getObject
[2] https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Endpoints+REST+API#Asterisk13EndpointsRESTAPI-sendMessage

Hi Jcolp,
I did read both wikis before I ask the question. But thankfully the term ARI push configuration (which you mention :star_struck:) is the thing I was looking for, and it guides me to two good articles Here and Here

Regarding endpoint messages, dose it means sending messages like SMS (or something like it ? )

Here me tring to do it, do can you guide me where is the issue

[5XX](!)
type=friend
disallow=all
allow=ulaw
host=dynamic
context=internal
canreinvite=yes
qualify=yes
[506](5XX)
callerid = "Akkilah" <506>
secret=1234
[phone](!)
type=friend
host=dynamic
disallow=all
context=internal
allow=ulaw
;dtmf =auto
dtmf=rfc2833 
[Moha](phone)
secret=adadad

Response

{
  "message": "Error parsing request body"
}

thank you very much

It means to send a SIP MESSAGE to the endpoint. What that does or means is up to the endpoint itself. I haven’t sent a message from the Swagger-UI site, so I do not know what is precisely expected from it to have it work.

In the swagger definition and UI the SIP MESSAGE “body” is marked as a query parameter. However, for some reason the swagger UI does not let you specify it as such. Oddly enough it does let you set it as a body parameter. Try adding something like the following in the “variables” field:

{
 "body": "this is a test"
}

Note, that setting it as a query parameter in other clients like curl seems to work fine so I suspect a bug maybe in the swagger UI client.

Hi kharwell ,

Thanks a lot for your response, it worked.

However, When I tried replicating the solution for

 PUT /endpoints/sendMessage 

I get the response 202 but nothing happens at the endpoint (no SMS received )

and on the asterisk CLI, I get the following

[Mar 11 05:38:34] ERROR[8074]: message.c:1333 ast_msg_send: Unknown message tech: 506
[Mar 11 05:38:40] ERROR[8074]: message.c:1333 ast_msg_send: Unknown message tech: 506

I was wondring , why asterisk is asking me regarding tech, its not even mention in the API parametars

I believe you’re getting that message due to not specifying the tech in the to/from field. You must specify the channel tech (pjsip, sip, etc…) there. For example:

to = pjsip:506
from = pjsip:Moha

Subsequently, you can remove the “tech” key/value from the variables object.

Yes its worked thanks a lot.

I tried SIP/506 before but not SIP:506.
There something I relies SMS before use to come from Moha (name of the sender ) now its coming with Asterisk as sender, do you have idea why ?

I’m not sure how chan_sip works in this regard. Make sure the “from” field is being set, and maybe check the “fromuser” setting on the peer? Maybe someone else has a better idea?

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