AnsweredAssumed Answered

Lua scripting on outgoing INVITE

Question asked by christos.georgiadis on Jan 19, 2015
Latest reply on Jan 20, 2015 by christos.georgiadis

Hi,

 

I am trying to remove all the video lines from an invite that is sent out via a sip trunk in cucm.

Here is my script

 

 

Before outbound SIP Normalization msg is:


 

v=0

o=CiscoSystemsCCM-SIP 12238799 2 IN IP4 10.47.6.33

s=SIP Call

b=TIAS:384000

b=AS:384

t=0 0

m=audio 17816 RTP/AVP 102 103 104 105 106 0 8 101

c=IN IP4 XXX.XXX.XXX.XXX

b=TIAS:64000

a=rtpmap:102 MP4A-LATM/90000

a=fmtp:102 bitrate=64000;profile-level-id=24;object=23

a=rtpmap:103 MP4A-LATM/90000

a=fmtp:103 bitrate=56000;profile-level-id=24;object=23

a=rtpmap:104 MP4A-LATM/90000

a=fmtp:104 bitrate=48000;profile-level-id=24;object=23

a=rtpmap:105 G7221/16000

a=fmtp:105 bitrate=32000

a=rtpmap:106 G7221/16000

a=fmtp:106 bitrate=24000

a=rtpmap:0 PCMU/8000

a=ptime:20

a=rtpmap:8 PCMA/8000

a=ptime:20

a=rtpmap:101 telephone-event/8000

a=fmtp:101 0-15

m=video 17818 RTP/AVP 97 98 99 34 31

c=IN IP4 XXX.XXX.XXX.XXX

b=TIAS:384000

a=label:11

a=rtpmap:97 H264/90000

a=fmtp:97 profile-level-id=428016;max-mbps=108000;max-fs=3600;max-cpb=200;max-br=5000;max-smbps=108000;max-fps=6000

a=rtpmap:98 H264/90000

a=fmtp:98 profile-level-id=428016;packetization-mode=1;max-mbps=108000;max-fs=3600;max-cpb=200;max-br=5000;max-smbps=108000;max-fps=6000

a=rtpmap:99 H263-1998/90000

a=fmtp:99 QCIF=1;CIF=1;CIF4=1;MAXBR=3840;CUSTOM=352,240,1

a=rtpmap:34 H263/90000

a=fmtp:34 QCIF=1;CIF=1;CIF4=1;MAXBR=3840

a=rtpmap:31 H261/90000

a=fmtp:31 CIF=1;QCIF=1;MAXBR=3840

a=content:main

a=rtcp-fb:* nack pli

a=rtcp-fb:* ccm fir

m=video 17820 RTP/AVP 97 98 99 34 31

c=IN IP4 XXX.XXX.XXX.XXX

b=TIAS:384000

a=label:12

a=rtpmap:97 H264/90000

a=fmtp:97 profile-level-id=428016;max-mbps=108000;max-fs=3840;max-cpb=200;max-br=5000;max-smbps=108000;max-fps=6000

a=rtpmap:98 H264/90000

a=fmtp:98 profile-level-id=428016;packetization-mode=1;max-mbps=108000;max-fs=3840;max-cpb=200;max-br=5000;max-smbps=108000;max-fps=6000

a=rtpmap:99 H263-1998/90000

a=fmtp:99 QCIF=1;CIF=1;CIF4=1;MAXBR=3840;CUSTOM=352,240,1

a=rtpmap:34 H263/90000

a=fmtp:34 QCIF=1;CIF=1;CIF4=1;MAXBR=3840

a=rtpmap:31 H261/90000

a=fmtp:31 CIF=1;QCIF=1;MAXBR=3840

a=content:slides

a=rtcp-fb:* nack pli

a=rtcp-fb:* ccm fir

m=application 17822 RTP/AVP 107

c=IN IP4 XXX.XXX.XXX.XXX

a=rtpmap:107 H224/0

 

 

After normalization it is

 

 

v=0

o=CiscoSystemsCCM-SIP 12238799 2 IN IP4 10.47.6.33

s=SIP Call

b=TIAS:384000

b=AS:384

t=0 0

m=audio 17816 RTP/AVP 102 103 104 105 106 0 8 101

c=IN IP4 XXX.XXX.XXX.XXX

b=TIAS:64000

a=rtpmap:102 MP4A-LATM/90000

a=fmtp:102 bitrate=64000;profile-level-id=24;object=23

a=rtpmap:103 MP4A-LATM/90000

a=fmtp:103 bitrate=56000;profile-level-id=24;object=23

a=rtpmap:104 MP4A-LATM/90000

a=fmtp:104 bitrate=48000;profile-level-id=24;object=23

a=rtpmap:105 G7221/16000

a=fmtp:105 bitrate=32000

a=rtpmap:106 G7221/16000

a=fmtp:106 bitrate=24000

a=rtpmap:0 PCMU/8000

a=ptime:20

a=rtpmap:8 PCMA/8000

a=ptime:20

a=rtpmap:101 telephone-event/8000

a=fmtp:101 0-15

m=video 17820 RTP/AVP 97 98 99 34 31

c=IN IP4 XXX.XXX.XXX.XXX

b=TIAS:384000

a=label:12

a=rtpmap:97 H264/90000

a=fmtp:97 profile-level-id=428016;max-mbps=108000;max-fs=3840;max-cpb=200;max-br=5000;max-smbps=108000;max-fps=6000

a=rtpmap:98 H264/90000

a=fmtp:98 profile-level-id=428016;packetization-mode=1;max-mbps=108000;max-fs=3840;max-cpb=200;max-br=5000;max-smbps=108000;max-fps=6000

a=rtpmap:99 H263-1998/90000

a=fmtp:99 QCIF=1;CIF=1;CIF4=1;MAXBR=3840;CUSTOM=352,240,1

a=rtpmap:34 H263/90000

a=fmtp:34 QCIF=1;CIF=1;CIF4=1;MAXBR=3840

a=rtpmap:31 H261/90000

a=fmtp:31 CIF=1;QCIF=1;MAXBR=3840

a=content:slides

a=rtcp-fb:* nack pli

a=rtcp-fb:* ccm fir

 

 

The script is the following

--------------------------------------

M = {}

function M.outbound_INVITE(msg)

    local sdp = msg:getSdp()

    if sdp

    then

    local video = {}

    for i=2,4 do

            video[i] = sdp:getMediaDescription(i)

            if video[i]

            then

                --remove the video media description

                sdp = sdp:removeMediaDescription(i)

                --set the modified sdp

        msg:setSdp(sdp)

        end

    end

    end 

end

return M

---------------------------------------

 

Can somebody tell me what is wrong with the script ?

The output of the cucm does not make sense to me

Outcomes