Developer Guide for SIP Transparency and Normalization
SIP Utility APIs
Downloads: This chapterpdf (PDF - 326.0KB) The complete bookPDF (PDF - 1.92MB) | Feedback

SIP Utility APIs

Table Of Contents

SIP Utility APIs

parseUri


SIP Utility APIs


The Lua environment provides an APIs that allows data strings to be manipulated. The following SIP Utility API is availabe:

parseUri

parseUri

parseUri(uri)

Given a URI string, this function parses the specified URI into a sipUri object and returns the sipUri object to the calling script. Null is returned if a valid URI is not specified.

Example:

Script

MM = {}
function M.inbound_INVITE(msg)
    local uriString = msg:getUri("P-Asserted-Identity")
    if uriString
    then
        local uri = sipUtils.parseUri(uriString)
    end
end
return M

Message

INVITE sip:1234@10.10.10.1 SIP/2.0
.
P-Asserted-Identity: <sip:1234@10.10.10.1>
.

Output/Results

Local variable uriString is set to "sip:1234@10.10.10.1"
Local variable uri is a sipUri object containing the parsed form of uriString
	"uri:getUser() is "1234"
	"uri:getHost() is "10.10.10.1"