Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- M={}
- function process_contact_headers(msg)
- if msg:getHeader("From")
- then
- local from = msg:getHeader("From")
- if string.find(from, "\".+\" <sip:")
- then
- local replaceheaderfrom = string.gsub(from, "\".+\" <sip:", "<sip:")
- msg:modifyHeader("From", replaceheaderfrom)
- end
- end
- if msg:getHeader("P-Preferred-Identity")
- then
- local ppref = msg:getHeader("P-Preferred-Identity")
- if string.find(ppref, "\".+\" <sip:")
- then
- local replaceheaderppref = string.gsub(ppref, "\".+\" <sip:", "<sip:")
- msg:modifyHeader("P-Preferred-Identity", replaceheaderppref)
- end
- end
- if msg:getHeader("Remote-Party-ID")
- then
- local rpid = msg:getHeader("Remote-Party-ID")
- if string.find(rpid, "\".+\" <sip:")
- then
- local replaceheaderrpid = string.gsub(rpid, "\".+\" <sip:", "<sip:")
- msg:modifyHeader("Remote-Party-ID", replaceheaderrpid)
- end
- - msg:removeHeader("Remote-Party-ID")
- end
- end
- M.inbound_INVITE = process_contact_headers
- M.inbound_ANY_INVITE = process_contact_headers
- - M.outbound_ANY_INVITE = process_contact_headers
- return M
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement