The similar case is already implemented in master branch of client: https://github.com/flashphoner/flashphoner_client/tree/master
The Recorder https://github.com/flashphoner/flashphoner_client/tree/master is responsible for audio and video stream recording.
You can adapt this code for your needs.

From architecture perspective, Flashphoner RTMP SIP Gateway is an open source Wowza server-side app with few proprietary core libs responsible for SIP, RTP, codecs and RTMP-RTP translation.
Therefore you can customize the existing app or rewrite the app on top of Flashphoner libs.

Before testing Flashphoner with your SIP gateway, you can carry out a test with a softphone-to-softphone call. If it works for softphones, it should work for Flashphoner too.
Flashphoner currently works in the softphone mode only. It will not be able to register other softphone. The feature is in our roadmap.
Therefore you can not connect a SIP softphone directly to Flashphoner, but Flashphoner is able to connect/register to your SIP gateway and share the stream received from SIP/RTP using Wowza capabilities. You can also implement any custom API using Wowza HTTP interfaces or implement it via Flash and the server-side app.