Can an application use the microphone for two different tasks at the same time? I'm currently exploring the PortSIP app( link is here) to make calls. I want to be able to record what I speak. I am successfully able to record using the microphone, when there is no call in progress. But once the call is initialized, the reciever can't hear my voice. 

Is there any way to make this work??
Can two apps use the microphone at the same time? 

As far as I know: By default, the same way two different apps can't use the camera at the same time, the same principle applies to microphone too. Since these hardwares' drivers respond to only one call from one user at a time. Of course you can make an app that gets the input from microphone and then acts as a broadcaster to share the input with other apps. But the microphone itself doesn't provide for two users at the same time. Since the Phone app is also a user, microphone provides only for it. That being told, my information can be outdated. Or there can be ways to cheat in this case. User Micheal from this Stack Overflow question says:


  I don't remember exactly where the limitation comes from, but on one of
  the platforms I've worked with we had a workaround in the form of a
  stream splitter. This class was written by the platform provider (so
  it was proprietary), and was part of libaudioflinger IIRC. It would
  manage the audio hw input stream, and hand out audio data to all
  clients (apps) that wanted to record audio. So it can be done if you
  have the ability to build your own Android ROM, but it's not trivial.


So is it possible? Yeah. But seems unnecessarily painful to me. Still as I said, take my words as a grain of salt, since my Android knowledge is not very up to date.

Can an app use microphone for two different things? 
An app is made of different components. User of the phone uses user interfaces (activities) to start processes that happen in the background (services) and all services have their own thing to do. Yet, they all belong to the same process that has a specific UID given by the Android. Once the given UID gets the input info from camera, microphone etc. it can use it for different services at the same time. That's up to app to decide.