[SR-Users] KSR.sdpops.remove_media is not working as expected

Daniel-Constantin Mierla miconda at gmail.com
Mon Jan 6 10:48:30 CET 2020


Hello,

do msg_apply_changes() after removing the media stream:

KSR.sdpops.remove_media("image")

KSR.textopsx.msg_apply_changes()

then do the rtpengine control.

The rtpengine takes the full sdp and puts back a full one.

Cheers,
Daniel

On 06.01.20 10:19, Miteshkumar Thakkar wrote:
> Thank you Henning.
>
>     does it actually remove the media after you send the message out?
>     Usually the message altering functions will only be applied when
>     you send out the message due to performance reasons.
>
>
> Yes, that's true. When the message sent out, I can see that
> remove_media() has actually removed that part from SDP. 
>
> So basically, when I am sending rtpengine_offer, SDP is not altered.
> What should I do to alter SDP before calling rtpengine_offer?
>
>
>
> On Fri, Dec 20, 2019 at 3:16 PM Miteshkumar Thakkar
> <mitesh.thakkar at plivo.com <mailto:mitesh.thakkar at plivo.com>> wrote:
>
>     Hi,
>
>     After removing media using below code, I am sending offer to
>     rtpengine. RTPEngine is receiving entire SDP. It is receiving
>     media type "image" as well. I have tested again.
>
>     KSR.sdpops.remove_media("image")
>     logger.log("info", "SDP:" .. headers.get("$sdp(body)"))
>
>
>     *SDP from RTPEngine log:*
>     *
>     *
>     =0
>     o=zt 53655765 2353687637 IN IP4 xxx.xxx.xxx.xxx
>     s=-
>     c=IN IP4 xxx.xxx.xxx.xxx
>     t=0 0
>     m=image xxxx RTP/AVP udptl t38
>     a=sendrecv
>     a=T38FaxVersion:0
>     a=T38MaxBitRate:14400
>     a=T38FaxRateManagement:transferredTCF
>     a=T38FaxMaxBuffer:262
>     a=T38FaxMaxDatagram:176
>     a=T38FaxUdpEC:t38UDPRedundancy
>     m=audio xxxx RTP/AVP 0
>     a=rtpmap:0 PCMU/8000
>
>
>
>
>
>     On Thu, Dec 19, 2019 at 4:04 PM Henning Westerholt <hw at skalatan.de
>     <mailto:hw at skalatan.de>> wrote:
>
>         Hello,
>
>          
>
>         from the logs it looks ok, no error etc..:
>
>          
>
>         3(237) DEBUG: app_lua [app_lua_sr.c:1651]:
>         sr_kemi_lua_exec_func_ex(): param[0] for: remove_media is str:
>         image
>
>         3(237) DEBUG: sdpops [sdpops_mod.c:1037]: sdp_remove_media():
>         attempting to search for media type: [image]
>
>         3(237) DEBUG: sdpops [sdpops_mod.c:1053]: sdp_remove_media():
>         stream 0 of 0 - media [image]
>
>         3(237) DEBUG: sdpops [sdpops_mod.c:1061]: sdp_remove_media():
>         removing media stream: image
>
>         3(237) DEBUG: sdpops [sdpops_mod.c:1053]: sdp_remove_media():
>         stream 1 of 0 - media [audio]
>
>          
>
>         This is probably a more frequest used function from the
>         module. Can you double check if it’s really not removed on the
>         network layer?
>
>          
>
>         Cheers,
>
>          
>
>         Henning
>
>          
>
>         -- 
>
>         Henning Westerholt – https://skalatan.de/blog/
>
>         Kamailio services – https://gilawa.com <https://gilawa.com/>
>
>          
>
>         *From:* Miteshkumar Thakkar <mitesh.thakkar at plivo.com
>         <mailto:mitesh.thakkar at plivo.com>>
>         *Sent:* Thursday, December 19, 2019 11:16 AM
>         *To:* Henning Westerholt <hw at skalatan.de <mailto:hw at skalatan.de>>
>         *Cc:* Kamailio (SER) - Users Mailing List
>         <sr-users at lists.kamailio.org <mailto:sr-users at lists.kamailio.org>>
>         *Subject:* Re: [SR-Users] KSR.sdpops.remove_media is not
>         working as expected
>
>          
>
>         The log mentioned at https://pastebin.com/5JZmQUfq is by
>         configuring "debug = 4" in kamailio.cfg. Please suggest other
>         way if any, to get more debug logs.
>
>          
>
>         Thank you, 
>
>         Mitesh
>
>          
>
>         On Thu, Dec 19, 2019 at 3:34 PM Henning Westerholt
>         <hw at skalatan.de <mailto:hw at skalatan.de>> wrote:
>
>             Hello,
>
>              
>
>             I see – do you get any error message in the logs? Can you
>             execute it with debug logging activated, the function
>             should output some debug logs about its working.
>
>              
>
>             Cheers,
>
>              
>
>             Henning
>
>              
>
>             -- 
>
>             Henning Westerholt – https://skalatan.de/blog/
>
>             Kamailio services – https://gilawa.com <https://gilawa.com/>
>
>              
>
>             *From:* Miteshkumar Thakkar <mitesh.thakkar at plivo.com
>             <mailto:mitesh.thakkar at plivo.com>>
>             *Sent:* Thursday, December 19, 2019 10:56 AM
>             *To:* Henning Westerholt <hw at skalatan.de
>             <mailto:hw at skalatan.de>>
>             *Cc:* Kamailio (SER) - Users Mailing List
>             <sr-users at lists.kamailio.org
>             <mailto:sr-users at lists.kamailio.org>>
>             *Subject:* Re: [SR-Users] KSR.sdpops.remove_media is not
>             working as expected
>
>              
>
>             Thank you for your response Henning!
>
>              
>
>             Unfortunately, it is not removed from outgoing message.
>
>             True. I also believe that msg_apply_changes is not
>             recommended, hence I am not using that.
>
>              
>
>             Thank you,
>
>             Mitesh
>
>              
>
>              
>
>             On Thu, Dec 19, 2019 at 3:14 PM Henning Westerholt
>             <hw at skalatan.de <mailto:hw at skalatan.de>> wrote:
>
>                 Hello,
>
>                  
>
>                 does it actually remove the media after you send the
>                 message out? Usually the message altering functions
>                 will only be applied when you send out the message due
>                 to performance reasons.
>
>                  
>
>                 You can force it in the cfg with the function
>                 “msg_apply_changes” – then you should be able to see
>                 it as well in the log. But using this function has
>                 other side effects and is not recommended if you don’t
>                 need it.
>
>                  
>
>                 Cheers,
>
>                  
>
>                 Henning
>
>                  
>
>                 -- 
>
>                 Henning Westerholt – https://skalatan.de/blog/
>
>                 Kamailio services – https://gilawa.com
>                 <https://gilawa.com/>
>
>                  
>
>                 *From:* sr-users <sr-users-bounces at lists.kamailio.org
>                 <mailto:sr-users-bounces at lists.kamailio.org>> *On
>                 Behalf Of *Miteshkumar Thakkar
>                 *Sent:* Tuesday, December 17, 2019 6:53 AM
>                 *To:* sr-users at lists.kamailio.org
>                 <mailto:sr-users at lists.kamailio.org>
>                 *Subject:* [SR-Users] KSR.sdpops.remove_media is not
>                 working as expected
>
>                  
>
>                 Hi,
>
>                  
>
>                 I wants to remove media type "image" from SDP. For
>                 that I have tried to use KSR.sdpops.remove_media but
>                 it is not working. Not working in the sense that there
>                 is no effect of that function on SDP. I am using lua.
>                 Kindly find more details below.
>
>                  
>
>                 *Kamailio version*: kamailio 5.2.5 (x86_64/linux) 62d35f
>
>                  
>
>                 *SDP to process:*
>
>                 INVITE sip:xxxxxxxxxx at xxxxxxxxx.com:5060
>                 <http://sip:xxxxxxxxxx@xxxxxxxxx.com:5060> SIP/2.0
>                 Via: SIP/2.0/UDP
>                 xxx.xxx.xxx.xxx:5060;branch=z9hG4bK-60823-1-0
>                 From: xxxxxxxxxx <sip: xxxxxxxxxx@ xxxxxxxxxx.com:5060
>                 <http://xxxxxxxxxx.com:5060>>;tag=xxxxx
>                 To: xxxxxxxxxx <sip: xxxxxxxxxx@ xxxxxxxxxx.com:5060
>                 <http://xxxxxxxxxx.com:5060>>
>                 Call-ID: 1-60823 at 172.16.19.64
>                 <mailto:1-60823 at 172.16.19.64>
>                 CSeq: 1 INVITE
>                 Contact: sip:xx at xxxxxxx:5060
>                 Max-Forwards: 70
>                 Content-Type: application/sdp
>                 Content-Length:   337
>
>                 v=0
>                 o=zt 53655765 2353687637 IN IP4 xxx.xxx.xxx.xxx
>                 s=-
>                 c=IN IP4 xxx.xxx.xxx.xxx
>                 t=0 0
>                 m=image xxxx RTP/AVP udptl t38
>                 a=sendrecv
>                 a=T38FaxVersion:0
>                 a=T38MaxBitRate:14400
>                 a=T38FaxRateManagement:transferredTCF
>                 a=T38FaxMaxBuffer:262
>                 a=T38FaxMaxDatagram:176
>                 a=T38FaxUdpEC:t38UDPRedundancy
>                 m=audio xxxx RTP/AVP 0
>                 a=rtpmap:0 PCMU/8000
>
>                  
>
>                  
>
>                 *Code snippet:*
>
>                 KSR.sdpops.remove_media("image")
>                 logger.log("info", "SDP:" .. headers.get("$sdp(body)"))
>
>                  
>
>                 *Log snippet:*
>
>                 https://pastebin.com/5JZmQUfq
>
>                  
>
>                 One more thing I would like to mention that if I do
>                 not use dialog module then the function
>                 KSR.sdpops.remove_media works. But I can not avoid
>                 using dialog module.
>
>                  
>
>                 Thanks in advance.
>
>                  
>
>                 Mitesh
>
>
> _______________________________________________
> Kamailio (SER) - Users Mailing List
> sr-users at lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

-- 
Daniel-Constantin Mierla -- www.asipto.com
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio World Conference - April 27-29, 2020, in Berlin -- www.kamailioworld.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20200106/79f2d8c9/attachment.html>


More information about the sr-users mailing list