<div dir="ltr"><div class="gmail_quote"><br><div dir="ltr">Matt, Thank you for the detailed response.  I have replied to the correct mailing list (asterisk-app-dev).  <div><br></div><div>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: <a href="https://wiki.asterisk.org/wiki/display/AST/Introduction+to+ARI+and+Channels" target="_blank">https://wiki.asterisk.org/wiki/display/AST/Introduction+to+ARI+and+Channels</a><div>


<br></div><div>I will take what you posted and read the new information and do some testing.</div><div class=""><div><br></div><div>> What do you mean by prefix? An example of what flowroute is looking for would help here.</div>
<div>

<br></div></div><div>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:</div><div><br>
</div>
<div>
exten => _1NXXXXXXXXX,1,Dial(SIP/123456789*${EXTEN}@flowroute)</div><div><br></div><div>Assuming 123456789 is my prefix.</div><div><br></div><div>How does this translate to an endpoint?  Do I need to manually prepend the prefix when POSTing to URL.  Like</div>


<div><br></div><div>POST /channels?endpoint=PJSIP/123456789*5555551212@flowroute&app=my_awesome_app</div><div><br></div><div><br></div><div>Thanks,</div><div>Chris<div><div class="h5"><br><div class="gmail_extra"><br>
<br><div class="gmail_quote">

On Fri, Aug 22, 2014 at 10:30 AM, Matthew Jordan <span dir="ltr"><<a href="mailto:mjordan@digium.com" target="_blank">mjordan@digium.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">


<div>On Fri, Aug 22, 2014 at 8:55 AM, Chris Bestall <<a href="mailto:chris.bestall@gmail.com" target="_blank">chris.bestall@gmail.com</a>> wrote:<br>
> I'm sorry if this has been asked before, but I've googled and not found much<br>
> in the way of help.<br>
<br>
</div>Just as an FYI, you may want to e-mail these kinds of questions to the<br>
asterisk-app-dev mailing list.<br>
<br>
We've also started doing a major documentation push for ARI on the<br>
Asterisk wiki [1] - hopefully we'll get more of these kinds of<br>
questions answered via those pages.<br>
<div><br>
> I'm using Asterisk 12 and the new PJSIP driver.  I'm also trying to use ARI<br>
> to originate a call.<br>
><br>
> What I'm confused by is the difference between an endpoint and an extension.<br>
> When I use the ARI to originate a call I am required to pass in an endpoint.<br>
> Do extensions even matter on outgoing calls when using PJSIP?<br>
<br>
</div>There's a number of terminology definitions that are colliding here.<br>
>From the perspective of ARI and the dialplan, the PJSIP channel driver<br>
doesn't really have anything to do with this. So the following is more<br>
of an answer to "What is an endpoint when creating a channel through<br>
ARI".<br>
<br>
An extension is a dialplan concept. It is generally a specific<br>
location in a context, where its full addressable address is a tuple<br>
of context, extension, priority.<br>
<br>
When you are using ARI, you have channels that have been handed to you<br>
from the dialplan. You exist as an application within the dialplan -<br>
since the Stasis dialplan application handed you the channels - but<br>
you aren't constrained by the dialplan. You can do whatever you want<br>
with those channels, and don't have to do so within the constraints of<br>
dialplan execution.<br>
<br>
So, an endpoint - from the perspective of ARI - is some identifier<br>
that a channel driver will understand as the thing that can have a<br>
path of communication between itself and Asterisk. That could be a<br>
chan_sip peer, it could be a chan_pjsip endpoint. It could even be a<br>
location in the dialplan, i.e., extension, via a Local channel. So<br>
when the POST /channels documentation [2] says:<br>
<br>
"endpoint: string - (required) Endpoint to call."<br>
<br>
that means it wants your dial string.<br>
<br>
You could create a channel directly to a chan_sip peer:<br>
<br>
POST /channels?endpoint=SIP/alice&app=my_awesome_app<br>
<br>
Or to a chan_pjsip endpoint:<br>
<br>
POST /channels?endpoint=PJSIP/alice&app=my_awesome_app<br>
<br>
Or, like I said, you could create a path between your ARI app and<br>
something else in the dialplan. In this case, the "endpoint" is the<br>
location in the dialplan you're creating a channel to:<br>
<br>
POST /channels?endpoint=Local/1000@default&app=my_awesome_app<br>
<br>
Or you could go really nutty and decide your app doesn't event want<br>
the channel! Instead, you can just spawn channels out into the<br>
dialplan and ignore them from there on:<br>
<br>
POST /channels?endpoint=PJSIP/trunk/<a href="mailto:sip%3Aalice@my_provider.net" target="_blank">sip:alice@my_provider.net</a>&context=default&extension=1000&priority=1<br>
<br>
Note that in this case, my "endpoint" from ARI's perspective is<br>
PJSIP/trunk/<a href="mailto:sip%3Aalice@my_provider.net" target="_blank">sip:alice@my_provider.net</a>, which is dialling a SIP URI<br>
through the PJSIP endpoint "trunk". What an endpoint is depends on the<br>
frame of reference.<br>
<br>
I answered a similar question a few days ago here:<br>
<br>
<a href="http://lists.digium.com/pipermail/asterisk-dev/2014-August/069880.html" target="_blank">http://lists.digium.com/pipermail/asterisk-dev/2014-August/069880.html</a><br>
<div><br>
> I have a follow up question as well.<br>
><br>
> I'm trying to use flowroute to perform outgoing calls.  I need to include a<br>
> prefix when calling.  Can this done be done with endpoints via config or do<br>
> I have to include the prefix each time I enter the endpoint?<br>
<br>
</div>What do you mean by prefix? An example of what flowroute is looking<br>
for would help here.<br>
<br>
[1] <a href="https://wiki.asterisk.org/wiki/pages/viewpage.action?pageId=29395573" target="_blank">https://wiki.asterisk.org/wiki/pages/viewpage.action?pageId=29395573</a><br>
[2] <a href="https://wiki.asterisk.org/wiki/display/AST/Asterisk+12+Channels+REST+API#Asterisk12ChannelsRESTAPI-originate" target="_blank">https://wiki.asterisk.org/wiki/display/AST/Asterisk+12+Channels+REST+API#Asterisk12ChannelsRESTAPI-originate</a><br>



<br>
Matt<br>
<span><font color="#888888"><br>
--<br>
Matthew Jordan<br>
Digium, Inc. | Engineering Manager<br>
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA<br>
Check us out at: <a href="http://digium.com" target="_blank">http://digium.com</a> & <a href="http://asterisk.org" target="_blank">http://asterisk.org</a><br>
</font></span></blockquote></div><br></div></div></div></div></div></div>
</div><br></div>