ARI resource for technology agnostic messaging

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hey all:

I've been thinking through how to handle technology agnostic messaging
in ARI. Since Asterisk 10, we've had the ability to send/receive
messages in Asterisk (either SIP or XMPP) using the dialplan in a
cohesive fashion. Outbound messages are sent using the MessageSend
dialplan application/AMI action; inbound messages are handled by a
special purpose channel driver (Message) in the dialplan. Various
functions (MESSAGE, MESSAGE_DATA) allow for extraction of message
information from the received text message.

While the existing process works, there's some drawbacks to it.

(1) The dialplan is not an ideal place to process a text message.
Doing a lot of string manipulations in the dialplan is not much fun.
(2) Dispatching the channel servicing the message to a Stasis dialplan
application (or to AGI, or any other externally controlled entity) is
not ideal, as only a single instance of the channel driver exists to
serve all messages. What's more, as a special purpose channel driver,
there are many operations that could be executed on a 'normal' channel
that would have odd effects on the Message channel. This creates a
burden on the consumer of Asterisk to know what is acceptable and what
is not.

Ideally, we'd have a mechanism in ARI to send messages to SIP/XMPP
endpoints/URIs and to be notified over the WebSocket when a message
arrives at Asterisk that an application is interested in. This would
never hit the dialplan: posting to a REST resource to send a message
would get dispatched to the appropriate channel driver immediately;
receiving a message would simply send an event out over the WebSocket.

This should be possible with only minimal changes in Asterisk's messaging core.

I've written a proposal up on the wiki for this here:

https://wiki.asterisk.org/wiki/x/ew6wAQ

---- The highlights ----

Allow sending a message to an endpoint through the endpoints resource:

POST /endpoints/PJSIP/alice/message
{
    "from": "pjsip:bob",
    "body": "I am the very model of a major general"
    "variables": [
        { "X-Foo-Bar": "I am a special header" },
        { "X-Foo-Yack": "I am not" },
    ],
}

Alternatively, if who you are sending the message to is a bit more
arbitrary, simply send it directly to the technology and let the
technology sort it out:

POST /endpoints/PJSIP/message
{
    "from": "xmpp:bob@xxxxxxxxxx",
    "to": "pjsip:generic/sip:alice@xxxxxxxxxxxxxxx"
    "body": "No, *I* am the very model of a major general"
}

Subscribing to an endpoint subscribes you to messages that are sent
to/received from that endpoint:

{
    "type": "MessageReceived",
    "from": "pjsip:alice",
    "to": "\"bob\" <bob@my_asterisk_server.org>",
    "body": "Who's the major general now?",
    "variables": [
        {"SIP_RECVADDR", "127.0.0.1"},
    ],
}

And that's about it.

Enabling this functionality is pretty interesting - some SIP providers
transform SIP MESSAGE requests into SMS messages; an XMPP chat room
could be monitored such that a participant could choose to cause an
audio conference to be automatically created and all current
participants dialled; applications could use SIP and XMPP to send
arbitrary messages to their Asterisk server to control their ARI
application. Lots of 'unified communication' possibilities in there.

Thoughts & comments appreciated -

Matt

-- 
Matthew Jordan
Digium, Inc. | Engineering Manager
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at: http://digium.com & http://asterisk.org

_______________________________________________
asterisk-app-dev mailing list
asterisk-app-dev@xxxxxxxxxxxxxxxx
http://lists.digium.com/cgi-bin/mailman/listinfo/asterisk-app-dev




[Index of Archives]     [Asterisk SS7]     [Asterisk Announcements]     [Asterisk Users]     [PJ SIP]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Linux API]

  Powered by Linux