[asterisk-dev] Run extension script on SIP peer registration
Russell Bryant
russell at digium.com
Thu Oct 1 09:17:14 CDT 2009
Olle E. Johansson wrote:
> You propably want a hook for when we loose contact as well. I think it
> would be better to hook into the qualify subsystem for these kind of
> events.
This is a very good suggestion. If someone wanted to pursue adding
asynchronous hooks into qualify status (or anything else) within the
Asterisk C code, it wouldn't be too hard to add.
I would suggest finding where we generate manager events for qualify
status today and generating an ast_event there. This part is probably
something we could merge. (See event.h, and search for instances of
ast_event_queue for examples of code that generates events).
Then, create a new module to subscribe to those events and act on them.
We have API calls that make it very easy to originate a call to start
dialplan execution (ast_pbx_outgoing_exten()). The Channel part of the
"call" could just be Local/extensionThatJustAnswersAndWaitsForever. The
extension would be where you handle your response to the event.
Alternatively, instead of originating a "call", you could run a shell
script, just execute the queue add/remove member applications directly,
etc etc etc...
--
Russell Bryant
Digium, Inc. | Engineering Manager, Open Source Software
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at: www.digium.com & www.asterisk.org
More information about the asterisk-dev
mailing list