herlesupreeth / docker_open5gs

Docker files to run open5gs + IMS + eNB + gNB + NR-UE in a docker
BSD 2-Clause "Simplified" License
304 stars 170 forks source link

volte call not establishing #201

Closed Sivanesh1992 closed 1 year ago

Sivanesh1992 commented 1 year ago

hi i am using below commit commit 795d8ba4297ee375c1760b2be4c274c720392448 in open5gs_hss_cx branch . Lte is attached and able to send sms but voice call is not established. call_notworking.zip

herlesupreeth commented 1 year ago

Please use a valid MSISDN, tel:00000001 is not valid neither is tel:00000002, there should not be leading zeros

Sivanesh1992 commented 1 year ago

i tested with one plus mobile with same MSISDN its working but while using samsung mobiles voice call is not establishing.

herlesupreeth commented 1 year ago

hmmm..I am guessing its related to Samsung sending the following (which is wrong) in INVITE (did you change in Samsung IMS settings to prefer using tel rather than sip ??)

image

Whereas Oneplus sends the following (correct one) in INVITE

image

Sivanesh1992 commented 1 year ago

we don't see any sip setting in samsung mobile

Sivanesh1992 commented 1 year ago

i try to change apn internet to ims also but sms is working voice call is not establishing

Sivanesh1992 commented 1 year ago

sorry , which file i need to change

Sivanesh1992 commented 1 year ago

After apply changes i need to rebuild?

herlesupreeth commented 1 year ago

Please apply the below diff and give it a try (please revert the previously applied diff). Yes it should be applied to scscf/kamailio_scscf.cfg

diff --git a/scscf/kamailio_scscf.cfg b/scscf/kamailio_scscf.cfg
index 7b8c945..76e599b 100644
--- a/scscf/kamailio_scscf.cfg
+++ b/scscf/kamailio_scscf.cfg
@@ -451,6 +451,12 @@ route {
                #               #$ru = $(ru{re.subst,/;phone-context=[A-Za-z.0-9+-]*@/;phone-context=NETWORKNAME@/g});
                #       }
                # }
+               if ($hdr(P-Asserted-Identity) =~ "tel:.*" && $fu =~ "sip:.*") {
+                       # For broken SIP implementation in Samsung devices
+                       remove_hf("P-Asserted-Identity");
+                       append_hf("P-Asserted-Identity: <$(fu{re.subst,/;*//g})>\r\n");
+                       msg_apply_changes();
+               }
                if (!is_method("REGISTER|SUBSCRIBE")) {
                        # sip:xxx;phone-context=xxxx@xxx format is not desired
                        if (($ru =~ ".*phone-context.*") && ($ru =~ "sip:.*")) {

No need to rebuild after applying the changes

Sivanesh1992 commented 1 year ago

Hi @herlesupreeth

After done above changes i facing same issue . from oneplus 8T mobile i am able to make call and send sms to samsung mobile But from samsung mobile i am not able to make call but able to send sms.

diff.zip

ausf.log nssf.log bsf.log pcf.log udm.log udr.log sgwu.log upf.log mme.log hss.log pcrf.log smf.log sgwc.log amf.log nrf.log scp.log

herlesupreeth commented 1 year ago

I dont think you applied the diff correctly. Remove all changes from SCSCF and apply the below change in PCSCF (pcscf/route/mo.cfg)

diff --git a/pcscf/route/mo.cfg b/pcscf/route/mo.cfg
index 8e7673f..67e4712 100644
--- a/pcscf/route/mo.cfg
+++ b/pcscf/route/mo.cfg
@@ -24,9 +24,9 @@ route[MO]
        # Add P-Charging-Vector
        sip_p_charging_vector("g");

-       if (is_present_hf("P-Preferred-Identity") && pcscf_assert_identity("location", "$hdr(P-Preferred-Identity)")) {
+       if (is_present_hf("P-Preferred-Identity") && pcscf_assert_identity("location", "$hdr(P-Preferred-Identity)") && $hdr(P-Preferred-Identity) =~ "sip:.*") {
                append_hf("P-Asserted-Identity: $hdr(P-Preferred-Identity)\r\n");
-       } else if (is_present_hf("P-Asserted-Identity") && pcscf_assert_identity("location", "$hdr(P-Asserted-Identity)")) {
+       } else if (is_present_hf("P-Asserted-Identity") && pcscf_assert_identity("location", "$hdr(P-Asserted-Identity)") && $hdr(P-Asserted-Identity) =~ "sip:.*") {
                append_hf("P-Asserted-Identity: $hdr(P-Asserted-Identity)\r\n");
        } else if (pcscf_assert_identity("location", "$(fu{tobody.uri})")) {
                append_hf("P-Asserted-Identity: <$(fu{tobody.uri})>\r\n");
Sivanesh1992 commented 1 year ago

after applying above changes still facing same issue

apply_PCSCF.zip

herlesupreeth commented 1 year ago

Please send me the logs of the PCSCF and SCSCF

herlesupreeth commented 1 year ago

Also, apply the below diff removing previous diffs

diff --git a/pcscf/route/mo.cfg b/pcscf/route/mo.cfg
index 8e7673f..5dc95e8 100644
--- a/pcscf/route/mo.cfg
+++ b/pcscf/route/mo.cfg
@@ -24,12 +24,19 @@ route[MO]
        # Add P-Charging-Vector
        sip_p_charging_vector("g");

-       if (is_present_hf("P-Preferred-Identity") && pcscf_assert_identity("location", "$hdr(P-Preferred-Identity)")) {
+       if (is_present_hf("P-Preferred-Identity") && pcscf_assert_identity("location", "$hdr(P-Preferred-Identity)") && $hdr(P-Preferred-Identity) =~ "sip:.*") {
                append_hf("P-Asserted-Identity: $hdr(P-Preferred-Identity)\r\n");
-       } else if (is_present_hf("P-Asserted-Identity") && pcscf_assert_identity("location", "$hdr(P-Asserted-Identity)")) {
+       } else if (is_present_hf("P-Asserted-Identity") && pcscf_assert_identity("location", "$hdr(P-Asserted-Identity)") && $hdr(P-Asserted-Identity) =~ "sip:.*") {
                append_hf("P-Asserted-Identity: $hdr(P-Asserted-Identity)\r\n");
        } else if (pcscf_assert_identity("location", "$(fu{tobody.uri})")) {
-               append_hf("P-Asserted-Identity: <$(fu{tobody.uri})>\r\n");
+               # For broken SIP implementation in Samsung devices
+               if ($fu =~ "tel:.*") {
+                       $var(new_hdr) = $(fu{tobody.uri}) + "@" + NETWORKNAME;
+                       $var(new_hdr) = $(var(new_hdr){re.subst,/tel:/sip:/g});
+                       append_hf("P-Asserted-Identity: <$var(new_hdr)>\r\n");
+               } else {
+                       append_hf("P-Asserted-Identity: <$(fu{tobody.uri})>\r\n");
+               }
        } else {
                append_hf("P-Asserted-Identity: <$pcscf_asserted_identity>\r\n");
        }
Sivanesh1992 commented 1 year ago

hi @herlesupreeth sorry for delay reply.

after make above changes i am not able to see volte in bouth one plus and samsung mobile newlog.zip scscf.log pcscf.log

Sivanesh1992 commented 1 year ago

in pcscf log i am getting below error:

docker logs pcscf Deploying component: 'pcscf-1' mysqld is alive 0(39) INFO: pv [pv_shv.c:60]: shvar_init_locks(): locks array size 16 0(39) CRITICAL: [core/cfg.y:3539]: yyerror_at(): parse error in config file /etc/kamailio_pcscf/route/mo.cfg, line 34, column 77: syntax error 0(39) CRITICAL: [core/cfg.y:3539]: yyerror_at(): parse error in config file /etc/kamailio_pcscf/route/mo.cfg, line 34, column 77: '('')' expected (function call) ERROR: bad config file (2 errors) 0(39) WARNING: [core/mem/q_malloc.c:487]: qm_free(): WARNING: free(0) called from cdp_avp: cdp_avp_mod.c: cdp_avp_destroy(226) 0(39) INFO: cdp [cdp_mod.c:255]: cdp_exit(): CDiameterPeer child stopping ... 0(39) INFO: cdp [cdp_mod.c:257]: cdp_exit(): ... CDiameterPeer child stopped 0(39) ERROR: ims_ipsec_pcscf [ipsec.c:582]: clean_sa(): Error sending delete SAs command via netlink socket: No data available 0(39) WARNING: ims_ipsec_pcscf [cmd.c:1170]: ipsec_cleanall(): Error cleaning IPSec Security associations during startup. 0(39) ERROR: ims_ipsec_pcscf [ipsec.c:624]: clean_policy(): Error sending delete policies command via netlink socket: No data available 0(39) WARNING: ims_ipsec_pcscf [cmd.c:1174]: ipsec_cleanall(): Error cleaning IPSec Policies during startup. 0(39) ERROR: ims_ipsec_pcscf [ims_ipsec_pcscf_mod.c:309]: mod_destroy(): Error destroying spi generator 0(39) ERROR: ims_ipsec_pcscf [ims_ipsec_pcscf_mod.c:313]: mod_destroy(): Error destroying port generator loading modules under config path: /usr/lib64/kamailio/modules_k/:/usr/lib64/kamailio/modules/:/usr/lib/kamailio/modules_k/:/usr/lib/kamailio/modules/:/usr/lib/x86_64-linux-gnu/kamailio/modules/:/usr/local/lib64/kamailio/modules

herlesupreeth commented 1 year ago

Thanks for the logs. Will take a look and get back. There is an error in the patch I sent.

herlesupreeth commented 1 year ago

Please try with this update diff in PCSCF (pcscf/route/mo.cfg)

diff --git a/pcscf/route/mo.cfg b/pcscf/route/mo.cfg
index 8e7673f..9f32879 100644
--- a/pcscf/route/mo.cfg
+++ b/pcscf/route/mo.cfg
@@ -24,12 +24,19 @@ route[MO]
        # Add P-Charging-Vector
        sip_p_charging_vector("g");

-       if (is_present_hf("P-Preferred-Identity") && pcscf_assert_identity("location", "$hdr(P-Preferred-Identity)")) {
+       if (is_present_hf("P-Preferred-Identity") && pcscf_assert_identity("location", "$hdr(P-Preferred-Identity)") && $hdr(P-Preferred-Identity) =~ "sip:.*") {
                append_hf("P-Asserted-Identity: $hdr(P-Preferred-Identity)\r\n");
-       } else if (is_present_hf("P-Asserted-Identity") && pcscf_assert_identity("location", "$hdr(P-Asserted-Identity)")) {
+       } else if (is_present_hf("P-Asserted-Identity") && pcscf_assert_identity("location", "$hdr(P-Asserted-Identity)") && $hdr(P-Asserted-Identity) =~ "sip:.*") {
                append_hf("P-Asserted-Identity: $hdr(P-Asserted-Identity)\r\n");
        } else if (pcscf_assert_identity("location", "$(fu{tobody.uri})")) {
-               append_hf("P-Asserted-Identity: <$(fu{tobody.uri})>\r\n");
+               # For broken SIP implementation in Samsung devices
+               if ($fu =~ "tel:.*") {
+                       $var(new_hdr) = "$(fu{tobody.uri})@NETWORKNAME";
+                       $var(new_hdr) = $(var(new_hdr){re.subst,/tel:/sip:/g});
+                       append_hf("P-Asserted-Identity: <$var(new_hdr)>\r\n");
+               } else {
+                       append_hf("P-Asserted-Identity: <$(fu{tobody.uri})>\r\n");
+               }
        } else {
                append_hf("P-Asserted-Identity: <$pcscf_asserted_identity>\r\n");
        }
Sivanesh1992 commented 1 year ago

i done above changes same issue able to make voice call from one plus mobile to samsung but samsung to oneplus is call is not establishing.

newPatch.zip scscf.log pcscf.log

herlesupreeth commented 1 year ago

Damn.. again its an issue in the diff I sent. Sorry, can you please try the below diff

diff --git a/pcscf/route/mo.cfg b/pcscf/route/mo.cfg
index 8e7673f..5f6f268 100644
--- a/pcscf/route/mo.cfg
+++ b/pcscf/route/mo.cfg
@@ -24,12 +24,19 @@ route[MO]
        # Add P-Charging-Vector
        sip_p_charging_vector("g");

-       if (is_present_hf("P-Preferred-Identity") && pcscf_assert_identity("location", "$hdr(P-Preferred-Identity)")) {
+       if (is_present_hf("P-Preferred-Identity") && pcscf_assert_identity("location", "$hdr(P-Preferred-Identity)") && $hdr(P-Preferred-Identity) =~ "sip:.*") {
                append_hf("P-Asserted-Identity: $hdr(P-Preferred-Identity)\r\n");
-       } else if (is_present_hf("P-Asserted-Identity") && pcscf_assert_identity("location", "$hdr(P-Asserted-Identity)")) {
+       } else if (is_present_hf("P-Asserted-Identity") && pcscf_assert_identity("location", "$hdr(P-Asserted-Identity)") && $hdr(P-Asserted-Identity) =~ "sip:.*") {
                append_hf("P-Asserted-Identity: $hdr(P-Asserted-Identity)\r\n");
        } else if (pcscf_assert_identity("location", "$(fu{tobody.uri})")) {
-               append_hf("P-Asserted-Identity: <$(fu{tobody.uri})>\r\n");
+               # For broken SIP implementation in Samsung devices
+               if ($fu =~ "tel:.*") {
+                       $var(new_hdr) = $(fu{tobody.uri}) + "@NETWORKNAME";
+                       $var(new_hdr) = $(var(new_hdr){re.subst,/tel:/sip:/g});
+                       append_hf("P-Asserted-Identity: <$var(new_hdr)>\r\n");
+               } else {
+                       append_hf("P-Asserted-Identity: <$(fu{tobody.uri})>\r\n");
+               }
        } else {
                append_hf("P-Asserted-Identity: <$pcscf_asserted_identity>\r\n");
        }
Sivanesh1992 commented 1 year ago

still facing same issue after change above patch

newpatch1.zip scscf.log pcscf.log

herlesupreeth commented 1 year ago

Samsung phones has one of the most non-spec compliant and shittiest IMS implementation. Please try out the below diff

diff --git a/pcscf/route/mo.cfg b/pcscf/route/mo.cfg
index 8e7673f..db0c43e 100644
--- a/pcscf/route/mo.cfg
+++ b/pcscf/route/mo.cfg
@@ -24,12 +24,20 @@ route[MO]
        # Add P-Charging-Vector
        sip_p_charging_vector("g");

-       if (is_present_hf("P-Preferred-Identity") && pcscf_assert_identity("location", "$hdr(P-Preferred-Identity)")) {
+       if (is_present_hf("P-Preferred-Identity") && pcscf_assert_identity("location", "$hdr(P-Preferred-Identity)") && $hdr(P-Preferred-Identity) =~ "sip:.*") {
                append_hf("P-Asserted-Identity: $hdr(P-Preferred-Identity)\r\n");
-       } else if (is_present_hf("P-Asserted-Identity") && pcscf_assert_identity("location", "$hdr(P-Asserted-Identity)")) {
+       } else if (is_present_hf("P-Asserted-Identity") && pcscf_assert_identity("location", "$hdr(P-Asserted-Identity)") && $hdr(P-Asserted-Identity) =~ "sip:.*") {
                append_hf("P-Asserted-Identity: $hdr(P-Asserted-Identity)\r\n");
        } else if (pcscf_assert_identity("location", "$(fu{tobody.uri})")) {
-               append_hf("P-Asserted-Identity: <$(fu{tobody.uri})>\r\n");
+               # For broken SIP implementation in Samsung devices
+               if ($fu =~ "tel:.*") {
+                       $var(new_hdr) = $(fu{tobody.uri}) + "@NETWORKNAME";
+                       $var(new_hdr) = $(var(new_hdr){re.subst,/tel:/sip:/g});
+                       append_hf("P-Asserted-Identity: <$var(new_hdr)>\r\n");
+                       $fu = $var(new_hdr);
+               } else {
+                       append_hf("P-Asserted-Identity: <$(fu{tobody.uri})>\r\n");
+               }
        } else {
                append_hf("P-Asserted-Identity: <$pcscf_asserted_identity>\r\n");
        }
Sivanesh1992 commented 1 year ago

thanks for your support @herlesupreeth now i am able to make call from samsung to one plus .

herlesupreeth commented 1 year ago

Awesome.. thanks for testing out patches. I will push the changes to repo now.

Sivanesh1992 commented 1 year ago

HI @herlesupreeth i found one more issue if i make a call from one plus8T to one plus norde CE 5G mobile call is automatically answered .

If i call from one plus nore CE5G to one plus8T mobile i am getting full ring until i answer the call manually

herlesupreeth commented 1 year ago

Then it could be a setting in phone. Not related to IMS in my opinion.

Sivanesh1992 commented 1 year ago

ok @herlesupreeth thankyou

helloTkk commented 4 months ago

thanks for your support @herlesupreeth now i am able to make call from samsung to one plus .

Hi @Sivanesh1992 , may I know which Samsung model you are using here? Thanks!