Advertisement
Guest User

Untitled

a guest
Feb 24th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. M={}
  2. function process_contact_headers(msg)
  3. if msg:getHeader("From")
  4. then
  5. local from = msg:getHeader("From")
  6. if string.find(from, "\".+\" <sip:")
  7. then
  8. local replaceheaderfrom = string.gsub(from, "\".+\" <sip:", "<sip:")
  9. msg:modifyHeader("From", replaceheaderfrom)
  10. end
  11. end
  12. if msg:getHeader("P-Preferred-Identity")
  13. then
  14. local ppref = msg:getHeader("P-Preferred-Identity")
  15. if string.find(ppref, "\".+\" <sip:")
  16. then
  17. local replaceheaderppref = string.gsub(ppref, "\".+\" <sip:", "<sip:")
  18. msg:modifyHeader("P-Preferred-Identity", replaceheaderppref)
  19. end
  20. end
  21. if msg:getHeader("Remote-Party-ID")
  22. then
  23. local rpid = msg:getHeader("Remote-Party-ID")
  24. if string.find(rpid, "\".+\" <sip:")
  25. then
  26. local replaceheaderrpid = string.gsub(rpid, "\".+\" <sip:", "<sip:")
  27. msg:modifyHeader("Remote-Party-ID", replaceheaderrpid)
  28. end
  29. - msg:removeHeader("Remote-Party-ID")
  30. end
  31. end
  32. M.inbound_INVITE = process_contact_headers
  33. M.inbound_ANY_INVITE = process_contact_headers
  34. - M.outbound_ANY_INVITE = process_contact_headers
  35. return M
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement