11-24-2016 02:04 AM - edited 03-17-2019 08:46 AM
Hi,
i ve got 2 scripts
script 1
M= {}
M.allowHeaders = {"x-inin-crn"}
function M.outbound_INVITE(msg)
local location = msg:getHeaderValueParameter("Call-info", "x-cisco-loc-name")
msg:addHeader("x-inin-crn", "2000")
msg:addHeaderValueParameter("x-inin-crn", "loc", location)
end
return M
script 2
M={}
function M.inbound_INVITE(msg)
local from = msg:getHeader("From")
local uri = string.match(from, "sip:4920000")
if uri
then
local start = string.find (from, "\"") --find the 1st quote
local finish = string.find (from, "\"", start+1) --find the last quote. start+1 to include the quote
local target = string.sub (from, start, finish) --display the word we want to replace
local targetPattern = string.gsub (target, "%-", "%%-")
local newfrom = string.gsub(from, targetPattern, '"Global Service Desk"')
msg:modifyHeader("From", newfrom)
end
end
return M
i need to have both of them in one SIP Normalization Script.
would I do this ?
O= {}
O.allowHeaders = {"x-inin-crn"}
function O.outbound_INVITE(msg)
local location = msg:getHeaderValueParameter("Call-info", "x-cisco-loc-name")
msg:addHeader("x-inin-crn", "2000")
msg:addHeaderValueParameter("x-inin-crn", "loc", location)
end
return O
M={}
function M.inbound_INVITE(msg)
local from = msg:getHeader("From")
local uri = string.match(from, "sip:4920000")
if uri
then
local start = string.find (from, "\"") --find the 1st quote
local finish = string.find (from, "\"", start+1) --find the last quote. start+1 to include the quote
local target = string.sub (from, start, finish) --display the word we want to replace
local targetPattern = string.gsub (target, "%-", "%%-")
local newfrom = string.gsub(from, targetPattern, '"Global Service Desk"')
msg:modifyHeader("From", newfrom)
end
end
return M
Thanks
10-25-2018 11:26 PM
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