How can I control ringer volume?
You can use Assistive Touch, which can be enabled in Settings > General > Accessibility to trigger Hardware Buttons. 

If you're asking from a developer perspective you should ask in Stack Overflow.