not Changing back ringer sound during ringing
<p>I searched many code samples and comments, but I couldn't find any solution for my ringing problem in call state listener.</p>

<p>I tried many ways. I believe it's a common issue, e.g. <a href="http://stackoverflow.com/a/14489509/2331641">http://stackoverflow.com/a/14489509/2331641</a>. I used the code below. Where did i do wrong? Is my approach  wrong?</p>

<p>I used <code>setRingMode</code> too and got the same result. I have permissions and I tried both service and broadcast.</p>

<pre><code> public void onCallStateChanged(int state, String incomingNumber) 
        {
            super.onCallStateChanged(state, incomingNumber);

            switch(state)
            {
                case TelephonyManager.CALL_STATE_RINGING: 
                         //make silent
                     AudioManager audioM= (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
        audioM.setStreamVolume(AudioManager.STREAM_RING,0, AudioManager.FLAG_ALLOW_RINGER_MODES);
                         //some controls and end block or not

                  //for get ringing sound back
                  audioManager.setStreamVolume(AudioManager.STREAM_RING, 7,AudioManager.FLAG_ALLOW_RINGER_MODES);

                    //but sound come back sometimes not everytimes i see stream value 7 but not ringing  
                case TelephonyManager.CALL_STATE_OFFHOOK:

                case TelephonyManager.CALL_STATE_IDLE: 
            }
    }
</code></pre>
