Ravi Inder Singh wrote: > Hi Benny, > I cannot be so sure that by adding Media Port this problem can be > resolved, as my requirement is for adding Answering Fax Machine, i.e. Media > port two functions, which both cannot resolve my issue. > a) get_frame () --> Conference bridge will get frames from this Media port. > Mem_player.c works like this only. > > b) put_frame () --> This will save to PCM frames to a buffer but these PCM > frames will come from Sound Port i.e. MIC. > > This is my understanding, please correct me if I am wrong on this. > > My requirement is to detect > > a) Answering Fax Machine detection --> which can be done by scanning > incoming Frames after they have been decoded in stream.c > > b) Answering Machine detection --> This should be done only when 200 OK > has been received from other side. Is there any way to handle from > application, to enable Media port only when 200 Ok has been received. The easiest is to implement a sink media port (like WAV capture), thus implementing put_frame(). Then you connect the call's stream to this media port, in the conference bridge, and at the same time you also connect the call's stream to the sound device as usual. You can control when exactly you want to connect them, as this is done in application's code. The drawback of this approach is you won't be able to remove the tone signal from the stream's signal, since connection from stream to sound device is independent from the connection from stream to your tone detection port. Another approach is to implement "dual-sided" media port. A put_frame() on the upstream side will trigger put_frame() to be called on the downstream side, and a get_frame() on the upstream side will also trigger get_frame() on the downstream side. The resample port is implemented this way, have a look at resample_port.c for the details. Then you can "insert" your tone detection media port between the call's stream and the bridge. You'll need to modify pjsua-lib code to do this since this kind of interconnection currently cannot be done at application's code. regards, -benny > Regards, > Ravi Inder Singh.