[sr-dev] [kamailio/kamailio] cscf_get_ue_via does not return UE via (#2864)

Aleksandar Yosifov a.v.yosifov at gmail.com
Mon Oct 4 08:49:50 CEST 2021


Hi,
It's not OK to modify the method in that way. That will cause problems with
standard implementation. As you cat see function returns explicitly the
first via for REQUESTs and the last via for RESPONSEs.
You should extend the method with parameters or modify it in another way.

BR,
Aleksandar Yosifov

On Wed, Sep 29, 2021 at 1:08 AM ErhanOnur <notifications at github.com> wrote:

> Description
>
> I put a dispatcher between PCSCF and UE. When I tried to register, Pcscf's
> save function saved dispatcher's via IP and via port instead of UE's via IP
> and via port.
>
> When I checked save function of ims_registrar_pcscf module , I saw that
> cscf_get_ue_via function is used for that. And It gives wrong via value.
> Instead of giving last via , it gives the first via in the via list.
>
> Here is the function:
>
> https://github.com/kamailio/kamailio/blob/master/src/lib/ims/ims_getters.c
>
> /**
>  * Looks for the UE Via in First Via header if its a request
>  * or in the last if its a response and returns its body
>  * @param msg - the SIP message
>  * @returns the via of the UE
>  */
> struct via_body* cscf_get_ue_via(struct sip_msg *msg)
> {
> 	struct via_body *vb=0;
>
> 	if (msg->first_line.type==SIP_REQUEST) vb = cscf_get_first_via(msg,0);
> 	else vb = cscf_get_last_via(msg);
>
> 	if (!vb) return 0;
>
> 	if (vb->port == 0) vb->port=5060;
> 	return vb;	
> }
>
> Troubleshooting
>
> I corrected the code as below:
>
> /**
>  * Looks for the UE Via in Last Via header and returns its body
>  * @param msg - the SIP message
>  * @returns the via of the UE
>  */
> struct via_body* cscf_get_ue_via(struct sip_msg *msg)
> {
> 	struct via_body *vb=0;
>
> 	vb = cscf_get_last_via(msg);
>
> 	if (!vb) return 0;
>
> 	if (vb->port == 0) vb->port=5060;
> 	return vb;	
> }
>
> Reproduction
>
> Try to put a dispatcher between PCSCF and UE. save function of
> ims_registrar_pcscf module saves dispatcher's IP and port as UE's IP and
> port.
> Debugging Data
>
> (paste your debugging data here)
>
> Log Messages
>
> (paste your log messages here)
>
> SIP Traffic
>
> (paste your sip traffic here)
>
> Possible Solutions Additional Information
>
>    - *Kamailio Version* - output of kamailio -v
>
> (paste your output here)
>
>
>    - *Operating System*:
>
> (paste your output here)
>
>> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub
> <https://github.com/kamailio/kamailio/issues/2864>, or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/ABO7UZM5YHFBFRF73Y4LTFLUEI4DXANCNFSM5E6NWBGA>
> .
> Triage notifications on the go with GitHub Mobile for iOS
> <https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
> or Android
> <https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
>
> _______________________________________________
> Kamailio (SER) - Development Mailing List
> sr-dev at lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20211004/ef488612/attachment-0001.htm>


More information about the sr-dev mailing list