<div dir="ltr"><font face="arial, helvetica, sans-serif">Ok, I'm now looking into implementing a similar thing with the "continue" request. </font><div><font face="arial, helvetica, sans-serif">The main issue that I'm seeing is this - the </font><span style="color:rgb(0,0,0);line-height:21px"><font face="courier new, monospace">ast_findlabel_extension </font><font face="arial, helvetica, sans-serif">function, </font><br><font face="arial, helvetica, sans-serif">requires a channel and a callerid. </font></span></div><div><span style="color:rgb(0,0,0);line-height:21px"><font face="arial, helvetica, sans-serif"><br></font></span></div><div><span style="font-family:arial,helvetica,sans-serif;color:rgb(0,0,0);line-height:21px">I've tried ascertaining how i can obtain that information from within the <br></span><font color="#000000"><span style="line-height:21px"><font face="courier new, monospace">ast_ari_channels_continue_in_dialplan </font><font face="arial, helvetica, sans-serif">function, but had failed to </font></span></font><span style="line-height:21px;color:rgb(0,0,0);font-family:arial,helvetica,sans-serif">do so. </span></div><div><font color="#000000" face="arial, helvetica, sans-serif"><span style="line-height:21px"><br></span></font></div><div><font color="#000000" face="arial, helvetica, sans-serif"><span style="line-height:21px">Any pointers?</span></font></div><div><font color="#000000" face="arial, helvetica, sans-serif"><span style="line-height:21px"><br></span></font></div><div><font color="#000000" face="arial, helvetica, sans-serif"><span style="line-height:21px">Nir S</span></font></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Oct 13, 2014 at 1:52 AM, Nir Simionovich <span dir="ltr"><<a href="mailto:nir.simionovich@gmail.com" target="_blank">nir.simionovich@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Ok, <div><br></div><div> I've opened an issue on JIRA (<a href="https://issues.asterisk.org/jira/browse/ASTERISK-24412" target="_blank">https://issues.asterisk.org/jira/browse/ASTERISK-24412</a>) with a small patch submission<br>that will correct the issue at hand - for the originate requests at this point. </div><div><br></div><div> Basically, before moving forward, I'd like to make sure I'm not off base with the implementation - and that I've done it right.</div><div>It's the first time I'm touching that side of the code, so I would appreciate the assistance and feedback.</div><div><br></div><div>Cheers,</div><div>Nir S</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Oct 12, 2014 at 12:46 AM, Nir Simionovich <span dir="ltr"><<a href="mailto:nir.simionovich@gmail.com" target="_blank">nir.simionovich@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">So, here's what I thought - instead of modifying the existing JSON, changing from "int" to "string" in priority, I think the better<br>way would be to add a new variable - "label". If defined, it will supersede the "priority". Judging from what I see in the code,<br>the "arguments" from the JSON POST are contained in the *args buffer, so I should now have an args->label in there.<div><br></div><div>So, if I'm not mistaken, the following should translate from the label to the priority:ast_find_label_extension.</div><div><br></div><div>So, I would need to add a "label" argument to ari_channels_handle_originate_with_id. However, and correct me if I'm wrong,<br>it would seem to me that the actual channel origination is performed using 'ast_pbx_outgoing_exten', and that would <br>return back the 'ast_channel' structure back to *chan in ari_channels_handle_originate_with_id. </div><div><br></div><div>Makes the entire thing kind'a tricky - no?</div><div><br></div><div> <br></div></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Oct 10, 2014 at 9:48 PM, Scott Griepentrog <span dir="ltr"><<a href="mailto:sgriepentrog@digium.com" target="_blank">sgriepentrog@digium.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div style="color:#660000">Yes, that's the function that converts a label to a priority. You should be able to use that to enable label lookup from the rest api.</div></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Oct 10, 2014 at 1:38 PM, Nir Simionovich <span dir="ltr"><<a href="mailto:nir.simionovich@gmail.com" target="_blank">nir.simionovich@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Well,<div><br></div><div> Can I assume you are referring to the following section in the code (pbx.c):</div><div><br></div><div><pre style="font-family:monospace,fixed;font-size:13px;border:1px solid rgb(204,204,204);margin:4px 8px 4px 2px;padding:4px 6px;color:rgb(0,0,0);background-color:rgb(245,245,245)">12371 <span style="color:rgb(224,128,0)">if</span> (sscanf(pri, <span style="color:rgb(0,32,128)">"%30d"</span>, &ipri) != 1) {
<a name="149069054b6f122b_149012d4633ab04c_148fb63f843bd175_148fb5b29b62ec8e_l12372" style="color:rgb(26,65,168)"></a>12372 ipri = <a href="http://doxygen.asterisk.org/trunk/db/de0/pbx_8h.html#0be9518646cf9aca4878b313cc02e901" title="Find the priority of an extension that has the specified label." style="color:rgb(0,0,255);text-decoration:none" target="_blank">ast_findlabel_extension</a>(chan, context ? context : <a href="http://doxygen.asterisk.org/trunk/d5/d7b/channel_8h.html#582dee4d5ea9b2ff6f309f0c5239f6bd" style="color:rgb(0,0,255);text-decoration:none" target="_blank">ast_channel_context</a>(chan),
<a name="149069054b6f122b_149012d4633ab04c_148fb63f843bd175_148fb5b29b62ec8e_l12373" style="color:rgb(26,65,168)"></a>12373 exten ? exten : <a href="http://doxygen.asterisk.org/trunk/d5/d7b/channel_8h.html#a8b52fbc8168e939bc5553502367d46a" style="color:rgb(0,0,255);text-decoration:none" target="_blank">ast_channel_exten</a>(chan), pri,
<a name="149069054b6f122b_149012d4633ab04c_148fb63f843bd175_148fb5b29b62ec8e_l12374" style="color:rgb(26,65,168)"></a>12374 <a href="http://doxygen.asterisk.org/trunk/d6/d90/strings_8h.html#38a896048b2ca84076864505f0aa8f01" title="returns the equivalent of logic or for strings, with an additional boolean check:..." style="color:rgb(0,0,255);text-decoration:none" target="_blank">S_COR</a>(<a href="http://doxygen.asterisk.org/trunk/d5/d7b/channel_8h.html#c2dc872b606534943c98304aed841b34" style="color:rgb(0,0,255);text-decoration:none" target="_blank">ast_channel_caller</a>(chan)-><span style="color:rgb(96,64,32)">id</span>.<a href="http://doxygen.asterisk.org/trunk/d6/d49/structnumber.html" title="Number structure." style="color:rgb(0,0,255);text-decoration:none" target="_blank">number</a>.valid, <a href="http://doxygen.asterisk.org/trunk/d5/d7b/channel_8h.html#c2dc872b606534943c98304aed841b34" style="color:rgb(0,0,255);text-decoration:none" target="_blank">ast_channel_caller</a>(chan)-><span style="color:rgb(96,64,32)">id</span>.<a href="http://doxygen.asterisk.org/trunk/d6/d49/structnumber.html" title="Number structure." style="color:rgb(0,0,255);text-decoration:none" target="_blank">number</a>.str, <a href="http://doxygen.asterisk.org/trunk/dc/d7f/resample_8c.html#070d2ce7b6bb7e5c05602aa8c308d0c4" style="color:rgb(0,0,255);text-decoration:none" target="_blank">NULL</a>));
<a name="149069054b6f122b_149012d4633ab04c_148fb63f843bd175_148fb5b29b62ec8e_l12375" style="color:rgb(26,65,168)"></a>12375 <span style="color:rgb(224,128,0)">if</span> (ipri < 1) {
<a name="149069054b6f122b_149012d4633ab04c_148fb63f843bd175_148fb5b29b62ec8e_l12376" style="color:rgb(26,65,168)"></a>12376 <a href="http://doxygen.asterisk.org/trunk/d1/d8c/logger_8h.html#cb8ee436a0c80c66dfcdec6b6bcc6196" title="Used for sending a log message This is the standard logger function. Probably the..." style="color:rgb(0,0,255);text-decoration:none" target="_blank">ast_log</a>(<a href="http://doxygen.asterisk.org/trunk/d1/d8c/logger_8h.html#df4476a6a4ea6c74231c826e899d7189" style="color:rgb(0,0,255);text-decoration:none" target="_blank">LOG_WARNING</a>, <span style="color:rgb(0,32,128)">"Priority '%s' must be a number > 0, or valid label\n"</span>, pri);
<a name="149069054b6f122b_149012d4633ab04c_148fb63f843bd175_148fb5b29b62ec8e_l12377" style="color:rgb(26,65,168)"></a>12377 <span style="color:rgb(224,128,0)">return</span> -1;
<a name="149069054b6f122b_149012d4633ab04c_148fb63f843bd175_148fb5b29b62ec8e_l12378" style="color:rgb(26,65,168)"></a>12378 } <span style="color:rgb(224,128,0)">else</span>
<a name="149069054b6f122b_149012d4633ab04c_148fb63f843bd175_148fb5b29b62ec8e_l12379" style="color:rgb(26,65,168)"></a>12379 mode = 0;
<a name="149069054b6f122b_149012d4633ab04c_148fb63f843bd175_148fb5b29b62ec8e_l12380" style="color:rgb(26,65,168)"></a>12380 }</pre></div><div><br></div><div> If I read it correctly, line 12372 will translate a label to a priority number. </div><div><br></div><div> Am I on the right track?</div><span><font color="#888888"><div><br></div><div>Nir</div><div><br></div></font></span></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Oct 9, 2014 at 6:39 PM, Scott Griepentrog <span dir="ltr"><<a href="mailto:sgriepentrog@digium.com" target="_blank">sgriepentrog@digium.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div style="color:rgb(102,0,0)">If you want to add the label option, my first thought would be to recommend you look at the implementation of app GoTo() for the api to lookup/specify a label. Then you would need to modify the channels.json in rest_api/api-docs to specify the new/different parameters to the rest methods, do a make ari-stubs to rebuild the rest handlers, and finally make the change to the method implementation in res/ari/resource_channels.c.</div></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Oct 9, 2014 at 4:56 AM, Nir Simionovich <span dir="ltr"><<a href="mailto:nir.simionovich@gmail.com" target="_blank">nir.simionovich@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">"Forgive me father for I have sinned, it has been over 25 years since I've used GWBasic/Basica - please spare thy humble servant from doom, as I repent my sins and go back in time 25 years" :-) <div><br></div><div>Now seriously, this may work nicely for classic dialplan, but for AEL that's a no go - don't even want to think about LUA at this point. </div><div><br></div><div>Any prospects in regards to this development? I've hadn't ever dug into this part of the code, but, how does Asterisk keep the dialplan in memory? is it a simple data structure? how do labels are manifested in that data structure? </div><div><br></div><div>Point me in the right direction for the information (apart from the code itself) - and I'll have a look at it.</div><div><br></div><div>Nir S</div></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Oct 8, 2014 at 9:01 PM, Scott Griepentrog <span dir="ltr"><<a href="mailto:sgriepentrog@digium.com" target="_blank">sgriepentrog@digium.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div style="color:#660000">The only two ARI methods I'm seeing where a priority is used are:</div><div style="color:#660000"><br></div><div style="color:#660000">1) Channel origination (optionally sending channel to dialplan instead of into a Stasis app)</div><div style="color:#660000"><br></div><div style="color:#660000">2) Channel continue (jump out of application into a specific point in dialplan)</div><div style="color:#660000"><br></div><div style="color:#660000">And yes, you are correct in pointing out that the continue is using an int rather than a long, which is clearly a consistency mistake in the API.</div><div style="color:#660000"><br></div><div style="color:#660000">In both cases, the priority is given as a part of typical context/extension/priority method of addressing where exactly in the dialplan you want to send the channel to. The most common scenario is to have a priority 1 as the starting point. The other numbers (using same => n) are then sequential but arbitrary, and it is generally not necessary to know what they actually are to jump to them directly.</div><div style="color:#660000"><br></div><div style="color:#660000">As you point out, labels in dialplan are a convenient way of allowing dialplan execution to jump or goto a specific point without needing to know the actual priority number. Unfortunately, the implementation in ARI does not (currently) allow for a label to be specified. This is a limitation that should probably be fixed - possibly a topic of discussion for Astridevcon.</div><div style="color:#660000"><br></div><div style="color:#660000">For a workaround, I would suggest using arbitrarily large priorities to jump to the correct label where this functionality is needed.</div><div style="color:#660000"><br></div><div style="color:#660000">For example:</div><div style="color:#660000"><br></div><div style="color:#660000">exten => _x.,1,Answer()</div><div style="color:#660000"> same => n,GoToIf($["${GOTTAGONOW}" = "1"]?louie)</div><div style="color:#660000"> same => n,Playback(tt-monkeys)</div><div style="color:#660000"> same => n,Hangup()</div><div style="color:#660000"> same => n(louie),Playback(lyrics-louie-louie)</div><div style="color:#660000"> same => n,Hangup()</div><div style="color:#660000"><br></div><div style="color:#660000">exten => _x.,10001,GoTo(louie)</div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div>On Wed, Oct 8, 2014 at 8:33 AM, Nir Simionovich <span dir="ltr"><<a href="mailto:nir.simionovich@gmail.com" target="_blank">nir.simionovich@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div dir="ltr">Hi Guys,<div><br></div><div> While working on PHPARI, I've come to a realization that the channels REST API<br>has a slight issue - primarily, its usage of the "priority" member in the REST API.</div><div><br></div><div> Currently, the specification states that "priority" is either "int" or "long" (depending <br>on the request). </div><div><br></div><div> The problem with that is for someone like myself, who codes dialplan in AEL or<br>using the "same => n," or the "exten => _X.,n," methodology - we have no visibility<br>of priority numbers - we use labels.</div><div><br></div><div> I'm not that familiar with the ARI part of the Asterisk code yet, as I'm focused on how<br>to actually work with it, but this is somewhat of a show stopper in my book, as all my<br>existing code relies heavily on label usage.</div><div><br></div><div> Btw, I tried pushing a label into the REST interface, got a 500 error - which means <br>it's designed to work with numbers and not labels. </div><div><br></div><div>Regards,</div><div> Nir S</div><div><br></div><div><br></div></div>
<br></div></div><span><font color="#888888">--<br>
_____________________________________________________________________<br>
-- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com" target="_blank">http://www.api-digital.com</a> --<br>
<br>
asterisk-dev mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
<a href="http://lists.digium.com/mailman/listinfo/asterisk-dev" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-dev</a><br></font></span></blockquote></div><span><font color="#888888"><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><img alt="Digium logo" src="https://my.digium.com/images/graphics/digium_RGB_signature.gif" width="288" height="50" style="color:rgb(0,0,0);font-family:Arial,Helvetica,sans-serif;font-size:12px"><div>Scott Griepentrog<br>Digium, Inc · Software Developer<br>445 Jan Davis Drive NW · Huntsville, AL 35806 · US<br>direct/fax: <a href="tel:%2B1%20256%20428%206239" value="+12564286239" target="_blank">+1 256 428 6239</a> · mobile: <a href="tel:%2B1%20256%20580%206090" value="+12565806090" target="_blank">+1 256 580 6090</a><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></div></div>
</font></span></div>
<br>--<br>
_____________________________________________________________________<br>
-- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com" target="_blank">http://www.api-digital.com</a> --<br>
<br>
asterisk-dev mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
<a href="http://lists.digium.com/mailman/listinfo/asterisk-dev" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-dev</a><br></blockquote></div><br></div>
</div></div><br>--<br>
_____________________________________________________________________<br>
-- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com" target="_blank">http://www.api-digital.com</a> --<br>
<br>
asterisk-dev mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
<a href="http://lists.digium.com/mailman/listinfo/asterisk-dev" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-dev</a><br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><img alt="Digium logo" src="https://my.digium.com/images/graphics/digium_RGB_signature.gif" width="288" height="50" style="color:rgb(0,0,0);font-family:Arial,Helvetica,sans-serif;font-size:12px"><div>Scott Griepentrog<br>Digium, Inc · Software Developer<br>445 Jan Davis Drive NW · Huntsville, AL 35806 · US<br>direct/fax: <a href="tel:%2B1%20256%20428%206239" value="+12564286239" target="_blank">+1 256 428 6239</a> · mobile: <a href="tel:%2B1%20256%20580%206090" value="+12565806090" target="_blank">+1 256 580 6090</a><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></div></div>
</div>
</div></div><br>--<br>
_____________________________________________________________________<br>
-- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com" target="_blank">http://www.api-digital.com</a> --<br>
<br>
asterisk-dev mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
<a href="http://lists.digium.com/mailman/listinfo/asterisk-dev" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-dev</a><br></blockquote></div><br></div>
</div></div><br>--<br>
_____________________________________________________________________<br>
-- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com" target="_blank">http://www.api-digital.com</a> --<br>
<br>
asterisk-dev mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
<a href="http://lists.digium.com/mailman/listinfo/asterisk-dev" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-dev</a><br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><img alt="Digium logo" src="https://my.digium.com/images/graphics/digium_RGB_signature.gif" width="288" height="50" style="color:rgb(0,0,0);font-family:Arial,Helvetica,sans-serif;font-size:12px"><div>Scott Griepentrog<br>Digium, Inc · Software Developer<br>445 Jan Davis Drive NW · Huntsville, AL 35806 · US<br>direct/fax: <a href="tel:%2B1%20256%20428%206239" value="+12564286239" target="_blank">+1 256 428 6239</a> · mobile: <a href="tel:%2B1%20256%20580%206090" value="+12565806090" target="_blank">+1 256 580 6090</a><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></div></div>
</div>
</div></div><br>--<br>
_____________________________________________________________________<br>
-- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com" target="_blank">http://www.api-digital.com</a> --<br>
<br>
asterisk-dev mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
<a href="http://lists.digium.com/mailman/listinfo/asterisk-dev" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-dev</a><br></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div></div>