sangoma / switchy

async FreeSWITCH cluster control
https://switchy.readthedocs.io/en/latest/
Mozilla Public License 2.0
69 stars 18 forks source link

Exposed the endpoint in build_originate_cmd() function. #16

Closed ncorbic closed 8 years ago

ncorbic commented 8 years ago

User can now use other endpoints aside from sofia.

moises-silva commented 8 years ago

@ncorbic @tgoodlet if the intention is that this API will become useful for other endpoints, then several other parameters do not make sense outside the sofia endpoint context, such as profile and destination url. I assume the intention was to use freetdm endpoints as well? if such, then the function needs other data such as span and channel. Probably nenad is hacking around that by passing something like the span name in place of profile and a dest url that is really just a number instead. At the very least the arguments should be renamed if that's the case.

goodboy commented 8 years ago

Hmm I didn't think of this. I guess the renaming should be added later. The extra argument doesn't hurt anything right now. @moises-silva can you think of some decent general names for these parameters?

moises-silva commented 8 years ago

@tgoodlet Well, the way FS handles this internally is just through endpoint and 'endpoint data' because the way the endpoint data string is interpreted depends on the endpoint. The sofia endpoints interprets the data as <profile>/<url> or even gateway/<gateway-name>/[number|destination_url]

I think we should do something similar, but a little better given python's flexibility with providing args. For example, just provide an endpoint (default to sofia) then kwargs and let an 'endpoint' handler build the rest of the originate command using the provided kwargs? so every endpoint handler can name the parameters differently and even perform endpoint-specific validation?

That way users can keep providing the profile parameter and the endpoint 'sofia' will know how to deal with it and what string generate based on that. For freetdm endpoints 'span', 'channel' parameters might be passed, and so on. This will prepare us for H.323 or any other endpoint we might want to use in the future.

goodboy commented 8 years ago

@moises-silva Cool sounds good. Is there anywhere I can find the specs for all (applicable) endpoints such that I can make an issue for this and link to it for future reference?

moises-silva commented 8 years ago

@tgoodlet sure, check the specs at src/mod/endpoints/*/mod_*.c

Aside from that, you probably only need sofia and freetdm for now:

https://freeswitch.org/confluence/display/FREESWITCH/FreeTDM (check the Dialplan section there)

For sofia you can keep what you have now. If we ever need to dial by gateway or user, modifications will be needed to support that.