4.22.1.4. Configuring SIP policies

The SIP proxy is capable of filtering the different media types in the SIP traffic based on their SDP headers using the media hash attribute. The possible actions for the different media types are shown in the table below. See Section 2.1, Policies for requests and responses for details.

ActionDescription
SIP_MEDIA_ACCEPT Accept the media type.
SIP_MEDIA_DROP Drop the media from the list of proposed media channels but forward the message to the peer.
SIP_MEDIA_ABORT Drop the SIP message containing the corresponding media type.
SIP_MEDIA_POLICY Call the function specified to make a decision about the media type. The function receives two parameters: self, and the media type string. See Section 2.1, Policies for requests and responses for details.

Table 4.66.  Action codes for SIP media types.

Media types are the strings in SDP headers that identify the type of media sent in the channel (e.g.: audio, video, * for all types, etc.). There are no predefined constants for the media types, as they are not defined in any RFCs or other standards. Typically, audio and video are used for voice and video streams, respectively.

Example 4.43. Disabling video traffic in SIP

This example class accepts only voice traffic, denying video streams and aborting on all other types of media streams.

class AudioSip(SipProxy)
      def config(self):
        self.media["audio"]=[SIP_MEDIA_ACCEPT]
        self.media["video"]=[SIP_MEDIA_DROP]
        self.media["*"]=[SIP_MEDIA_ABORT]