[Freeswitch-dev] How to invoke Freeswitch APIs from other modules

Anthony Minessale anthony.minessale at gmail.com
Fri Jan 17 03:56:06 MSK 2014


Do you just want to run a command from your C mod?

switch_stream_handle_t stream = { 0 };

SWITCH_STANDARD_STREAM(stream);

switch_api_execute("show", "channels", NULL, &stream);
printf("result: %s\n", (char *) stream.data);
switch_safe_free(stream.data);




On Thu, Jan 16, 2014 at 5:22 PM, Peter Hillier <peterhillier at yahoo.com>wrote:

> Hi folks,
> I am working on a pet project in order to become more familiar with
> Freeswitch. I have added my own module and APIs successfully, but am stuck
> when it comes to communicating with the other modules in Freeswitch. I see
> that other modules "export" functionality via APIs, but am not sure how,
> from within a C software routine in another Freeswitch module, that I
> should invoke this functionality.
>
> More specifically I want to call the sofia module API to flush all
> internal registrations (flush_inbound_reg) when some condition is triggered
> in my module. This module is written in C code, and I have googled my
> brains out trying to find an example of how to do this. Which is better:
> mod_event_socket. mod? xml_curl? RPC?   I cannot seem to find any examples
> of how to create events in C (e.g. what parameters need to be specified),
> and what is the best solution for local communications.
>
> I could modify my local copy of sofia to provide direct calls, but I
> prefer to understand how this is intended to be done with the existing
> tools. I have the feeling I am missing something simple and would
> appreciate any pointers that anyone can provide.
>
> Thanks,
> Peter
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
> 
> 
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://wiki.freeswitch.org
> http://www.cluecon.com
>
> FreeSWITCH-dev mailing list
> FreeSWITCH-dev at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
> http://www.freeswitch.org
>
>


-- 
Anthony Minessale II       ♬ @anthmfs  ♬ @FreeSWITCH  ♬

☞ http://freeswitch.org/http://cluecon.com/http://twitter.com/FreeSWITCH
☞ irc.freenode.net #freeswitch ☞ *http://freeswitch.org/g+
<http://freeswitch.org/g+>*

ClueCon Weekly Development Call
☎ sip:888 at conference.freeswitch.org  ☎ +19193869900
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-dev/attachments/20140116/0a6a1c37/attachment-0001.html 


Join us at ClueCon 2013 Aug 6-8, 2013
More information about the FreeSWITCH-dev mailing list