05-29-2018 11:44 AM
Hi there,
I'm looking for SIP Normalization Script to the change the From field from Internal IP Address to Public IP Address.
I have looked at some scripts on this website and modified:
M={}
function M.outbound_INVITE(msg)
local from = msg:getHeader("From") --Get FROM Header
local b = string.gsub(from, "<sip:.+@10.10.10.1>", "<sip:.+@A.B.C.D>") --New FROM Header
msg:modifyHeader("From", b) --Replace FROM Header
end
return M
When applied it doesn't show the number before @10.10.10.1. How I can let the portion before @ unchanged? (which wildcard I can use) So that the number is shown.
Any help will be highly appreciated.
Thanks.
Solved! Go to Solution.
05-30-2018 08:15 AM
Hi Sam,
gsub is greedy, so unless you capture the LHS, it will disappear after the substitution. I would try:
local b = string.gsub(from, "@10.10.10.1>", "@A.B.C.D>")
Mark
05-30-2018 08:15 AM
Hi Sam,
gsub is greedy, so unless you capture the LHS, it will disappear after the substitution. I would try:
local b = string.gsub(from, "@10.10.10.1>", "@A.B.C.D>")
Mark
05-31-2018 07:16 AM
Hi Mark,
Thanks for your reaction. It's working like a charm
Is it possible to add another method in this script? I want to add change in Via and Diversion in the same method.
Thanks.
05-31-2018 12:11 PM
Sam,
If you want to change the headers in the same 'outbound_INVITE' headers, then just add additional header manipulations in the function you are working on.
Mark
01-07-2019 06:10 AM
Hello All,
We are using below SIP normalization for inbound and outbound in one script does it work's?
Error message " Unavaliable--CVP_11.0.1" message showing for the incoming customer call and CCB calls as well.
We have created below script, but for incoming call from customer we are not seeing the error message on IP phones,But for Courtesy Call Back calls, when they are connected it is showing as " Unavaliabl" on the IP phones.
Script #
M = {}
function M.inbound_ANY(msg)
local from = msg:getHeader("Remote-Party-ID")
if (from ~= nil) then
from = string.gsub(from, "--CVP[_0-9]*", "")
msg:modifyHeader("Remote-Party-ID", from )
end
end
function M.outbound_ANY_ANY(msg)
local from = msg:getHeader("Remote-Party-ID")
if (from ~= nil) then
from = string.gsub(from, "--CVP[_0-9]*", "")
msg:modifyHeader("Remote-Party-ID", from )
end
end
return M
any suggestions to fix this.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide