[asterisk-dev] New application for MQTT send

Kevin Harwell kharwell at digium.com
Mon Oct 23 16:19:29 CDT 2017


On Fri, Oct 20, 2017 at 2:51 PM, Gabriel Ortiz Lour <ortiz.admin at gmail.com>
wrote:

> Hi devs!
>
>   I want to code a new asterisk App to send messages over MQTT. looking
> the docs the MQTT lib needs frequent calling to a "loop" function, since
> the "send" method is asyncronous.
>
>   I don't want to use it externally with "System" or "AGI" since it will
> be called in the ahngup handler and I would like to use the fast "publish"
> call (hangup handlers should be quick, right? :)
>
>   Where would I put this frequent calling on asterisk code? should I build
> a thread for this? or put inside some asterisk "main loop"?
>

Usually you want something like this to be non-blocking, so you'll need to
put this in a separate thread (unless for some reason you want the main
thread to block while it is in the "loop"). So in your application exec
handler you'd initiate a thread that runs the "loop".


>
> Thanks,
> Gabriel
>
>
>

-- 

Kevin Harwell
Digium, Inc. | Software Developer
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at: http://digium.com & http://asterisk.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20171023/aeceee07/attachment.html>


More information about the asterisk-dev mailing list