Play incoming SIP call on audio device
October 2, 2016 
        
            
                
                    
                    asterisk banana-pi 
    Directing SIP call audio to audio device
Recently, I was asked to implement a sort of public announcement system for a banana pi variant running asterisk.
Sure there is the built-in asterisk public announcement system, which will let you make announcements using the phone speakers (if supported and enabled); but the requirement in my case was different.
Basically, there was to be a designated SIP extension. Users wanting to make a public announcement would call this extension & make their announcement. This was to be played on the banana pi speaker in realtime.
I started searching online for a solution and came across the PJSIP library. I couldn’t find a ready-made solution and started to code my own using the PJSIP library.
Here’s the code: