@Akkilah posted a new topic, subject "ARI config/dynamic/". It read:

   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
    [code] 
        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
        
    [/code]

Then @jcolp said

    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

After which, @Akkilah added

    Hi Jcolp,  
    I did read both wikis before I ask the question. But thankfully the term ARI push configuration ( **which you mention** ) 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
    [code] 
        [5XX](!)
        type=friend
        disallow=all
        allow=ulaw
        host=dynamic
        context=internal
        canreinvite=yes
        qualify=yes
        
    [/code]
    [code] 
        [506](5XX)
        callerid = "Akkilah" <506>
        secret=1234
        
    [/code]
    [code] 
        [phone](!)
        type=friend
        host=dynamic
        disallow=all
        context=internal
        allow=ulaw
        ;dtmf =auto
        dtmf=rfc2833 
        
    [/code]
    [code] 
        [Moha](phone)
        secret=adadad
        
    [/code]
    
    Screenshot from 2020-03-10 16-43-46960×590 45.5 KB
    
    Response
    [code] 
        {
          "message": "Error parsing request body"
        }
        
    [/code]
    
    thank you very much

To which @jcolp replied

    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.

@kharwell replied

    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:
    [code] 
        {
         "body": "this is a test"
        }
        
    [/code]
    
    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.

So @Akkilah replied

    Hi kharwell ,
    
    Thanks a lot for your response, it worked.
    
    However, When I tried replicating the solution for
    [code] 
         PUT /endpoints/sendMessage 
        
    [/code]
    
    I get the response 202 but nothing happens at the endpoint (no SMS received )
    
    Screenshot from 2020-03-11 12-40-31569×613 33 KB
    
    and on the asterisk CLI, I get the following
    [code] 
        [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
        
        
    [/code]
    
    I was wondring , why asterisk is asking me regarding tech, its not even mention in the API parametars

@kharwell replied

    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.

Then @Akkilah said

    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 ?

Then @kharwell said

    Akkilah:
    
    > 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?

After which, @system added

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


{'source': 'discourse', 'url': 'https://community.asterisk.org/t/ari-config-dynamic/83045', 'title': 'ARI config/dynamic/', 'views': 690, 'has_accepted_answer': True, 'word_count': 784, 'like_count': 0, 'reply_count': 6, 'participant_count': 3, 'posts': 10, 'tags': '', 'author': '@Akkilah', 'participants': '@Akkilah, @jcolp, @kharwell, @system', 'image_url': [None], 'created_at': '2020-03-10T12:34:09.879Z', 'last_posted_at': '2020-04-10T19:16:20.938Z'}