[asterisk-dev] proposed api change/addition - ast_stun_request()

Luigi Rizzo rizzo at icir.org
Fri Jul 13 11:33:01 CDT 2007


On Thu, Jul 12, 2007 at 01:33:05PM -0500, Kevin P. Fleming wrote:
> Luigi Rizzo wrote:
> 
> > comments/suggestions on the name/objections ?
> 
> Sounds like a good plan to me. Should probably move the code into a new
> file (main/stun.c) in that case as well.

ok, committed but still in rtp.c

http://svn.digium.com/view/asterisk?view=rev&rev=75034

Comments on the API are mostly welcome.

Keep in mind that if you want a reply (which you need before
advertising your external address in SIP or SDP or perhaps
other ill-designed protocols), the options are the following
(these also apply to DNS resolutions, btw):

1. make the request blocking, as i did. No need for any
   code restructuring.

2. handle the task in a separate thread. This requires some
   (probably non trivial) code restructuring because at the moment
   e.g. chan_sip handles some of these things within the thread
   listening on the main SIP socket.
  
3. implement a mechanism such that the processing of the current
   flow of execution can be suspended, and resumed once the replies
   arrives or a timeout fires. This would e.g. be useful for things
   such as DNS lookups and database queries done within the main
   processing thread of certain channel drivers, but this also
   might require some non-trivial code restructuring.

No wonder i picked 1. in the example i gave in the commit message,
as it is the simplest one. But in the long term i'd really like
to implement option #3.

cheers
luigi



More information about the asterisk-dev mailing list