Your IP : 172.28.240.42


Current Path : /usr/lib/python2.7/dist-packages/twisted/test/
Upload File :
Current File : //usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyc


=Nc@sdZddlmZmZddlmZddlmZmZm	Z	ddl
mZddlm
Z
ddlmZddlZddlZdd	lmZd
djdd
Zdjdd
Zdjdd
Zdjdd
Zdjdd
Zdjdd
Zdjdd
Zdd:dYZdejfdYZdefdYZdejfdYZ dejfdYZ!dejfdYZ"d ejfd!YZ#d"d;d#YZ$d$d<d%YZ%d&ejfd'YZ&d(ejfd)YZ'd*ej(fd+YZ)d,ejfd-YZ*d.Z+d/Z,d0Z-d1Z.d2ej/fd3YZ0d4ej1fd5YZ2d6ejfd7YZ3d8ejfd9YZ4dS(=s&Session Initialization Protocol tests.i(tunittesttutil(tsip(tdefertreactortutils(tVersion(t
proto_helpers(tcredN(t
implementss



s?INVITE sip:foo SIP/2.0
From: mo
To: joe
Content-Length: 4

abcds
s
s-INVITE sip:foo SIP/2.0
From: mo
To: joe

1234sHINVITE sip:foo SIP/2.0
From: mo
To: joe
Content-Length: 4

1234

lalalalsINVITE sip:foo SIP/2.0
From: mo
To: joe
Content-Length: 0

INVITE sip:loop SIP/2.0
From: foo
To: bar
Content-Length: 4

abcdINVITE sip:loop SIP/2.0
From: foo
To: bar
Content-Length: 4

1234s4SIP/2.0 200 OK
From:  foo
To:bar
Content-Length: 0

s.INVITE sip:foo SIP/2.0
f: mo
t: joe
l: 4

abcds=INVITE sip:foo SIP/2.0
Via: SIP/2.0/UDP 10.0.0.1:5060;rport

t	TestRealmcBseZdZRS(cGstjddfS(NcSsdS(N(tNone(((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyt<lambda>[s(RtIContactR(tselftavatarIdtmindt
interfaces((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyt
requestAvatarZs(t__name__t
__module__R(((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyR
YstMessageParsingTestCasecBsYeZdZdZdZdZdZdZdZdZ	dZ
RS(	cCs%g|_tj|jj|_dS(N(tlRtMessagesParsertappendtparser(R((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pytsetUp^s	cCs!|jj||jjdS(N(RtdataReceivedtdataDone(Rtmessage((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pytfeedMessagebscCsi|j|j||j|jj||j|j||j|j||j|jddS(sValidate Requests.iN(tassertEqualtmethodturittoStringtheaderstbodytfinished(RtmR R!R#R$((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pytvalidateMessagefs
cCsk|j}|jt|jt|d|j|dddidgd6dgd6d	gd
6ddS(NiitINVITEssip:footmotfromtjoettot4scontent-lengthtabcd(RRtrequest1RtlenR'(RR((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyt
testSimplens	

!cCs|j}|jt|jt|jt|d|j|dddidgd6dgd6d	gd
6d|j|dddidgd6dgd6d
dS(NiiR(ssip:fooR)R*R+R,R-scontent-lengthR.it1234(RRR/trequest2RR0R'(RR((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyttestTwoMessagesws	


!cCsk|j}|jt|jt|d|j|dddidgd6dgd6d	gd
6ddS(NiiR(ssip:fooR)R*R+R,R-scontent-lengthR2(RRtrequest3RR0R'(RR((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyttestGarbages	

!cCs|j}|jt|jt|d|j|dddidgd6dgd6d	gd
6d|j|ddd
idgd6dgd6dgd
6d|j|ddd
idgd6dgd6dgd
6ddS(NiiR(ssip:fooR)R*R+R,t0scontent-lengthtissip:looptfootbarR-R.iR2(RRtrequest4RR0R'(RR((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyttestThreeInOnes	

!
!
!cCsk|j}|jt|jt|d|j|dddidgd6dgd6d	gd
6ddS(NiiR(ssip:fooR)R*R+R,R-scontent-lengthR.(RRt
request_shortRR0R'(RR((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyt	testShorts	

!cCs|j}|jt|jt|d|d}|j|jd|j|jd|j|jidgd6dgd6d	gd
6|j|jd|j|j	ddS(NiiitOKR9R*R:R,R7scontent-lengthR8(
RRt	response1RR0tcodetphraseR#R$R%(RRR&((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyttestSimpleResponses	

%(RRRRR'R1R4R6R<R>RC(((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyR]s						
					tMessageParsingTestCase2cBseZdZdZRS(s/Same as base class, but feed data char by char.cCs2x|D]}|jj|qW|jjdS(N(RRR(RRtc((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyRs
(RRt__doc__R(((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyRDstMakeMessageTestCasecBs#eZdZdZdZRS(cCs<tjdd}|jdd|j|jddS(NR(ssip:fooR9R:s$INVITE sip:foo SIP/2.0
Foo: bar

(RtRequestt	addHeaderRR"(Rtr((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyttestRequests
	cCsYtjdd}|jdd|jdd|jd|j|jddS(	NiR?R9R:sContent-LengthR-R2s3SIP/2.0 200 OK
Foo: bar
Content-Length: 4

1234(RtResponseRItbodyDataReceivedRR"(RRJ((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyttestResponses
	cCs)tjd}|j|jddS(NisSIP/2.0 200 OK

(RRLRR"(RRJ((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyttestStatusCodes(RRRKRNRO(((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyRGs			tViaTestCasecBsbeZdZdZdZdZdZdZdZdZ	dZ
d	ZRS(
cCs/|j}|j|tj|jdS(N(R"RRtparseViaHeader(Rtvts((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pytcheckRoundtripscCsdtjd}tjd}|j|j|j|j|j|j|j|j|jdS(NsSIP/2.0/UDP 192.168.1.1:5060s SIP/2.0/UDP     192.168.1.1:5060(RRQRt	transportthosttport(Rtv1tv2((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyttestExtraWhitespaces
cCsd}tj|}|j|jd|j|jd|j|jd|j|jd
|j|jd
|j|j	t
|j|jd|j|jd|j|j
d|j|jd|j|jd	|j|d
S(sC
        Test parsing a Via header with one of everything.
        sVSIP/2.0/UDP first.example.com:4000;ttl=16;maddr=224.2.0.1 ;branch=a7c6a8dlze (Example)tUDPsfirst.example.comiis	224.2.0.1t
a7c6a8dlzeisKSIP/2.0/UDP first.example.com:4000;ttl=16;branch=a7c6a8dlze;maddr=224.2.0.1N(RRQRRURVRWtrportRt
rportValuetrportRequestedtFalsetttltmaddrtbranchthiddenR"RT(RRSRR((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyttest_complexscCsd}tj|}|j|jd|j|jd|j|jd|j|jd|j|jd|j|j	t
|j|jd|j|jd|j|j
d|j|jt|j|jd|j|dS(s3
        Test parsing a simple Via header.
        sSIP/2.0/UDP example.com;hiddenR[sexample.comis#SIP/2.0/UDP example.com:5060;hiddenN(RRQRRURVRWR]RR^R_R`RaRbRcRdtTrueR"RT(RRSRR((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyttest_simplescCs tjd}|j|dS(Nsexample.com(RtViaRT(RRR((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyttestSimplerscCstjddt}|jd|jg}|jt|d|j|ddd|j|ddt|j|jd	|j|j	t|j|j
t|j|jd
d
S(s|
        Setting rport to True is deprecated, but still produces a Via header
        with the expected properties.
        sfoo.barR]toffendingFunctionsiiRs+rport=True is deprecated since Twisted 9.0.tcategorysSIP/2.0/UDP foo.bar:5060;rportN(
RRhRft
flushWarningsttest_deprecatedRPortRR0tDeprecationWarningR"R]R_R^R(RRRtwarnings((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyRms	cCsUtjddd}|j|jd|j|jt|j|jddS(sU
        An rport setting of None should insert the parameter with no value.
        sfoo.barR]sSIP/2.0/UDP foo.bar:5060;rportN(RRhRRR"R_RfR^(RRR((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyt
test_rport(scCshtjddd}|j|jd|j|jt|j|jd|j|jddS(sk
        An rport numeric setting should insert the parameter with the number
        value given.
        sfoo.barR]is SIP/2.0/UDP foo.bar:5060;rport=1N(RRhRR"R_R`R^R](RRR((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyttest_rportValue2s
cCsd}tj|}|j|jd|j|jd|j|jd|j|jd|j|jd|j|j	j
dddS(	Ns8SIP/2.0/UDP 10.0.0.1:5060;received=22.13.1.5;rport=12345R[s10.0.0.1is	22.13.1.5i90srport=12345i(RRQRRURVRWtreceivedR]tassertNotEqualsR"tfind(RRSRR((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyttestNAT>scCs/d}tj|}|j|j|dS(sX
       Parsing and serializing Via headers with unknown parameters should work.
       s?SIP/2.0/UDP example.com:5060;branch=a12345b;bogus;pie=deliciousN(RRQRR"(RRSRR((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyttest_unknownParamsJs(RRRTRZReRgRiRmRpRqRuRv(((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyRPs							
		tURLTestCasecBseZdZdZRS(cCs@x9ddddgD]%}|jtj|j|qWdS(Nssip:j.doe@big.coms&sip:j.doe:secret@big.com;transport=tcps!sip:j.doe@big.com?subject=projectssip:example.com(RRtparseURLR"(Rturl((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyt
testRoundtripVs
cCsd}tj|}xnddddd d!d"d#d$dddgfdidd6dd6fgD]%\}}|jt|||q]WdS(%Nsesip:user:pass@hosta:123;transport=udp;user=phone;method=foo;ttl=12;maddr=1.2.3.4;blah;goo=bar?a=b&c=dtusernametusertpasswordtpassRVthostaRWi{RUtudptusertypetphoneR R9RaiRbs1.2.3.4tothertblahsgoo=barR#tbtatdRE(susernamesuser(R}R~(shostR(sporti{(s	transportR(RR(smethodsfoo(sttli(smaddrs1.2.3.4(RRxRtgetattr(RRSRytkRR((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyttestComplex_s	'(RRRzR(((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyRwTs		t
ParseTestCasecBseZdZRS(c
Csxdddifdddifdddifdddifdd	did
d6dd	6fgD]`\}}}}tj|\}}}|j|||j|j||j||q`WdS(
Ns""A. G. Bell" <sip:foo@example.com>s
A. G. Bellssip:foo@example.comsAnon <sip:foo@example.com>tAnonR8s<sip:foo@example.com>s)foo <sip:foo@example.com>;tag=bar;foo=bazR9R:ttagtbaz(RtparseAddressRR"(Rtaddresstnameturlstparamstgnametgurltgparams((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyttestParseAddressns-(RRR(((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyRlstDummyLocatorcBseZeejdZRS(cCstjtjdddS(Ns
server.comRWi(RtsucceedRtURL(Rt
logicalURL((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyt
getAddresss(RRR	RtILocatorR(((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyR~s
tFailingLocatorcBseZeejdZRS(cCstjtS(N(RtfailtLookupError(RR((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyRs(RRR	RRR(((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyRs
t
ProxyTestCasecBsbeZdZdZdZdZdZdZdZdZ	dZ
d	ZRS(
csCtjd_tj_g_fdj_dS(Ns	127.0.0.1csjj||fS(N(tsentR(tdesttmsg(R(s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyRs(RtProxytproxyRtlocatorRtsendMessage(R((Rs9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyRs	cCs;tjdd}|jdtjdj|jdtjdj|jdd|jdd	|jd
d|jj|jd|jt|j	d
|j	d\}}|j|j
d|j|jd|j|jjd|j|j
d|j|jddddgdS(NR(ssip:footvias1.2.3.4s1.2.3.5R9R:R,s<sip:joe@server.com>tcontacts<sip:joe@1.2.3.5>iiis
server.comsSIP/2.0/UDP 127.0.0.1:5060sSIP/2.0/UDP 1.2.3.4:5060sSIP/2.0/UDP 1.2.3.5:5060(s1.2.3.4i(RRHRIRhR"RtdatagramReceivedRR0RRWRVR!R R#(RRJRR&((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyttestRequestForwards"cCstjdd}|jdtjdj|jdd|jdd|jd	d
|jj|jd|jd
\}}|j|j	dddgdS(NR(ssip:fooRs1.2.3.4R9R:R,s<sip:joe@server.com>Rs<sip:joe@1.2.3.4>s1.1.1.1iisSIP/2.0/UDP 127.0.0.1:5060s)SIP/2.0/UDP 1.2.3.4:5060;received=1.1.1.1(s1.1.1.1i(
RRHRIRhR"RRRRR#(RRJRR&((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyttestReceivedRequestForwardscCsdtjd}|jdtjdj|jj|jd|jt|j	ddS(NiRsfoo.coms1.1.1.1ii(s1.1.1.1i(
RRLRIRhR"RRRR0R(RRJ((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyttestResponseWrongViascCstjd}|jdtjdj|jdtjdddj|jj|jd|jt|j	d	|j	d
\}}|j|j
|jfd
|j|jd|j|j
ddgdS(NiRs	127.0.0.1s
client.comRWis1.1.1.1iiisSIP/2.0/UDP client.com:1234(s1.1.1.1i(s
client.comi(RRLRIRhR"RRRR0RRVRWRAR#(RRJRR&((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyttestResponseForwards%cCstjd}|jdtjdj|jdtjdddj|jj|jd|jt|j	d	|j	d
\}}|j|j
|jfddS(
NiRs	127.0.0.1s10.0.0.1Rrs
client.coms1.1.1.1iii(s1.1.1.1i(s
client.comi(RRLRIRhR"RRRR0RRVRW(RRJRR&((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyttestReceivedResponseForwardscstjd}|jdtjdjgfd|j_|jj|jd	|jt	dd\}}|jt	|j
jdgd|j|jddS(
NiRs	127.0.0.1cs
j|S(N(R(R(R(s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyRss1.1.1.1iii(s1.1.1.1i(
RRLRIRhR"RtgotResponseRRR0R#tgetRA(RRJR&taddr((Rs9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyttestResponseToUss%cCstjdd}|jdtjdj|jdtjdj|jj|jd|j|jgdS(	NR(ssip:fooRs1.2.3.4s	127.0.0.1s
client.comi(s
client.comi(	RRHRIRhR"RRRR(RRJ((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyttestLoops
cCstjdd}|jdtjdj|jddt|j_|jj|jd|j	t
|jd|jd	\}}|j	|j|j
fd
|j	|jd
|j	|jddgdS(NR(ssip:fooRs1.2.3.4R,s<sip:joe@server.com>iiiisSIP/2.0/UDP 1.2.3.4:5060(s1.2.3.4i(s1.2.3.4i(RRHRIRhR"RRRRRR0RRVRWRAR#(RRJRR&((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyttestCantForwardRequestscCsdS(N((R((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyttestCantForwardResponses(RRRRRRRRRRRR(((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyRs			
						tRegistrationTestCasecBseZdZejeejdeddZdZdZ	dZ
dZdZd	Z
d
ZdZdZd
ZdZdZdZRS(csbtjdd_tjd_jj_j_g_fdj_dS(NRVs	127.0.0.1sbell.example.comcsjj||fS(N(RR(RR(R(s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyRs(Rt
RegisterProxyRtInMemoryRegistrytregistryRRR(R((Rs9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyRs
	RkRs5twisted.protocols.sip.DigestAuthorizer was deprecatedcCs7x*|jjjD]\}}|jqW|`dS(N(RtuserstvaluestcancelR(RRR!((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyttearDownscCsntjdd}|jdd|jdd|jdtjdj|jj|jd
dS(NtREGISTERssip:bell.example.comR,ssip:joe@bell.example.comRssip:joe@client.com:1234Rs
client.comi(s
client.comi(RRHRIRhR"RR(RRJ((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pytregisters
cCs~tjdd}|jdd|jdd|jdtjdj|jd	d
|jj|jddS(
NRssip:bell.example.comR,ssip:joe@bell.example.comRt*Rs
client.comtexpiresR7i(s
client.comi(RRHRIRhR"RR(RRJ((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyt
unregisterscCsT|j|jd\}}|j|j|jfd|j|jd|j|jddg|j|jddg|j|jd	d
g|jt|jdddk|jt	|j
jd|j
jd\}}|j|jd
|j
jjtjdddd}|jd|j|jd|S(Nis
client.comiiRsSIP/2.0/UDP client.com:5060R,ssip:joe@bell.example.comRssip:joe@client.com:5060RiiiiiR+R{RVsbell.example.comcSs|j|jfS(N(RVRW(tdesturl((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyR"s(s
client.comi(iiii(s
client.comi(RRRRVRWRAR#t
failUnlesstintR0RRR"RRRRRtaddCallback(RRR&tdcR!R((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyttestRegisters"
cCs|j|j|jd\}}|j|j|jfd
|j|jd|j|jddg|j|jddg|j|jd	d
g|j|jddg|j|jj	idS(Nis
client.comiiRsSIP/2.0/UDP client.com:5060R,ssip:joe@bell.example.comRssip:joe@client.com:5060RR7(s
client.comi(
RRRRRVRWRAR#RR(RRR&((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyttestUnregister&s

cCsWt}tjj|}tjj}|jdd|j|||j_dS(NsuserXname@127.0.0.1t	passXword(	R
RtportaltPortaltcheckerst'InMemoryUsernamePasswordDatabaseDontUsetaddUsertregisterCheckerR(RRJtpRE((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyt	addPortal3s	
cCss|j|j|jt|jjd|jt|jd|jd\}}|j|jddS(Niii(RRRR0RRRRA(RRR&((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyttestFailedAuthentication;s

cCs||j|jjj|j_tj|jjd<|jd|jg}|jt	|d|j|ddd|j|ddt
tjdd	}|jd
d|jdd
|jdtj
dj|jdddjd|jj|jd|jt	|jjd|jt	|jd|jd\}}|j|jddS(sK
        Test that registration with basic authentication suceeds.
        tbasicRjiiRsEtwisted.protocols.sip.BasicAuthorizer was deprecated in Twisted 9.0.0RkRssip:bell.example.comR,ssip:joe@bell.example.comRssip:joe@client.com:1234Rs
client.comt
authorizationsBasic suserXname:passXwordtbase64iiN(s
client.comi(RRtauthorizerstcopyRtBasicAuthorizerRlttest_basicAuthenticationRR0RnRHRIRhR"tencodeRRRRRA(RRoRJRR&((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyREs.
		cCs||j|jjj|j_tj|jjd<|jd|jg}|jt	|d|j|ddd|j|ddt
tjdd	}|jd
d|jdd
|jdtj
dj|jdddjd|jj|jd|jt	|jjd|jt	|jd|jd\}}|j|jddS(sr
        Failed registration with basic authentication results in an
        unauthorized error response.
        RRjiiRsEtwisted.protocols.sip.BasicAuthorizer was deprecated in Twisted 9.0.0RkRssip:bell.example.comR,ssip:joe@bell.example.comRssip:joe@client.com:1234Rs
client.comRsBasic suserXname:passwordRiiN(s
client.comi(RRRRRRRlttest_failedBasicAuthenticationRR0RnRHRIRhR"RRRRRRA(RRoRJRR&((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyRds.
	cCstjdd}|jdd|jdd|jdtjdj|jj|jd|jt|j	d
dS(NRs
sip:wrong.comR,ssip:joe@bell.example.comRssip:joe@client.com:1234Rs
client.comii(s
client.comi(
RRHRIRhR"RRRR0R(RRJ((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyttestWrongDomainRegisterscCstjdd}|jdd|jdd|jdtjdj|jj|jd|jt|j	d
dS(NRssip:bell.example.comR,ssip:joe@foo.comRssip:joe@client.com:1234Rs
client.comii(s
client.comi(
RRHRIRhR"RRRR0R(RRJ((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyttestWrongToDomainRegisterscCsK|jtjdddd}|jjj|}|j|t|S(NR{R+RVsfoo.com(RRRRRRt
assertFailureR(RRyR((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyttestWrongDomainLookups

cCsK|jtjdddd}|jjj|}|j|t|S(NR{tjaneRVsbell.example.com(RRRRRRRR(RRyR((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyttestNoContactLookups

(RRRRtsuppressWarningsRtsuppressRnRRRRRRRRRRRRR(((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyRs"							
		
		 			tClientcBseZdZdZRS(cCs,tjj|g|_tj|_dS(N(RtBaset__init__RrRtDeferredtdeferred(R((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyRs	cCs'|jj||jj|jdS(N(RrRRtcallback(RtresponseR((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pythandle_responses(RRRR(((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyRs	tLiveTestcBsPeZdZejeejdeddZdZdZ	dZ
RS(cCstjdd|_tjd|_|j|j_|j_tjd|jdd|_t	|_
tjd|j
dd|_|jjj
|jjjf|_dS(NRVs	127.0.0.1sbell.example.comit	interface(RRRRRRRt	listenUDPt
serverPortRtclientt
clientPorttgetHostRVRWt
serverAddress(R((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyRsRkRs5twisted.protocols.sip.DigestAuthorizer was deprecatedcCsjx*|jjjD]\}}|jqWtj|jj}tj|jj}tj	||gS(N(
RRRRRt
maybeDeferredRt
stopListeningRt
gatherResults(RRR!td1td2((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyRs
csjjj}tjdd}|jdd|jdd||jdtjdd	|jjj	tj
d
dd	jd|jj}fd}|j
||S(
NRssip:bell.example.comR,ssip:joe@bell.example.comRssip:joe@127.0.0.1:%dRs	127.0.0.1RWRVics7jt|d|d}j|jddS(Niii(RR0RA(RrRJ(R(s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pytchecks
(RRRWRRHRIRhR"RRRRRR(RRRJRR((Rs9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyRs%	#
cs)jjj}tjdd}|jdd|jdd||jdtjdd	|d
tjj	dj
g}jt|dj|d
ddj|d
dt
jjtjddd	jd|jj}fd}|j||S(sp
        rport is allowed without a value, apparently because server
        implementors might be too stupid to check the received port
        against 5060 and see if they're equal, and because client
        implementors might be too stupid to bind to port 5060, or set a
        value on the rport parameter they send if they bind to another
        port.
        Rssip:bell.example.comR,ssip:joe@bell.example.comRssip:joe@127.0.0.1:%dRs	127.0.0.1RWR]RjiiRs+rport=True is deprecated since Twisted 9.0.RkRVcs7jt|d|d}j|jddS(Niii(RR0RA(RrRJ(R(s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyRs
(RRRWRRHRIRhRfR"Rlttest_amoralRPortRR0RnRRRRRR(RRRJRoRR((Rs9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyRs*	+	

(RRRRRRRRnRRR(((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyRs				sY
REGISTER sip:intarweb.us SIP/2.0
Via: SIP/2.0/UDP 192.168.1.100:50609
From: <sip:exarkun@intarweb.us:50609>
To: <sip:exarkun@intarweb.us:50609>
Contact: "exarkun" <sip:exarkun@192.168.1.100:50609>
Call-ID: 94E7E5DAF39111D791C6000393764646@intarweb.us
CSeq: 9898 REGISTER
Expires: 500
User-Agent: X-Lite build 1061
Content-Length: 0

sSIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 192.168.1.100:50609;received=127.0.0.1;rport=5632
To: <sip:exarkun@intarweb.us:50609>
From: <sip:exarkun@intarweb.us:50609>
Call-ID: 94E7E5DAF39111D791C6000393764646@intarweb.us
CSeq: 9898 REGISTER
WWW-Authenticate: Digest nonce="92956076410767313901322208775",opaque="1674186428",qop-options="auth",algorithm="MD5",realm="intarweb.us"

s REGISTER sip:intarweb.us SIP/2.0
Via: SIP/2.0/UDP 192.168.1.100:50609
From: <sip:exarkun@intarweb.us:50609>
To: <sip:exarkun@intarweb.us:50609>
Contact: "exarkun" <sip:exarkun@192.168.1.100:50609>
Call-ID: 94E7E5DAF39111D791C6000393764646@intarweb.us
CSeq: 9899 REGISTER
Expires: 500
Authorization: Digest username="exarkun",realm="intarweb.us",nonce="92956076410767313901322208775",response="4a47980eea31694f997369214292374b",uri="sip:intarweb.us",algorithm=MD5,opaque="1674186428"
User-Agent: X-Lite build 1061
Content-Length: 0

s5SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.1.100:50609;received=127.0.0.1;rport=5632
To: <sip:exarkun@intarweb.us:50609>
From: <sip:exarkun@intarweb.us:50609>
Call-ID: 94E7E5DAF39111D791C6000393764646@intarweb.us
CSeq: 9899 REGISTER
Contact: sip:exarkun@127.0.0.1:5632
Expires: 3600
Content-Length: 0

tFakeDigestAuthorizercBseZdZdZRS(cCsdS(Nt92956076410767313901322208775((R((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyt
generateNonce1scCsdS(Nt
1674186428((R((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pytgenerateOpaque3s(RRRR(((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyR0s	tFakeRegistrycBs)eZdZdZdZdZRS(siMake sure expiration is always seen to be 3600.

    Otherwise slow reactors fail tests incorrectly.
    cCsAd|jks|jdkr4td|jnd|_|S(Niisbad seconds to expire: %s(tsecondsToExpirytRuntimeError(Rtreg((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyt_cbReg=s
	cCs%tjj||}|j|jS(N(RRtgetRegistrationInfoRR(RR!R((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyRDscCs+tjj||||}|j|jS(N(RRtregisterAddressRR(Rt	domainURLRtphysicalURLR((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyR	Hs	(RRRFRRR	(((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyR7s		tAuthorizationTestCasecBseZdZejeejdeddZdZdZ	ejdeddejdeddejdeddejdeddge	_RS(	cCstjdd|_|jjj|j_t|jjd<td|_|j|j_|j_t	j
|_|j|j_t}t
jj|}t
jj}|jdd|j|||j_dS(NRVsintarweb.ustdigestsexarkun@intarweb.usR}(RRRRRRRRRRtFakeDatagramTransportRUR
RRRRRRR(RRJRRE((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyRNs	
RkRs5twisted.protocols.sip.DigestAuthorizer was deprecatedcCs7x*|jjjD]\}}|jqW|`dS(N(RRRRR(RRR!((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyRbscCsv|jjtd|j|jjdtdfg|j_|jjtd|j|jjdtdfdS(Ns	127.0.0.1ii(s	127.0.0.1i(s	127.0.0.1i(s	127.0.0.1i(s	127.0.0.1i(	RRtregisterRequestRRUtwrittentchallengeResponsetauthRequestt
okResponse(R((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyt
testChallengegs


s8twisted.protocols.sip.DigestedCredentials was deprecateds2twisted.protocols.sip.DigestCalcHA1 was deprecateds7twisted.protocols.sip.DigestCalcResponse was deprecated(
RRRRRRRRnRR(((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyRMs$								tDeprecationTestscBs;eZdZdZdZdZdZdZRS(sS
    Tests for deprecation of obsolete components of L{twisted.protocols.sip}.
    c	Cs8|jtddddtjdddddddS(s5
        L{sip.DigestCalcHA1} is deprecated.
        tTwistedi	iR8N(tcallDeprecatedRRt
DigestCalcHA1(R((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyttest_deprecatedDigestCalcHA1scCs>|jtddddtjdddddddd
dS(s:
        L{sip.DigestCalcResponse} is deprecated.
        Ri	iR8N(RRRtDigestCalcResponse(R((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyt!test_deprecatedDigestCalcResponsescCs&|jtddddtjdS(s7
        L{sip.BasicAuthorizer} is deprecated.
        Ri	iN(RRRR(R((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyttest_deprecatedBasicAuthorizerscCs&|jtddddtjdS(s8
        L{sip.DigestAuthorizer} is deprecated.
        Ri	iN(RRRtDigestAuthorizer(R((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyttest_deprecatedDigestAuthorizerscCs/|jtddddtjdiidS(s;
        L{sip.DigestedCredentials} is deprecated.
        Ri	iR8N(RRRtDigestedCredentials(R((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyt"test_deprecatedDigestedCredentialss(RRRFRRRRR (((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyRs				((((5RFt
twisted.trialRRttwisted.protocolsRttwisted.internetRRRttwisted.python.versionsRttwisted.testRttwistedRttwisted.cred.portalttwisted.cred.checkerstzope.interfaceR	treplaceR/R3R5R;R@R=trequest_nattedR
tTestCaseRRDRGRPRwRRRRRRRRRRRRRRRRRR(((s9/usr/lib/python2.7/dist-packages/twisted/test/test_sip.pyt<module>sL
	X	jX
9