Kamailio - Changing the From URI for Level3

Posted by Michael Palmer on Tuesday, April 10, 2012

So Level3 uses the E.164 recommendation for sending caller information. The problem with this is that they send a + prefix to the phone number. The problem with sending the + in the caller number, is that a common desk phone (Polycom/Cisco/Yealink/Aastra) will try to make an IP call to the number, or just fail. It seems like only cell phones handle the + character in a number.

So to keep that plus out of the network, I added the following code to my kamailio.cfg to “filter” out the + before sending to the caller.

1
2
3
4
$avp(s:from)=$fu;
$avp(s:from) = $(fu{re.subst,/\+1//g});
  if ($(avp(s:from){s.len}) == 0) { $avp(s:from)  = $fu; }
uac_replace_from("$avp(s:from)");

Maybe there is a better way, but this is working in production. Let me know if anyone has a better method!


comments powered by Disqus