Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Noprint
Panel
borderColorgreen
bgColortransparent
borderWidth2

Back to Table of Contents

Back to SIP Services

Back to SIP Message Manipulation

Back to SMM Examples

Back to SDP Manipulation Examples

Code Block
# Sample SMM Rules to manipulate SDP content using the ADD operation
#
# Rule 1 Action 1: add line "i=i-line" to session block
# Rule 1 Action 2: add line "i=i-line" to first instance of audio stream
# Rule 1 Action 3: add line "a=rtpmap:8 PCMA/8000 " to first instance of audio stream
set profiles signaling sipAdaptorProfile smmProfile rule 1 criterion 1 type message message messageTypes request methodTypes invite
set profiles signaling sipAdaptorProfile smmProfile rule 1 criterion 1 type message message condition exist
set profiles signaling sipAdaptorProfile smmProfile rule 1 criterion 2 type messageBody messageBody messageBodyType sdp condition exist
set profiles signaling sipAdaptorProfile smmProfile rule 1 criterion 3 type sdpContent sdpContent codecNames PCMA/8000
set profiles signaling sipAdaptorProfile smmProfile rule 1 criterion 3 type sdpContent sdpContent streamType audio streamInstanceId 1
set profiles signaling sipAdaptorProfile smmProfile rule 1 criterion 3 type sdpContent sdpContent condition exist
set profiles signaling sipAdaptorProfile smmProfile rule 1 action 1 operation add type sdpContent sdpContentSubType line
set profiles signaling sipAdaptorProfile smmProfile rule 1 action 1 from type value value i=i-line
set profiles signaling sipAdaptorProfile smmProfile rule 1 action 1 to type sdpContent sdpContent streamType session streamInstanceId 1
set profiles signaling sipAdaptorProfile smmProfile rule 1 action 2 operation add type sdpContent sdpContentSubType line
set profiles signaling sipAdaptorProfile smmProfile rule 1 action 2 from type value value i=i-line
set profiles signaling sipAdaptorProfile smmProfile rule 1 action 2 to type sdpContent sdpContent streamType audio streamInstanceId 1
set profiles signaling sipAdaptorProfile smmProfile rule 1 action 3 operation add type sdpContent sdpContentSubType line
set profiles signaling sipAdaptorProfile smmProfile rule 1 action 3 from type value value "a=rtpmap:8 PCMA/8000"
set profiles signaling sipAdaptorProfile smmProfile rule 1 action 3 to type sdpContent sdpContent streamType audio streamInstanceId 1
# Rule 2 action 1: Add a audio stream by specifying sdpContentSubType as stream
# Rule 2 action 2: Add a audio stream by specifying sdpContentSubType as line with from value "m="
# Rule 2 action 3, 4: Add "a=rtpmap:" attribute line for newly added video stream
set profiles signaling sipAdaptorProfile smmProfile rule 2 criterion 1 type message message messageTypes request methodTypes invite
set profiles signaling sipAdaptorProfile smmProfile rule 2 criterion 1 type message message condition exist
set profiles signaling sipAdaptorProfile smmProfile rule 2 criterion 2 type messageBody messageBody messageBodyType sdp condition exist
set profiles signaling sipAdaptorProfile smmProfile rule 2 action 1 operation add type sdpContent sdpContentSubType stream
set profiles signaling sipAdaptorProfile smmProfile rule 2 action 1 from type value value "m=audio 8888 RTP/AVP 0 8"
set profiles signaling sipAdaptorProfile smmProfile rule 2 action 1 to type sdpContent sdpContent streamType audio streamInstanceId last
set profiles signaling sipAdaptorProfile smmProfile rule 2 action 2 operation add type sdpContent sdpContentSubType line
set profiles signaling sipAdaptorProfile smmProfile rule 2 action 2 from type value value "m=video 9999 RTP/AVP 31 32"
set profiles signaling sipAdaptorProfile smmProfile rule 2 action 2 to type sdpContent sdpContent streamType video streamInstanceId last
set profiles signaling sipAdaptorProfile smmProfile rule 2 action 3 operation add type sdpContent sdpContentSubType line
set profiles signaling sipAdaptorProfile smmProfile rule 2 action 3 from type value value "a=rtpmap:31 H261/90000"
set profiles signaling sipAdaptorProfile smmProfile rule 2 action 3 to type sdpContent sdpContent streamType video streamInstanceId last
set profiles signaling sipAdaptorProfile smmProfile rule 2 action 4 operation add type sdpContent sdpContentSubType line
set profiles signaling sipAdaptorProfile smmProfile rule 2 action 4 from type value value "a=rtpmap:32 H262/90000"
set profiles signaling sipAdaptorProfile smmProfile rule 2 action 4 to type sdpContent sdpContent streamType video streamInstanceId last
# Rule 3: add a codec to video stream as the first codec without specifying payload type
set profiles signaling sipAdaptorProfile smmProfile rule 3 criterion 1 type message message messageTypes request methodTypes invite
set profiles signaling sipAdaptorProfile smmProfile rule 3 criterion 1 type message message condition exist
set profiles signaling sipAdaptorProfile smmProfile rule 3 criterion 2 type messageBody messageBody messageBodyType sdp condition exist
set profiles signaling sipAdaptorProfile smmProfile rule 3 criterion 3 type 
sdpContent sdpContent codecNames H261/90000 condition absent
set profiles signaling sipAdaptorProfile smmProfile rule 3 criterion 3 type sdpContent sdpContent streamType video streamInstanceId 1
set profiles signaling sipAdaptorProfile smmProfile rule 3 action 1 operation add type sdpContent sdpContentSubType codecByName
set profiles signaling sipAdaptorProfile smmProfile rule 3 action 1 from type value value "H261/90000"
set profiles signaling sipAdaptorProfile smmProfile rule 3 action 1 to type sdpContent sdpContent streamType video streamInstanceId 1 payloadType 
next codecPosition 2
# Rule 4: add a codec to video stream as the last codec with specified payload type
# Important, it is up to the operator to ensure that specified payload type is an appropriate value
set profiles signaling sipAdaptorProfile smmProfile rule 4 criterion 1 type message message messageTypes request methodTypes invite
set profiles signaling sipAdaptorProfile smmProfile rule 4 criterion 1 type message message condition exist
set profiles signaling sipAdaptorProfile smmProfile rule 4 criterion 2 type messageBody messageBody messageBodyType sdp condition exist
set profiles signaling sipAdaptorProfile smmProfile rule 4 criterion 3 type sdpContent sdpContent codecNames H263/90000 condition absent
set profiles signaling sipAdaptorProfile smmProfile rule 4 criterion 3 type sdpContent sdpContent streamType video streamInstanceId 1
set profiles signaling sipAdaptorProfile smmProfile rule 4 action 1 operation add type sdpContent sdpContentSubType codecByName
set profiles signaling sipAdaptorProfile smmProfile rule 4 action 1 from type value value "H263/90000"
set profiles signaling sipAdaptorProfile smmProfile rule 4 action 1 to type sdpContent sdpContent streamType video streamInstanceId 1 payloadType 34 codecPosition 2
# Rule 5: Add parameter to a sdp line specified by a variable
# Rule 5 Action 1: store "a=rtpmap:" to variable var1
# Rule 5 Action 2: store payloadtype for codec "iLBC/8000" to var2
# Rule 5 Action 3: append var2 to var1, so that var1 will have "a=rtpmap:xx", xx is the payload type of codec iLBC/8000
# Rule 5 Action 4: add parameter to a line identified by var1 
set profiles signaling sipAdaptorProfile smmProfile rule 5 criterion 1 type message message messageTypes request methodTypes invite
set profiles signaling sipAdaptorProfile smmProfile rule 5 criterion 1 type message message condition exist
set profiles signaling sipAdaptorProfile smmProfile rule 5 criterion 2 type messageBody messageBody messageBodyType sdp condition exist
set profiles signaling sipAdaptorProfile smmProfile rule 5 criterion 3 type sdpContent sdpContent codecNames iLBC/8000 condition absent
set profiles signaling sipAdaptorProfile smmProfile rule 5 criterion 3 type sdpContent sdpContent streamType audio streamInstanceId last
set profiles signaling sipAdaptorProfile smmProfile rule 5 action 1 type variable operation store
set profiles signaling sipAdaptorProfile smmProfile rule 5 action 1 from type value value "a=rtpmap:"
set profiles signaling sipAdaptorProfile smmProfile rule 5 action 1 to type variable variableValue var1
set profiles signaling sipAdaptorProfile smmProfile rule 5 action 2 type sdpContent operation getPayloadType sdpContentSubType codecByName
set profiles signaling sipAdaptorProfile smmProfile rule 5 action 2 from type sdpContent sdpContent streamType audio streamInstanceId 1 
codecNames "iLBC/8000"
set profiles signaling sipAdaptorProfile smmProfile rule 5 action 2 to type variable variableValue var2
set profiles signaling sipAdaptorProfile smmProfile rule 5 action 3 type variable operation append
set profiles signaling sipAdaptorProfile smmProfile rule 5 action 3 from type variable variableValue var2
set profiles signaling sipAdaptorProfile smmProfile rule 5 action 3 to type variable variableValue var1
set profiles signaling sipAdaptorProfile smmProfile rule 5 action 4 operation add type sdpContent sdpContentSubType parameter
set profiles signaling sipAdaptorProfile smmProfile rule 5 action 4 from type value value ABCDEF=abcdef
set profiles signaling sipAdaptorProfile smmProfile rule 5 action 4 to type sdpContent sdpContent sdpLine type variable variableValue var1
set profiles signaling sipAdaptorProfile smmProfile rule 5 action 4 to sdpContent paramDelimiter ";" streamType audio streamInstanceId 1