Hi all, I'm running into some issues with E164 conversions and was wondering if there was a decent standardized method for conversions. Conversions using $rU seem to be working great, but $fU is behaving badly. This is what I have so far:
xlog("$ci - caller id was $avp(src=>callerid)");
if($avp(src=>callerid) =~ "^+"){ xlog("$ci - caller id already E164"); }else if($(rU{s.substr,0,$(avp(src=>countrycode){s.len})}) == $avp(src=>countrycode)){ $avp(src=>callerid) = "+" + $avp(src=>callerid); $fU = $avp(src=>callerid); $avp(uacreplacefromdisplay) = $fU; $avp(uacreplacefromuri) = $fu; xlog("$ci - Adding plus to make caller id e164"); }else{ $fU = "+" + $avp(src=>countrycode) + $fU; $avp(uacreplacefromdisplay) = $fU; $avp(uacreplacefromuri) = $fu; xlog("$ci - converting domestic caller id number to $fU ($fu) - $avp(uacreplacefromdisplay) $avp(uacreplacefromuri)"); }
Previously, I'd found a suggestion mentioning using uac_replace_from in the route[RELAY] (which is the purpose of the uacreplacefrom avps), but $fU does not appear to be changing its value. Is there something I'm doing incorrectly?
Hello,
If you want to change the From (or To) header content, you should use the "uac" modules replace_from/_to functions. They will transparently make sure that both end-points get the correct header content.
Cheers,
Henning
-- Henning Westerholt - https://skalatan.de/blog/ Kamailio services - https://gilawa.comhttps://gilawa.com/
From: sr-users sr-users-bounces@lists.kamailio.org On Behalf Of Melissa Frasik Sent: Tuesday, July 27, 2021 11:26 PM To: sr-users@lists.kamailio.org Subject: [SR-Users] Guidelines on E164 conversions
Hi all, I'm running into some issues with E164 conversions and was wondering if there was a decent standardized method for conversions. Conversions using $rU seem to be working great, but $fU is behaving badly. This is what I have so far:
xlog("$ci - caller id was $avp(src=>callerid)");
if($avp(src=>callerid) =~ "^+"){ xlog("$ci - caller id already E164"); }else if($(rU{s.substr,0,$(avp(src=>countrycode){s.len})}) == $avp(src=>countrycode)){ $avp(src=>callerid) = "+" + $avp(src=>callerid); $fU = $avp(src=>callerid); $avp(uacreplacefromdisplay) = $fU; $avp(uacreplacefromuri) = $fu; xlog("$ci - Adding plus to make caller id e164"); }else{ $fU = "+" + $avp(src=>countrycode) + $fU; $avp(uacreplacefromdisplay) = $fU; $avp(uacreplacefromuri) = $fu; xlog("$ci - converting domestic caller id number to $fU ($fu) - $avp(uacreplacefromdisplay) $avp(uacreplacefromuri)"); }
Previously, I'd found a suggestion mentioning using uac_replace_from in the route[RELAY] (which is the purpose of the uacreplacefrom avps), but $fU does not appear to be changing its value. Is there something I'm doing incorrectly?
Hello,
My apologies, I seem to have posted an incomplete code segment. I only seem to have issues when it comes to replacing $fU (before using uac_replace_from) - the same action on $rU seems to work properly. In the below situation, the $fU variable should be updated with the plus, but the $avp(uacreplacefromdisplay) variable has the value of the original $fU, not the updated one. Is this practice redundant, and should actions on $fU and $rU be avoided in favor of uac_replace_to/uac_replace_from?
$fU = "+" + $avp(src=>countrycode) + $fU;
$avp(uacreplacefromdisplay) = $fU;
$avp(uacreplacefromuri) = $fu;
if ($avp(uacreplacefromdisplay) && $avp(uacreplacefromuri)) {
uac_replace_from("$avp(uacreplacefromdisplay)","$avp(uacreplacefromuri)");
$avp(uacreplacefromdisplay[*])=$null;
$avp(uacreplacefromuri[*])=$null;
}
xlog("$ci - converting domestic caller id number to $fU ($fu) - $avp(uacreplacefromdisplay) $avp(uacreplacefromuri)");
Thank you so much for your help!
________________________________ From: Henning Westerholt hw@skalatan.de Sent: Wednesday, July 28, 2021 1:29 PM To: Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org Cc: Melissa Frasik melissa.frasik@dicecorp.com Subject: RE: Guidelines on E164 conversions
Hello,
If you want to change the From (or To) header content, you should use the “uac” modules replace_from/_to functions. They will transparently make sure that both end-points get the correct header content.
Cheers,
Henning
--
Henning Westerholt – https://skalatan.de/blog/
Kamailio services – https://gilawa.comhttps://gilawa.com/
From: sr-users sr-users-bounces@lists.kamailio.org On Behalf Of Melissa Frasik Sent: Tuesday, July 27, 2021 11:26 PM To: sr-users@lists.kamailio.org Subject: [SR-Users] Guidelines on E164 conversions
Hi all,
I'm running into some issues with E164 conversions and was wondering if there was a decent standardized method for conversions. Conversions using $rU seem to be working great, but $fU is behaving badly. This is what I have so far:
xlog("$ci - caller id was $avp(src=>callerid)");
if($avp(src=>callerid) =~ "^+"){
xlog("$ci - caller id already E164");
}else if($(rU{s.substr,0,$(avp(src=>countrycode){s.len})}) == $avp(src=>countrycode)){
$avp(src=>callerid) = "+" + $avp(src=>callerid);
$fU = $avp(src=>callerid);
$avp(uacreplacefromdisplay) = $fU;
$avp(uacreplacefromuri) = $fu;
xlog("$ci - Adding plus to make caller id e164");
}else{
$fU = "+" + $avp(src=>countrycode) + $fU;
$avp(uacreplacefromdisplay) = $fU;
$avp(uacreplacefromuri) = $fu;
xlog("$ci - converting domestic caller id number to $fU ($fu) - $avp(uacreplacefromdisplay) $avp(uacreplacefromuri)");
}
Previously, I'd found a suggestion mentioning using uac_replace_from in the route[RELAY] (which is the purpose of the uacreplacefrom avps), but $fU does not appear to be changing its value. Is there something I'm doing incorrectly?
Hello,
Yes – as said, you should use the uac functions to change the From/To headers. This is recommended over using the $fU or $tU.
Cheers,
Henning
From: sr-users sr-users-bounces@lists.kamailio.org On Behalf Of Melissa Frasik Sent: Wednesday, July 28, 2021 7:52 PM To: Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org Subject: Re: [SR-Users] Guidelines on E164 conversions
Hello,
My apologies, I seem to have posted an incomplete code segment. I only seem to have issues when it comes to replacing $fU (before using uac_replace_from) - the same action on $rU seems to work properly. In the below situation, the $fU variable should be updated with the plus, but the $avp(uacreplacefromdisplay) variable has the value of the original $fU, not the updated one. Is this practice redundant, and should actions on $fU and $rU be avoided in favor of uac_replace_to/uac_replace_from?
$fU = "+" + $avp(src=>countrycode) + $fU;
$avp(uacreplacefromdisplay) = $fU;
$avp(uacreplacefromuri) = $fu;
if ($avp(uacreplacefromdisplay) && $avp(uacreplacefromuri)) {
uac_replace_from("$avp(uacreplacefromdisplay)","$avp(uacreplacefromuri)");
$avp(uacreplacefromdisplay[*])=$null;
$avp(uacreplacefromuri[*])=$null;
}
xlog("$ci - converting domestic caller id number to $fU ($fu) - $avp(uacreplacefromdisplay) $avp(uacreplacefromuri)");
Thank you so much for your help! ________________________________ From: Henning Westerholt <hw@skalatan.demailto:hw@skalatan.de> Sent: Wednesday, July 28, 2021 1:29 PM To: Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org> Cc: Melissa Frasik <melissa.frasik@dicecorp.commailto:melissa.frasik@dicecorp.com> Subject: RE: Guidelines on E164 conversions
Hello,
If you want to change the From (or To) header content, you should use the “uac” modules replace_from/_to functions. They will transparently make sure that both end-points get the correct header content.
Cheers,
Henning
--
Henning Westerholt – https://skalatan.de/blog/
Kamailio services – https://gilawa.comhttps://gilawa.com/
From: sr-users <sr-users-bounces@lists.kamailio.orgmailto:sr-users-bounces@lists.kamailio.org> On Behalf Of Melissa Frasik Sent: Tuesday, July 27, 2021 11:26 PM To: sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org Subject: [SR-Users] Guidelines on E164 conversions
Hi all,
I'm running into some issues with E164 conversions and was wondering if there was a decent standardized method for conversions. Conversions using $rU seem to be working great, but $fU is behaving badly. This is what I have so far:
xlog("$ci - caller id was $avp(src=>callerid)");
if($avp(src=>callerid) =~ "^+"){
xlog("$ci - caller id already E164");
}else if($(rU{s.substr,0,$(avp(src=>countrycode){s.len})}) == $avp(src=>countrycode)){
$avp(src=>callerid) = "+" + $avp(src=>callerid);
$fU = $avp(src=>callerid);
$avp(uacreplacefromdisplay) = $fU;
$avp(uacreplacefromuri) = $fu;
xlog("$ci - Adding plus to make caller id e164");
}else{
$fU = "+" + $avp(src=>countrycode) + $fU;
$avp(uacreplacefromdisplay) = $fU;
$avp(uacreplacefromuri) = $fu;
xlog("$ci - converting domestic caller id number to $fU ($fu) - $avp(uacreplacefromdisplay) $avp(uacreplacefromuri)");
}
Previously, I'd found a suggestion mentioning using uac_replace_from in the route[RELAY] (which is the purpose of the uacreplacefrom avps), but $fU does not appear to be changing its value. Is there something I'm doing incorrectly?
Thank you so much! I removed any $fU/$rU manipulation in favor of uac_replace_from/to and so far, results have been much more consistent. Appreciate all the help!
Melissa Frasik
Developer
melissa.frasik@iptelx.netmailto:melissa.frasik@iptelx.netmailto:first.last@dicecorp.com
Phone: (989) 891-2800
Fax: (989) 891-2801
[cid:fd86c074-5618-48e4-8ca0-1ed41c69d3e0]
www.dicecorp.comhttp://www.dicecorp.com/
[cid:780ee621-51aa-4f13-90f6-6be3bb239e90][cid:ff4cc17e-fb35-400e-9d71-3ab0bd466f0c][cid:53753460-c1c5-4c07-ac8e-d61c778095de][cid:02bbb391-2898-4410-90eb-5b311af9e37e][cid:57fbdb17-aa8e-462b-b7ba-8efac17f3145]
________________________________ From: Henning Westerholt hw@skalatan.de Sent: Thursday, July 29, 2021 9:35 AM To: Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org Cc: Melissa Frasik melissa.frasik@dicecorp.com Subject: RE: Guidelines on E164 conversions
Hello,
Yes – as said, you should use the uac functions to change the From/To headers. This is recommended over using the $fU or $tU.
Cheers,
Henning
From: sr-users sr-users-bounces@lists.kamailio.org On Behalf Of Melissa Frasik Sent: Wednesday, July 28, 2021 7:52 PM To: Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org Subject: Re: [SR-Users] Guidelines on E164 conversions
Hello,
My apologies, I seem to have posted an incomplete code segment. I only seem to have issues when it comes to replacing $fU (before using uac_replace_from) - the same action on $rU seems to work properly. In the below situation, the $fU variable should be updated with the plus, but the $avp(uacreplacefromdisplay) variable has the value of the original $fU, not the updated one. Is this practice redundant, and should actions on $fU and $rU be avoided in favor of uac_replace_to/uac_replace_from?
$fU = "+" + $avp(src=>countrycode) + $fU;
$avp(uacreplacefromdisplay) = $fU;
$avp(uacreplacefromuri) = $fu;
if ($avp(uacreplacefromdisplay) && $avp(uacreplacefromuri)) {
uac_replace_from("$avp(uacreplacefromdisplay)","$avp(uacreplacefromuri)");
$avp(uacreplacefromdisplay[*])=$null;
$avp(uacreplacefromuri[*])=$null;
}
xlog("$ci - converting domestic caller id number to $fU ($fu) - $avp(uacreplacefromdisplay) $avp(uacreplacefromuri)");
Thank you so much for your help!
________________________________
From: Henning Westerholt <hw@skalatan.demailto:hw@skalatan.de> Sent: Wednesday, July 28, 2021 1:29 PM To: Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org> Cc: Melissa Frasik <melissa.frasik@dicecorp.commailto:melissa.frasik@dicecorp.com> Subject: RE: Guidelines on E164 conversions
Hello,
If you want to change the From (or To) header content, you should use the “uac” modules replace_from/_to functions. They will transparently make sure that both end-points get the correct header content.
Cheers,
Henning
--
Henning Westerholt – https://skalatan.de/blog/
Kamailio services – https://gilawa.comhttps://gilawa.com/
From: sr-users <sr-users-bounces@lists.kamailio.orgmailto:sr-users-bounces@lists.kamailio.org> On Behalf Of Melissa Frasik Sent: Tuesday, July 27, 2021 11:26 PM To: sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org Subject: [SR-Users] Guidelines on E164 conversions
Hi all,
I'm running into some issues with E164 conversions and was wondering if there was a decent standardized method for conversions. Conversions using $rU seem to be working great, but $fU is behaving badly. This is what I have so far:
xlog("$ci - caller id was $avp(src=>callerid)");
if($avp(src=>callerid) =~ "^+"){
xlog("$ci - caller id already E164");
}else if($(rU{s.substr,0,$(avp(src=>countrycode){s.len})}) == $avp(src=>countrycode)){
$avp(src=>callerid) = "+" + $avp(src=>callerid);
$fU = $avp(src=>callerid);
$avp(uacreplacefromdisplay) = $fU;
$avp(uacreplacefromuri) = $fu;
xlog("$ci - Adding plus to make caller id e164");
}else{
$fU = "+" + $avp(src=>countrycode) + $fU;
$avp(uacreplacefromdisplay) = $fU;
$avp(uacreplacefromuri) = $fu;
xlog("$ci - converting domestic caller id number to $fU ($fu) - $avp(uacreplacefromdisplay) $avp(uacreplacefromuri)");
}
Previously, I'd found a suggestion mentioning using uac_replace_from in the route[RELAY] (which is the purpose of the uacreplacefrom avps), but $fU does not appear to be changing its value. Is there something I'm doing incorrectly?