<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On Dec 4, 2013, at 1:59 PM, Matthew Jordan <<a href="mailto:mjordan@digium.com">mjordan@digium.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Ideally, you would create the channel and receive a response indicating what channel you just created. Once you've done that, you'd initiate another request to start running the channel. This is really the only way to keep events from showing up until after you've received the handle to the channel.<br><br></div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Something like:<br><br></div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">POST /channels?endpoint=PJSIP/matt&app=hello-world<br></div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"> => Returns 200 OK with channel 12345<br></div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">POST /channels/12345/run</div></blockquote><br></div><div>I don’t really care for this approach.</div><div><br></div><div>You’re adding an additional round-trip for origination. Adding an extra call in order to avoid an asynchronous ordering issue feels wrong. Remote API’s should be kept course-grained; this is moving in the wrong direction.</div><div><br></div><div>You’re also exposing a new state for channels that one has to contend with in the API. These anticipatory channels may only be run (or deleted, I guess, if they change their minds about originating). And those are the only channels that may be run. I’d almost want to call it a different sort of resource (a protochannel?) since the available operations for it are very different from what you can do on a normal channel.</div><div><br></div><div>What if we use the app and appArgs that can be passed into the origination? When the channel is created for origination, it is already subscribed to the given app. When it is answered, a StasisStart event is generated for the given application, with the given arguments (just as if it had hit Stasis(app,appArgs) in the dialplan).</div><div><br></div><div>Let’s be consistent and create a ChannelOriginated event. We can guarantee that this will be the first event for originated channels. It will have the appArgs and channel information, similar to the StasisStart event. The application can put a unique identifier in the application’s arguments in order to associate the originated channel with a request.</div><div><br></div><div>Another option would be to allow the user to specify the unique id of the channel. This seems a bit frightening, but might be worth pursuing.</div><div><span style="orphans: 2; text-align: -webkit-auto; widows: 2;">-- </span></div><div apple-content-edited="true"><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">David M. Lee<br>Digium, Inc. | Software Developer<br>445 Jan Davis Drive NW - Huntsville, AL 35806 - USA<br>Check us out at: <a href="http://www.digium.com">www.digium.com</a> & <a href="http://www.asterisk.org">www.asterisk.org</a></div>
</div>
<br></body></html>