08-02-2024 06:55 AM
I'm seeing a few references to carrier-id and how it could match a dial-peer either outbound or inbound (e.g. Page 12 in BRKCOL-2314).
Could anyone explain please:
1. What is the format of this carrier-id or cid tag? Is it a SIP header inside the INVITE or is it somehow part of the VIA header?
2. Is there any easy way to set this in CUCM such as a LUA script?
It sounds like an obvious way for CUBE to send calls to a carrier based on the intelligence of the downstream system. Incidentally, if there's a better way to indicate outbound CUBE dialpeer from a CUCM calling node, I would be interested to know.
08-07-2024 09:40 AM
Luckily @Jonathan Schulenberg posted a old Cisco Live slide (shame on Cisco for removing this vital documentation).
Carrier ID takes this format: x-route-tag="cid:carrier@next-hop" and is part of the VIA header.
Example: x-route-tag="cid:colt@10.1.1.1"
08-07-2024 09:43 AM - edited 08-07-2024 10:39 AM
Here is a LUA script to add the Carrier ID into the VIA header on CUCM -> CUBE messages:
--[[
In CUCM, you MUST specify a parameter of "carrier" (e.g. carrier=colt)
This script will append ;x-route-tag="cid:carrier@next-hop" to the VIA header.
--]]
M = {}
trace.enable()
function M.outbound_ANY(msg)
local carrier = scriptParameters.getValue("carrier")
local via = msg:getHeader("Via")
if via and carrier
then
-- Derive NextHop from RequestURI:
local method,ruri,ver = msg:getRequestLine()
local nexthop = ruri:match("@(%d+%.%d+%.%d+%.%d+)")
-- Strip Previous CarrierID tag if present:
local newvia = via:gsub("^(.*);x-route-tag=\"cid:.+\";?(.*)$", "%1%2")
-- Add new CarrierID tag:
newvia = newvia:gsub("^(.+)$","%1" .. ";x-route-tag=\"cid:" .. carrier .. "@" .. nexthop .. "\"" ,1)
if trace.enabled()
then
trace.format("LUA VIA: Nexthop is:%s", nexthop)
trace.format("LUA VIA: Carrier will be:%s", carrier)
trace.format("LUA VIA: New header is:%s", newvia)
end
-- CUCM to amend the header:
msg:modifyHeader("Via", newvia)
end
end
return M
I haven't tested this in a live environment and I'm surprised it isn't part of a DevNet sample. If anyone could critique this/or tell me why it won't work, I would be very grateful. It's working well on a basic outbound SIP call.
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