Re: [asterisk-dev] Endpoints vs Extensions

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

 




Matt, Thank you for the detailed response.  I have replied to the correct mailing list (asterisk-app-dev).  

I have read the ARI portion of the wiki many times, though looks like a lot of new information is up at the URL you posted since I last visited: https://wiki.asterisk.org/wiki/display/AST/Introduction+to+ARI+and+Channels

I will take what you posted and read the new information and do some testing.

> What do you mean by prefix? An example of what flowroute is looking for would help here.

Flowroute supports IP based authentication for outgoing calls, but I also need to prepend a prefix before any number when sending an outgoing call.  The old extension looked like this:

exten => _1NXXXXXXXXX,1,Dial(SIP/123456789*${EXTEN}@flowroute)

Assuming 123456789 is my prefix.

How does this translate to an endpoint?  Do I need to manually prepend the prefix when POSTing to URL.  Like

POST /channels?endpoint=PJSIP/123456789*5555551212@flowroute&app=my_awesome_app


Thanks,
Chris



On Fri, Aug 22, 2014 at 10:30 AM, Matthew Jordan <mjordan@xxxxxxxxxx> wrote:
On Fri, Aug 22, 2014 at 8:55 AM, Chris Bestall <chris.bestall@xxxxxxxxx> wrote:
> I'm sorry if this has been asked before, but I've googled and not found much
> in the way of help.

Just as an FYI, you may want to e-mail these kinds of questions to the
asterisk-app-dev mailing list.

We've also started doing a major documentation push for ARI on the
Asterisk wiki [1] - hopefully we'll get more of these kinds of
questions answered via those pages.

> I'm using Asterisk 12 and the new PJSIP driver.  I'm also trying to use ARI
> to originate a call.
>
> What I'm confused by is the difference between an endpoint and an extension.
> When I use the ARI to originate a call I am required to pass in an endpoint.
> Do extensions even matter on outgoing calls when using PJSIP?

There's a number of terminology definitions that are colliding here.
>From the perspective of ARI and the dialplan, the PJSIP channel driver
doesn't really have anything to do with this. So the following is more
of an answer to "What is an endpoint when creating a channel through
ARI".

An extension is a dialplan concept. It is generally a specific
location in a context, where its full addressable address is a tuple
of context, extension, priority.

When you are using ARI, you have channels that have been handed to you
from the dialplan. You exist as an application within the dialplan -
since the Stasis dialplan application handed you the channels - but
you aren't constrained by the dialplan. You can do whatever you want
with those channels, and don't have to do so within the constraints of
dialplan execution.

So, an endpoint - from the perspective of ARI - is some identifier
that a channel driver will understand as the thing that can have a
path of communication between itself and Asterisk. That could be a
chan_sip peer, it could be a chan_pjsip endpoint. It could even be a
location in the dialplan, i.e., extension, via a Local channel. So
when the POST /channels documentation [2] says:

"endpoint: string - (required) Endpoint to call."

that means it wants your dial string.

You could create a channel directly to a chan_sip peer:

POST /channels?endpoint=SIP/alice&app=my_awesome_app

Or to a chan_pjsip endpoint:

POST /channels?endpoint=PJSIP/alice&app=my_awesome_app

Or, like I said, you could create a path between your ARI app and
something else in the dialplan. In this case, the "endpoint" is the
location in the dialplan you're creating a channel to:

POST /channels?endpoint=Local/1000@default&app=my_awesome_app

Or you could go really nutty and decide your app doesn't event want
the channel! Instead, you can just spawn channels out into the
dialplan and ignore them from there on:

POST /channels?endpoint=PJSIP/trunk/sip:alice@my_provider.net&context=default&extension=1000&priority=1

Note that in this case, my "endpoint" from ARI's perspective is
PJSIP/trunk/sip:alice@my_provider.net, which is dialling a SIP URI
through the PJSIP endpoint "trunk". What an endpoint is depends on the
frame of reference.

I answered a similar question a few days ago here:

http://lists.digium.com/pipermail/asterisk-dev/2014-August/069880.html

> I have a follow up question as well.
>
> I'm trying to use flowroute to perform outgoing calls.  I need to include a
> prefix when calling.  Can this done be done with endpoints via config or do
> I have to include the prefix each time I enter the endpoint?

What do you mean by prefix? An example of what flowroute is looking
for would help here.

[1] https://wiki.asterisk.org/wiki/pages/viewpage.action?pageId=29395573
[2] https://wiki.asterisk.org/wiki/display/AST/Asterisk+12+Channels+REST+API#Asterisk12ChannelsRESTAPI-originate

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