C# Class SIPSorcery.SIP.App.SIPProviderMagicJack

Tweaks the nonce on requests for provider MagicJack.
ファイルを表示 Open project: sipsorcery/sipsorcery Class Usage Examples

Public Properties

Property Type Description
logger log4net.ILog

Public Methods

Method Description
GetAuthenticationHeader ( SIPResponse authReqdResponse ) : SIPAuthenticationHeader

MagicJack apply a custom algorithm when calculating their nonce seemingly in order to prevent other SIP UAs from being able to authenticate. This method attempts to apply the same algorithm to allow the authenticated requests from this stack.

MJ is modifying the nonce dynamically. They append an underscore, then 8 characters to the nonce before computing the MD5. The 8 characters come from the call id. Use the first 8 bytes of the nonce as an index into your call id. Assume your callid is: callid: 9876ABC56738DD43... index: 0123456789ABCDEF and your nonce is: 8765abc4_32190 Take the first digit of your nonce (which in our example is 8 ), and find the value in the callid at index 8, which is 6. So, append that to the nonce. 8765abc4_32190_6 Then move on to the second digit of the nonce, which is 7 in our example. Find the value at index 7 in the callid, which is 5, and append that: 8765abc4_32190_65 continue until you have done 8 digits. Your new nonce would be: 8765abc4_32190_65CB38DA Use this value when computing the MD5, but pass the original nonce to magicJack.

IsMagicJackRequest ( SIPResponse sipResponse ) : bool

Private Methods

Method Description
GetNonce ( string origNonce, string callId ) : string

Method Details

GetAuthenticationHeader() public static method

MagicJack apply a custom algorithm when calculating their nonce seemingly in order to prevent other SIP UAs from being able to authenticate. This method attempts to apply the same algorithm to allow the authenticated requests from this stack.
MJ is modifying the nonce dynamically. They append an underscore, then 8 characters to the nonce before computing the MD5. The 8 characters come from the call id. Use the first 8 bytes of the nonce as an index into your call id. Assume your callid is: callid: 9876ABC56738DD43... index: 0123456789ABCDEF and your nonce is: 8765abc4_32190 Take the first digit of your nonce (which in our example is 8 ), and find the value in the callid at index 8, which is 6. So, append that to the nonce. 8765abc4_32190_6 Then move on to the second digit of the nonce, which is 7 in our example. Find the value at index 7 in the callid, which is 5, and append that: 8765abc4_32190_65 continue until you have done 8 digits. Your new nonce would be: 8765abc4_32190_65CB38DA Use this value when computing the MD5, but pass the original nonce to magicJack.
public static GetAuthenticationHeader ( SIPResponse authReqdResponse ) : SIPAuthenticationHeader
authReqdResponse SIPSorcery.SIP.SIPResponse
return SIPSorcery.SIP.SIPAuthenticationHeader

IsMagicJackRequest() public static method

public static IsMagicJackRequest ( SIPResponse sipResponse ) : bool
sipResponse SIPSorcery.SIP.SIPResponse
return bool

Property Details

logger public_oe static_oe property

public static ILog,log4net logger
return log4net.ILog