On Fri, Oct 20, 2017 at 2:51 PM, Gabriel Ortiz Lour <ortiz.ad...@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
-- 
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-dev mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-dev

Reply via email to