Skip to content

Commit 1224a46

Browse files
authored
Adding SERVICE method (#1284)
* adding SERVICE method * changing content-type * adding comment
1 parent 40fd873 commit 1224a46

2 files changed

Lines changed: 32 additions & 2 deletions

File tree

src/core/SIP/SIPConstants.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//-----------------------------------------------------------------------------
1+
//-----------------------------------------------------------------------------
22
// Filename: SIPConstants.cs
33
//
44
// Description: SIP constants.
@@ -385,6 +385,7 @@ public enum SIPMethodsEnum
385385
MESSAGE = 15, // RFC3428.
386386
PRACK = 16, // RFC3262.
387387
UPDATE = 17, // RFC3311.
388+
SERVICE = 18 // Not defined in RFC. But there are reported uses of this method. Example: https://learn.microsoft.com/en-us/openspecs/office_protocols/ms-pres/258ef387-09f9-416d-b7a8-3ec20f4d9944
388389
}
389390

390391
public static class SIPMethods
@@ -674,4 +675,4 @@ public static List<SIPExtensions> ParseSIPExtensions(string extensionList, out s
674675
return knownExtensions;
675676
}
676677
}
677-
}
678+
}

test/unit/core/SIP/SIPRequestUnitTest.cs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1557,6 +1557,35 @@ public void GenerateDiversionHeadersOnToStringTest()
15571557
logger.LogDebug("-----------------------------------------");
15581558
}
15591559

1560+
[Fact]
1561+
public void ParseSERVICEUnitTest()
1562+
{
1563+
logger.LogDebug("--> " + System.Reflection.MethodBase.GetCurrentMethod().Name);
1564+
logger.BeginScope(System.Reflection.MethodBase.GetCurrentMethod().Name);
1565+
1566+
string sipMsg =
1567+
"SERVICE sip:[email protected] SIP/2.0" + m_CRLF +
1568+
"From: <sip:[email protected]>;epid=85D7DC3A61;tag=ddfb74b87" + m_CRLF +
1569+
"To: <sip:[email protected]>" + m_CRLF +
1570+
"Call-ID: fc2gbd6449264ecfbe9rbf23f11f7be9" + m_CRLF +
1571+
"CSEQ: 73 SERVICE" + m_CRLF +
1572+
"CONTACT: <sip:[email protected]>" + m_CRLF +
1573+
"Via: SIP/2.0/UDP 10.0.0.1:5060;branch=yxxxcvvvbbbnnmm1;" + m_CRLF +
1574+
"Max-Forwards: 67" + m_CRLF +
1575+
"Content-Length: 5" + m_CRLF +
1576+
"CONTENT-TYPE: text/text" + m_CRLF +
1577+
"USER-AGENT: Agent" + m_CRLF + m_CRLF +
1578+
"abcd" + m_CRLF;
1579+
1580+
SIPMessageBuffer sipMessageBuffer = SIPMessageBuffer.ParseSIPMessage(Encoding.UTF8.GetBytes(sipMsg), null, null);
1581+
SIPRequest serviceReq = SIPRequest.ParseSIPRequest(sipMessageBuffer);
1582+
1583+
Assert.True(serviceReq.Method == SIPMethodsEnum.SERVICE, "The SIP request method was not parsed correctly.");
1584+
Assert.True(serviceReq.Header.CSeqMethod == SIPMethodsEnum.SERVICE, "The SIP request CSeq method was not parsed correctly.");
1585+
1586+
logger.LogDebug("-----------------------------------------");
1587+
}
1588+
15601589
}
15611590

15621591
#pragma warning restore SYSLIB0021

0 commit comments

Comments
 (0)