Refuse / reject a RE-INVITE


I have an asterisk 11.6, connected to a voip provider with a classic sip trunk. When I receive an incoming call on this trunk, I sometimes try to terminate it on an external pstn number, using this same trunk to dial out.
When I do this, calls are established correctly (invites, ack, ok), but immediately after the remote server reinvite both legs to have the media directly and take my box out of the rtp loop. Makes sense to me, except that the provider fails somewhere, and there is no audio on the call (the RTP flow doesnt appear at all on the asterisk box - and I am struggling to get an answer from the voip provider.

Is there a way to refuse (at initial call setup) the reinvite, ou reject it when it arrives ?

It looks like directmedia applies to asterisk initiating the reinvites, not handling them.

Any help will be much appreciated,


Because Asterisk is a back to back user agent, it has to cooperate for it to be taken out of the media path. I would expect directmedia=no to stop it cooperating, and if it goes out of the media path and you have any service requiring it to be in the media path, you should raise a bug report.

It is more likely that the third party device is trying to remove itself from the path.