[asterisk-dev] Help to catch media immediately after channel being answered

Russell Bryant russell at digium.com
Tue May 31 01:29:19 CDT 2011


----- Original Message -----
> Hello to all
> 
> Working with asterisk for couple of month, and got such task: I need
> to catch audio data(a couple of seconds)(and probably send some signal
> too, but it is optionally), which asterisk will receive after channel
> being answered(inbound call). I did not found any hook-system in
> source where I can register my code for such event. For now I wrote
> dialplan application which do my task and called right after ANSWER
> application, but the problem is channel can be answered by other
> applications and I will miss data I interested in. Now I trying to
> analyse __ast_answer function in channel.c, but I'm not sure it is
> right place. Probably there are other suitable places which I did not
> discovered yet?

There are a couple of hook APIs that can be used for this.

to hook into audio frames:
    include/asterisk/audiohook.h
    example usage: funcs/func_volume.c

to hook into _all_ frames (1.8 and up):
    include/asterisk/framehook.h
    no example usage yet (it's being used for T.38 Gateway support)

-- 
Russell Bryant
Digium, Inc.   |   Engineering Manager, Open Source Software
445 Jan Davis Drive NW    -     Huntsville, AL 35806  -  USA
www.digium.com  -=-  www.asterisk.org -=- blogs.asterisk.org



More information about the asterisk-dev mailing list