diff options
author | Gerald Begumisa <ben_g@users.sourceforge.net> | 2007-09-08 14:38:30 +0000 |
---|---|---|
committer | Gerald Begumisa <ben_g@users.sourceforge.net> | 2007-09-08 14:38:30 +0000 |
commit | 0d8f72030d5b7ef0462f025e401c9a480b8cf2a0 (patch) | |
tree | 6abd5349f156b87be6914974ddfc99c2992a3097 /orkaudio/audiocaptureplugins/voip/VoIp.cpp | |
parent | 8284fc8d74cb49aa2bd97b3063ed6e503486e940 (diff) |
Minor change to remove leading whitespace(s) from the SIP header value obtained when processing the SIP fields to be extracted as per SipExtractFields in config.xml
git-svn-id: https://oreka.svn.sourceforge.net/svnroot/oreka/trunk@485 09dcff7a-b715-0410-9601-b79a96267cd0
Diffstat (limited to 'orkaudio/audiocaptureplugins/voip/VoIp.cpp')
-rw-r--r-- | orkaudio/audiocaptureplugins/voip/VoIp.cpp | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/orkaudio/audiocaptureplugins/voip/VoIp.cpp b/orkaudio/audiocaptureplugins/voip/VoIp.cpp index 25a9494..58d7298 100644 --- a/orkaudio/audiocaptureplugins/voip/VoIp.cpp +++ b/orkaudio/audiocaptureplugins/voip/VoIp.cpp @@ -233,6 +233,20 @@ char* GrabLine(char* start, char* limit, CStdString& out) return c; } +// Grabs a line of characters in memory skipping any leading +// whitespaces. This is intended for use in the case of SIP +// headers, ref RFC 3261, section 7.3.1 +char* GrabLineSkipLeadingWhitespace(char* start, char* limit, CStdString& out) +{ + char* c = start; + while(*c == 0x20 && (*c != '\0' && *c != 0x0D && *c != 0x0A) && c<limit) + { + c = c+1; + } + + GrabLine(c, limit, out); +} + static int iax2_codec_to_rtp_payloadtype(int codec) { switch(codec) { @@ -1546,7 +1560,24 @@ bool TrySipInvite(EthernetHeaderStruct* ethernetHeader, IpHeaderStruct* ipHeader if(szField) { CStdString field; - GrabLine(szField, sipEnd, field); + + // XXX + // The line below was replaced because I experienced + // cases where we would have a leading whitespace in the + // tag which has been extracted. However, since we are + // dealing with SIP, RFC 3261, section 7.3.1 illustrates + // that any leading whitespaces after the colon is not + // in fact part of the header value. Therefore, I + // created the GrabLineSkipLeadingWhitespace() function + // which I use in this particular case. + // + // Hope this is ok. + // + // --Gerald + // + //GrabLine(szField, sipEnd, field); + + GrabLineSkipLeadingWhitespace(szField, sipEnd, field); info->m_extractedFields.insert(std::make_pair(*it, field)); } } |