rfc3261.txt 633 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067
  1. Network Working Group J. Rosenberg
  2. Request for Comments: 3261 dynamicsoft
  3. Obsoletes: 2543 H. Schulzrinne
  4. Category: Standards Track Columbia U.
  5. G. Camarillo
  6. Ericsson
  7. A. Johnston
  8. WorldCom
  9. J. Peterson
  10. Neustar
  11. R. Sparks
  12. dynamicsoft
  13. M. Handley
  14. ICIR
  15. E. Schooler
  16. AT&T
  17. June 2002
  18. SIP: Session Initiation Protocol
  19. Status of this Memo
  20. This document specifies an Internet standards track protocol for the
  21. Internet community, and requests discussion and suggestions for
  22. improvements. Please refer to the current edition of the "Internet
  23. Official Protocol Standards" (STD 1) for the standardization state
  24. and status of this protocol. Distribution of this memo is unlimited.
  25. Copyright Notice
  26. Copyright (C) The Internet Society (2002). All Rights Reserved.
  27. Abstract
  28. This document describes Session Initiation Protocol (SIP), an
  29. application-layer control (signaling) protocol for creating,
  30. modifying, and terminating sessions with one or more participants.
  31. These sessions include Internet telephone calls, multimedia
  32. distribution, and multimedia conferences.
  33. SIP invitations used to create sessions carry session descriptions
  34. that allow participants to agree on a set of compatible media types.
  35. SIP makes use of elements called proxy servers to help route requests
  36. to the user's current location, authenticate and authorize users for
  37. services, implement provider call-routing policies, and provide
  38. features to users. SIP also provides a registration function that
  39. allows users to upload their current locations for use by proxy
  40. servers. SIP runs on top of several different transport protocols.
  41. Rosenberg, et. al. Standards Track [Page 1]
  42. RFC 3261 SIP: Session Initiation Protocol June 2002
  43. Table of Contents
  44. 1 Introduction ........................................ 8
  45. 2 Overview of SIP Functionality ....................... 9
  46. 3 Terminology ......................................... 10
  47. 4 Overview of Operation ............................... 10
  48. 5 Structure of the Protocol ........................... 18
  49. 6 Definitions ......................................... 20
  50. 7 SIP Messages ........................................ 26
  51. 7.1 Requests ............................................ 27
  52. 7.2 Responses ........................................... 28
  53. 7.3 Header Fields ....................................... 29
  54. 7.3.1 Header Field Format ................................. 30
  55. 7.3.2 Header Field Classification ......................... 32
  56. 7.3.3 Compact Form ........................................ 32
  57. 7.4 Bodies .............................................. 33
  58. 7.4.1 Message Body Type ................................... 33
  59. 7.4.2 Message Body Length ................................. 33
  60. 7.5 Framing SIP Messages ................................ 34
  61. 8 General User Agent Behavior ......................... 34
  62. 8.1 UAC Behavior ........................................ 35
  63. 8.1.1 Generating the Request .............................. 35
  64. 8.1.1.1 Request-URI ......................................... 35
  65. 8.1.1.2 To .................................................. 36
  66. 8.1.1.3 From ................................................ 37
  67. 8.1.1.4 Call-ID ............................................. 37
  68. 8.1.1.5 CSeq ................................................ 38
  69. 8.1.1.6 Max-Forwards ........................................ 38
  70. 8.1.1.7 Via ................................................. 39
  71. 8.1.1.8 Contact ............................................. 40
  72. 8.1.1.9 Supported and Require ............................... 40
  73. 8.1.1.10 Additional Message Components ....................... 41
  74. 8.1.2 Sending the Request ................................. 41
  75. 8.1.3 Processing Responses ................................ 42
  76. 8.1.3.1 Transaction Layer Errors ............................ 42
  77. 8.1.3.2 Unrecognized Responses .............................. 42
  78. 8.1.3.3 Vias ................................................ 43
  79. 8.1.3.4 Processing 3xx Responses ............................ 43
  80. 8.1.3.5 Processing 4xx Responses ............................ 45
  81. 8.2 UAS Behavior ........................................ 46
  82. 8.2.1 Method Inspection ................................... 46
  83. 8.2.2 Header Inspection ................................... 46
  84. 8.2.2.1 To and Request-URI .................................. 46
  85. 8.2.2.2 Merged Requests ..................................... 47
  86. 8.2.2.3 Require ............................................. 47
  87. 8.2.3 Content Processing .................................. 48
  88. 8.2.4 Applying Extensions ................................. 49
  89. 8.2.5 Processing the Request .............................. 49
  90. Rosenberg, et. al. Standards Track [Page 2]
  91. RFC 3261 SIP: Session Initiation Protocol June 2002
  92. 8.2.6 Generating the Response ............................. 49
  93. 8.2.6.1 Sending a Provisional Response ...................... 49
  94. 8.2.6.2 Headers and Tags .................................... 50
  95. 8.2.7 Stateless UAS Behavior .............................. 50
  96. 8.3 Redirect Servers .................................... 51
  97. 9 Canceling a Request ................................. 53
  98. 9.1 Client Behavior ..................................... 53
  99. 9.2 Server Behavior ..................................... 55
  100. 10 Registrations ....................................... 56
  101. 10.1 Overview ............................................ 56
  102. 10.2 Constructing the REGISTER Request ................... 57
  103. 10.2.1 Adding Bindings ..................................... 59
  104. 10.2.1.1 Setting the Expiration Interval of Contact Addresses 60
  105. 10.2.1.2 Preferences among Contact Addresses ................. 61
  106. 10.2.2 Removing Bindings ................................... 61
  107. 10.2.3 Fetching Bindings ................................... 61
  108. 10.2.4 Refreshing Bindings ................................. 61
  109. 10.2.5 Setting the Internal Clock .......................... 62
  110. 10.2.6 Discovering a Registrar ............................. 62
  111. 10.2.7 Transmitting a Request .............................. 62
  112. 10.2.8 Error Responses ..................................... 63
  113. 10.3 Processing REGISTER Requests ........................ 63
  114. 11 Querying for Capabilities ........................... 66
  115. 11.1 Construction of OPTIONS Request ..................... 67
  116. 11.2 Processing of OPTIONS Request ....................... 68
  117. 12 Dialogs ............................................. 69
  118. 12.1 Creation of a Dialog ................................ 70
  119. 12.1.1 UAS behavior ........................................ 70
  120. 12.1.2 UAC Behavior ........................................ 71
  121. 12.2 Requests within a Dialog ............................ 72
  122. 12.2.1 UAC Behavior ........................................ 73
  123. 12.2.1.1 Generating the Request .............................. 73
  124. 12.2.1.2 Processing the Responses ............................ 75
  125. 12.2.2 UAS Behavior ........................................ 76
  126. 12.3 Termination of a Dialog ............................. 77
  127. 13 Initiating a Session ................................ 77
  128. 13.1 Overview ............................................ 77
  129. 13.2 UAC Processing ...................................... 78
  130. 13.2.1 Creating the Initial INVITE ......................... 78
  131. 13.2.2 Processing INVITE Responses ......................... 81
  132. 13.2.2.1 1xx Responses ....................................... 81
  133. 13.2.2.2 3xx Responses ....................................... 81
  134. 13.2.2.3 4xx, 5xx and 6xx Responses .......................... 81
  135. 13.2.2.4 2xx Responses ....................................... 82
  136. 13.3 UAS Processing ...................................... 83
  137. 13.3.1 Processing of the INVITE ............................ 83
  138. 13.3.1.1 Progress ............................................ 84
  139. 13.3.1.2 The INVITE is Redirected ............................ 84
  140. Rosenberg, et. al. Standards Track [Page 3]
  141. RFC 3261 SIP: Session Initiation Protocol June 2002
  142. 13.3.1.3 The INVITE is Rejected .............................. 85
  143. 13.3.1.4 The INVITE is Accepted .............................. 85
  144. 14 Modifying an Existing Session ....................... 86
  145. 14.1 UAC Behavior ........................................ 86
  146. 14.2 UAS Behavior ........................................ 88
  147. 15 Terminating a Session ............................... 89
  148. 15.1 Terminating a Session with a BYE Request ............ 90
  149. 15.1.1 UAC Behavior ........................................ 90
  150. 15.1.2 UAS Behavior ........................................ 91
  151. 16 Proxy Behavior ...................................... 91
  152. 16.1 Overview ............................................ 91
  153. 16.2 Stateful Proxy ...................................... 92
  154. 16.3 Request Validation .................................. 94
  155. 16.4 Route Information Preprocessing ..................... 96
  156. 16.5 Determining Request Targets ......................... 97
  157. 16.6 Request Forwarding .................................. 99
  158. 16.7 Response Processing ................................. 107
  159. 16.8 Processing Timer C .................................. 114
  160. 16.9 Handling Transport Errors ........................... 115
  161. 16.10 CANCEL Processing ................................... 115
  162. 16.11 Stateless Proxy ..................................... 116
  163. 16.12 Summary of Proxy Route Processing ................... 118
  164. 16.12.1 Examples ............................................ 118
  165. 16.12.1.1 Basic SIP Trapezoid ................................. 118
  166. 16.12.1.2 Traversing a Strict-Routing Proxy ................... 120
  167. 16.12.1.3 Rewriting Record-Route Header Field Values .......... 121
  168. 17 Transactions ........................................ 122
  169. 17.1 Client Transaction .................................. 124
  170. 17.1.1 INVITE Client Transaction ........................... 125
  171. 17.1.1.1 Overview of INVITE Transaction ...................... 125
  172. 17.1.1.2 Formal Description .................................. 125
  173. 17.1.1.3 Construction of the ACK Request ..................... 129
  174. 17.1.2 Non-INVITE Client Transaction ....................... 130
  175. 17.1.2.1 Overview of the non-INVITE Transaction .............. 130
  176. 17.1.2.2 Formal Description .................................. 131
  177. 17.1.3 Matching Responses to Client Transactions ........... 132
  178. 17.1.4 Handling Transport Errors ........................... 133
  179. 17.2 Server Transaction .................................. 134
  180. 17.2.1 INVITE Server Transaction ........................... 134
  181. 17.2.2 Non-INVITE Server Transaction ....................... 137
  182. 17.2.3 Matching Requests to Server Transactions ............ 138
  183. 17.2.4 Handling Transport Errors ........................... 141
  184. 18 Transport ........................................... 141
  185. 18.1 Clients ............................................. 142
  186. 18.1.1 Sending Requests .................................... 142
  187. 18.1.2 Receiving Responses ................................. 144
  188. 18.2 Servers ............................................. 145
  189. 18.2.1 Receiving Requests .................................. 145
  190. Rosenberg, et. al. Standards Track [Page 4]
  191. RFC 3261 SIP: Session Initiation Protocol June 2002
  192. 18.2.2 Sending Responses ................................... 146
  193. 18.3 Framing ............................................. 147
  194. 18.4 Error Handling ...................................... 147
  195. 19 Common Message Components ........................... 147
  196. 19.1 SIP and SIPS Uniform Resource Indicators ............ 148
  197. 19.1.1 SIP and SIPS URI Components ......................... 148
  198. 19.1.2 Character Escaping Requirements ..................... 152
  199. 19.1.3 Example SIP and SIPS URIs ........................... 153
  200. 19.1.4 URI Comparison ...................................... 153
  201. 19.1.5 Forming Requests from a URI ......................... 156
  202. 19.1.6 Relating SIP URIs and tel URLs ...................... 157
  203. 19.2 Option Tags ......................................... 158
  204. 19.3 Tags ................................................ 159
  205. 20 Header Fields ....................................... 159
  206. 20.1 Accept .............................................. 161
  207. 20.2 Accept-Encoding ..................................... 163
  208. 20.3 Accept-Language ..................................... 164
  209. 20.4 Alert-Info .......................................... 164
  210. 20.5 Allow ............................................... 165
  211. 20.6 Authentication-Info ................................. 165
  212. 20.7 Authorization ....................................... 165
  213. 20.8 Call-ID ............................................. 166
  214. 20.9 Call-Info ........................................... 166
  215. 20.10 Contact ............................................. 167
  216. 20.11 Content-Disposition ................................. 168
  217. 20.12 Content-Encoding .................................... 169
  218. 20.13 Content-Language .................................... 169
  219. 20.14 Content-Length ...................................... 169
  220. 20.15 Content-Type ........................................ 170
  221. 20.16 CSeq ................................................ 170
  222. 20.17 Date ................................................ 170
  223. 20.18 Error-Info .......................................... 171
  224. 20.19 Expires ............................................. 171
  225. 20.20 From ................................................ 172
  226. 20.21 In-Reply-To ......................................... 172
  227. 20.22 Max-Forwards ........................................ 173
  228. 20.23 Min-Expires ......................................... 173
  229. 20.24 MIME-Version ........................................ 173
  230. 20.25 Organization ........................................ 174
  231. 20.26 Priority ............................................ 174
  232. 20.27 Proxy-Authenticate .................................. 174
  233. 20.28 Proxy-Authorization ................................. 175
  234. 20.29 Proxy-Require ....................................... 175
  235. 20.30 Record-Route ........................................ 175
  236. 20.31 Reply-To ............................................ 176
  237. 20.32 Require ............................................. 176
  238. 20.33 Retry-After ......................................... 176
  239. 20.34 Route ............................................... 177
  240. Rosenberg, et. al. Standards Track [Page 5]
  241. RFC 3261 SIP: Session Initiation Protocol June 2002
  242. 20.35 Server .............................................. 177
  243. 20.36 Subject ............................................. 177
  244. 20.37 Supported ........................................... 178
  245. 20.38 Timestamp ........................................... 178
  246. 20.39 To .................................................. 178
  247. 20.40 Unsupported ......................................... 179
  248. 20.41 User-Agent .......................................... 179
  249. 20.42 Via ................................................. 179
  250. 20.43 Warning ............................................. 180
  251. 20.44 WWW-Authenticate .................................... 182
  252. 21 Response Codes ...................................... 182
  253. 21.1 Provisional 1xx ..................................... 182
  254. 21.1.1 100 Trying .......................................... 183
  255. 21.1.2 180 Ringing ......................................... 183
  256. 21.1.3 181 Call Is Being Forwarded ......................... 183
  257. 21.1.4 182 Queued .......................................... 183
  258. 21.1.5 183 Session Progress ................................ 183
  259. 21.2 Successful 2xx ...................................... 183
  260. 21.2.1 200 OK .............................................. 183
  261. 21.3 Redirection 3xx ..................................... 184
  262. 21.3.1 300 Multiple Choices ................................ 184
  263. 21.3.2 301 Moved Permanently ............................... 184
  264. 21.3.3 302 Moved Temporarily ............................... 184
  265. 21.3.4 305 Use Proxy ....................................... 185
  266. 21.3.5 380 Alternative Service ............................. 185
  267. 21.4 Request Failure 4xx ................................. 185
  268. 21.4.1 400 Bad Request ..................................... 185
  269. 21.4.2 401 Unauthorized .................................... 185
  270. 21.4.3 402 Payment Required ................................ 186
  271. 21.4.4 403 Forbidden ....................................... 186
  272. 21.4.5 404 Not Found ....................................... 186
  273. 21.4.6 405 Method Not Allowed .............................. 186
  274. 21.4.7 406 Not Acceptable .................................. 186
  275. 21.4.8 407 Proxy Authentication Required ................... 186
  276. 21.4.9 408 Request Timeout ................................. 186
  277. 21.4.10 410 Gone ............................................ 187
  278. 21.4.11 413 Request Entity Too Large ........................ 187
  279. 21.4.12 414 Request-URI Too Long ............................ 187
  280. 21.4.13 415 Unsupported Media Type .......................... 187
  281. 21.4.14 416 Unsupported URI Scheme .......................... 187
  282. 21.4.15 420 Bad Extension ................................... 187
  283. 21.4.16 421 Extension Required .............................. 188
  284. 21.4.17 423 Interval Too Brief .............................. 188
  285. 21.4.18 480 Temporarily Unavailable ......................... 188
  286. 21.4.19 481 Call/Transaction Does Not Exist ................. 188
  287. 21.4.20 482 Loop Detected ................................... 188
  288. 21.4.21 483 Too Many Hops ................................... 189
  289. 21.4.22 484 Address Incomplete .............................. 189
  290. Rosenberg, et. al. Standards Track [Page 6]
  291. RFC 3261 SIP: Session Initiation Protocol June 2002
  292. 21.4.23 485 Ambiguous ....................................... 189
  293. 21.4.24 486 Busy Here ....................................... 189
  294. 21.4.25 487 Request Terminated .............................. 190
  295. 21.4.26 488 Not Acceptable Here ............................. 190
  296. 21.4.27 491 Request Pending ................................. 190
  297. 21.4.28 493 Undecipherable .................................. 190
  298. 21.5 Server Failure 5xx .................................. 190
  299. 21.5.1 500 Server Internal Error ........................... 190
  300. 21.5.2 501 Not Implemented ................................. 191
  301. 21.5.3 502 Bad Gateway ..................................... 191
  302. 21.5.4 503 Service Unavailable ............................. 191
  303. 21.5.5 504 Server Time-out ................................. 191
  304. 21.5.6 505 Version Not Supported ........................... 192
  305. 21.5.7 513 Message Too Large ............................... 192
  306. 21.6 Global Failures 6xx ................................. 192
  307. 21.6.1 600 Busy Everywhere ................................. 192
  308. 21.6.2 603 Decline ......................................... 192
  309. 21.6.3 604 Does Not Exist Anywhere ......................... 192
  310. 21.6.4 606 Not Acceptable .................................. 192
  311. 22 Usage of HTTP Authentication ........................ 193
  312. 22.1 Framework ........................................... 193
  313. 22.2 User-to-User Authentication ......................... 195
  314. 22.3 Proxy-to-User Authentication ........................ 197
  315. 22.4 The Digest Authentication Scheme .................... 199
  316. 23 S/MIME .............................................. 201
  317. 23.1 S/MIME Certificates ................................. 201
  318. 23.2 S/MIME Key Exchange ................................. 202
  319. 23.3 Securing MIME bodies ................................ 205
  320. 23.4 SIP Header Privacy and Integrity using S/MIME:
  321. Tunneling SIP ....................................... 207
  322. 23.4.1 Integrity and Confidentiality Properties of SIP
  323. Headers ............................................. 207
  324. 23.4.1.1 Integrity ........................................... 207
  325. 23.4.1.2 Confidentiality ..................................... 208
  326. 23.4.2 Tunneling Integrity and Authentication .............. 209
  327. 23.4.3 Tunneling Encryption ................................ 211
  328. 24 Examples ............................................ 213
  329. 24.1 Registration ........................................ 213
  330. 24.2 Session Setup ....................................... 214
  331. 25 Augmented BNF for the SIP Protocol .................. 219
  332. 25.1 Basic Rules ......................................... 219
  333. 26 Security Considerations: Threat Model and Security
  334. Usage Recommendations ............................... 232
  335. 26.1 Attacks and Threat Models ........................... 233
  336. 26.1.1 Registration Hijacking .............................. 233
  337. 26.1.2 Impersonating a Server .............................. 234
  338. 26.1.3 Tampering with Message Bodies ....................... 235
  339. 26.1.4 Tearing Down Sessions ............................... 235
  340. Rosenberg, et. al. Standards Track [Page 7]
  341. RFC 3261 SIP: Session Initiation Protocol June 2002
  342. 26.1.5 Denial of Service and Amplification ................. 236
  343. 26.2 Security Mechanisms ................................. 237
  344. 26.2.1 Transport and Network Layer Security ................ 238
  345. 26.2.2 SIPS URI Scheme ..................................... 239
  346. 26.2.3 HTTP Authentication ................................. 240
  347. 26.2.4 S/MIME .............................................. 240
  348. 26.3 Implementing Security Mechanisms .................... 241
  349. 26.3.1 Requirements for Implementers of SIP ................ 241
  350. 26.3.2 Security Solutions .................................. 242
  351. 26.3.2.1 Registration ........................................ 242
  352. 26.3.2.2 Interdomain Requests ................................ 243
  353. 26.3.2.3 Peer-to-Peer Requests ............................... 245
  354. 26.3.2.4 DoS Protection ...................................... 246
  355. 26.4 Limitations ......................................... 247
  356. 26.4.1 HTTP Digest ......................................... 247
  357. 26.4.2 S/MIME .............................................. 248
  358. 26.4.3 TLS ................................................. 249
  359. 26.4.4 SIPS URIs ........................................... 249
  360. 26.5 Privacy ............................................. 251
  361. 27 IANA Considerations ................................. 252
  362. 27.1 Option Tags ......................................... 252
  363. 27.2 Warn-Codes .......................................... 252
  364. 27.3 Header Field Names .................................. 253
  365. 27.4 Method and Response Codes ........................... 253
  366. 27.5 The "message/sip" MIME type. ....................... 254
  367. 27.6 New Content-Disposition Parameter Registrations ..... 255
  368. 28 Changes From RFC 2543 ............................... 255
  369. 28.1 Major Functional Changes ............................ 255
  370. 28.2 Minor Functional Changes ............................ 260
  371. 29 Normative References ................................ 261
  372. 30 Informative References .............................. 262
  373. A Table of Timer Values ............................... 265
  374. Acknowledgments ................................................ 266
  375. Authors' Addresses ............................................. 267
  376. Full Copyright Statement ....................................... 269
  377. 1 Introduction
  378. There are many applications of the Internet that require the creation
  379. and management of a session, where a session is considered an
  380. exchange of data between an association of participants. The
  381. implementation of these applications is complicated by the practices
  382. of participants: users may move between endpoints, they may be
  383. addressable by multiple names, and they may communicate in several
  384. different media - sometimes simultaneously. Numerous protocols have
  385. been authored that carry various forms of real-time multimedia
  386. session data such as voice, video, or text messages. The Session
  387. Initiation Protocol (SIP) works in concert with these protocols by
  388. Rosenberg, et. al. Standards Track [Page 8]
  389. RFC 3261 SIP: Session Initiation Protocol June 2002
  390. enabling Internet endpoints (called user agents) to discover one
  391. another and to agree on a characterization of a session they would
  392. like to share. For locating prospective session participants, and
  393. for other functions, SIP enables the creation of an infrastructure of
  394. network hosts (called proxy servers) to which user agents can send
  395. registrations, invitations to sessions, and other requests. SIP is
  396. an agile, general-purpose tool for creating, modifying, and
  397. terminating sessions that works independently of underlying transport
  398. protocols and without dependency on the type of session that is being
  399. established.
  400. 2 Overview of SIP Functionality
  401. SIP is an application-layer control protocol that can establish,
  402. modify, and terminate multimedia sessions (conferences) such as
  403. Internet telephony calls. SIP can also invite participants to
  404. already existing sessions, such as multicast conferences. Media can
  405. be added to (and removed from) an existing session. SIP
  406. transparently supports name mapping and redirection services, which
  407. supports personal mobility [27] - users can maintain a single
  408. externally visible identifier regardless of their network location.
  409. SIP supports five facets of establishing and terminating multimedia
  410. communications:
  411. User location: determination of the end system to be used for
  412. communication;
  413. User availability: determination of the willingness of the called
  414. party to engage in communications;
  415. User capabilities: determination of the media and media parameters
  416. to be used;
  417. Session setup: "ringing", establishment of session parameters at
  418. both called and calling party;
  419. Session management: including transfer and termination of
  420. sessions, modifying session parameters, and invoking
  421. services.
  422. SIP is not a vertically integrated communications system. SIP is
  423. rather a component that can be used with other IETF protocols to
  424. build a complete multimedia architecture. Typically, these
  425. architectures will include protocols such as the Real-time Transport
  426. Protocol (RTP) (RFC 1889 [28]) for transporting real-time data and
  427. providing QoS feedback, the Real-Time streaming protocol (RTSP) (RFC
  428. 2326 [29]) for controlling delivery of streaming media, the Media
  429. Rosenberg, et. al. Standards Track [Page 9]
  430. RFC 3261 SIP: Session Initiation Protocol June 2002
  431. Gateway Control Protocol (MEGACO) (RFC 3015 [30]) for controlling
  432. gateways to the Public Switched Telephone Network (PSTN), and the
  433. Session Description Protocol (SDP) (RFC 2327 [1]) for describing
  434. multimedia sessions. Therefore, SIP should be used in conjunction
  435. with other protocols in order to provide complete services to the
  436. users. However, the basic functionality and operation of SIP does
  437. not depend on any of these protocols.
  438. SIP does not provide services. Rather, SIP provides primitives that
  439. can be used to implement different services. For example, SIP can
  440. locate a user and deliver an opaque object to his current location.
  441. If this primitive is used to deliver a session description written in
  442. SDP, for instance, the endpoints can agree on the parameters of a
  443. session. If the same primitive is used to deliver a photo of the
  444. caller as well as the session description, a "caller ID" service can
  445. be easily implemented. As this example shows, a single primitive is
  446. typically used to provide several different services.
  447. SIP does not offer conference control services such as floor control
  448. or voting and does not prescribe how a conference is to be managed.
  449. SIP can be used to initiate a session that uses some other conference
  450. control protocol. Since SIP messages and the sessions they establish
  451. can pass through entirely different networks, SIP cannot, and does
  452. not, provide any kind of network resource reservation capabilities.
  453. The nature of the services provided make security particularly
  454. important. To that end, SIP provides a suite of security services,
  455. which include denial-of-service prevention, authentication (both user
  456. to user and proxy to user), integrity protection, and encryption and
  457. privacy services.
  458. SIP works with both IPv4 and IPv6.
  459. 3 Terminology
  460. In this document, the key words "MUST", "MUST NOT", "REQUIRED",
  461. "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT
  462. RECOMMENDED", "MAY", and "OPTIONAL" are to be interpreted as
  463. described in BCP 14, RFC 2119 [2] and indicate requirement levels for
  464. compliant SIP implementations.
  465. 4 Overview of Operation
  466. This section introduces the basic operations of SIP using simple
  467. examples. This section is tutorial in nature and does not contain
  468. any normative statements.
  469. Rosenberg, et. al. Standards Track [Page 10]
  470. RFC 3261 SIP: Session Initiation Protocol June 2002
  471. The first example shows the basic functions of SIP: location of an
  472. end point, signal of a desire to communicate, negotiation of session
  473. parameters to establish the session, and teardown of the session once
  474. established.
  475. Figure 1 shows a typical example of a SIP message exchange between
  476. two users, Alice and Bob. (Each message is labeled with the letter
  477. "F" and a number for reference by the text.) In this example, Alice
  478. uses a SIP application on her PC (referred to as a softphone) to call
  479. Bob on his SIP phone over the Internet. Also shown are two SIP proxy
  480. servers that act on behalf of Alice and Bob to facilitate the session
  481. establishment. This typical arrangement is often referred to as the
  482. "SIP trapezoid" as shown by the geometric shape of the dotted lines
  483. in Figure 1.
  484. Alice "calls" Bob using his SIP identity, a type of Uniform Resource
  485. Identifier (URI) called a SIP URI. SIP URIs are defined in Section
  486. 19.1. It has a similar form to an email address, typically
  487. containing a username and a host name. In this case, it is
  488. sip:bob@biloxi.com, where biloxi.com is the domain of Bob's SIP
  489. service provider. Alice has a SIP URI of sip:alice@atlanta.com.
  490. Alice might have typed in Bob's URI or perhaps clicked on a hyperlink
  491. or an entry in an address book. SIP also provides a secure URI,
  492. called a SIPS URI. An example would be sips:bob@biloxi.com. A call
  493. made to a SIPS URI guarantees that secure, encrypted transport
  494. (namely TLS) is used to carry all SIP messages from the caller to the
  495. domain of the callee. From there, the request is sent securely to
  496. the callee, but with security mechanisms that depend on the policy of
  497. the domain of the callee.
  498. SIP is based on an HTTP-like request/response transaction model.
  499. Each transaction consists of a request that invokes a particular
  500. method, or function, on the server and at least one response. In
  501. this example, the transaction begins with Alice's softphone sending
  502. an INVITE request addressed to Bob's SIP URI. INVITE is an example
  503. of a SIP method that specifies the action that the requestor (Alice)
  504. wants the server (Bob) to take. The INVITE request contains a number
  505. of header fields. Header fields are named attributes that provide
  506. additional information about a message. The ones present in an
  507. INVITE include a unique identifier for the call, the destination
  508. address, Alice's address, and information about the type of session
  509. that Alice wishes to establish with Bob. The INVITE (message F1 in
  510. Figure 1) might look like this:
  511. Rosenberg, et. al. Standards Track [Page 11]
  512. RFC 3261 SIP: Session Initiation Protocol June 2002
  513. atlanta.com . . . biloxi.com
  514. . proxy proxy .
  515. . .
  516. Alice's . . . . . . . . . . . . . . . . . . . . Bob's
  517. softphone SIP Phone
  518. | | | |
  519. | INVITE F1 | | |
  520. |--------------->| INVITE F2 | |
  521. | 100 Trying F3 |--------------->| INVITE F4 |
  522. |<---------------| 100 Trying F5 |--------------->|
  523. | |<-------------- | 180 Ringing F6 |
  524. | | 180 Ringing F7 |<---------------|
  525. | 180 Ringing F8 |<---------------| 200 OK F9 |
  526. |<---------------| 200 OK F10 |<---------------|
  527. | 200 OK F11 |<---------------| |
  528. |<---------------| | |
  529. | ACK F12 |
  530. |------------------------------------------------->|
  531. | Media Session |
  532. |<================================================>|
  533. | BYE F13 |
  534. |<-------------------------------------------------|
  535. | 200 OK F14 |
  536. |------------------------------------------------->|
  537. | |
  538. Figure 1: SIP session setup example with SIP trapezoid
  539. INVITE sip:bob@biloxi.com SIP/2.0
  540. Via: SIP/2.0/UDP pc33.atlanta.com;branch=z9hG4bK776asdhds
  541. Max-Forwards: 70
  542. To: Bob <sip:bob@biloxi.com>
  543. From: Alice <sip:alice@atlanta.com>;tag=1928301774
  544. Call-ID: a84b4c76e66710@pc33.atlanta.com
  545. CSeq: 314159 INVITE
  546. Contact: <sip:alice@pc33.atlanta.com>
  547. Content-Type: application/sdp
  548. Content-Length: 142
  549. (Alice's SDP not shown)
  550. The first line of the text-encoded message contains the method name
  551. (INVITE). The lines that follow are a list of header fields. This
  552. example contains a minimum required set. The header fields are
  553. briefly described below:
  554. Rosenberg, et. al. Standards Track [Page 12]
  555. RFC 3261 SIP: Session Initiation Protocol June 2002
  556. Via contains the address (pc33.atlanta.com) at which Alice is
  557. expecting to receive responses to this request. It also contains a
  558. branch parameter that identifies this transaction.
  559. To contains a display name (Bob) and a SIP or SIPS URI
  560. (sip:bob@biloxi.com) towards which the request was originally
  561. directed. Display names are described in RFC 2822 [3].
  562. From also contains a display name (Alice) and a SIP or SIPS URI
  563. (sip:alice@atlanta.com) that indicate the originator of the request.
  564. This header field also has a tag parameter containing a random string
  565. (1928301774) that was added to the URI by the softphone. It is used
  566. for identification purposes.
  567. Call-ID contains a globally unique identifier for this call,
  568. generated by the combination of a random string and the softphone's
  569. host name or IP address. The combination of the To tag, From tag,
  570. and Call-ID completely defines a peer-to-peer SIP relationship
  571. between Alice and Bob and is referred to as a dialog.
  572. CSeq or Command Sequence contains an integer and a method name. The
  573. CSeq number is incremented for each new request within a dialog and
  574. is a traditional sequence number.
  575. Contact contains a SIP or SIPS URI that represents a direct route to
  576. contact Alice, usually composed of a username at a fully qualified
  577. domain name (FQDN). While an FQDN is preferred, many end systems do
  578. not have registered domain names, so IP addresses are permitted.
  579. While the Via header field tells other elements where to send the
  580. response, the Contact header field tells other elements where to send
  581. future requests.
  582. Max-Forwards serves to limit the number of hops a request can make on
  583. the way to its destination. It consists of an integer that is
  584. decremented by one at each hop.
  585. Content-Type contains a description of the message body (not shown).
  586. Content-Length contains an octet (byte) count of the message body.
  587. The complete set of SIP header fields is defined in Section 20.
  588. The details of the session, such as the type of media, codec, or
  589. sampling rate, are not described using SIP. Rather, the body of a
  590. SIP message contains a description of the session, encoded in some
  591. other protocol format. One such format is the Session Description
  592. Protocol (SDP) (RFC 2327 [1]). This SDP message (not shown in the
  593. Rosenberg, et. al. Standards Track [Page 13]
  594. RFC 3261 SIP: Session Initiation Protocol June 2002
  595. example) is carried by the SIP message in a way that is analogous to
  596. a document attachment being carried by an email message, or a web
  597. page being carried in an HTTP message.
  598. Since the softphone does not know the location of Bob or the SIP
  599. server in the biloxi.com domain, the softphone sends the INVITE to
  600. the SIP server that serves Alice's domain, atlanta.com. The address
  601. of the atlanta.com SIP server could have been configured in Alice's
  602. softphone, or it could have been discovered by DHCP, for example.
  603. The atlanta.com SIP server is a type of SIP server known as a proxy
  604. server. A proxy server receives SIP requests and forwards them on
  605. behalf of the requestor. In this example, the proxy server receives
  606. the INVITE request and sends a 100 (Trying) response back to Alice's
  607. softphone. The 100 (Trying) response indicates that the INVITE has
  608. been received and that the proxy is working on her behalf to route
  609. the INVITE to the destination. Responses in SIP use a three-digit
  610. code followed by a descriptive phrase. This response contains the
  611. same To, From, Call-ID, CSeq and branch parameter in the Via as the
  612. INVITE, which allows Alice's softphone to correlate this response to
  613. the sent INVITE. The atlanta.com proxy server locates the proxy
  614. server at biloxi.com, possibly by performing a particular type of DNS
  615. (Domain Name Service) lookup to find the SIP server that serves the
  616. biloxi.com domain. This is described in [4]. As a result, it
  617. obtains the IP address of the biloxi.com proxy server and forwards,
  618. or proxies, the INVITE request there. Before forwarding the request,
  619. the atlanta.com proxy server adds an additional Via header field
  620. value that contains its own address (the INVITE already contains
  621. Alice's address in the first Via). The biloxi.com proxy server
  622. receives the INVITE and responds with a 100 (Trying) response back to
  623. the atlanta.com proxy server to indicate that it has received the
  624. INVITE and is processing the request. The proxy server consults a
  625. database, generically called a location service, that contains the
  626. current IP address of Bob. (We shall see in the next section how
  627. this database can be populated.) The biloxi.com proxy server adds
  628. another Via header field value with its own address to the INVITE and
  629. proxies it to Bob's SIP phone.
  630. Bob's SIP phone receives the INVITE and alerts Bob to the incoming
  631. call from Alice so that Bob can decide whether to answer the call,
  632. that is, Bob's phone rings. Bob's SIP phone indicates this in a 180
  633. (Ringing) response, which is routed back through the two proxies in
  634. the reverse direction. Each proxy uses the Via header field to
  635. determine where to send the response and removes its own address from
  636. the top. As a result, although DNS and location service lookups were
  637. required to route the initial INVITE, the 180 (Ringing) response can
  638. be returned to the caller without lookups or without state being
  639. Rosenberg, et. al. Standards Track [Page 14]
  640. RFC 3261 SIP: Session Initiation Protocol June 2002
  641. maintained in the proxies. This also has the desirable property that
  642. each proxy that sees the INVITE will also see all responses to the
  643. INVITE.
  644. When Alice's softphone receives the 180 (Ringing) response, it passes
  645. this information to Alice, perhaps using an audio ringback tone or by
  646. displaying a message on Alice's screen.
  647. In this example, Bob decides to answer the call. When he picks up
  648. the handset, his SIP phone sends a 200 (OK) response to indicate that
  649. the call has been answered. The 200 (OK) contains a message body
  650. with the SDP media description of the type of session that Bob is
  651. willing to establish with Alice. As a result, there is a two-phase
  652. exchange of SDP messages: Alice sent one to Bob, and Bob sent one
  653. back to Alice. This two-phase exchange provides basic negotiation
  654. capabilities and is based on a simple offer/answer model of SDP
  655. exchange. If Bob did not wish to answer the call or was busy on
  656. another call, an error response would have been sent instead of the
  657. 200 (OK), which would have resulted in no media session being
  658. established. The complete list of SIP response codes is in Section
  659. 21. The 200 (OK) (message F9 in Figure 1) might look like this as
  660. Bob sends it out:
  661. SIP/2.0 200 OK
  662. Via: SIP/2.0/UDP server10.biloxi.com
  663. ;branch=z9hG4bKnashds8;received=192.0.2.3
  664. Via: SIP/2.0/UDP bigbox3.site3.atlanta.com
  665. ;branch=z9hG4bK77ef4c2312983.1;received=192.0.2.2
  666. Via: SIP/2.0/UDP pc33.atlanta.com
  667. ;branch=z9hG4bK776asdhds ;received=192.0.2.1
  668. To: Bob <sip:bob@biloxi.com>;tag=a6c85cf
  669. From: Alice <sip:alice@atlanta.com>;tag=1928301774
  670. Call-ID: a84b4c76e66710@pc33.atlanta.com
  671. CSeq: 314159 INVITE
  672. Contact: <sip:bob@192.0.2.4>
  673. Content-Type: application/sdp
  674. Content-Length: 131
  675. (Bob's SDP not shown)
  676. The first line of the response contains the response code (200) and
  677. the reason phrase (OK). The remaining lines contain header fields.
  678. The Via, To, From, Call-ID, and CSeq header fields are copied from
  679. the INVITE request. (There are three Via header field values - one
  680. added by Alice's SIP phone, one added by the atlanta.com proxy, and
  681. one added by the biloxi.com proxy.) Bob's SIP phone has added a tag
  682. parameter to the To header field. This tag will be incorporated by
  683. both endpoints into the dialog and will be included in all future
  684. Rosenberg, et. al. Standards Track [Page 15]
  685. RFC 3261 SIP: Session Initiation Protocol June 2002
  686. requests and responses in this call. The Contact header field
  687. contains a URI at which Bob can be directly reached at his SIP phone.
  688. The Content-Type and Content-Length refer to the message body (not
  689. shown) that contains Bob's SDP media information.
  690. In addition to DNS and location service lookups shown in this
  691. example, proxy servers can make flexible "routing decisions" to
  692. decide where to send a request. For example, if Bob's SIP phone
  693. returned a 486 (Busy Here) response, the biloxi.com proxy server
  694. could proxy the INVITE to Bob's voicemail server. A proxy server can
  695. also send an INVITE to a number of locations at the same time. This
  696. type of parallel search is known as forking.
  697. In this case, the 200 (OK) is routed back through the two proxies and
  698. is received by Alice's softphone, which then stops the ringback tone
  699. and indicates that the call has been answered. Finally, Alice's
  700. softphone sends an acknowledgement message, ACK, to Bob's SIP phone
  701. to confirm the reception of the final response (200 (OK)). In this
  702. example, the ACK is sent directly from Alice's softphone to Bob's SIP
  703. phone, bypassing the two proxies. This occurs because the endpoints
  704. have learned each other's address from the Contact header fields
  705. through the INVITE/200 (OK) exchange, which was not known when the
  706. initial INVITE was sent. The lookups performed by the two proxies
  707. are no longer needed, so the proxies drop out of the call flow. This
  708. completes the INVITE/200/ACK three-way handshake used to establish
  709. SIP sessions. Full details on session setup are in Section 13.
  710. Alice and Bob's media session has now begun, and they send media
  711. packets using the format to which they agreed in the exchange of SDP.
  712. In general, the end-to-end media packets take a different path from
  713. the SIP signaling messages.
  714. During the session, either Alice or Bob may decide to change the
  715. characteristics of the media session. This is accomplished by
  716. sending a re-INVITE containing a new media description. This re-
  717. INVITE references the existing dialog so that the other party knows
  718. that it is to modify an existing session instead of establishing a
  719. new session. The other party sends a 200 (OK) to accept the change.
  720. The requestor responds to the 200 (OK) with an ACK. If the other
  721. party does not accept the change, he sends an error response such as
  722. 488 (Not Acceptable Here), which also receives an ACK. However, the
  723. failure of the re-INVITE does not cause the existing call to fail -
  724. the session continues using the previously negotiated
  725. characteristics. Full details on session modification are in Section
  726. 14.
  727. Rosenberg, et. al. Standards Track [Page 16]
  728. RFC 3261 SIP: Session Initiation Protocol June 2002
  729. At the end of the call, Bob disconnects (hangs up) first and
  730. generates a BYE message. This BYE is routed directly to Alice's
  731. softphone, again bypassing the proxies. Alice confirms receipt of
  732. the BYE with a 200 (OK) response, which terminates the session and
  733. the BYE transaction. No ACK is sent - an ACK is only sent in
  734. response to a response to an INVITE request. The reasons for this
  735. special handling for INVITE will be discussed later, but relate to
  736. the reliability mechanisms in SIP, the length of time it can take for
  737. a ringing phone to be answered, and forking. For this reason,
  738. request handling in SIP is often classified as either INVITE or non-
  739. INVITE, referring to all other methods besides INVITE. Full details
  740. on session termination are in Section 15.
  741. Section 24.2 describes the messages shown in Figure 1 in full.
  742. In some cases, it may be useful for proxies in the SIP signaling path
  743. to see all the messaging between the endpoints for the duration of
  744. the session. For example, if the biloxi.com proxy server wished to
  745. remain in the SIP messaging path beyond the initial INVITE, it would
  746. add to the INVITE a required routing header field known as Record-
  747. Route that contained a URI resolving to the hostname or IP address of
  748. the proxy. This information would be received by both Bob's SIP
  749. phone and (due to the Record-Route header field being passed back in
  750. the 200 (OK)) Alice's softphone and stored for the duration of the
  751. dialog. The biloxi.com proxy server would then receive and proxy the
  752. ACK, BYE, and 200 (OK) to the BYE. Each proxy can independently
  753. decide to receive subsequent messages, and those messages will pass
  754. through all proxies that elect to receive it. This capability is
  755. frequently used for proxies that are providing mid-call features.
  756. Registration is another common operation in SIP. Registration is one
  757. way that the biloxi.com server can learn the current location of Bob.
  758. Upon initialization, and at periodic intervals, Bob's SIP phone sends
  759. REGISTER messages to a server in the biloxi.com domain known as a SIP
  760. registrar. The REGISTER messages associate Bob's SIP or SIPS URI
  761. (sip:bob@biloxi.com) with the machine into which he is currently
  762. logged (conveyed as a SIP or SIPS URI in the Contact header field).
  763. The registrar writes this association, also called a binding, to a
  764. database, called the location service, where it can be used by the
  765. proxy in the biloxi.com domain. Often, a registrar server for a
  766. domain is co-located with the proxy for that domain. It is an
  767. important concept that the distinction between types of SIP servers
  768. is logical, not physical.
  769. Bob is not limited to registering from a single device. For example,
  770. both his SIP phone at home and the one in the office could send
  771. registrations. This information is stored together in the location
  772. Rosenberg, et. al. Standards Track [Page 17]
  773. RFC 3261 SIP: Session Initiation Protocol June 2002
  774. service and allows a proxy to perform various types of searches to
  775. locate Bob. Similarly, more than one user can be registered on a
  776. single device at the same time.
  777. The location service is just an abstract concept. It generally
  778. contains information that allows a proxy to input a URI and receive a
  779. set of zero or more URIs that tell the proxy where to send the
  780. request. Registrations are one way to create this information, but
  781. not the only way. Arbitrary mapping functions can be configured at
  782. the discretion of the administrator.
  783. Finally, it is important to note that in SIP, registration is used
  784. for routing incoming SIP requests and has no role in authorizing
  785. outgoing requests. Authorization and authentication are handled in
  786. SIP either on a request-by-request basis with a challenge/response
  787. mechanism, or by using a lower layer scheme as discussed in Section
  788. 26.
  789. The complete set of SIP message details for this registration example
  790. is in Section 24.1.
  791. Additional operations in SIP, such as querying for the capabilities
  792. of a SIP server or client using OPTIONS, or canceling a pending
  793. request using CANCEL, will be introduced in later sections.
  794. 5 Structure of the Protocol
  795. SIP is structured as a layered protocol, which means that its
  796. behavior is described in terms of a set of fairly independent
  797. processing stages with only a loose coupling between each stage. The
  798. protocol behavior is described as layers for the purpose of
  799. presentation, allowing the description of functions common across
  800. elements in a single section. It does not dictate an implementation
  801. in any way. When we say that an element "contains" a layer, we mean
  802. it is compliant to the set of rules defined by that layer.
  803. Not every element specified by the protocol contains every layer.
  804. Furthermore, the elements specified by SIP are logical elements, not
  805. physical ones. A physical realization can choose to act as different
  806. logical elements, perhaps even on a transaction-by-transaction basis.
  807. The lowest layer of SIP is its syntax and encoding. Its encoding is
  808. specified using an augmented Backus-Naur Form grammar (BNF). The
  809. complete BNF is specified in Section 25; an overview of a SIP
  810. message's structure can be found in Section 7.
  811. Rosenberg, et. al. Standards Track [Page 18]
  812. RFC 3261 SIP: Session Initiation Protocol June 2002
  813. The second layer is the transport layer. It defines how a client
  814. sends requests and receives responses and how a server receives
  815. requests and sends responses over the network. All SIP elements
  816. contain a transport layer. The transport layer is described in
  817. Section 18.
  818. The third layer is the transaction layer. Transactions are a
  819. fundamental component of SIP. A transaction is a request sent by a
  820. client transaction (using the transport layer) to a server
  821. transaction, along with all responses to that request sent from the
  822. server transaction back to the client. The transaction layer handles
  823. application-layer retransmissions, matching of responses to requests,
  824. and application-layer timeouts. Any task that a user agent client
  825. (UAC) accomplishes takes place using a series of transactions.
  826. Discussion of transactions can be found in Section 17. User agents
  827. contain a transaction layer, as do stateful proxies. Stateless
  828. proxies do not contain a transaction layer. The transaction layer
  829. has a client component (referred to as a client transaction) and a
  830. server component (referred to as a server transaction), each of which
  831. are represented by a finite state machine that is constructed to
  832. process a particular request.
  833. The layer above the transaction layer is called the transaction user
  834. (TU). Each of the SIP entities, except the stateless proxy, is a
  835. transaction user. When a TU wishes to send a request, it creates a
  836. client transaction instance and passes it the request along with the
  837. destination IP address, port, and transport to which to send the
  838. request. A TU that creates a client transaction can also cancel it.
  839. When a client cancels a transaction, it requests that the server stop
  840. further processing, revert to the state that existed before the
  841. transaction was initiated, and generate a specific error response to
  842. that transaction. This is done with a CANCEL request, which
  843. constitutes its own transaction, but references the transaction to be
  844. cancelled (Section 9).
  845. The SIP elements, that is, user agent clients and servers, stateless
  846. and stateful proxies and registrars, contain a core that
  847. distinguishes them from each other. Cores, except for the stateless
  848. proxy, are transaction users. While the behavior of the UAC and UAS
  849. cores depends on the method, there are some common rules for all
  850. methods (Section 8). For a UAC, these rules govern the construction
  851. of a request; for a UAS, they govern the processing of a request and
  852. generating a response. Since registrations play an important role in
  853. SIP, a UAS that handles a REGISTER is given the special name
  854. registrar. Section 10 describes UAC and UAS core behavior for the
  855. REGISTER method. Section 11 describes UAC and UAS core behavior for
  856. the OPTIONS method, used for determining the capabilities of a UA.
  857. Rosenberg, et. al. Standards Track [Page 19]
  858. RFC 3261 SIP: Session Initiation Protocol June 2002
  859. Certain other requests are sent within a dialog. A dialog is a
  860. peer-to-peer SIP relationship between two user agents that persists
  861. for some time. The dialog facilitates sequencing of messages and
  862. proper routing of requests between the user agents. The INVITE
  863. method is the only way defined in this specification to establish a
  864. dialog. When a UAC sends a request that is within the context of a
  865. dialog, it follows the common UAC rules as discussed in Section 8 but
  866. also the rules for mid-dialog requests. Section 12 discusses dialogs
  867. and presents the procedures for their construction and maintenance,
  868. in addition to construction of requests within a dialog.
  869. The most important method in SIP is the INVITE method, which is used
  870. to establish a session between participants. A session is a
  871. collection of participants, and streams of media between them, for
  872. the purposes of communication. Section 13 discusses how sessions are
  873. initiated, resulting in one or more SIP dialogs. Section 14
  874. discusses how characteristics of that session are modified through
  875. the use of an INVITE request within a dialog. Finally, section 15
  876. discusses how a session is terminated.
  877. The procedures of Sections 8, 10, 11, 12, 13, 14, and 15 deal
  878. entirely with the UA core (Section 9 describes cancellation, which
  879. applies to both UA core and proxy core). Section 16 discusses the
  880. proxy element, which facilitates routing of messages between user
  881. agents.
  882. 6 Definitions
  883. The following terms have special significance for SIP.
  884. Address-of-Record: An address-of-record (AOR) is a SIP or SIPS URI
  885. that points to a domain with a location service that can map
  886. the URI to another URI where the user might be available.
  887. Typically, the location service is populated through
  888. registrations. An AOR is frequently thought of as the "public
  889. address" of the user.
  890. Back-to-Back User Agent: A back-to-back user agent (B2BUA) is a
  891. logical entity that receives a request and processes it as a
  892. user agent server (UAS). In order to determine how the request
  893. should be answered, it acts as a user agent client (UAC) and
  894. generates requests. Unlike a proxy server, it maintains dialog
  895. state and must participate in all requests sent on the dialogs
  896. it has established. Since it is a concatenation of a UAC and
  897. UAS, no explicit definitions are needed for its behavior.
  898. Rosenberg, et. al. Standards Track [Page 20]
  899. RFC 3261 SIP: Session Initiation Protocol June 2002
  900. Call: A call is an informal term that refers to some communication
  901. between peers, generally set up for the purposes of a
  902. multimedia conversation.
  903. Call Leg: Another name for a dialog [31]; no longer used in this
  904. specification.
  905. Call Stateful: A proxy is call stateful if it retains state for a
  906. dialog from the initiating INVITE to the terminating BYE
  907. request. A call stateful proxy is always transaction stateful,
  908. but the converse is not necessarily true.
  909. Client: A client is any network element that sends SIP requests
  910. and receives SIP responses. Clients may or may not interact
  911. directly with a human user. User agent clients and proxies are
  912. clients.
  913. Conference: A multimedia session (see below) that contains
  914. multiple participants.
  915. Core: Core designates the functions specific to a particular type
  916. of SIP entity, i.e., specific to either a stateful or stateless
  917. proxy, a user agent or registrar. All cores, except those for
  918. the stateless proxy, are transaction users.
  919. Dialog: A dialog is a peer-to-peer SIP relationship between two
  920. UAs that persists for some time. A dialog is established by
  921. SIP messages, such as a 2xx response to an INVITE request. A
  922. dialog is identified by a call identifier, local tag, and a
  923. remote tag. A dialog was formerly known as a call leg in RFC
  924. 2543.
  925. Downstream: A direction of message forwarding within a transaction
  926. that refers to the direction that requests flow from the user
  927. agent client to user agent server.
  928. Final Response: A response that terminates a SIP transaction, as
  929. opposed to a provisional response that does not. All 2xx, 3xx,
  930. 4xx, 5xx and 6xx responses are final.
  931. Header: A header is a component of a SIP message that conveys
  932. information about the message. It is structured as a sequence
  933. of header fields.
  934. Header Field: A header field is a component of the SIP message
  935. header. A header field can appear as one or more header field
  936. rows. Header field rows consist of a header field name and zero
  937. or more header field values. Multiple header field values on a
  938. Rosenberg, et. al. Standards Track [Page 21]
  939. RFC 3261 SIP: Session Initiation Protocol June 2002
  940. given header field row are separated by commas. Some header
  941. fields can only have a single header field value, and as a
  942. result, always appear as a single header field row.
  943. Header Field Value: A header field value is a single value; a
  944. header field consists of zero or more header field values.
  945. Home Domain: The domain providing service to a SIP user.
  946. Typically, this is the domain present in the URI in the
  947. address-of-record of a registration.
  948. Informational Response: Same as a provisional response.
  949. Initiator, Calling Party, Caller: The party initiating a session
  950. (and dialog) with an INVITE request. A caller retains this
  951. role from the time it sends the initial INVITE that established
  952. a dialog until the termination of that dialog.
  953. Invitation: An INVITE request.
  954. Invitee, Invited User, Called Party, Callee: The party that
  955. receives an INVITE request for the purpose of establishing a
  956. new session. A callee retains this role from the time it
  957. receives the INVITE until the termination of the dialog
  958. established by that INVITE.
  959. Location Service: A location service is used by a SIP redirect or
  960. proxy server to obtain information about a callee's possible
  961. location(s). It contains a list of bindings of address-of-
  962. record keys to zero or more contact addresses. The bindings
  963. can be created and removed in many ways; this specification
  964. defines a REGISTER method that updates the bindings.
  965. Loop: A request that arrives at a proxy, is forwarded, and later
  966. arrives back at the same proxy. When it arrives the second
  967. time, its Request-URI is identical to the first time, and other
  968. header fields that affect proxy operation are unchanged, so
  969. that the proxy would make the same processing decision on the
  970. request it made the first time. Looped requests are errors,
  971. and the procedures for detecting them and handling them are
  972. described by the protocol.
  973. Loose Routing: A proxy is said to be loose routing if it follows
  974. the procedures defined in this specification for processing of
  975. the Route header field. These procedures separate the
  976. destination of the request (present in the Request-URI) from
  977. Rosenberg, et. al. Standards Track [Page 22]
  978. RFC 3261 SIP: Session Initiation Protocol June 2002
  979. the set of proxies that need to be visited along the way
  980. (present in the Route header field). A proxy compliant to
  981. these mechanisms is also known as a loose router.
  982. Message: Data sent between SIP elements as part of the protocol.
  983. SIP messages are either requests or responses.
  984. Method: The method is the primary function that a request is meant
  985. to invoke on a server. The method is carried in the request
  986. message itself. Example methods are INVITE and BYE.
  987. Outbound Proxy: A proxy that receives requests from a client, even
  988. though it may not be the server resolved by the Request-URI.
  989. Typically, a UA is manually configured with an outbound proxy,
  990. or can learn about one through auto-configuration protocols.
  991. Parallel Search: In a parallel search, a proxy issues several
  992. requests to possible user locations upon receiving an incoming
  993. request. Rather than issuing one request and then waiting for
  994. the final response before issuing the next request as in a
  995. sequential search, a parallel search issues requests without
  996. waiting for the result of previous requests.
  997. Provisional Response: A response used by the server to indicate
  998. progress, but that does not terminate a SIP transaction. 1xx
  999. responses are provisional, other responses are considered
  1000. final.
  1001. Proxy, Proxy Server: An intermediary entity that acts as both a
  1002. server and a client for the purpose of making requests on
  1003. behalf of other clients. A proxy server primarily plays the
  1004. role of routing, which means its job is to ensure that a
  1005. request is sent to another entity "closer" to the targeted
  1006. user. Proxies are also useful for enforcing policy (for
  1007. example, making sure a user is allowed to make a call). A
  1008. proxy interprets, and, if necessary, rewrites specific parts of
  1009. a request message before forwarding it.
  1010. Recursion: A client recurses on a 3xx response when it generates a
  1011. new request to one or more of the URIs in the Contact header
  1012. field in the response.
  1013. Redirect Server: A redirect server is a user agent server that
  1014. generates 3xx responses to requests it receives, directing the
  1015. client to contact an alternate set of URIs.
  1016. Rosenberg, et. al. Standards Track [Page 23]
  1017. RFC 3261 SIP: Session Initiation Protocol June 2002
  1018. Registrar: A registrar is a server that accepts REGISTER requests
  1019. and places the information it receives in those requests into
  1020. the location service for the domain it handles.
  1021. Regular Transaction: A regular transaction is any transaction with
  1022. a method other than INVITE, ACK, or CANCEL.
  1023. Request: A SIP message sent from a client to a server, for the
  1024. purpose of invoking a particular operation.
  1025. Response: A SIP message sent from a server to a client, for
  1026. indicating the status of a request sent from the client to the
  1027. server.
  1028. Ringback: Ringback is the signaling tone produced by the calling
  1029. party's application indicating that a called party is being
  1030. alerted (ringing).
  1031. Route Set: A route set is a collection of ordered SIP or SIPS URI
  1032. which represent a list of proxies that must be traversed when
  1033. sending a particular request. A route set can be learned,
  1034. through headers like Record-Route, or it can be configured.
  1035. Server: A server is a network element that receives requests in
  1036. order to service them and sends back responses to those
  1037. requests. Examples of servers are proxies, user agent servers,
  1038. redirect servers, and registrars.
  1039. Sequential Search: In a sequential search, a proxy server attempts
  1040. each contact address in sequence, proceeding to the next one
  1041. only after the previous has generated a final response. A 2xx
  1042. or 6xx class final response always terminates a sequential
  1043. search.
  1044. Session: From the SDP specification: "A multimedia session is a
  1045. set of multimedia senders and receivers and the data streams
  1046. flowing from senders to receivers. A multimedia conference is
  1047. an example of a multimedia session." (RFC 2327 [1]) (A session
  1048. as defined for SDP can comprise one or more RTP sessions.) As
  1049. defined, a callee can be invited several times, by different
  1050. calls, to the same session. If SDP is used, a session is
  1051. defined by the concatenation of the SDP user name, session id,
  1052. network type, address type, and address elements in the origin
  1053. field.
  1054. SIP Transaction: A SIP transaction occurs between a client and a
  1055. server and comprises all messages from the first request sent
  1056. from the client to the server up to a final (non-1xx) response
  1057. Rosenberg, et. al. Standards Track [Page 24]
  1058. RFC 3261 SIP: Session Initiation Protocol June 2002
  1059. sent from the server to the client. If the request is INVITE
  1060. and the final response is a non-2xx, the transaction also
  1061. includes an ACK to the response. The ACK for a 2xx response to
  1062. an INVITE request is a separate transaction.
  1063. Spiral: A spiral is a SIP request that is routed to a proxy,
  1064. forwarded onwards, and arrives once again at that proxy, but
  1065. this time differs in a way that will result in a different
  1066. processing decision than the original request. Typically, this
  1067. means that the request's Request-URI differs from its previous
  1068. arrival. A spiral is not an error condition, unlike a loop. A
  1069. typical cause for this is call forwarding. A user calls
  1070. joe@example.com. The example.com proxy forwards it to Joe's
  1071. PC, which in turn, forwards it to bob@example.com. This
  1072. request is proxied back to the example.com proxy. However,
  1073. this is not a loop. Since the request is targeted at a
  1074. different user, it is considered a spiral, and is a valid
  1075. condition.
  1076. Stateful Proxy: A logical entity that maintains the client and
  1077. server transaction state machines defined by this specification
  1078. during the processing of a request, also known as a transaction
  1079. stateful proxy. The behavior of a stateful proxy is further
  1080. defined in Section 16. A (transaction) stateful proxy is not
  1081. the same as a call stateful proxy.
  1082. Stateless Proxy: A logical entity that does not maintain the
  1083. client or server transaction state machines defined in this
  1084. specification when it processes requests. A stateless proxy
  1085. forwards every request it receives downstream and every
  1086. response it receives upstream.
  1087. Strict Routing: A proxy is said to be strict routing if it follows
  1088. the Route processing rules of RFC 2543 and many prior work in
  1089. progress versions of this RFC. That rule caused proxies to
  1090. destroy the contents of the Request-URI when a Route header
  1091. field was present. Strict routing behavior is not used in this
  1092. specification, in favor of a loose routing behavior. Proxies
  1093. that perform strict routing are also known as strict routers.
  1094. Target Refresh Request: A target refresh request sent within a
  1095. dialog is defined as a request that can modify the remote
  1096. target of the dialog.
  1097. Transaction User (TU): The layer of protocol processing that
  1098. resides above the transaction layer. Transaction users include
  1099. the UAC core, UAS core, and proxy core.
  1100. Rosenberg, et. al. Standards Track [Page 25]
  1101. RFC 3261 SIP: Session Initiation Protocol June 2002
  1102. Upstream: A direction of message forwarding within a transaction
  1103. that refers to the direction that responses flow from the user
  1104. agent server back to the user agent client.
  1105. URL-encoded: A character string encoded according to RFC 2396,
  1106. Section 2.4 [5].
  1107. User Agent Client (UAC): A user agent client is a logical entity
  1108. that creates a new request, and then uses the client
  1109. transaction state machinery to send it. The role of UAC lasts
  1110. only for the duration of that transaction. In other words, if
  1111. a piece of software initiates a request, it acts as a UAC for
  1112. the duration of that transaction. If it receives a request
  1113. later, it assumes the role of a user agent server for the
  1114. processing of that transaction.
  1115. UAC Core: The set of processing functions required of a UAC that
  1116. reside above the transaction and transport layers.
  1117. User Agent Server (UAS): A user agent server is a logical entity
  1118. that generates a response to a SIP request. The response
  1119. accepts, rejects, or redirects the request. This role lasts
  1120. only for the duration of that transaction. In other words, if
  1121. a piece of software responds to a request, it acts as a UAS for
  1122. the duration of that transaction. If it generates a request
  1123. later, it assumes the role of a user agent client for the
  1124. processing of that transaction.
  1125. UAS Core: The set of processing functions required at a UAS that
  1126. resides above the transaction and transport layers.
  1127. User Agent (UA): A logical entity that can act as both a user
  1128. agent client and user agent server.
  1129. The role of UAC and UAS, as well as proxy and redirect servers, are
  1130. defined on a transaction-by-transaction basis. For example, the user
  1131. agent initiating a call acts as a UAC when sending the initial INVITE
  1132. request and as a UAS when receiving a BYE request from the callee.
  1133. Similarly, the same software can act as a proxy server for one
  1134. request and as a redirect server for the next request.
  1135. Proxy, location, and registrar servers defined above are logical
  1136. entities; implementations MAY combine them into a single application.
  1137. 7 SIP Messages
  1138. SIP is a text-based protocol and uses the UTF-8 charset (RFC 2279
  1139. [7]).
  1140. Rosenberg, et. al. Standards Track [Page 26]
  1141. RFC 3261 SIP: Session Initiation Protocol June 2002
  1142. A SIP message is either a request from a client to a server, or a
  1143. response from a server to a client.
  1144. Both Request (section 7.1) and Response (section 7.2) messages use
  1145. the basic format of RFC 2822 [3], even though the syntax differs in
  1146. character set and syntax specifics. (SIP allows header fields that
  1147. would not be valid RFC 2822 header fields, for example.) Both types
  1148. of messages consist of a start-line, one or more header fields, an
  1149. empty line indicating the end of the header fields, and an optional
  1150. message-body.
  1151. generic-message = start-line
  1152. *message-header
  1153. CRLF
  1154. [ message-body ]
  1155. start-line = Request-Line / Status-Line
  1156. The start-line, each message-header line, and the empty line MUST be
  1157. terminated by a carriage-return line-feed sequence (CRLF). Note that
  1158. the empty line MUST be present even if the message-body is not.
  1159. Except for the above difference in character sets, much of SIP's
  1160. message and header field syntax is identical to HTTP/1.1. Rather
  1161. than repeating the syntax and semantics here, we use [HX.Y] to refer
  1162. to Section X.Y of the current HTTP/1.1 specification (RFC 2616 [8]).
  1163. However, SIP is not an extension of HTTP.
  1164. 7.1 Requests
  1165. SIP requests are distinguished by having a Request-Line for a start-
  1166. line. A Request-Line contains a method name, a Request-URI, and the
  1167. protocol version separated by a single space (SP) character.
  1168. The Request-Line ends with CRLF. No CR or LF are allowed except in
  1169. the end-of-line CRLF sequence. No linear whitespace (LWS) is allowed
  1170. in any of the elements.
  1171. Request-Line = Method SP Request-URI SP SIP-Version CRLF
  1172. Method: This specification defines six methods: REGISTER for
  1173. registering contact information, INVITE, ACK, and CANCEL for
  1174. setting up sessions, BYE for terminating sessions, and
  1175. OPTIONS for querying servers about their capabilities. SIP
  1176. extensions, documented in standards track RFCs, may define
  1177. additional methods.
  1178. Rosenberg, et. al. Standards Track [Page 27]
  1179. RFC 3261 SIP: Session Initiation Protocol June 2002
  1180. Request-URI: The Request-URI is a SIP or SIPS URI as described in
  1181. Section 19.1 or a general URI (RFC 2396 [5]). It indicates
  1182. the user or service to which this request is being addressed.
  1183. The Request-URI MUST NOT contain unescaped spaces or control
  1184. characters and MUST NOT be enclosed in "<>".
  1185. SIP elements MAY support Request-URIs with schemes other than
  1186. "sip" and "sips", for example the "tel" URI scheme of RFC
  1187. 2806 [9]. SIP elements MAY translate non-SIP URIs using any
  1188. mechanism at their disposal, resulting in SIP URI, SIPS URI,
  1189. or some other scheme.
  1190. SIP-Version: Both request and response messages include the
  1191. version of SIP in use, and follow [H3.1] (with HTTP replaced
  1192. by SIP, and HTTP/1.1 replaced by SIP/2.0) regarding version
  1193. ordering, compliance requirements, and upgrading of version
  1194. numbers. To be compliant with this specification,
  1195. applications sending SIP messages MUST include a SIP-Version
  1196. of "SIP/2.0". The SIP-Version string is case-insensitive,
  1197. but implementations MUST send upper-case.
  1198. Unlike HTTP/1.1, SIP treats the version number as a literal
  1199. string. In practice, this should make no difference.
  1200. 7.2 Responses
  1201. SIP responses are distinguished from requests by having a Status-Line
  1202. as their start-line. A Status-Line consists of the protocol version
  1203. followed by a numeric Status-Code and its associated textual phrase,
  1204. with each element separated by a single SP character.
  1205. No CR or LF is allowed except in the final CRLF sequence.
  1206. Status-Line = SIP-Version SP Status-Code SP Reason-Phrase CRLF
  1207. The Status-Code is a 3-digit integer result code that indicates the
  1208. outcome of an attempt to understand and satisfy a request. The
  1209. Reason-Phrase is intended to give a short textual description of the
  1210. Status-Code. The Status-Code is intended for use by automata,
  1211. whereas the Reason-Phrase is intended for the human user. A client
  1212. is not required to examine or display the Reason-Phrase.
  1213. While this specification suggests specific wording for the reason
  1214. phrase, implementations MAY choose other text, for example, in the
  1215. language indicated in the Accept-Language header field of the
  1216. request.
  1217. Rosenberg, et. al. Standards Track [Page 28]
  1218. RFC 3261 SIP: Session Initiation Protocol June 2002
  1219. The first digit of the Status-Code defines the class of response.
  1220. The last two digits do not have any categorization role. For this
  1221. reason, any response with a status code between 100 and 199 is
  1222. referred to as a "1xx response", any response with a status code
  1223. between 200 and 299 as a "2xx response", and so on. SIP/2.0 allows
  1224. six values for the first digit:
  1225. 1xx: Provisional -- request received, continuing to process the
  1226. request;
  1227. 2xx: Success -- the action was successfully received, understood,
  1228. and accepted;
  1229. 3xx: Redirection -- further action needs to be taken in order to
  1230. complete the request;
  1231. 4xx: Client Error -- the request contains bad syntax or cannot be
  1232. fulfilled at this server;
  1233. 5xx: Server Error -- the server failed to fulfill an apparently
  1234. valid request;
  1235. 6xx: Global Failure -- the request cannot be fulfilled at any
  1236. server.
  1237. Section 21 defines these classes and describes the individual codes.
  1238. 7.3 Header Fields
  1239. SIP header fields are similar to HTTP header fields in both syntax
  1240. and semantics. In particular, SIP header fields follow the [H4.2]
  1241. definitions of syntax for the message-header and the rules for
  1242. extending header fields over multiple lines. However, the latter is
  1243. specified in HTTP with implicit whitespace and folding. This
  1244. specification conforms to RFC 2234 [10] and uses only explicit
  1245. whitespace and folding as an integral part of the grammar.
  1246. [H4.2] also specifies that multiple header fields of the same field
  1247. name whose value is a comma-separated list can be combined into one
  1248. header field. That applies to SIP as well, but the specific rule is
  1249. different because of the different grammars. Specifically, any SIP
  1250. header whose grammar is of the form
  1251. header = "header-name" HCOLON header-value *(COMMA header-value)
  1252. allows for combining header fields of the same name into a comma-
  1253. separated list. The Contact header field allows a comma-separated
  1254. list unless the header field value is "*".
  1255. Rosenberg, et. al. Standards Track [Page 29]
  1256. RFC 3261 SIP: Session Initiation Protocol June 2002
  1257. 7.3.1 Header Field Format
  1258. Header fields follow the same generic header format as that given in
  1259. Section 2.2 of RFC 2822 [3]. Each header field consists of a field
  1260. name followed by a colon (":") and the field value.
  1261. field-name: field-value
  1262. The formal grammar for a message-header specified in Section 25
  1263. allows for an arbitrary amount of whitespace on either side of the
  1264. colon; however, implementations should avoid spaces between the field
  1265. name and the colon and use a single space (SP) between the colon and
  1266. the field-value.
  1267. Subject: lunch
  1268. Subject : lunch
  1269. Subject :lunch
  1270. Subject: lunch
  1271. Thus, the above are all valid and equivalent, but the last is the
  1272. preferred form.
  1273. Header fields can be extended over multiple lines by preceding each
  1274. extra line with at least one SP or horizontal tab (HT). The line
  1275. break and the whitespace at the beginning of the next line are
  1276. treated as a single SP character. Thus, the following are
  1277. equivalent:
  1278. Subject: I know you're there, pick up the phone and talk to me!
  1279. Subject: I know you're there,
  1280. pick up the phone
  1281. and talk to me!
  1282. The relative order of header fields with different field names is not
  1283. significant. However, it is RECOMMENDED that header fields which are
  1284. needed for proxy processing (Via, Route, Record-Route, Proxy-Require,
  1285. Max-Forwards, and Proxy-Authorization, for example) appear towards
  1286. the top of the message to facilitate rapid parsing. The relative
  1287. order of header field rows with the same field name is important.
  1288. Multiple header field rows with the same field-name MAY be present in
  1289. a message if and only if the entire field-value for that header field
  1290. is defined as a comma-separated list (that is, if follows the grammar
  1291. defined in Section 7.3). It MUST be possible to combine the multiple
  1292. header field rows into one "field-name: field-value" pair, without
  1293. changing the semantics of the message, by appending each subsequent
  1294. field-value to the first, each separated by a comma. The exceptions
  1295. to this rule are the WWW-Authenticate, Authorization, Proxy-
  1296. Authenticate, and Proxy-Authorization header fields. Multiple header
  1297. Rosenberg, et. al. Standards Track [Page 30]
  1298. RFC 3261 SIP: Session Initiation Protocol June 2002
  1299. field rows with these names MAY be present in a message, but since
  1300. their grammar does not follow the general form listed in Section 7.3,
  1301. they MUST NOT be combined into a single header field row.
  1302. Implementations MUST be able to process multiple header field rows
  1303. with the same name in any combination of the single-value-per-line or
  1304. comma-separated value forms.
  1305. The following groups of header field rows are valid and equivalent:
  1306. Route: <sip:alice@atlanta.com>
  1307. Subject: Lunch
  1308. Route: <sip:bob@biloxi.com>
  1309. Route: <sip:carol@chicago.com>
  1310. Route: <sip:alice@atlanta.com>, <sip:bob@biloxi.com>
  1311. Route: <sip:carol@chicago.com>
  1312. Subject: Lunch
  1313. Subject: Lunch
  1314. Route: <sip:alice@atlanta.com>, <sip:bob@biloxi.com>,
  1315. <sip:carol@chicago.com>
  1316. Each of the following blocks is valid but not equivalent to the
  1317. others:
  1318. Route: <sip:alice@atlanta.com>
  1319. Route: <sip:bob@biloxi.com>
  1320. Route: <sip:carol@chicago.com>
  1321. Route: <sip:bob@biloxi.com>
  1322. Route: <sip:alice@atlanta.com>
  1323. Route: <sip:carol@chicago.com>
  1324. Route: <sip:alice@atlanta.com>,<sip:carol@chicago.com>,
  1325. <sip:bob@biloxi.com>
  1326. The format of a header field-value is defined per header-name. It
  1327. will always be either an opaque sequence of TEXT-UTF8 octets, or a
  1328. combination of whitespace, tokens, separators, and quoted strings.
  1329. Many existing header fields will adhere to the general form of a
  1330. value followed by a semi-colon separated sequence of parameter-name,
  1331. parameter-value pairs:
  1332. field-name: field-value *(;parameter-name=parameter-value)
  1333. Rosenberg, et. al. Standards Track [Page 31]
  1334. RFC 3261 SIP: Session Initiation Protocol June 2002
  1335. Even though an arbitrary number of parameter pairs may be attached to
  1336. a header field value, any given parameter-name MUST NOT appear more
  1337. than once.
  1338. When comparing header fields, field names are always case-
  1339. insensitive. Unless otherwise stated in the definition of a
  1340. particular header field, field values, parameter names, and parameter
  1341. values are case-insensitive. Tokens are always case-insensitive.
  1342. Unless specified otherwise, values expressed as quoted strings are
  1343. case-sensitive. For example,
  1344. Contact: <sip:alice@atlanta.com>;expires=3600
  1345. is equivalent to
  1346. CONTACT: <sip:alice@atlanta.com>;ExPiReS=3600
  1347. and
  1348. Content-Disposition: session;handling=optional
  1349. is equivalent to
  1350. content-disposition: Session;HANDLING=OPTIONAL
  1351. The following two header fields are not equivalent:
  1352. Warning: 370 devnull "Choose a bigger pipe"
  1353. Warning: 370 devnull "CHOOSE A BIGGER PIPE"
  1354. 7.3.2 Header Field Classification
  1355. Some header fields only make sense in requests or responses. These
  1356. are called request header fields and response header fields,
  1357. respectively. If a header field appears in a message not matching
  1358. its category (such as a request header field in a response), it MUST
  1359. be ignored. Section 20 defines the classification of each header
  1360. field.
  1361. 7.3.3 Compact Form
  1362. SIP provides a mechanism to represent common header field names in an
  1363. abbreviated form. This may be useful when messages would otherwise
  1364. become too large to be carried on the transport available to it
  1365. (exceeding the maximum transmission unit (MTU) when using UDP, for
  1366. example). These compact forms are defined in Section 20. A compact
  1367. form MAY be substituted for the longer form of a header field name at
  1368. any time without changing the semantics of the message. A header
  1369. Rosenberg, et. al. Standards Track [Page 32]
  1370. RFC 3261 SIP: Session Initiation Protocol June 2002
  1371. field name MAY appear in both long and short forms within the same
  1372. message. Implementations MUST accept both the long and short forms
  1373. of each header name.
  1374. 7.4 Bodies
  1375. Requests, including new requests defined in extensions to this
  1376. specification, MAY contain message bodies unless otherwise noted.
  1377. The interpretation of the body depends on the request method.
  1378. For response messages, the request method and the response status
  1379. code determine the type and interpretation of any message body. All
  1380. responses MAY include a body.
  1381. 7.4.1 Message Body Type
  1382. The Internet media type of the message body MUST be given by the
  1383. Content-Type header field. If the body has undergone any encoding
  1384. such as compression, then this MUST be indicated by the Content-
  1385. Encoding header field; otherwise, Content-Encoding MUST be omitted.
  1386. If applicable, the character set of the message body is indicated as
  1387. part of the Content-Type header-field value.
  1388. The "multipart" MIME type defined in RFC 2046 [11] MAY be used within
  1389. the body of the message. Implementations that send requests
  1390. containing multipart message bodies MUST send a session description
  1391. as a non-multipart message body if the remote implementation requests
  1392. this through an Accept header field that does not contain multipart.
  1393. SIP messages MAY contain binary bodies or body parts. When no
  1394. explicit charset parameter is provided by the sender, media subtypes
  1395. of the "text" type are defined to have a default charset value of
  1396. "UTF-8".
  1397. 7.4.2 Message Body Length
  1398. The body length in bytes is provided by the Content-Length header
  1399. field. Section 20.14 describes the necessary contents of this header
  1400. field in detail.
  1401. The "chunked" transfer encoding of HTTP/1.1 MUST NOT be used for SIP.
  1402. (Note: The chunked encoding modifies the body of a message in order
  1403. to transfer it as a series of chunks, each with its own size
  1404. indicator.)
  1405. Rosenberg, et. al. Standards Track [Page 33]
  1406. RFC 3261 SIP: Session Initiation Protocol June 2002
  1407. 7.5 Framing SIP Messages
  1408. Unlike HTTP, SIP implementations can use UDP or other unreliable
  1409. datagram protocols. Each such datagram carries one request or
  1410. response. See Section 18 on constraints on usage of unreliable
  1411. transports.
  1412. Implementations processing SIP messages over stream-oriented
  1413. transports MUST ignore any CRLF appearing before the start-line
  1414. [H4.1].
  1415. The Content-Length header field value is used to locate the end of
  1416. each SIP message in a stream. It will always be present when SIP
  1417. messages are sent over stream-oriented transports.
  1418. 8 General User Agent Behavior
  1419. A user agent represents an end system. It contains a user agent
  1420. client (UAC), which generates requests, and a user agent server
  1421. (UAS), which responds to them. A UAC is capable of generating a
  1422. request based on some external stimulus (the user clicking a button,
  1423. or a signal on a PSTN line) and processing a response. A UAS is
  1424. capable of receiving a request and generating a response based on
  1425. user input, external stimulus, the result of a program execution, or
  1426. some other mechanism.
  1427. When a UAC sends a request, the request passes through some number of
  1428. proxy servers, which forward the request towards the UAS. When the
  1429. UAS generates a response, the response is forwarded towards the UAC.
  1430. UAC and UAS procedures depend strongly on two factors. First, based
  1431. on whether the request or response is inside or outside of a dialog,
  1432. and second, based on the method of a request. Dialogs are discussed
  1433. thoroughly in Section 12; they represent a peer-to-peer relationship
  1434. between user agents and are established by specific SIP methods, such
  1435. as INVITE.
  1436. In this section, we discuss the method-independent rules for UAC and
  1437. UAS behavior when processing requests that are outside of a dialog.
  1438. This includes, of course, the requests which themselves establish a
  1439. dialog.
  1440. Security procedures for requests and responses outside of a dialog
  1441. are described in Section 26. Specifically, mechanisms exist for the
  1442. UAS and UAC to mutually authenticate. A limited set of privacy
  1443. features are also supported through encryption of bodies using
  1444. S/MIME.
  1445. Rosenberg, et. al. Standards Track [Page 34]
  1446. RFC 3261 SIP: Session Initiation Protocol June 2002
  1447. 8.1 UAC Behavior
  1448. This section covers UAC behavior outside of a dialog.
  1449. 8.1.1 Generating the Request
  1450. A valid SIP request formulated by a UAC MUST, at a minimum, contain
  1451. the following header fields: To, From, CSeq, Call-ID, Max-Forwards,
  1452. and Via; all of these header fields are mandatory in all SIP
  1453. requests. These six header fields are the fundamental building
  1454. blocks of a SIP message, as they jointly provide for most of the
  1455. critical message routing services including the addressing of
  1456. messages, the routing of responses, limiting message propagation,
  1457. ordering of messages, and the unique identification of transactions.
  1458. These header fields are in addition to the mandatory request line,
  1459. which contains the method, Request-URI, and SIP version.
  1460. Examples of requests sent outside of a dialog include an INVITE to
  1461. establish a session (Section 13) and an OPTIONS to query for
  1462. capabilities (Section 11).
  1463. 8.1.1.1 Request-URI
  1464. The initial Request-URI of the message SHOULD be set to the value of
  1465. the URI in the To field. One notable exception is the REGISTER
  1466. method; behavior for setting the Request-URI of REGISTER is given in
  1467. Section 10. It may also be undesirable for privacy reasons or
  1468. convenience to set these fields to the same value (especially if the
  1469. originating UA expects that the Request-URI will be changed during
  1470. transit).
  1471. In some special circumstances, the presence of a pre-existing route
  1472. set can affect the Request-URI of the message. A pre-existing route
  1473. set is an ordered set of URIs that identify a chain of servers, to
  1474. which a UAC will send outgoing requests that are outside of a dialog.
  1475. Commonly, they are configured on the UA by a user or service provider
  1476. manually, or through some other non-SIP mechanism. When a provider
  1477. wishes to configure a UA with an outbound proxy, it is RECOMMENDED
  1478. that this be done by providing it with a pre-existing route set with
  1479. a single URI, that of the outbound proxy.
  1480. When a pre-existing route set is present, the procedures for
  1481. populating the Request-URI and Route header field detailed in Section
  1482. 12.2.1.1 MUST be followed (even though there is no dialog), using the
  1483. desired Request-URI as the remote target URI.
  1484. Rosenberg, et. al. Standards Track [Page 35]
  1485. RFC 3261 SIP: Session Initiation Protocol June 2002
  1486. 8.1.1.2 To
  1487. The To header field first and foremost specifies the desired
  1488. "logical" recipient of the request, or the address-of-record of the
  1489. user or resource that is the target of this request. This may or may
  1490. not be the ultimate recipient of the request. The To header field
  1491. MAY contain a SIP or SIPS URI, but it may also make use of other URI
  1492. schemes (the tel URL (RFC 2806 [9]), for example) when appropriate.
  1493. All SIP implementations MUST support the SIP URI scheme. Any
  1494. implementation that supports TLS MUST support the SIPS URI scheme.
  1495. The To header field allows for a display name.
  1496. A UAC may learn how to populate the To header field for a particular
  1497. request in a number of ways. Usually the user will suggest the To
  1498. header field through a human interface, perhaps inputting the URI
  1499. manually or selecting it from some sort of address book. Frequently,
  1500. the user will not enter a complete URI, but rather a string of digits
  1501. or letters (for example, "bob"). It is at the discretion of the UA
  1502. to choose how to interpret this input. Using the string to form the
  1503. user part of a SIP URI implies that the UA wishes the name to be
  1504. resolved in the domain to the right-hand side (RHS) of the at-sign in
  1505. the SIP URI (for instance, sip:bob@example.com). Using the string to
  1506. form the user part of a SIPS URI implies that the UA wishes to
  1507. communicate securely, and that the name is to be resolved in the
  1508. domain to the RHS of the at-sign. The RHS will frequently be the
  1509. home domain of the requestor, which allows for the home domain to
  1510. process the outgoing request. This is useful for features like
  1511. "speed dial" that require interpretation of the user part in the home
  1512. domain. The tel URL may be used when the UA does not wish to specify
  1513. the domain that should interpret a telephone number that has been
  1514. input by the user. Rather, each domain through which the request
  1515. passes would be given that opportunity. As an example, a user in an
  1516. airport might log in and send requests through an outbound proxy in
  1517. the airport. If they enter "411" (this is the phone number for local
  1518. directory assistance in the United States), that needs to be
  1519. interpreted and processed by the outbound proxy in the airport, not
  1520. the user's home domain. In this case, tel:411 would be the right
  1521. choice.
  1522. A request outside of a dialog MUST NOT contain a To tag; the tag in
  1523. the To field of a request identifies the peer of the dialog. Since
  1524. no dialog is established, no tag is present.
  1525. For further information on the To header field, see Section 20.39.
  1526. The following is an example of a valid To header field:
  1527. To: Carol <sip:carol@chicago.com>
  1528. Rosenberg, et. al. Standards Track [Page 36]
  1529. RFC 3261 SIP: Session Initiation Protocol June 2002
  1530. 8.1.1.3 From
  1531. The From header field indicates the logical identity of the initiator
  1532. of the request, possibly the user's address-of-record. Like the To
  1533. header field, it contains a URI and optionally a display name. It is
  1534. used by SIP elements to determine which processing rules to apply to
  1535. a request (for example, automatic call rejection). As such, it is
  1536. very important that the From URI not contain IP addresses or the FQDN
  1537. of the host on which the UA is running, since these are not logical
  1538. names.
  1539. The From header field allows for a display name. A UAC SHOULD use
  1540. the display name "Anonymous", along with a syntactically correct, but
  1541. otherwise meaningless URI (like sip:thisis@anonymous.invalid), if the
  1542. identity of the client is to remain hidden.
  1543. Usually, the value that populates the From header field in requests
  1544. generated by a particular UA is pre-provisioned by the user or by the
  1545. administrators of the user's local domain. If a particular UA is
  1546. used by multiple users, it might have switchable profiles that
  1547. include a URI corresponding to the identity of the profiled user.
  1548. Recipients of requests can authenticate the originator of a request
  1549. in order to ascertain that they are who their From header field
  1550. claims they are (see Section 22 for more on authentication).
  1551. The From field MUST contain a new "tag" parameter, chosen by the UAC.
  1552. See Section 19.3 for details on choosing a tag.
  1553. For further information on the From header field, see Section 20.20.
  1554. Examples:
  1555. From: "Bob" <sips:bob@biloxi.com> ;tag=a48s
  1556. From: sip:+12125551212@phone2net.com;tag=887s
  1557. From: Anonymous <sip:c8oqz84zk7z@privacy.org>;tag=hyh8
  1558. 8.1.1.4 Call-ID
  1559. The Call-ID header field acts as a unique identifier to group
  1560. together a series of messages. It MUST be the same for all requests
  1561. and responses sent by either UA in a dialog. It SHOULD be the same
  1562. in each registration from a UA.
  1563. In a new request created by a UAC outside of any dialog, the Call-ID
  1564. header field MUST be selected by the UAC as a globally unique
  1565. identifier over space and time unless overridden by method-specific
  1566. behavior. All SIP UAs must have a means to guarantee that the Call-
  1567. ID header fields they produce will not be inadvertently generated by
  1568. any other UA. Note that when requests are retried after certain
  1569. Rosenberg, et. al. Standards Track [Page 37]
  1570. RFC 3261 SIP: Session Initiation Protocol June 2002
  1571. failure responses that solicit an amendment to a request (for
  1572. example, a challenge for authentication), these retried requests are
  1573. not considered new requests, and therefore do not need new Call-ID
  1574. header fields; see Section 8.1.3.5.
  1575. Use of cryptographically random identifiers (RFC 1750 [12]) in the
  1576. generation of Call-IDs is RECOMMENDED. Implementations MAY use the
  1577. form "localid@host". Call-IDs are case-sensitive and are simply
  1578. compared byte-by-byte.
  1579. Using cryptographically random identifiers provides some
  1580. protection against session hijacking and reduces the likelihood of
  1581. unintentional Call-ID collisions.
  1582. No provisioning or human interface is required for the selection of
  1583. the Call-ID header field value for a request.
  1584. For further information on the Call-ID header field, see Section
  1585. 20.8.
  1586. Example:
  1587. Call-ID: f81d4fae-7dec-11d0-a765-00a0c91e6bf6@foo.bar.com
  1588. 8.1.1.5 CSeq
  1589. The CSeq header field serves as a way to identify and order
  1590. transactions. It consists of a sequence number and a method. The
  1591. method MUST match that of the request. For non-REGISTER requests
  1592. outside of a dialog, the sequence number value is arbitrary. The
  1593. sequence number value MUST be expressible as a 32-bit unsigned
  1594. integer and MUST be less than 2**31. As long as it follows the above
  1595. guidelines, a client may use any mechanism it would like to select
  1596. CSeq header field values.
  1597. Section 12.2.1.1 discusses construction of the CSeq for requests
  1598. within a dialog.
  1599. Example:
  1600. CSeq: 4711 INVITE
  1601. Rosenberg, et. al. Standards Track [Page 38]
  1602. RFC 3261 SIP: Session Initiation Protocol June 2002
  1603. 8.1.1.6 Max-Forwards
  1604. The Max-Forwards header field serves to limit the number of hops a
  1605. request can transit on the way to its destination. It consists of an
  1606. integer that is decremented by one at each hop. If the Max-Forwards
  1607. value reaches 0 before the request reaches its destination, it will
  1608. be rejected with a 483(Too Many Hops) error response.
  1609. A UAC MUST insert a Max-Forwards header field into each request it
  1610. originates with a value that SHOULD be 70. This number was chosen to
  1611. be sufficiently large to guarantee that a request would not be
  1612. dropped in any SIP network when there were no loops, but not so large
  1613. as to consume proxy resources when a loop does occur. Lower values
  1614. should be used with caution and only in networks where topologies are
  1615. known by the UA.
  1616. 8.1.1.7 Via
  1617. The Via header field indicates the transport used for the transaction
  1618. and identifies the location where the response is to be sent. A Via
  1619. header field value is added only after the transport that will be
  1620. used to reach the next hop has been selected (which may involve the
  1621. usage of the procedures in [4]).
  1622. When the UAC creates a request, it MUST insert a Via into that
  1623. request. The protocol name and protocol version in the header field
  1624. MUST be SIP and 2.0, respectively. The Via header field value MUST
  1625. contain a branch parameter. This parameter is used to identify the
  1626. transaction created by that request. This parameter is used by both
  1627. the client and the server.
  1628. The branch parameter value MUST be unique across space and time for
  1629. all requests sent by the UA. The exceptions to this rule are CANCEL
  1630. and ACK for non-2xx responses. As discussed below, a CANCEL request
  1631. will have the same value of the branch parameter as the request it
  1632. cancels. As discussed in Section 17.1.1.3, an ACK for a non-2xx
  1633. response will also have the same branch ID as the INVITE whose
  1634. response it acknowledges.
  1635. The uniqueness property of the branch ID parameter, to facilitate
  1636. its use as a transaction ID, was not part of RFC 2543.
  1637. The branch ID inserted by an element compliant with this
  1638. specification MUST always begin with the characters "z9hG4bK". These
  1639. 7 characters are used as a magic cookie (7 is deemed sufficient to
  1640. ensure that an older RFC 2543 implementation would not pick such a
  1641. value), so that servers receiving the request can determine that the
  1642. branch ID was constructed in the fashion described by this
  1643. Rosenberg, et. al. Standards Track [Page 39]
  1644. RFC 3261 SIP: Session Initiation Protocol June 2002
  1645. specification (that is, globally unique). Beyond this requirement,
  1646. the precise format of the branch token is implementation-defined.
  1647. The Via header maddr, ttl, and sent-by components will be set when
  1648. the request is processed by the transport layer (Section 18).
  1649. Via processing for proxies is described in Section 16.6 Item 8 and
  1650. Section 16.7 Item 3.
  1651. 8.1.1.8 Contact
  1652. The Contact header field provides a SIP or SIPS URI that can be used
  1653. to contact that specific instance of the UA for subsequent requests.
  1654. The Contact header field MUST be present and contain exactly one SIP
  1655. or SIPS URI in any request that can result in the establishment of a
  1656. dialog. For the methods defined in this specification, that includes
  1657. only the INVITE request. For these requests, the scope of the
  1658. Contact is global. That is, the Contact header field value contains
  1659. the URI at which the UA would like to receive requests, and this URI
  1660. MUST be valid even if used in subsequent requests outside of any
  1661. dialogs.
  1662. If the Request-URI or top Route header field value contains a SIPS
  1663. URI, the Contact header field MUST contain a SIPS URI as well.
  1664. For further information on the Contact header field, see Section
  1665. 20.10.
  1666. 8.1.1.9 Supported and Require
  1667. If the UAC supports extensions to SIP that can be applied by the
  1668. server to the response, the UAC SHOULD include a Supported header
  1669. field in the request listing the option tags (Section 19.2) for those
  1670. extensions.
  1671. The option tags listed MUST only refer to extensions defined in
  1672. standards-track RFCs. This is to prevent servers from insisting that
  1673. clients implement non-standard, vendor-defined features in order to
  1674. receive service. Extensions defined by experimental and
  1675. informational RFCs are explicitly excluded from usage with the
  1676. Supported header field in a request, since they too are often used to
  1677. document vendor-defined extensions.
  1678. If the UAC wishes to insist that a UAS understand an extension that
  1679. the UAC will apply to the request in order to process the request, it
  1680. MUST insert a Require header field into the request listing the
  1681. option tag for that extension. If the UAC wishes to apply an
  1682. extension to the request and insist that any proxies that are
  1683. Rosenberg, et. al. Standards Track [Page 40]
  1684. RFC 3261 SIP: Session Initiation Protocol June 2002
  1685. traversed understand that extension, it MUST insert a Proxy-Require
  1686. header field into the request listing the option tag for that
  1687. extension.
  1688. As with the Supported header field, the option tags in the Require
  1689. and Proxy-Require header fields MUST only refer to extensions defined
  1690. in standards-track RFCs.
  1691. 8.1.1.10 Additional Message Components
  1692. After a new request has been created, and the header fields described
  1693. above have been properly constructed, any additional optional header
  1694. fields are added, as are any header fields specific to the method.
  1695. SIP requests MAY contain a MIME-encoded message-body. Regardless of
  1696. the type of body that a request contains, certain header fields must
  1697. be formulated to characterize the contents of the body. For further
  1698. information on these header fields, see Sections 20.11 through 20.15.
  1699. 8.1.2 Sending the Request
  1700. The destination for the request is then computed. Unless there is
  1701. local policy specifying otherwise, the destination MUST be determined
  1702. by applying the DNS procedures described in [4] as follows. If the
  1703. first element in the route set indicated a strict router (resulting
  1704. in forming the request as described in Section 12.2.1.1), the
  1705. procedures MUST be applied to the Request-URI of the request.
  1706. Otherwise, the procedures are applied to the first Route header field
  1707. value in the request (if one exists), or to the request's Request-URI
  1708. if there is no Route header field present. These procedures yield an
  1709. ordered set of address, port, and transports to attempt. Independent
  1710. of which URI is used as input to the procedures of [4], if the
  1711. Request-URI specifies a SIPS resource, the UAC MUST follow the
  1712. procedures of [4] as if the input URI were a SIPS URI.
  1713. Local policy MAY specify an alternate set of destinations to attempt.
  1714. If the Request-URI contains a SIPS URI, any alternate destinations
  1715. MUST be contacted with TLS. Beyond that, there are no restrictions
  1716. on the alternate destinations if the request contains no Route header
  1717. field. This provides a simple alternative to a pre-existing route
  1718. set as a way to specify an outbound proxy. However, that approach
  1719. for configuring an outbound proxy is NOT RECOMMENDED; a pre-existing
  1720. route set with a single URI SHOULD be used instead. If the request
  1721. contains a Route header field, the request SHOULD be sent to the
  1722. locations derived from its topmost value, but MAY be sent to any
  1723. server that the UA is certain will honor the Route and Request-URI
  1724. policies specified in this document (as opposed to those in RFC
  1725. 2543). In particular, a UAC configured with an outbound proxy SHOULD
  1726. Rosenberg, et. al. Standards Track [Page 41]
  1727. RFC 3261 SIP: Session Initiation Protocol June 2002
  1728. attempt to send the request to the location indicated in the first
  1729. Route header field value instead of adopting the policy of sending
  1730. all messages to the outbound proxy.
  1731. This ensures that outbound proxies that do not add Record-Route
  1732. header field values will drop out of the path of subsequent
  1733. requests. It allows endpoints that cannot resolve the first Route
  1734. URI to delegate that task to an outbound proxy.
  1735. The UAC SHOULD follow the procedures defined in [4] for stateful
  1736. elements, trying each address until a server is contacted. Each try
  1737. constitutes a new transaction, and therefore each carries a different
  1738. topmost Via header field value with a new branch parameter.
  1739. Furthermore, the transport value in the Via header field is set to
  1740. whatever transport was determined for the target server.
  1741. 8.1.3 Processing Responses
  1742. Responses are first processed by the transport layer and then passed
  1743. up to the transaction layer. The transaction layer performs its
  1744. processing and then passes the response up to the TU. The majority
  1745. of response processing in the TU is method specific. However, there
  1746. are some general behaviors independent of the method.
  1747. 8.1.3.1 Transaction Layer Errors
  1748. In some cases, the response returned by the transaction layer will
  1749. not be a SIP message, but rather a transaction layer error. When a
  1750. timeout error is received from the transaction layer, it MUST be
  1751. treated as if a 408 (Request Timeout) status code has been received.
  1752. If a fatal transport error is reported by the transport layer
  1753. (generally, due to fatal ICMP errors in UDP or connection failures in
  1754. TCP), the condition MUST be treated as a 503 (Service Unavailable)
  1755. status code.
  1756. 8.1.3.2 Unrecognized Responses
  1757. A UAC MUST treat any final response it does not recognize as being
  1758. equivalent to the x00 response code of that class, and MUST be able
  1759. to process the x00 response code for all classes. For example, if a
  1760. UAC receives an unrecognized response code of 431, it can safely
  1761. assume that there was something wrong with its request and treat the
  1762. response as if it had received a 400 (Bad Request) response code. A
  1763. UAC MUST treat any provisional response different than 100 that it
  1764. does not recognize as 183 (Session Progress). A UAC MUST be able to
  1765. process 100 and 183 responses.
  1766. Rosenberg, et. al. Standards Track [Page 42]
  1767. RFC 3261 SIP: Session Initiation Protocol June 2002
  1768. 8.1.3.3 Vias
  1769. If more than one Via header field value is present in a response, the
  1770. UAC SHOULD discard the message.
  1771. The presence of additional Via header field values that precede
  1772. the originator of the request suggests that the message was
  1773. misrouted or possibly corrupted.
  1774. 8.1.3.4 Processing 3xx Responses
  1775. Upon receipt of a redirection response (for example, a 301 response
  1776. status code), clients SHOULD use the URI(s) in the Contact header
  1777. field to formulate one or more new requests based on the redirected
  1778. request. This process is similar to that of a proxy recursing on a
  1779. 3xx class response as detailed in Sections 16.5 and 16.6. A client
  1780. starts with an initial target set containing exactly one URI, the
  1781. Request-URI of the original request. If a client wishes to formulate
  1782. new requests based on a 3xx class response to that request, it places
  1783. the URIs to try into the target set. Subject to the restrictions in
  1784. this specification, a client can choose which Contact URIs it places
  1785. into the target set. As with proxy recursion, a client processing
  1786. 3xx class responses MUST NOT add any given URI to the target set more
  1787. than once. If the original request had a SIPS URI in the Request-
  1788. URI, the client MAY choose to recurse to a non-SIPS URI, but SHOULD
  1789. inform the user of the redirection to an insecure URI.
  1790. Any new request may receive 3xx responses themselves containing
  1791. the original URI as a contact. Two locations can be configured to
  1792. redirect to each other. Placing any given URI in the target set
  1793. only once prevents infinite redirection loops.
  1794. As the target set grows, the client MAY generate new requests to the
  1795. URIs in any order. A common mechanism is to order the set by the "q"
  1796. parameter value from the Contact header field value. Requests to the
  1797. URIs MAY be generated serially or in parallel. One approach is to
  1798. process groups of decreasing q-values serially and process the URIs
  1799. in each q-value group in parallel. Another is to perform only serial
  1800. processing in decreasing q-value order, arbitrarily choosing between
  1801. contacts of equal q-value.
  1802. If contacting an address in the list results in a failure, as defined
  1803. in the next paragraph, the element moves to the next address in the
  1804. list, until the list is exhausted. If the list is exhausted, then
  1805. the request has failed.
  1806. Rosenberg, et. al. Standards Track [Page 43]
  1807. RFC 3261 SIP: Session Initiation Protocol June 2002
  1808. Failures SHOULD be detected through failure response codes (codes
  1809. greater than 399); for network errors the client transaction will
  1810. report any transport layer failures to the transaction user. Note
  1811. that some response codes (detailed in 8.1.3.5) indicate that the
  1812. request can be retried; requests that are reattempted should not be
  1813. considered failures.
  1814. When a failure for a particular contact address is received, the
  1815. client SHOULD try the next contact address. This will involve
  1816. creating a new client transaction to deliver a new request.
  1817. In order to create a request based on a contact address in a 3xx
  1818. response, a UAC MUST copy the entire URI from the target set into the
  1819. Request-URI, except for the "method-param" and "header" URI
  1820. parameters (see Section 19.1.1 for a definition of these parameters).
  1821. It uses the "header" parameters to create header field values for the
  1822. new request, overwriting header field values associated with the
  1823. redirected request in accordance with the guidelines in Section
  1824. 19.1.5.
  1825. Note that in some instances, header fields that have been
  1826. communicated in the contact address may instead append to existing
  1827. request header fields in the original redirected request. As a
  1828. general rule, if the header field can accept a comma-separated list
  1829. of values, then the new header field value MAY be appended to any
  1830. existing values in the original redirected request. If the header
  1831. field does not accept multiple values, the value in the original
  1832. redirected request MAY be overwritten by the header field value
  1833. communicated in the contact address. For example, if a contact
  1834. address is returned with the following value:
  1835. sip:user@host?Subject=foo&Call-Info=<http://www.foo.com>
  1836. Then any Subject header field in the original redirected request is
  1837. overwritten, but the HTTP URL is merely appended to any existing
  1838. Call-Info header field values.
  1839. It is RECOMMENDED that the UAC reuse the same To, From, and Call-ID
  1840. used in the original redirected request, but the UAC MAY also choose
  1841. to update the Call-ID header field value for new requests, for
  1842. example.
  1843. Finally, once the new request has been constructed, it is sent using
  1844. a new client transaction, and therefore MUST have a new branch ID in
  1845. the top Via field as discussed in Section 8.1.1.7.
  1846. Rosenberg, et. al. Standards Track [Page 44]
  1847. RFC 3261 SIP: Session Initiation Protocol June 2002
  1848. In all other respects, requests sent upon receipt of a redirect
  1849. response SHOULD re-use the header fields and bodies of the original
  1850. request.
  1851. In some instances, Contact header field values may be cached at UAC
  1852. temporarily or permanently depending on the status code received and
  1853. the presence of an expiration interval; see Sections 21.3.2 and
  1854. 21.3.3.
  1855. 8.1.3.5 Processing 4xx Responses
  1856. Certain 4xx response codes require specific UA processing,
  1857. independent of the method.
  1858. If a 401 (Unauthorized) or 407 (Proxy Authentication Required)
  1859. response is received, the UAC SHOULD follow the authorization
  1860. procedures of Section 22.2 and Section 22.3 to retry the request with
  1861. credentials.
  1862. If a 413 (Request Entity Too Large) response is received (Section
  1863. 21.4.11), the request contained a body that was longer than the UAS
  1864. was willing to accept. If possible, the UAC SHOULD retry the
  1865. request, either omitting the body or using one of a smaller length.
  1866. If a 415 (Unsupported Media Type) response is received (Section
  1867. 21.4.13), the request contained media types not supported by the UAS.
  1868. The UAC SHOULD retry sending the request, this time only using
  1869. content with types listed in the Accept header field in the response,
  1870. with encodings listed in the Accept-Encoding header field in the
  1871. response, and with languages listed in the Accept-Language in the
  1872. response.
  1873. If a 416 (Unsupported URI Scheme) response is received (Section
  1874. 21.4.14), the Request-URI used a URI scheme not supported by the
  1875. server. The client SHOULD retry the request, this time, using a SIP
  1876. URI.
  1877. If a 420 (Bad Extension) response is received (Section 21.4.15), the
  1878. request contained a Require or Proxy-Require header field listing an
  1879. option-tag for a feature not supported by a proxy or UAS. The UAC
  1880. SHOULD retry the request, this time omitting any extensions listed in
  1881. the Unsupported header field in the response.
  1882. In all of the above cases, the request is retried by creating a new
  1883. request with the appropriate modifications. This new request
  1884. constitutes a new transaction and SHOULD have the same value of the
  1885. Call-ID, To, and From of the previous request, but the CSeq should
  1886. contain a new sequence number that is one higher than the previous.
  1887. Rosenberg, et. al. Standards Track [Page 45]
  1888. RFC 3261 SIP: Session Initiation Protocol June 2002
  1889. With other 4xx responses, including those yet to be defined, a retry
  1890. may or may not be possible depending on the method and the use case.
  1891. 8.2 UAS Behavior
  1892. When a request outside of a dialog is processed by a UAS, there is a
  1893. set of processing rules that are followed, independent of the method.
  1894. Section 12 gives guidance on how a UAS can tell whether a request is
  1895. inside or outside of a dialog.
  1896. Note that request processing is atomic. If a request is accepted,
  1897. all state changes associated with it MUST be performed. If it is
  1898. rejected, all state changes MUST NOT be performed.
  1899. UASs SHOULD process the requests in the order of the steps that
  1900. follow in this section (that is, starting with authentication, then
  1901. inspecting the method, the header fields, and so on throughout the
  1902. remainder of this section).
  1903. 8.2.1 Method Inspection
  1904. Once a request is authenticated (or authentication is skipped), the
  1905. UAS MUST inspect the method of the request. If the UAS recognizes
  1906. but does not support the method of a request, it MUST generate a 405
  1907. (Method Not Allowed) response. Procedures for generating responses
  1908. are described in Section 8.2.6. The UAS MUST also add an Allow
  1909. header field to the 405 (Method Not Allowed) response. The Allow
  1910. header field MUST list the set of methods supported by the UAS
  1911. generating the message. The Allow header field is presented in
  1912. Section 20.5.
  1913. If the method is one supported by the server, processing continues.
  1914. 8.2.2 Header Inspection
  1915. If a UAS does not understand a header field in a request (that is,
  1916. the header field is not defined in this specification or in any
  1917. supported extension), the server MUST ignore that header field and
  1918. continue processing the message. A UAS SHOULD ignore any malformed
  1919. header fields that are not necessary for processing requests.
  1920. 8.2.2.1 To and Request-URI
  1921. The To header field identifies the original recipient of the request
  1922. designated by the user identified in the From field. The original
  1923. recipient may or may not be the UAS processing the request, due to
  1924. call forwarding or other proxy operations. A UAS MAY apply any
  1925. policy it wishes to determine whether to accept requests when the To
  1926. Rosenberg, et. al. Standards Track [Page 46]
  1927. RFC 3261 SIP: Session Initiation Protocol June 2002
  1928. header field is not the identity of the UAS. However, it is
  1929. RECOMMENDED that a UAS accept requests even if they do not recognize
  1930. the URI scheme (for example, a tel: URI) in the To header field, or
  1931. if the To header field does not address a known or current user of
  1932. this UAS. If, on the other hand, the UAS decides to reject the
  1933. request, it SHOULD generate a response with a 403 (Forbidden) status
  1934. code and pass it to the server transaction for transmission.
  1935. However, the Request-URI identifies the UAS that is to process the
  1936. request. If the Request-URI uses a scheme not supported by the UAS,
  1937. it SHOULD reject the request with a 416 (Unsupported URI Scheme)
  1938. response. If the Request-URI does not identify an address that the
  1939. UAS is willing to accept requests for, it SHOULD reject the request
  1940. with a 404 (Not Found) response. Typically, a UA that uses the
  1941. REGISTER method to bind its address-of-record to a specific contact
  1942. address will see requests whose Request-URI equals that contact
  1943. address. Other potential sources of received Request-URIs include
  1944. the Contact header fields of requests and responses sent by the UA
  1945. that establish or refresh dialogs.
  1946. 8.2.2.2 Merged Requests
  1947. If the request has no tag in the To header field, the UAS core MUST
  1948. check the request against ongoing transactions. If the From tag,
  1949. Call-ID, and CSeq exactly match those associated with an ongoing
  1950. transaction, but the request does not match that transaction (based
  1951. on the matching rules in Section 17.2.3), the UAS core SHOULD
  1952. generate a 482 (Loop Detected) response and pass it to the server
  1953. transaction.
  1954. The same request has arrived at the UAS more than once, following
  1955. different paths, most likely due to forking. The UAS processes
  1956. the first such request received and responds with a 482 (Loop
  1957. Detected) to the rest of them.
  1958. 8.2.2.3 Require
  1959. Assuming the UAS decides that it is the proper element to process the
  1960. request, it examines the Require header field, if present.
  1961. The Require header field is used by a UAC to tell a UAS about SIP
  1962. extensions that the UAC expects the UAS to support in order to
  1963. process the request properly. Its format is described in Section
  1964. 20.32. If a UAS does not understand an option-tag listed in a
  1965. Require header field, it MUST respond by generating a response with
  1966. status code 420 (Bad Extension). The UAS MUST add an Unsupported
  1967. header field, and list in it those options it does not understand
  1968. amongst those in the Require header field of the request.
  1969. Rosenberg, et. al. Standards Track [Page 47]
  1970. RFC 3261 SIP: Session Initiation Protocol June 2002
  1971. Note that Require and Proxy-Require MUST NOT be used in a SIP CANCEL
  1972. request, or in an ACK request sent for a non-2xx response. These
  1973. header fields MUST be ignored if they are present in these requests.
  1974. An ACK request for a 2xx response MUST contain only those Require and
  1975. Proxy-Require values that were present in the initial request.
  1976. Example:
  1977. UAC->UAS: INVITE sip:watson@bell-telephone.com SIP/2.0
  1978. Require: 100rel
  1979. UAS->UAC: SIP/2.0 420 Bad Extension
  1980. Unsupported: 100rel
  1981. This behavior ensures that the client-server interaction will
  1982. proceed without delay when all options are understood by both
  1983. sides, and only slow down if options are not understood (as in the
  1984. example above). For a well-matched client-server pair, the
  1985. interaction proceeds quickly, saving a round-trip often required
  1986. by negotiation mechanisms. In addition, it also removes ambiguity
  1987. when the client requires features that the server does not
  1988. understand. Some features, such as call handling fields, are only
  1989. of interest to end systems.
  1990. 8.2.3 Content Processing
  1991. Assuming the UAS understands any extensions required by the client,
  1992. the UAS examines the body of the message, and the header fields that
  1993. describe it. If there are any bodies whose type (indicated by the
  1994. Content-Type), language (indicated by the Content-Language) or
  1995. encoding (indicated by the Content-Encoding) are not understood, and
  1996. that body part is not optional (as indicated by the Content-
  1997. Disposition header field), the UAS MUST reject the request with a 415
  1998. (Unsupported Media Type) response. The response MUST contain an
  1999. Accept header field listing the types of all bodies it understands,
  2000. in the event the request contained bodies of types not supported by
  2001. the UAS. If the request contained content encodings not understood
  2002. by the UAS, the response MUST contain an Accept-Encoding header field
  2003. listing the encodings understood by the UAS. If the request
  2004. contained content with languages not understood by the UAS, the
  2005. response MUST contain an Accept-Language header field indicating the
  2006. languages understood by the UAS. Beyond these checks, body handling
  2007. depends on the method and type. For further information on the
  2008. processing of content-specific header fields, see Section 7.4 as well
  2009. as Section 20.11 through 20.15.
  2010. Rosenberg, et. al. Standards Track [Page 48]
  2011. RFC 3261 SIP: Session Initiation Protocol June 2002
  2012. 8.2.4 Applying Extensions
  2013. A UAS that wishes to apply some extension when generating the
  2014. response MUST NOT do so unless support for that extension is
  2015. indicated in the Supported header field in the request. If the
  2016. desired extension is not supported, the server SHOULD rely only on
  2017. baseline SIP and any other extensions supported by the client. In
  2018. rare circumstances, where the server cannot process the request
  2019. without the extension, the server MAY send a 421 (Extension Required)
  2020. response. This response indicates that the proper response cannot be
  2021. generated without support of a specific extension. The needed
  2022. extension(s) MUST be included in a Require header field in the
  2023. response. This behavior is NOT RECOMMENDED, as it will generally
  2024. break interoperability.
  2025. Any extensions applied to a non-421 response MUST be listed in a
  2026. Require header field included in the response. Of course, the server
  2027. MUST NOT apply extensions not listed in the Supported header field in
  2028. the request. As a result of this, the Require header field in a
  2029. response will only ever contain option tags defined in standards-
  2030. track RFCs.
  2031. 8.2.5 Processing the Request
  2032. Assuming all of the checks in the previous subsections are passed,
  2033. the UAS processing becomes method-specific. Section 10 covers the
  2034. REGISTER request, Section 11 covers the OPTIONS request, Section 13
  2035. covers the INVITE request, and Section 15 covers the BYE request.
  2036. 8.2.6 Generating the Response
  2037. When a UAS wishes to construct a response to a request, it follows
  2038. the general procedures detailed in the following subsections.
  2039. Additional behaviors specific to the response code in question, which
  2040. are not detailed in this section, may also be required.
  2041. Once all procedures associated with the creation of a response have
  2042. been completed, the UAS hands the response back to the server
  2043. transaction from which it received the request.
  2044. 8.2.6.1 Sending a Provisional Response
  2045. One largely non-method-specific guideline for the generation of
  2046. responses is that UASs SHOULD NOT issue a provisional response for a
  2047. non-INVITE request. Rather, UASs SHOULD generate a final response to
  2048. a non-INVITE request as soon as possible.
  2049. Rosenberg, et. al. Standards Track [Page 49]
  2050. RFC 3261 SIP: Session Initiation Protocol June 2002
  2051. When a 100 (Trying) response is generated, any Timestamp header field
  2052. present in the request MUST be copied into this 100 (Trying)
  2053. response. If there is a delay in generating the response, the UAS
  2054. SHOULD add a delay value into the Timestamp value in the response.
  2055. This value MUST contain the difference between the time of sending of
  2056. the response and receipt of the request, measured in seconds.
  2057. 8.2.6.2 Headers and Tags
  2058. The From field of the response MUST equal the From header field of
  2059. the request. The Call-ID header field of the response MUST equal the
  2060. Call-ID header field of the request. The CSeq header field of the
  2061. response MUST equal the CSeq field of the request. The Via header
  2062. field values in the response MUST equal the Via header field values
  2063. in the request and MUST maintain the same ordering.
  2064. If a request contained a To tag in the request, the To header field
  2065. in the response MUST equal that of the request. However, if the To
  2066. header field in the request did not contain a tag, the URI in the To
  2067. header field in the response MUST equal the URI in the To header
  2068. field; additionally, the UAS MUST add a tag to the To header field in
  2069. the response (with the exception of the 100 (Trying) response, in
  2070. which a tag MAY be present). This serves to identify the UAS that is
  2071. responding, possibly resulting in a component of a dialog ID. The
  2072. same tag MUST be used for all responses to that request, both final
  2073. and provisional (again excepting the 100 (Trying)). Procedures for
  2074. the generation of tags are defined in Section 19.3.
  2075. 8.2.7 Stateless UAS Behavior
  2076. A stateless UAS is a UAS that does not maintain transaction state.
  2077. It replies to requests normally, but discards any state that would
  2078. ordinarily be retained by a UAS after a response has been sent. If a
  2079. stateless UAS receives a retransmission of a request, it regenerates
  2080. the response and resends it, just as if it were replying to the first
  2081. instance of the request. A UAS cannot be stateless unless the request
  2082. processing for that method would always result in the same response
  2083. if the requests are identical. This rules out stateless registrars,
  2084. for example. Stateless UASs do not use a transaction layer; they
  2085. receive requests directly from the transport layer and send responses
  2086. directly to the transport layer.
  2087. The stateless UAS role is needed primarily to handle unauthenticated
  2088. requests for which a challenge response is issued. If
  2089. unauthenticated requests were handled statefully, then malicious
  2090. floods of unauthenticated requests could create massive amounts of
  2091. Rosenberg, et. al. Standards Track [Page 50]
  2092. RFC 3261 SIP: Session Initiation Protocol June 2002
  2093. transaction state that might slow or completely halt call processing
  2094. in a UAS, effectively creating a denial of service condition; for
  2095. more information see Section 26.1.5.
  2096. The most important behaviors of a stateless UAS are the following:
  2097. o A stateless UAS MUST NOT send provisional (1xx) responses.
  2098. o A stateless UAS MUST NOT retransmit responses.
  2099. o A stateless UAS MUST ignore ACK requests.
  2100. o A stateless UAS MUST ignore CANCEL requests.
  2101. o To header tags MUST be generated for responses in a stateless
  2102. manner - in a manner that will generate the same tag for the
  2103. same request consistently. For information on tag construction
  2104. see Section 19.3.
  2105. In all other respects, a stateless UAS behaves in the same manner as
  2106. a stateful UAS. A UAS can operate in either a stateful or stateless
  2107. mode for each new request.
  2108. 8.3 Redirect Servers
  2109. In some architectures it may be desirable to reduce the processing
  2110. load on proxy servers that are responsible for routing requests, and
  2111. improve signaling path robustness, by relying on redirection.
  2112. Redirection allows servers to push routing information for a request
  2113. back in a response to the client, thereby taking themselves out of
  2114. the loop of further messaging for this transaction while still aiding
  2115. in locating the target of the request. When the originator of the
  2116. request receives the redirection, it will send a new request based on
  2117. the URI(s) it has received. By propagating URIs from the core of the
  2118. network to its edges, redirection allows for considerable network
  2119. scalability.
  2120. A redirect server is logically constituted of a server transaction
  2121. layer and a transaction user that has access to a location service of
  2122. some kind (see Section 10 for more on registrars and location
  2123. services). This location service is effectively a database
  2124. containing mappings between a single URI and a set of one or more
  2125. alternative locations at which the target of that URI can be found.
  2126. A redirect server does not issue any SIP requests of its own. After
  2127. receiving a request other than CANCEL, the server either refuses the
  2128. request or gathers the list of alternative locations from the
  2129. Rosenberg, et. al. Standards Track [Page 51]
  2130. RFC 3261 SIP: Session Initiation Protocol June 2002
  2131. location service and returns a final response of class 3xx. For
  2132. well-formed CANCEL requests, it SHOULD return a 2xx response. This
  2133. response ends the SIP transaction. The redirect server maintains
  2134. transaction state for an entire SIP transaction. It is the
  2135. responsibility of clients to detect forwarding loops between redirect
  2136. servers.
  2137. When a redirect server returns a 3xx response to a request, it
  2138. populates the list of (one or more) alternative locations into the
  2139. Contact header field. An "expires" parameter to the Contact header
  2140. field values may also be supplied to indicate the lifetime of the
  2141. Contact data.
  2142. The Contact header field contains URIs giving the new locations or
  2143. user names to try, or may simply specify additional transport
  2144. parameters. A 301 (Moved Permanently) or 302 (Moved Temporarily)
  2145. response may also give the same location and username that was
  2146. targeted by the initial request but specify additional transport
  2147. parameters such as a different server or multicast address to try, or
  2148. a change of SIP transport from UDP to TCP or vice versa.
  2149. However, redirect servers MUST NOT redirect a request to a URI equal
  2150. to the one in the Request-URI; instead, provided that the URI does
  2151. not point to itself, the server MAY proxy the request to the
  2152. destination URI, or MAY reject it with a 404.
  2153. If a client is using an outbound proxy, and that proxy actually
  2154. redirects requests, a potential arises for infinite redirection
  2155. loops.
  2156. Note that a Contact header field value MAY also refer to a different
  2157. resource than the one originally called. For example, a SIP call
  2158. connected to PSTN gateway may need to deliver a special informational
  2159. announcement such as "The number you have dialed has been changed."
  2160. A Contact response header field can contain any suitable URI
  2161. indicating where the called party can be reached, not limited to SIP
  2162. URIs. For example, it could contain URIs for phones, fax, or irc (if
  2163. they were defined) or a mailto: (RFC 2368 [32]) URL. Section 26.4.4
  2164. discusses implications and limitations of redirecting a SIPS URI to a
  2165. non-SIPS URI.
  2166. The "expires" parameter of a Contact header field value indicates how
  2167. long the URI is valid. The value of the parameter is a number
  2168. indicating seconds. If this parameter is not provided, the value of
  2169. the Expires header field determines how long the URI is valid.
  2170. Malformed values SHOULD be treated as equivalent to 3600.
  2171. Rosenberg, et. al. Standards Track [Page 52]
  2172. RFC 3261 SIP: Session Initiation Protocol June 2002
  2173. This provides a modest level of backwards compatibility with RFC
  2174. 2543, which allowed absolute times in this header field. If an
  2175. absolute time is received, it will be treated as malformed, and
  2176. then default to 3600.
  2177. Redirect servers MUST ignore features that are not understood
  2178. (including unrecognized header fields, any unknown option tags in
  2179. Require, or even method names) and proceed with the redirection of
  2180. the request in question.
  2181. 9 Canceling a Request
  2182. The previous section has discussed general UA behavior for generating
  2183. requests and processing responses for requests of all methods. In
  2184. this section, we discuss a general purpose method, called CANCEL.
  2185. The CANCEL request, as the name implies, is used to cancel a previous
  2186. request sent by a client. Specifically, it asks the UAS to cease
  2187. processing the request and to generate an error response to that
  2188. request. CANCEL has no effect on a request to which a UAS has
  2189. already given a final response. Because of this, it is most useful
  2190. to CANCEL requests to which it can take a server long time to
  2191. respond. For this reason, CANCEL is best for INVITE requests, which
  2192. can take a long time to generate a response. In that usage, a UAS
  2193. that receives a CANCEL request for an INVITE, but has not yet sent a
  2194. final response, would "stop ringing", and then respond to the INVITE
  2195. with a specific error response (a 487).
  2196. CANCEL requests can be constructed and sent by both proxies and user
  2197. agent clients. Section 15 discusses under what conditions a UAC
  2198. would CANCEL an INVITE request, and Section 16.10 discusses proxy
  2199. usage of CANCEL.
  2200. A stateful proxy responds to a CANCEL, rather than simply forwarding
  2201. a response it would receive from a downstream element. For that
  2202. reason, CANCEL is referred to as a "hop-by-hop" request, since it is
  2203. responded to at each stateful proxy hop.
  2204. 9.1 Client Behavior
  2205. A CANCEL request SHOULD NOT be sent to cancel a request other than
  2206. INVITE.
  2207. Since requests other than INVITE are responded to immediately,
  2208. sending a CANCEL for a non-INVITE request would always create a
  2209. race condition.
  2210. Rosenberg, et. al. Standards Track [Page 53]
  2211. RFC 3261 SIP: Session Initiation Protocol June 2002
  2212. The following procedures are used to construct a CANCEL request. The
  2213. Request-URI, Call-ID, To, the numeric part of CSeq, and From header
  2214. fields in the CANCEL request MUST be identical to those in the
  2215. request being cancelled, including tags. A CANCEL constructed by a
  2216. client MUST have only a single Via header field value matching the
  2217. top Via value in the request being cancelled. Using the same values
  2218. for these header fields allows the CANCEL to be matched with the
  2219. request it cancels (Section 9.2 indicates how such matching occurs).
  2220. However, the method part of the CSeq header field MUST have a value
  2221. of CANCEL. This allows it to be identified and processed as a
  2222. transaction in its own right (See Section 17).
  2223. If the request being cancelled contains a Route header field, the
  2224. CANCEL request MUST include that Route header field's values.
  2225. This is needed so that stateless proxies are able to route CANCEL
  2226. requests properly.
  2227. The CANCEL request MUST NOT contain any Require or Proxy-Require
  2228. header fields.
  2229. Once the CANCEL is constructed, the client SHOULD check whether it
  2230. has received any response (provisional or final) for the request
  2231. being cancelled (herein referred to as the "original request").
  2232. If no provisional response has been received, the CANCEL request MUST
  2233. NOT be sent; rather, the client MUST wait for the arrival of a
  2234. provisional response before sending the request. If the original
  2235. request has generated a final response, the CANCEL SHOULD NOT be
  2236. sent, as it is an effective no-op, since CANCEL has no effect on
  2237. requests that have already generated a final response. When the
  2238. client decides to send the CANCEL, it creates a client transaction
  2239. for the CANCEL and passes it the CANCEL request along with the
  2240. destination address, port, and transport. The destination address,
  2241. port, and transport for the CANCEL MUST be identical to those used to
  2242. send the original request.
  2243. If it was allowed to send the CANCEL before receiving a response
  2244. for the previous request, the server could receive the CANCEL
  2245. before the original request.
  2246. Note that both the transaction corresponding to the original request
  2247. and the CANCEL transaction will complete independently. However, a
  2248. UAC canceling a request cannot rely on receiving a 487 (Request
  2249. Terminated) response for the original request, as an RFC 2543-
  2250. compliant UAS will not generate such a response. If there is no
  2251. final response for the original request in 64*T1 seconds (T1 is
  2252. Rosenberg, et. al. Standards Track [Page 54]
  2253. RFC 3261 SIP: Session Initiation Protocol June 2002
  2254. defined in Section 17.1.1.1), the client SHOULD then consider the
  2255. original transaction cancelled and SHOULD destroy the client
  2256. transaction handling the original request.
  2257. 9.2 Server Behavior
  2258. The CANCEL method requests that the TU at the server side cancel a
  2259. pending transaction. The TU determines the transaction to be
  2260. cancelled by taking the CANCEL request, and then assuming that the
  2261. request method is anything but CANCEL or ACK and applying the
  2262. transaction matching procedures of Section 17.2.3. The matching
  2263. transaction is the one to be cancelled.
  2264. The processing of a CANCEL request at a server depends on the type of
  2265. server. A stateless proxy will forward it, a stateful proxy might
  2266. respond to it and generate some CANCEL requests of its own, and a UAS
  2267. will respond to it. See Section 16.10 for proxy treatment of CANCEL.
  2268. A UAS first processes the CANCEL request according to the general UAS
  2269. processing described in Section 8.2. However, since CANCEL requests
  2270. are hop-by-hop and cannot be resubmitted, they cannot be challenged
  2271. by the server in order to get proper credentials in an Authorization
  2272. header field. Note also that CANCEL requests do not contain a
  2273. Require header field.
  2274. If the UAS did not find a matching transaction for the CANCEL
  2275. according to the procedure above, it SHOULD respond to the CANCEL
  2276. with a 481 (Call Leg/Transaction Does Not Exist). If the transaction
  2277. for the original request still exists, the behavior of the UAS on
  2278. receiving a CANCEL request depends on whether it has already sent a
  2279. final response for the original request. If it has, the CANCEL
  2280. request has no effect on the processing of the original request, no
  2281. effect on any session state, and no effect on the responses generated
  2282. for the original request. If the UAS has not issued a final response
  2283. for the original request, its behavior depends on the method of the
  2284. original request. If the original request was an INVITE, the UAS
  2285. SHOULD immediately respond to the INVITE with a 487 (Request
  2286. Terminated). A CANCEL request has no impact on the processing of
  2287. transactions with any other method defined in this specification.
  2288. Regardless of the method of the original request, as long as the
  2289. CANCEL matched an existing transaction, the UAS answers the CANCEL
  2290. request itself with a 200 (OK) response. This response is
  2291. constructed following the procedures described in Section 8.2.6
  2292. noting that the To tag of the response to the CANCEL and the To tag
  2293. in the response to the original request SHOULD be the same. The
  2294. response to CANCEL is passed to the server transaction for
  2295. transmission.
  2296. Rosenberg, et. al. Standards Track [Page 55]
  2297. RFC 3261 SIP: Session Initiation Protocol June 2002
  2298. 10 Registrations
  2299. 10.1 Overview
  2300. SIP offers a discovery capability. If a user wants to initiate a
  2301. session with another user, SIP must discover the current host(s) at
  2302. which the destination user is reachable. This discovery process is
  2303. frequently accomplished by SIP network elements such as proxy servers
  2304. and redirect servers which are responsible for receiving a request,
  2305. determining where to send it based on knowledge of the location of
  2306. the user, and then sending it there. To do this, SIP network
  2307. elements consult an abstract service known as a location service,
  2308. which provides address bindings for a particular domain. These
  2309. address bindings map an incoming SIP or SIPS URI, sip:bob@biloxi.com,
  2310. for example, to one or more URIs that are somehow "closer" to the
  2311. desired user, sip:bob@engineering.biloxi.com, for example.
  2312. Ultimately, a proxy will consult a location service that maps a
  2313. received URI to the user agent(s) at which the desired recipient is
  2314. currently residing.
  2315. Registration creates bindings in a location service for a particular
  2316. domain that associates an address-of-record URI with one or more
  2317. contact addresses. Thus, when a proxy for that domain receives a
  2318. request whose Request-URI matches the address-of-record, the proxy
  2319. will forward the request to the contact addresses registered to that
  2320. address-of-record. Generally, it only makes sense to register an
  2321. address-of-record at a domain's location service when requests for
  2322. that address-of-record would be routed to that domain. In most
  2323. cases, this means that the domain of the registration will need to
  2324. match the domain in the URI of the address-of-record.
  2325. There are many ways by which the contents of the location service can
  2326. be established. One way is administratively. In the above example,
  2327. Bob is known to be a member of the engineering department through
  2328. access to a corporate database. However, SIP provides a mechanism
  2329. for a UA to create a binding explicitly. This mechanism is known as
  2330. registration.
  2331. Registration entails sending a REGISTER request to a special type of
  2332. UAS known as a registrar. A registrar acts as the front end to the
  2333. location service for a domain, reading and writing mappings based on
  2334. the contents of REGISTER requests. This location service is then
  2335. typically consulted by a proxy server that is responsible for routing
  2336. requests for that domain.
  2337. An illustration of the overall registration process is given in
  2338. Figure 2. Note that the registrar and proxy server are logical roles
  2339. that can be played by a single device in a network; for purposes of
  2340. Rosenberg, et. al. Standards Track [Page 56]
  2341. RFC 3261 SIP: Session Initiation Protocol June 2002
  2342. clarity the two are separated in this illustration. Also note that
  2343. UAs may send requests through a proxy server in order to reach a
  2344. registrar if the two are separate elements.
  2345. SIP does not mandate a particular mechanism for implementing the
  2346. location service. The only requirement is that a registrar for some
  2347. domain MUST be able to read and write data to the location service,
  2348. and a proxy or a redirect server for that domain MUST be capable of
  2349. reading that same data. A registrar MAY be co-located with a
  2350. particular SIP proxy server for the same domain.
  2351. 10.2 Constructing the REGISTER Request
  2352. REGISTER requests add, remove, and query bindings. A REGISTER
  2353. request can add a new binding between an address-of-record and one or
  2354. more contact addresses. Registration on behalf of a particular
  2355. address-of-record can be performed by a suitably authorized third
  2356. party. A client can also remove previous bindings or query to
  2357. determine which bindings are currently in place for an address-of-
  2358. record.
  2359. Except as noted, the construction of the REGISTER request and the
  2360. behavior of clients sending a REGISTER request is identical to the
  2361. general UAC behavior described in Section 8.1 and Section 17.1.
  2362. A REGISTER request does not establish a dialog. A UAC MAY include a
  2363. Route header field in a REGISTER request based on a pre-existing
  2364. route set as described in Section 8.1. The Record-Route header field
  2365. has no meaning in REGISTER requests or responses, and MUST be ignored
  2366. if present. In particular, the UAC MUST NOT create a new route set
  2367. based on the presence or absence of a Record-Route header field in
  2368. any response to a REGISTER request.
  2369. The following header fields, except Contact, MUST be included in a
  2370. REGISTER request. A Contact header field MAY be included:
  2371. Request-URI: The Request-URI names the domain of the location
  2372. service for which the registration is meant (for example,
  2373. "sip:chicago.com"). The "userinfo" and "@" components of the
  2374. SIP URI MUST NOT be present.
  2375. To: The To header field contains the address of record whose
  2376. registration is to be created, queried, or modified. The To
  2377. header field and the Request-URI field typically differ, as
  2378. the former contains a user name. This address-of-record MUST
  2379. be a SIP URI or SIPS URI.
  2380. Rosenberg, et. al. Standards Track [Page 57]
  2381. RFC 3261 SIP: Session Initiation Protocol June 2002
  2382. From: The From header field contains the address-of-record of the
  2383. person responsible for the registration. The value is the
  2384. same as the To header field unless the request is a third-
  2385. party registration.
  2386. Call-ID: All registrations from a UAC SHOULD use the same Call-ID
  2387. header field value for registrations sent to a particular
  2388. registrar.
  2389. If the same client were to use different Call-ID values, a
  2390. registrar could not detect whether a delayed REGISTER request
  2391. might have arrived out of order.
  2392. CSeq: The CSeq value guarantees proper ordering of REGISTER
  2393. requests. A UA MUST increment the CSeq value by one for each
  2394. REGISTER request with the same Call-ID.
  2395. Contact: REGISTER requests MAY contain a Contact header field with
  2396. zero or more values containing address bindings.
  2397. UAs MUST NOT send a new registration (that is, containing new Contact
  2398. header field values, as opposed to a retransmission) until they have
  2399. received a final response from the registrar for the previous one or
  2400. the previous REGISTER request has timed out.
  2401. Rosenberg, et. al. Standards Track [Page 58]
  2402. RFC 3261 SIP: Session Initiation Protocol June 2002
  2403. bob
  2404. +----+
  2405. | UA |
  2406. | |
  2407. +----+
  2408. |
  2409. |3)INVITE
  2410. | carol@chicago.com
  2411. chicago.com +--------+ V
  2412. +---------+ 2)Store|Location|4)Query +-----+
  2413. |Registrar|=======>| Service|<=======|Proxy|sip.chicago.com
  2414. +---------+ +--------+=======>+-----+
  2415. A 5)Resp |
  2416. | |
  2417. | |
  2418. 1)REGISTER| |
  2419. | |
  2420. +----+ |
  2421. | UA |<-------------------------------+
  2422. cube2214a| | 6)INVITE
  2423. +----+ carol@cube2214a.chicago.com
  2424. carol
  2425. Figure 2: REGISTER example
  2426. The following Contact header parameters have a special meaning in
  2427. REGISTER requests:
  2428. action: The "action" parameter from RFC 2543 has been deprecated.
  2429. UACs SHOULD NOT use the "action" parameter.
  2430. expires: The "expires" parameter indicates how long the UA would
  2431. like the binding to be valid. The value is a number
  2432. indicating seconds. If this parameter is not provided, the
  2433. value of the Expires header field is used instead.
  2434. Implementations MAY treat values larger than 2**32-1
  2435. (4294967295 seconds or 136 years) as equivalent to 2**32-1.
  2436. Malformed values SHOULD be treated as equivalent to 3600.
  2437. 10.2.1 Adding Bindings
  2438. The REGISTER request sent to a registrar includes the contact
  2439. address(es) to which SIP requests for the address-of-record should be
  2440. forwarded. The address-of-record is included in the To header field
  2441. of the REGISTER request.
  2442. Rosenberg, et. al. Standards Track [Page 59]
  2443. RFC 3261 SIP: Session Initiation Protocol June 2002
  2444. The Contact header field values of the request typically consist of
  2445. SIP or SIPS URIs that identify particular SIP endpoints (for example,
  2446. "sip:carol@cube2214a.chicago.com"), but they MAY use any URI scheme.
  2447. A SIP UA can choose to register telephone numbers (with the tel URL,
  2448. RFC 2806 [9]) or email addresses (with a mailto URL, RFC 2368 [32])
  2449. as Contacts for an address-of-record, for example.
  2450. For example, Carol, with address-of-record "sip:carol@chicago.com",
  2451. would register with the SIP registrar of the domain chicago.com. Her
  2452. registrations would then be used by a proxy server in the chicago.com
  2453. domain to route requests for Carol's address-of-record to her SIP
  2454. endpoint.
  2455. Once a client has established bindings at a registrar, it MAY send
  2456. subsequent registrations containing new bindings or modifications to
  2457. existing bindings as necessary. The 2xx response to the REGISTER
  2458. request will contain, in a Contact header field, a complete list of
  2459. bindings that have been registered for this address-of-record at this
  2460. registrar.
  2461. If the address-of-record in the To header field of a REGISTER request
  2462. is a SIPS URI, then any Contact header field values in the request
  2463. SHOULD also be SIPS URIs. Clients should only register non-SIPS URIs
  2464. under a SIPS address-of-record when the security of the resource
  2465. represented by the contact address is guaranteed by other means.
  2466. This may be applicable to URIs that invoke protocols other than SIP,
  2467. or SIP devices secured by protocols other than TLS.
  2468. Registrations do not need to update all bindings. Typically, a UA
  2469. only updates its own contact addresses.
  2470. 10.2.1.1 Setting the Expiration Interval of Contact Addresses
  2471. When a client sends a REGISTER request, it MAY suggest an expiration
  2472. interval that indicates how long the client would like the
  2473. registration to be valid. (As described in Section 10.3, the
  2474. registrar selects the actual time interval based on its local
  2475. policy.)
  2476. There are two ways in which a client can suggest an expiration
  2477. interval for a binding: through an Expires header field or an
  2478. "expires" Contact header parameter. The latter allows expiration
  2479. intervals to be suggested on a per-binding basis when more than one
  2480. binding is given in a single REGISTER request, whereas the former
  2481. suggests an expiration interval for all Contact header field values
  2482. that do not contain the "expires" parameter.
  2483. Rosenberg, et. al. Standards Track [Page 60]
  2484. RFC 3261 SIP: Session Initiation Protocol June 2002
  2485. If neither mechanism for expressing a suggested expiration time is
  2486. present in a REGISTER, the client is indicating its desire for the
  2487. server to choose.
  2488. 10.2.1.2 Preferences among Contact Addresses
  2489. If more than one Contact is sent in a REGISTER request, the
  2490. registering UA intends to associate all of the URIs in these Contact
  2491. header field values with the address-of-record present in the To
  2492. field. This list can be prioritized with the "q" parameter in the
  2493. Contact header field. The "q" parameter indicates a relative
  2494. preference for the particular Contact header field value compared to
  2495. other bindings for this address-of-record. Section 16.6 describes
  2496. how a proxy server uses this preference indication.
  2497. 10.2.2 Removing Bindings
  2498. Registrations are soft state and expire unless refreshed, but can
  2499. also be explicitly removed. A client can attempt to influence the
  2500. expiration interval selected by the registrar as described in Section
  2501. 10.2.1. A UA requests the immediate removal of a binding by
  2502. specifying an expiration interval of "0" for that contact address in
  2503. a REGISTER request. UAs SHOULD support this mechanism so that
  2504. bindings can be removed before their expiration interval has passed.
  2505. The REGISTER-specific Contact header field value of "*" applies to
  2506. all registrations, but it MUST NOT be used unless the Expires header
  2507. field is present with a value of "0".
  2508. Use of the "*" Contact header field value allows a registering UA
  2509. to remove all bindings associated with an address-of-record
  2510. without knowing their precise values.
  2511. 10.2.3 Fetching Bindings
  2512. A success response to any REGISTER request contains the complete list
  2513. of existing bindings, regardless of whether the request contained a
  2514. Contact header field. If no Contact header field is present in a
  2515. REGISTER request, the list of bindings is left unchanged.
  2516. 10.2.4 Refreshing Bindings
  2517. Each UA is responsible for refreshing the bindings that it has
  2518. previously established. A UA SHOULD NOT refresh bindings set up by
  2519. other UAs.
  2520. Rosenberg, et. al. Standards Track [Page 61]
  2521. RFC 3261 SIP: Session Initiation Protocol June 2002
  2522. The 200 (OK) response from the registrar contains a list of Contact
  2523. fields enumerating all current bindings. The UA compares each
  2524. contact address to see if it created the contact address, using
  2525. comparison rules in Section 19.1.4. If so, it updates the expiration
  2526. time interval according to the expires parameter or, if absent, the
  2527. Expires field value. The UA then issues a REGISTER request for each
  2528. of its bindings before the expiration interval has elapsed. It MAY
  2529. combine several updates into one REGISTER request.
  2530. A UA SHOULD use the same Call-ID for all registrations during a
  2531. single boot cycle. Registration refreshes SHOULD be sent to the same
  2532. network address as the original registration, unless redirected.
  2533. 10.2.5 Setting the Internal Clock
  2534. If the response for a REGISTER request contains a Date header field,
  2535. the client MAY use this header field to learn the current time in
  2536. order to set any internal clocks.
  2537. 10.2.6 Discovering a Registrar
  2538. UAs can use three ways to determine the address to which to send
  2539. registrations: by configuration, using the address-of-record, and
  2540. multicast. A UA can be configured, in ways beyond the scope of this
  2541. specification, with a registrar address. If there is no configured
  2542. registrar address, the UA SHOULD use the host part of the address-
  2543. of-record as the Request-URI and address the request there, using the
  2544. normal SIP server location mechanisms [4]. For example, the UA for
  2545. the user "sip:carol@chicago.com" addresses the REGISTER request to
  2546. "sip:chicago.com".
  2547. Finally, a UA can be configured to use multicast. Multicast
  2548. registrations are addressed to the well-known "all SIP servers"
  2549. multicast address "sip.mcast.net" (224.0.1.75 for IPv4). No well-
  2550. known IPv6 multicast address has been allocated; such an allocation
  2551. will be documented separately when needed. SIP UAs MAY listen to
  2552. that address and use it to become aware of the location of other
  2553. local users (see [33]); however, they do not respond to the request.
  2554. Multicast registration may be inappropriate in some environments,
  2555. for example, if multiple businesses share the same local area
  2556. network.
  2557. 10.2.7 Transmitting a Request
  2558. Once the REGISTER method has been constructed, and the destination of
  2559. the message identified, UACs follow the procedures described in
  2560. Section 8.1.2 to hand off the REGISTER to the transaction layer.
  2561. Rosenberg, et. al. Standards Track [Page 62]
  2562. RFC 3261 SIP: Session Initiation Protocol June 2002
  2563. If the transaction layer returns a timeout error because the REGISTER
  2564. yielded no response, the UAC SHOULD NOT immediately re-attempt a
  2565. registration to the same registrar.
  2566. An immediate re-attempt is likely to also timeout. Waiting some
  2567. reasonable time interval for the conditions causing the timeout to
  2568. be corrected reduces unnecessary load on the network. No specific
  2569. interval is mandated.
  2570. 10.2.8 Error Responses
  2571. If a UA receives a 423 (Interval Too Brief) response, it MAY retry
  2572. the registration after making the expiration interval of all contact
  2573. addresses in the REGISTER request equal to or greater than the
  2574. expiration interval within the Min-Expires header field of the 423
  2575. (Interval Too Brief) response.
  2576. 10.3 Processing REGISTER Requests
  2577. A registrar is a UAS that responds to REGISTER requests and maintains
  2578. a list of bindings that are accessible to proxy servers and redirect
  2579. servers within its administrative domain. A registrar handles
  2580. requests according to Section 8.2 and Section 17.2, but it accepts
  2581. only REGISTER requests. A registrar MUST not generate 6xx responses.
  2582. A registrar MAY redirect REGISTER requests as appropriate. One
  2583. common usage would be for a registrar listening on a multicast
  2584. interface to redirect multicast REGISTER requests to its own unicast
  2585. interface with a 302 (Moved Temporarily) response.
  2586. Registrars MUST ignore the Record-Route header field if it is
  2587. included in a REGISTER request. Registrars MUST NOT include a
  2588. Record-Route header field in any response to a REGISTER request.
  2589. A registrar might receive a request that traversed a proxy which
  2590. treats REGISTER as an unknown request and which added a Record-
  2591. Route header field value.
  2592. A registrar has to know (for example, through configuration) the set
  2593. of domain(s) for which it maintains bindings. REGISTER requests MUST
  2594. be processed by a registrar in the order that they are received.
  2595. REGISTER requests MUST also be processed atomically, meaning that a
  2596. particular REGISTER request is either processed completely or not at
  2597. all. Each REGISTER message MUST be processed independently of any
  2598. other registration or binding changes.
  2599. Rosenberg, et. al. Standards Track [Page 63]
  2600. RFC 3261 SIP: Session Initiation Protocol June 2002
  2601. When receiving a REGISTER request, a registrar follows these steps:
  2602. 1. The registrar inspects the Request-URI to determine whether it
  2603. has access to bindings for the domain identified in the
  2604. Request-URI. If not, and if the server also acts as a proxy
  2605. server, the server SHOULD forward the request to the addressed
  2606. domain, following the general behavior for proxying messages
  2607. described in Section 16.
  2608. 2. To guarantee that the registrar supports any necessary
  2609. extensions, the registrar MUST process the Require header field
  2610. values as described for UASs in Section 8.2.2.
  2611. 3. A registrar SHOULD authenticate the UAC. Mechanisms for the
  2612. authentication of SIP user agents are described in Section 22.
  2613. Registration behavior in no way overrides the generic
  2614. authentication framework for SIP. If no authentication
  2615. mechanism is available, the registrar MAY take the From address
  2616. as the asserted identity of the originator of the request.
  2617. 4. The registrar SHOULD determine if the authenticated user is
  2618. authorized to modify registrations for this address-of-record.
  2619. For example, a registrar might consult an authorization
  2620. database that maps user names to a list of addresses-of-record
  2621. for which that user has authorization to modify bindings. If
  2622. the authenticated user is not authorized to modify bindings,
  2623. the registrar MUST return a 403 (Forbidden) and skip the
  2624. remaining steps.
  2625. In architectures that support third-party registration, one
  2626. entity may be responsible for updating the registrations
  2627. associated with multiple addresses-of-record.
  2628. 5. The registrar extracts the address-of-record from the To header
  2629. field of the request. If the address-of-record is not valid
  2630. for the domain in the Request-URI, the registrar MUST send a
  2631. 404 (Not Found) response and skip the remaining steps. The URI
  2632. MUST then be converted to a canonical form. To do that, all
  2633. URI parameters MUST be removed (including the user-param), and
  2634. any escaped characters MUST be converted to their unescaped
  2635. form. The result serves as an index into the list of bindings.
  2636. Rosenberg, et. al. Standards Track [Page 64]
  2637. RFC 3261 SIP: Session Initiation Protocol June 2002
  2638. 6. The registrar checks whether the request contains the Contact
  2639. header field. If not, it skips to the last step. If the
  2640. Contact header field is present, the registrar checks if there
  2641. is one Contact field value that contains the special value "*"
  2642. and an Expires field. If the request has additional Contact
  2643. fields or an expiration time other than zero, the request is
  2644. invalid, and the server MUST return a 400 (Invalid Request) and
  2645. skip the remaining steps. If not, the registrar checks whether
  2646. the Call-ID agrees with the value stored for each binding. If
  2647. not, it MUST remove the binding. If it does agree, it MUST
  2648. remove the binding only if the CSeq in the request is higher
  2649. than the value stored for that binding. Otherwise, the update
  2650. MUST be aborted and the request fails.
  2651. 7. The registrar now processes each contact address in the Contact
  2652. header field in turn. For each address, it determines the
  2653. expiration interval as follows:
  2654. - If the field value has an "expires" parameter, that value
  2655. MUST be taken as the requested expiration.
  2656. - If there is no such parameter, but the request has an
  2657. Expires header field, that value MUST be taken as the
  2658. requested expiration.
  2659. - If there is neither, a locally-configured default value MUST
  2660. be taken as the requested expiration.
  2661. The registrar MAY choose an expiration less than the requested
  2662. expiration interval. If and only if the requested expiration
  2663. interval is greater than zero AND smaller than one hour AND
  2664. less than a registrar-configured minimum, the registrar MAY
  2665. reject the registration with a response of 423 (Interval Too
  2666. Brief). This response MUST contain a Min-Expires header field
  2667. that states the minimum expiration interval the registrar is
  2668. willing to honor. It then skips the remaining steps.
  2669. Allowing the registrar to set the registration interval
  2670. protects it against excessively frequent registration refreshes
  2671. while limiting the state that it needs to maintain and
  2672. decreasing the likelihood of registrations going stale. The
  2673. expiration interval of a registration is frequently used in the
  2674. creation of services. An example is a follow-me service, where
  2675. the user may only be available at a terminal for a brief
  2676. period. Therefore, registrars should accept brief
  2677. registrations; a request should only be rejected if the
  2678. interval is so short that the refreshes would degrade registrar
  2679. performance.
  2680. Rosenberg, et. al. Standards Track [Page 65]
  2681. RFC 3261 SIP: Session Initiation Protocol June 2002
  2682. For each address, the registrar then searches the list of
  2683. current bindings using the URI comparison rules. If the
  2684. binding does not exist, it is tentatively added. If the
  2685. binding does exist, the registrar checks the Call-ID value. If
  2686. the Call-ID value in the existing binding differs from the
  2687. Call-ID value in the request, the binding MUST be removed if
  2688. the expiration time is zero and updated otherwise. If they are
  2689. the same, the registrar compares the CSeq value. If the value
  2690. is higher than that of the existing binding, it MUST update or
  2691. remove the binding as above. If not, the update MUST be
  2692. aborted and the request fails.
  2693. This algorithm ensures that out-of-order requests from the same
  2694. UA are ignored.
  2695. Each binding record records the Call-ID and CSeq values from
  2696. the request.
  2697. The binding updates MUST be committed (that is, made visible to
  2698. the proxy or redirect server) if and only if all binding
  2699. updates and additions succeed. If any one of them fails (for
  2700. example, because the back-end database commit failed), the
  2701. request MUST fail with a 500 (Server Error) response and all
  2702. tentative binding updates MUST be removed.
  2703. 8. The registrar returns a 200 (OK) response. The response MUST
  2704. contain Contact header field values enumerating all current
  2705. bindings. Each Contact value MUST feature an "expires"
  2706. parameter indicating its expiration interval chosen by the
  2707. registrar. The response SHOULD include a Date header field.
  2708. 11 Querying for Capabilities
  2709. The SIP method OPTIONS allows a UA to query another UA or a proxy
  2710. server as to its capabilities. This allows a client to discover
  2711. information about the supported methods, content types, extensions,
  2712. codecs, etc. without "ringing" the other party. For example, before
  2713. a client inserts a Require header field into an INVITE listing an
  2714. option that it is not certain the destination UAS supports, the
  2715. client can query the destination UAS with an OPTIONS to see if this
  2716. option is returned in a Supported header field. All UAs MUST support
  2717. the OPTIONS method.
  2718. The target of the OPTIONS request is identified by the Request-URI,
  2719. which could identify another UA or a SIP server. If the OPTIONS is
  2720. addressed to a proxy server, the Request-URI is set without a user
  2721. part, similar to the way a Request-URI is set for a REGISTER request.
  2722. Rosenberg, et. al. Standards Track [Page 66]
  2723. RFC 3261 SIP: Session Initiation Protocol June 2002
  2724. Alternatively, a server receiving an OPTIONS request with a Max-
  2725. Forwards header field value of 0 MAY respond to the request
  2726. regardless of the Request-URI.
  2727. This behavior is common with HTTP/1.1. This behavior can be used
  2728. as a "traceroute" functionality to check the capabilities of
  2729. individual hop servers by sending a series of OPTIONS requests
  2730. with incremented Max-Forwards values.
  2731. As is the case for general UA behavior, the transaction layer can
  2732. return a timeout error if the OPTIONS yields no response. This may
  2733. indicate that the target is unreachable and hence unavailable.
  2734. An OPTIONS request MAY be sent as part of an established dialog to
  2735. query the peer on capabilities that may be utilized later in the
  2736. dialog.
  2737. 11.1 Construction of OPTIONS Request
  2738. An OPTIONS request is constructed using the standard rules for a SIP
  2739. request as discussed in Section 8.1.1.
  2740. A Contact header field MAY be present in an OPTIONS.
  2741. An Accept header field SHOULD be included to indicate the type of
  2742. message body the UAC wishes to receive in the response. Typically,
  2743. this is set to a format that is used to describe the media
  2744. capabilities of a UA, such as SDP (application/sdp).
  2745. The response to an OPTIONS request is assumed to be scoped to the
  2746. Request-URI in the original request. However, only when an OPTIONS
  2747. is sent as part of an established dialog is it guaranteed that future
  2748. requests will be received by the server that generated the OPTIONS
  2749. response.
  2750. Example OPTIONS request:
  2751. OPTIONS sip:carol@chicago.com SIP/2.0
  2752. Via: SIP/2.0/UDP pc33.atlanta.com;branch=z9hG4bKhjhs8ass877
  2753. Max-Forwards: 70
  2754. To: <sip:carol@chicago.com>
  2755. From: Alice <sip:alice@atlanta.com>;tag=1928301774
  2756. Call-ID: a84b4c76e66710
  2757. CSeq: 63104 OPTIONS
  2758. Contact: <sip:alice@pc33.atlanta.com>
  2759. Accept: application/sdp
  2760. Content-Length: 0
  2761. Rosenberg, et. al. Standards Track [Page 67]
  2762. RFC 3261 SIP: Session Initiation Protocol June 2002
  2763. 11.2 Processing of OPTIONS Request
  2764. The response to an OPTIONS is constructed using the standard rules
  2765. for a SIP response as discussed in Section 8.2.6. The response code
  2766. chosen MUST be the same that would have been chosen had the request
  2767. been an INVITE. That is, a 200 (OK) would be returned if the UAS is
  2768. ready to accept a call, a 486 (Busy Here) would be returned if the
  2769. UAS is busy, etc. This allows an OPTIONS request to be used to
  2770. determine the basic state of a UAS, which can be an indication of
  2771. whether the UAS will accept an INVITE request.
  2772. An OPTIONS request received within a dialog generates a 200 (OK)
  2773. response that is identical to one constructed outside a dialog and
  2774. does not have any impact on the dialog.
  2775. This use of OPTIONS has limitations due to the differences in proxy
  2776. handling of OPTIONS and INVITE requests. While a forked INVITE can
  2777. result in multiple 200 (OK) responses being returned, a forked
  2778. OPTIONS will only result in a single 200 (OK) response, since it is
  2779. treated by proxies using the non-INVITE handling. See Section 16.7
  2780. for the normative details.
  2781. If the response to an OPTIONS is generated by a proxy server, the
  2782. proxy returns a 200 (OK), listing the capabilities of the server.
  2783. The response does not contain a message body.
  2784. Allow, Accept, Accept-Encoding, Accept-Language, and Supported header
  2785. fields SHOULD be present in a 200 (OK) response to an OPTIONS
  2786. request. If the response is generated by a proxy, the Allow header
  2787. field SHOULD be omitted as it is ambiguous since a proxy is method
  2788. agnostic. Contact header fields MAY be present in a 200 (OK)
  2789. response and have the same semantics as in a 3xx response. That is,
  2790. they may list a set of alternative names and methods of reaching the
  2791. user. A Warning header field MAY be present.
  2792. A message body MAY be sent, the type of which is determined by the
  2793. Accept header field in the OPTIONS request (application/sdp is the
  2794. default if the Accept header field is not present). If the types
  2795. include one that can describe media capabilities, the UAS SHOULD
  2796. include a body in the response for that purpose. Details on the
  2797. construction of such a body in the case of application/sdp are
  2798. described in [13].
  2799. Rosenberg, et. al. Standards Track [Page 68]
  2800. RFC 3261 SIP: Session Initiation Protocol June 2002
  2801. Example OPTIONS response generated by a UAS (corresponding to the
  2802. request in Section 11.1):
  2803. SIP/2.0 200 OK
  2804. Via: SIP/2.0/UDP pc33.atlanta.com;branch=z9hG4bKhjhs8ass877
  2805. ;received=192.0.2.4
  2806. To: <sip:carol@chicago.com>;tag=93810874
  2807. From: Alice <sip:alice@atlanta.com>;tag=1928301774
  2808. Call-ID: a84b4c76e66710
  2809. CSeq: 63104 OPTIONS
  2810. Contact: <sip:carol@chicago.com>
  2811. Contact: <mailto:carol@chicago.com>
  2812. Allow: INVITE, ACK, CANCEL, OPTIONS, BYE
  2813. Accept: application/sdp
  2814. Accept-Encoding: gzip
  2815. Accept-Language: en
  2816. Supported: foo
  2817. Content-Type: application/sdp
  2818. Content-Length: 274
  2819. (SDP not shown)
  2820. 12 Dialogs
  2821. A key concept for a user agent is that of a dialog. A dialog
  2822. represents a peer-to-peer SIP relationship between two user agents
  2823. that persists for some time. The dialog facilitates sequencing of
  2824. messages between the user agents and proper routing of requests
  2825. between both of them. The dialog represents a context in which to
  2826. interpret SIP messages. Section 8 discussed method independent UA
  2827. processing for requests and responses outside of a dialog. This
  2828. section discusses how those requests and responses are used to
  2829. construct a dialog, and then how subsequent requests and responses
  2830. are sent within a dialog.
  2831. A dialog is identified at each UA with a dialog ID, which consists of
  2832. a Call-ID value, a local tag and a remote tag. The dialog ID at each
  2833. UA involved in the dialog is not the same. Specifically, the local
  2834. tag at one UA is identical to the remote tag at the peer UA. The
  2835. tags are opaque tokens that facilitate the generation of unique
  2836. dialog IDs.
  2837. A dialog ID is also associated with all responses and with any
  2838. request that contains a tag in the To field. The rules for computing
  2839. the dialog ID of a message depend on whether the SIP element is a UAC
  2840. or UAS. For a UAC, the Call-ID value of the dialog ID is set to the
  2841. Call-ID of the message, the remote tag is set to the tag in the To
  2842. field of the message, and the local tag is set to the tag in the From
  2843. Rosenberg, et. al. Standards Track [Page 69]
  2844. RFC 3261 SIP: Session Initiation Protocol June 2002
  2845. field of the message (these rules apply to both requests and
  2846. responses). As one would expect for a UAS, the Call-ID value of the
  2847. dialog ID is set to the Call-ID of the message, the remote tag is set
  2848. to the tag in the From field of the message, and the local tag is set
  2849. to the tag in the To field of the message.
  2850. A dialog contains certain pieces of state needed for further message
  2851. transmissions within the dialog. This state consists of the dialog
  2852. ID, a local sequence number (used to order requests from the UA to
  2853. its peer), a remote sequence number (used to order requests from its
  2854. peer to the UA), a local URI, a remote URI, remote target, a boolean
  2855. flag called "secure", and a route set, which is an ordered list of
  2856. URIs. The route set is the list of servers that need to be traversed
  2857. to send a request to the peer. A dialog can also be in the "early"
  2858. state, which occurs when it is created with a provisional response,
  2859. and then transition to the "confirmed" state when a 2xx final
  2860. response arrives. For other responses, or if no response arrives at
  2861. all on that dialog, the early dialog terminates.
  2862. 12.1 Creation of a Dialog
  2863. Dialogs are created through the generation of non-failure responses
  2864. to requests with specific methods. Within this specification, only
  2865. 2xx and 101-199 responses with a To tag, where the request was
  2866. INVITE, will establish a dialog. A dialog established by a non-final
  2867. response to a request is in the "early" state and it is called an
  2868. early dialog. Extensions MAY define other means for creating
  2869. dialogs. Section 13 gives more details that are specific to the
  2870. INVITE method. Here, we describe the process for creation of dialog
  2871. state that is not dependent on the method.
  2872. UAs MUST assign values to the dialog ID components as described
  2873. below.
  2874. 12.1.1 UAS behavior
  2875. When a UAS responds to a request with a response that establishes a
  2876. dialog (such as a 2xx to INVITE), the UAS MUST copy all Record-Route
  2877. header field values from the request into the response (including the
  2878. URIs, URI parameters, and any Record-Route header field parameters,
  2879. whether they are known or unknown to the UAS) and MUST maintain the
  2880. order of those values. The UAS MUST add a Contact header field to
  2881. the response. The Contact header field contains an address where the
  2882. UAS would like to be contacted for subsequent requests in the dialog
  2883. (which includes the ACK for a 2xx response in the case of an INVITE).
  2884. Generally, the host portion of this URI is the IP address or FQDN of
  2885. the host. The URI provided in the Contact header field MUST be a SIP
  2886. or SIPS URI. If the request that initiated the dialog contained a
  2887. Rosenberg, et. al. Standards Track [Page 70]
  2888. RFC 3261 SIP: Session Initiation Protocol June 2002
  2889. SIPS URI in the Request-URI or in the top Record-Route header field
  2890. value, if there was any, or the Contact header field if there was no
  2891. Record-Route header field, the Contact header field in the response
  2892. MUST be a SIPS URI. The URI SHOULD have global scope (that is, the
  2893. same URI can be used in messages outside this dialog). The same way,
  2894. the scope of the URI in the Contact header field of the INVITE is not
  2895. limited to this dialog either. It can therefore be used in messages
  2896. to the UAC even outside this dialog.
  2897. The UAS then constructs the state of the dialog. This state MUST be
  2898. maintained for the duration of the dialog.
  2899. If the request arrived over TLS, and the Request-URI contained a SIPS
  2900. URI, the "secure" flag is set to TRUE.
  2901. The route set MUST be set to the list of URIs in the Record-Route
  2902. header field from the request, taken in order and preserving all URI
  2903. parameters. If no Record-Route header field is present in the
  2904. request, the route set MUST be set to the empty set. This route set,
  2905. even if empty, overrides any pre-existing route set for future
  2906. requests in this dialog. The remote target MUST be set to the URI
  2907. from the Contact header field of the request.
  2908. The remote sequence number MUST be set to the value of the sequence
  2909. number in the CSeq header field of the request. The local sequence
  2910. number MUST be empty. The call identifier component of the dialog ID
  2911. MUST be set to the value of the Call-ID in the request. The local
  2912. tag component of the dialog ID MUST be set to the tag in the To field
  2913. in the response to the request (which always includes a tag), and the
  2914. remote tag component of the dialog ID MUST be set to the tag from the
  2915. From field in the request. A UAS MUST be prepared to receive a
  2916. request without a tag in the From field, in which case the tag is
  2917. considered to have a value of null.
  2918. This is to maintain backwards compatibility with RFC 2543, which
  2919. did not mandate From tags.
  2920. The remote URI MUST be set to the URI in the From field, and the
  2921. local URI MUST be set to the URI in the To field.
  2922. 12.1.2 UAC Behavior
  2923. When a UAC sends a request that can establish a dialog (such as an
  2924. INVITE) it MUST provide a SIP or SIPS URI with global scope (i.e.,
  2925. the same SIP URI can be used in messages outside this dialog) in the
  2926. Contact header field of the request. If the request has a Request-
  2927. URI or a topmost Route header field value with a SIPS URI, the
  2928. Contact header field MUST contain a SIPS URI.
  2929. Rosenberg, et. al. Standards Track [Page 71]
  2930. RFC 3261 SIP: Session Initiation Protocol June 2002
  2931. When a UAC receives a response that establishes a dialog, it
  2932. constructs the state of the dialog. This state MUST be maintained
  2933. for the duration of the dialog.
  2934. If the request was sent over TLS, and the Request-URI contained a
  2935. SIPS URI, the "secure" flag is set to TRUE.
  2936. The route set MUST be set to the list of URIs in the Record-Route
  2937. header field from the response, taken in reverse order and preserving
  2938. all URI parameters. If no Record-Route header field is present in
  2939. the response, the route set MUST be set to the empty set. This route
  2940. set, even if empty, overrides any pre-existing route set for future
  2941. requests in this dialog. The remote target MUST be set to the URI
  2942. from the Contact header field of the response.
  2943. The local sequence number MUST be set to the value of the sequence
  2944. number in the CSeq header field of the request. The remote sequence
  2945. number MUST be empty (it is established when the remote UA sends a
  2946. request within the dialog). The call identifier component of the
  2947. dialog ID MUST be set to the value of the Call-ID in the request.
  2948. The local tag component of the dialog ID MUST be set to the tag in
  2949. the From field in the request, and the remote tag component of the
  2950. dialog ID MUST be set to the tag in the To field of the response. A
  2951. UAC MUST be prepared to receive a response without a tag in the To
  2952. field, in which case the tag is considered to have a value of null.
  2953. This is to maintain backwards compatibility with RFC 2543, which
  2954. did not mandate To tags.
  2955. The remote URI MUST be set to the URI in the To field, and the local
  2956. URI MUST be set to the URI in the From field.
  2957. 12.2 Requests within a Dialog
  2958. Once a dialog has been established between two UAs, either of them
  2959. MAY initiate new transactions as needed within the dialog. The UA
  2960. sending the request will take the UAC role for the transaction. The
  2961. UA receiving the request will take the UAS role. Note that these may
  2962. be different roles than the UAs held during the transaction that
  2963. established the dialog.
  2964. Requests within a dialog MAY contain Record-Route and Contact header
  2965. fields. However, these requests do not cause the dialog's route set
  2966. to be modified, although they may modify the remote target URI.
  2967. Specifically, requests that are not target refresh requests do not
  2968. modify the dialog's remote target URI, and requests that are target
  2969. refresh requests do. For dialogs that have been established with an
  2970. Rosenberg, et. al. Standards Track [Page 72]
  2971. RFC 3261 SIP: Session Initiation Protocol June 2002
  2972. INVITE, the only target refresh request defined is re-INVITE (see
  2973. Section 14). Other extensions may define different target refresh
  2974. requests for dialogs established in other ways.
  2975. Note that an ACK is NOT a target refresh request.
  2976. Target refresh requests only update the dialog's remote target URI,
  2977. and not the route set formed from the Record-Route. Updating the
  2978. latter would introduce severe backwards compatibility problems with
  2979. RFC 2543-compliant systems.
  2980. 12.2.1 UAC Behavior
  2981. 12.2.1.1 Generating the Request
  2982. A request within a dialog is constructed by using many of the
  2983. components of the state stored as part of the dialog.
  2984. The URI in the To field of the request MUST be set to the remote URI
  2985. from the dialog state. The tag in the To header field of the request
  2986. MUST be set to the remote tag of the dialog ID. The From URI of the
  2987. request MUST be set to the local URI from the dialog state. The tag
  2988. in the From header field of the request MUST be set to the local tag
  2989. of the dialog ID. If the value of the remote or local tags is null,
  2990. the tag parameter MUST be omitted from the To or From header fields,
  2991. respectively.
  2992. Usage of the URI from the To and From fields in the original
  2993. request within subsequent requests is done for backwards
  2994. compatibility with RFC 2543, which used the URI for dialog
  2995. identification. In this specification, only the tags are used for
  2996. dialog identification. It is expected that mandatory reflection
  2997. of the original To and From URI in mid-dialog requests will be
  2998. deprecated in a subsequent revision of this specification.
  2999. The Call-ID of the request MUST be set to the Call-ID of the dialog.
  3000. Requests within a dialog MUST contain strictly monotonically
  3001. increasing and contiguous CSeq sequence numbers (increasing-by-one)
  3002. in each direction (excepting ACK and CANCEL of course, whose numbers
  3003. equal the requests being acknowledged or cancelled). Therefore, if
  3004. the local sequence number is not empty, the value of the local
  3005. sequence number MUST be incremented by one, and this value MUST be
  3006. placed into the CSeq header field. If the local sequence number is
  3007. empty, an initial value MUST be chosen using the guidelines of
  3008. Section 8.1.1.5. The method field in the CSeq header field value
  3009. MUST match the method of the request.
  3010. Rosenberg, et. al. Standards Track [Page 73]
  3011. RFC 3261 SIP: Session Initiation Protocol June 2002
  3012. With a length of 32 bits, a client could generate, within a single
  3013. call, one request a second for about 136 years before needing to
  3014. wrap around. The initial value of the sequence number is chosen
  3015. so that subsequent requests within the same call will not wrap
  3016. around. A non-zero initial value allows clients to use a time-
  3017. based initial sequence number. A client could, for example,
  3018. choose the 31 most significant bits of a 32-bit second clock as an
  3019. initial sequence number.
  3020. The UAC uses the remote target and route set to build the Request-URI
  3021. and Route header field of the request.
  3022. If the route set is empty, the UAC MUST place the remote target URI
  3023. into the Request-URI. The UAC MUST NOT add a Route header field to
  3024. the request.
  3025. If the route set is not empty, and the first URI in the route set
  3026. contains the lr parameter (see Section 19.1.1), the UAC MUST place
  3027. the remote target URI into the Request-URI and MUST include a Route
  3028. header field containing the route set values in order, including all
  3029. parameters.
  3030. If the route set is not empty, and its first URI does not contain the
  3031. lr parameter, the UAC MUST place the first URI from the route set
  3032. into the Request-URI, stripping any parameters that are not allowed
  3033. in a Request-URI. The UAC MUST add a Route header field containing
  3034. the remainder of the route set values in order, including all
  3035. parameters. The UAC MUST then place the remote target URI into the
  3036. Route header field as the last value.
  3037. For example, if the remote target is sip:user@remoteua and the route
  3038. set contains:
  3039. <sip:proxy1>,<sip:proxy2>,<sip:proxy3;lr>,<sip:proxy4>
  3040. The request will be formed with the following Request-URI and Route
  3041. header field:
  3042. METHOD sip:proxy1
  3043. Route: <sip:proxy2>,<sip:proxy3;lr>,<sip:proxy4>,<sip:user@remoteua>
  3044. If the first URI of the route set does not contain the lr
  3045. parameter, the proxy indicated does not understand the routing
  3046. mechanisms described in this document and will act as specified in
  3047. RFC 2543, replacing the Request-URI with the first Route header
  3048. field value it receives while forwarding the message. Placing the
  3049. Request-URI at the end of the Route header field preserves the
  3050. Rosenberg, et. al. Standards Track [Page 74]
  3051. RFC 3261 SIP: Session Initiation Protocol June 2002
  3052. information in that Request-URI across the strict router (it will
  3053. be returned to the Request-URI when the request reaches a loose-
  3054. router).
  3055. A UAC SHOULD include a Contact header field in any target refresh
  3056. requests within a dialog, and unless there is a need to change it,
  3057. the URI SHOULD be the same as used in previous requests within the
  3058. dialog. If the "secure" flag is true, that URI MUST be a SIPS URI.
  3059. As discussed in Section 12.2.2, a Contact header field in a target
  3060. refresh request updates the remote target URI. This allows a UA to
  3061. provide a new contact address, should its address change during the
  3062. duration of the dialog.
  3063. However, requests that are not target refresh requests do not affect
  3064. the remote target URI for the dialog.
  3065. The rest of the request is formed as described in Section 8.1.1.
  3066. Once the request has been constructed, the address of the server is
  3067. computed and the request is sent, using the same procedures for
  3068. requests outside of a dialog (Section 8.1.2).
  3069. The procedures in Section 8.1.2 will normally result in the
  3070. request being sent to the address indicated by the topmost Route
  3071. header field value or the Request-URI if no Route header field is
  3072. present. Subject to certain restrictions, they allow the request
  3073. to be sent to an alternate address (such as a default outbound
  3074. proxy not represented in the route set).
  3075. 12.2.1.2 Processing the Responses
  3076. The UAC will receive responses to the request from the transaction
  3077. layer. If the client transaction returns a timeout, this is treated
  3078. as a 408 (Request Timeout) response.
  3079. The behavior of a UAC that receives a 3xx response for a request sent
  3080. within a dialog is the same as if the request had been sent outside a
  3081. dialog. This behavior is described in Section 8.1.3.4.
  3082. Note, however, that when the UAC tries alternative locations, it
  3083. still uses the route set for the dialog to build the Route header
  3084. of the request.
  3085. When a UAC receives a 2xx response to a target refresh request, it
  3086. MUST replace the dialog's remote target URI with the URI from the
  3087. Contact header field in that response, if present.
  3088. Rosenberg, et. al. Standards Track [Page 75]
  3089. RFC 3261 SIP: Session Initiation Protocol June 2002
  3090. If the response for a request within a dialog is a 481
  3091. (Call/Transaction Does Not Exist) or a 408 (Request Timeout), the UAC
  3092. SHOULD terminate the dialog. A UAC SHOULD also terminate a dialog if
  3093. no response at all is received for the request (the client
  3094. transaction would inform the TU about the timeout.)
  3095. For INVITE initiated dialogs, terminating the dialog consists of
  3096. sending a BYE.
  3097. 12.2.2 UAS Behavior
  3098. Requests sent within a dialog, as any other requests, are atomic. If
  3099. a particular request is accepted by the UAS, all the state changes
  3100. associated with it are performed. If the request is rejected, none
  3101. of the state changes are performed.
  3102. Note that some requests, such as INVITEs, affect several pieces of
  3103. state.
  3104. The UAS will receive the request from the transaction layer. If the
  3105. request has a tag in the To header field, the UAS core computes the
  3106. dialog identifier corresponding to the request and compares it with
  3107. existing dialogs. If there is a match, this is a mid-dialog request.
  3108. In that case, the UAS first applies the same processing rules for
  3109. requests outside of a dialog, discussed in Section 8.2.
  3110. If the request has a tag in the To header field, but the dialog
  3111. identifier does not match any existing dialogs, the UAS may have
  3112. crashed and restarted, or it may have received a request for a
  3113. different (possibly failed) UAS (the UASs can construct the To tags
  3114. so that a UAS can identify that the tag was for a UAS for which it is
  3115. providing recovery). Another possibility is that the incoming
  3116. request has been simply misrouted. Based on the To tag, the UAS MAY
  3117. either accept or reject the request. Accepting the request for
  3118. acceptable To tags provides robustness, so that dialogs can persist
  3119. even through crashes. UAs wishing to support this capability must
  3120. take into consideration some issues such as choosing monotonically
  3121. increasing CSeq sequence numbers even across reboots, reconstructing
  3122. the route set, and accepting out-of-range RTP timestamps and sequence
  3123. numbers.
  3124. If the UAS wishes to reject the request because it does not wish to
  3125. recreate the dialog, it MUST respond to the request with a 481
  3126. (Call/Transaction Does Not Exist) status code and pass that to the
  3127. server transaction.
  3128. Rosenberg, et. al. Standards Track [Page 76]
  3129. RFC 3261 SIP: Session Initiation Protocol June 2002
  3130. Requests that do not change in any way the state of a dialog may be
  3131. received within a dialog (for example, an OPTIONS request). They are
  3132. processed as if they had been received outside the dialog.
  3133. If the remote sequence number is empty, it MUST be set to the value
  3134. of the sequence number in the CSeq header field value in the request.
  3135. If the remote sequence number was not empty, but the sequence number
  3136. of the request is lower than the remote sequence number, the request
  3137. is out of order and MUST be rejected with a 500 (Server Internal
  3138. Error) response. If the remote sequence number was not empty, and
  3139. the sequence number of the request is greater than the remote
  3140. sequence number, the request is in order. It is possible for the
  3141. CSeq sequence number to be higher than the remote sequence number by
  3142. more than one. This is not an error condition, and a UAS SHOULD be
  3143. prepared to receive and process requests with CSeq values more than
  3144. one higher than the previous received request. The UAS MUST then set
  3145. the remote sequence number to the value of the sequence number in the
  3146. CSeq header field value in the request.
  3147. If a proxy challenges a request generated by the UAC, the UAC has
  3148. to resubmit the request with credentials. The resubmitted request
  3149. will have a new CSeq number. The UAS will never see the first
  3150. request, and thus, it will notice a gap in the CSeq number space.
  3151. Such a gap does not represent any error condition.
  3152. When a UAS receives a target refresh request, it MUST replace the
  3153. dialog's remote target URI with the URI from the Contact header field
  3154. in that request, if present.
  3155. 12.3 Termination of a Dialog
  3156. Independent of the method, if a request outside of a dialog generates
  3157. a non-2xx final response, any early dialogs created through
  3158. provisional responses to that request are terminated. The mechanism
  3159. for terminating confirmed dialogs is method specific. In this
  3160. specification, the BYE method terminates a session and the dialog
  3161. associated with it. See Section 15 for details.
  3162. 13 Initiating a Session
  3163. 13.1 Overview
  3164. When a user agent client desires to initiate a session (for example,
  3165. audio, video, or a game), it formulates an INVITE request. The
  3166. INVITE request asks a server to establish a session. This request
  3167. may be forwarded by proxies, eventually arriving at one or more UAS
  3168. that can potentially accept the invitation. These UASs will
  3169. frequently need to query the user about whether to accept the
  3170. Rosenberg, et. al. Standards Track [Page 77]
  3171. RFC 3261 SIP: Session Initiation Protocol June 2002
  3172. invitation. After some time, those UASs can accept the invitation
  3173. (meaning the session is to be established) by sending a 2xx response.
  3174. If the invitation is not accepted, a 3xx, 4xx, 5xx or 6xx response is
  3175. sent, depending on the reason for the rejection. Before sending a
  3176. final response, the UAS can also send provisional responses (1xx) to
  3177. advise the UAC of progress in contacting the called user.
  3178. After possibly receiving one or more provisional responses, the UAC
  3179. will get one or more 2xx responses or one non-2xx final response.
  3180. Because of the protracted amount of time it can take to receive final
  3181. responses to INVITE, the reliability mechanisms for INVITE
  3182. transactions differ from those of other requests (like OPTIONS).
  3183. Once it receives a final response, the UAC needs to send an ACK for
  3184. every final response it receives. The procedure for sending this ACK
  3185. depends on the type of response. For final responses between 300 and
  3186. 699, the ACK processing is done in the transaction layer and follows
  3187. one set of rules (See Section 17). For 2xx responses, the ACK is
  3188. generated by the UAC core.
  3189. A 2xx response to an INVITE establishes a session, and it also
  3190. creates a dialog between the UA that issued the INVITE and the UA
  3191. that generated the 2xx response. Therefore, when multiple 2xx
  3192. responses are received from different remote UAs (because the INVITE
  3193. forked), each 2xx establishes a different dialog. All these dialogs
  3194. are part of the same call.
  3195. This section provides details on the establishment of a session using
  3196. INVITE. A UA that supports INVITE MUST also support ACK, CANCEL and
  3197. BYE.
  3198. 13.2 UAC Processing
  3199. 13.2.1 Creating the Initial INVITE
  3200. Since the initial INVITE represents a request outside of a dialog,
  3201. its construction follows the procedures of Section 8.1.1. Additional
  3202. processing is required for the specific case of INVITE.
  3203. An Allow header field (Section 20.5) SHOULD be present in the INVITE.
  3204. It indicates what methods can be invoked within a dialog, on the UA
  3205. sending the INVITE, for the duration of the dialog. For example, a
  3206. UA capable of receiving INFO requests within a dialog [34] SHOULD
  3207. include an Allow header field listing the INFO method.
  3208. A Supported header field (Section 20.37) SHOULD be present in the
  3209. INVITE. It enumerates all the extensions understood by the UAC.
  3210. Rosenberg, et. al. Standards Track [Page 78]
  3211. RFC 3261 SIP: Session Initiation Protocol June 2002
  3212. An Accept (Section 20.1) header field MAY be present in the INVITE.
  3213. It indicates which Content-Types are acceptable to the UA, in both
  3214. the response received by it, and in any subsequent requests sent to
  3215. it within dialogs established by the INVITE. The Accept header field
  3216. is especially useful for indicating support of various session
  3217. description formats.
  3218. The UAC MAY add an Expires header field (Section 20.19) to limit the
  3219. validity of the invitation. If the time indicated in the Expires
  3220. header field is reached and no final answer for the INVITE has been
  3221. received, the UAC core SHOULD generate a CANCEL request for the
  3222. INVITE, as per Section 9.
  3223. A UAC MAY also find it useful to add, among others, Subject (Section
  3224. 20.36), Organization (Section 20.25) and User-Agent (Section 20.41)
  3225. header fields. They all contain information related to the INVITE.
  3226. The UAC MAY choose to add a message body to the INVITE. Section
  3227. 8.1.1.10 deals with how to construct the header fields -- Content-
  3228. Type among others -- needed to describe the message body.
  3229. There are special rules for message bodies that contain a session
  3230. description - their corresponding Content-Disposition is "session".
  3231. SIP uses an offer/answer model where one UA sends a session
  3232. description, called the offer, which contains a proposed description
  3233. of the session. The offer indicates the desired communications means
  3234. (audio, video, games), parameters of those means (such as codec
  3235. types) and addresses for receiving media from the answerer. The
  3236. other UA responds with another session description, called the
  3237. answer, which indicates which communications means are accepted, the
  3238. parameters that apply to those means, and addresses for receiving
  3239. media from the offerer. An offer/answer exchange is within the
  3240. context of a dialog, so that if a SIP INVITE results in multiple
  3241. dialogs, each is a separate offer/answer exchange. The offer/answer
  3242. model defines restrictions on when offers and answers can be made
  3243. (for example, you cannot make a new offer while one is in progress).
  3244. This results in restrictions on where the offers and answers can
  3245. appear in SIP messages. In this specification, offers and answers
  3246. can only appear in INVITE requests and responses, and ACK. The usage
  3247. of offers and answers is further restricted. For the initial INVITE
  3248. transaction, the rules are:
  3249. o The initial offer MUST be in either an INVITE or, if not there,
  3250. in the first reliable non-failure message from the UAS back to
  3251. the UAC. In this specification, that is the final 2xx
  3252. response.
  3253. Rosenberg, et. al. Standards Track [Page 79]
  3254. RFC 3261 SIP: Session Initiation Protocol June 2002
  3255. o If the initial offer is in an INVITE, the answer MUST be in a
  3256. reliable non-failure message from UAS back to UAC which is
  3257. correlated to that INVITE. For this specification, that is
  3258. only the final 2xx response to that INVITE. That same exact
  3259. answer MAY also be placed in any provisional responses sent
  3260. prior to the answer. The UAC MUST treat the first session
  3261. description it receives as the answer, and MUST ignore any
  3262. session descriptions in subsequent responses to the initial
  3263. INVITE.
  3264. o If the initial offer is in the first reliable non-failure
  3265. message from the UAS back to UAC, the answer MUST be in the
  3266. acknowledgement for that message (in this specification, ACK
  3267. for a 2xx response).
  3268. o After having sent or received an answer to the first offer, the
  3269. UAC MAY generate subsequent offers in requests based on rules
  3270. specified for that method, but only if it has received answers
  3271. to any previous offers, and has not sent any offers to which it
  3272. hasn't gotten an answer.
  3273. o Once the UAS has sent or received an answer to the initial
  3274. offer, it MUST NOT generate subsequent offers in any responses
  3275. to the initial INVITE. This means that a UAS based on this
  3276. specification alone can never generate subsequent offers until
  3277. completion of the initial transaction.
  3278. Concretely, the above rules specify two exchanges for UAs compliant
  3279. to this specification alone - the offer is in the INVITE, and the
  3280. answer in the 2xx (and possibly in a 1xx as well, with the same
  3281. value), or the offer is in the 2xx, and the answer is in the ACK.
  3282. All user agents that support INVITE MUST support these two exchanges.
  3283. The Session Description Protocol (SDP) (RFC 2327 [1]) MUST be
  3284. supported by all user agents as a means to describe sessions, and its
  3285. usage for constructing offers and answers MUST follow the procedures
  3286. defined in [13].
  3287. The restrictions of the offer-answer model just described only apply
  3288. to bodies whose Content-Disposition header field value is "session".
  3289. Therefore, it is possible that both the INVITE and the ACK contain a
  3290. body message (for example, the INVITE carries a photo (Content-
  3291. Disposition: render) and the ACK a session description (Content-
  3292. Disposition: session)).
  3293. If the Content-Disposition header field is missing, bodies of
  3294. Content-Type application/sdp imply the disposition "session", while
  3295. other content types imply "render".
  3296. Rosenberg, et. al. Standards Track [Page 80]
  3297. RFC 3261 SIP: Session Initiation Protocol June 2002
  3298. Once the INVITE has been created, the UAC follows the procedures
  3299. defined for sending requests outside of a dialog (Section 8). This
  3300. results in the construction of a client transaction that will
  3301. ultimately send the request and deliver responses to the UAC.
  3302. 13.2.2 Processing INVITE Responses
  3303. Once the INVITE has been passed to the INVITE client transaction, the
  3304. UAC waits for responses for the INVITE. If the INVITE client
  3305. transaction returns a timeout rather than a response the TU acts as
  3306. if a 408 (Request Timeout) response had been received, as described
  3307. in Section 8.1.3.
  3308. 13.2.2.1 1xx Responses
  3309. Zero, one or multiple provisional responses may arrive before one or
  3310. more final responses are received. Provisional responses for an
  3311. INVITE request can create "early dialogs". If a provisional response
  3312. has a tag in the To field, and if the dialog ID of the response does
  3313. not match an existing dialog, one is constructed using the procedures
  3314. defined in Section 12.1.2.
  3315. The early dialog will only be needed if the UAC needs to send a
  3316. request to its peer within the dialog before the initial INVITE
  3317. transaction completes. Header fields present in a provisional
  3318. response are applicable as long as the dialog is in the early state
  3319. (for example, an Allow header field in a provisional response
  3320. contains the methods that can be used in the dialog while this is in
  3321. the early state).
  3322. 13.2.2.2 3xx Responses
  3323. A 3xx response may contain one or more Contact header field values
  3324. providing new addresses where the callee might be reachable.
  3325. Depending on the status code of the 3xx response (see Section 21.3),
  3326. the UAC MAY choose to try those new addresses.
  3327. 13.2.2.3 4xx, 5xx and 6xx Responses
  3328. A single non-2xx final response may be received for the INVITE. 4xx,
  3329. 5xx and 6xx responses may contain a Contact header field value
  3330. indicating the location where additional information about the error
  3331. can be found. Subsequent final responses (which would only arrive
  3332. under error conditions) MUST be ignored.
  3333. All early dialogs are considered terminated upon reception of the
  3334. non-2xx final response.
  3335. Rosenberg, et. al. Standards Track [Page 81]
  3336. RFC 3261 SIP: Session Initiation Protocol June 2002
  3337. After having received the non-2xx final response the UAC core
  3338. considers the INVITE transaction completed. The INVITE client
  3339. transaction handles the generation of ACKs for the response (see
  3340. Section 17).
  3341. 13.2.2.4 2xx Responses
  3342. Multiple 2xx responses may arrive at the UAC for a single INVITE
  3343. request due to a forking proxy. Each response is distinguished by
  3344. the tag parameter in the To header field, and each represents a
  3345. distinct dialog, with a distinct dialog identifier.
  3346. If the dialog identifier in the 2xx response matches the dialog
  3347. identifier of an existing dialog, the dialog MUST be transitioned to
  3348. the "confirmed" state, and the route set for the dialog MUST be
  3349. recomputed based on the 2xx response using the procedures of Section
  3350. 12.2.1.2. Otherwise, a new dialog in the "confirmed" state MUST be
  3351. constructed using the procedures of Section 12.1.2.
  3352. Note that the only piece of state that is recomputed is the route
  3353. set. Other pieces of state such as the highest sequence numbers
  3354. (remote and local) sent within the dialog are not recomputed. The
  3355. route set only is recomputed for backwards compatibility. RFC
  3356. 2543 did not mandate mirroring of the Record-Route header field in
  3357. a 1xx, only 2xx. However, we cannot update the entire state of
  3358. the dialog, since mid-dialog requests may have been sent within
  3359. the early dialog, modifying the sequence numbers, for example.
  3360. The UAC core MUST generate an ACK request for each 2xx received from
  3361. the transaction layer. The header fields of the ACK are constructed
  3362. in the same way as for any request sent within a dialog (see Section
  3363. 12) with the exception of the CSeq and the header fields related to
  3364. authentication. The sequence number of the CSeq header field MUST be
  3365. the same as the INVITE being acknowledged, but the CSeq method MUST
  3366. be ACK. The ACK MUST contain the same credentials as the INVITE. If
  3367. the 2xx contains an offer (based on the rules above), the ACK MUST
  3368. carry an answer in its body. If the offer in the 2xx response is not
  3369. acceptable, the UAC core MUST generate a valid answer in the ACK and
  3370. then send a BYE immediately.
  3371. Once the ACK has been constructed, the procedures of [4] are used to
  3372. determine the destination address, port and transport. However, the
  3373. request is passed to the transport layer directly for transmission,
  3374. rather than a client transaction. This is because the UAC core
  3375. handles retransmissions of the ACK, not the transaction layer. The
  3376. ACK MUST be passed to the client transport every time a
  3377. retransmission of the 2xx final response that triggered the ACK
  3378. arrives.
  3379. Rosenberg, et. al. Standards Track [Page 82]
  3380. RFC 3261 SIP: Session Initiation Protocol June 2002
  3381. The UAC core considers the INVITE transaction completed 64*T1 seconds
  3382. after the reception of the first 2xx response. At this point all the
  3383. early dialogs that have not transitioned to established dialogs are
  3384. terminated. Once the INVITE transaction is considered completed by
  3385. the UAC core, no more new 2xx responses are expected to arrive.
  3386. If, after acknowledging any 2xx response to an INVITE, the UAC does
  3387. not want to continue with that dialog, then the UAC MUST terminate
  3388. the dialog by sending a BYE request as described in Section 15.
  3389. 13.3 UAS Processing
  3390. 13.3.1 Processing of the INVITE
  3391. The UAS core will receive INVITE requests from the transaction layer.
  3392. It first performs the request processing procedures of Section 8.2,
  3393. which are applied for both requests inside and outside of a dialog.
  3394. Assuming these processing states are completed without generating a
  3395. response, the UAS core performs the additional processing steps:
  3396. 1. If the request is an INVITE that contains an Expires header
  3397. field, the UAS core sets a timer for the number of seconds
  3398. indicated in the header field value. When the timer fires, the
  3399. invitation is considered to be expired. If the invitation
  3400. expires before the UAS has generated a final response, a 487
  3401. (Request Terminated) response SHOULD be generated.
  3402. 2. If the request is a mid-dialog request, the method-independent
  3403. processing described in Section 12.2.2 is first applied. It
  3404. might also modify the session; Section 14 provides details.
  3405. 3. If the request has a tag in the To header field but the dialog
  3406. identifier does not match any of the existing dialogs, the UAS
  3407. may have crashed and restarted, or may have received a request
  3408. for a different (possibly failed) UAS. Section 12.2.2 provides
  3409. guidelines to achieve a robust behavior under such a situation.
  3410. Processing from here forward assumes that the INVITE is outside of a
  3411. dialog, and is thus for the purposes of establishing a new session.
  3412. The INVITE may contain a session description, in which case the UAS
  3413. is being presented with an offer for that session. It is possible
  3414. that the user is already a participant in that session, even though
  3415. the INVITE is outside of a dialog. This can happen when a user is
  3416. invited to the same multicast conference by multiple other
  3417. participants. If desired, the UAS MAY use identifiers within the
  3418. session description to detect this duplication. For example, SDP
  3419. Rosenberg, et. al. Standards Track [Page 83]
  3420. RFC 3261 SIP: Session Initiation Protocol June 2002
  3421. contains a session id and version number in the origin (o) field. If
  3422. the user is already a member of the session, and the session
  3423. parameters contained in the session description have not changed, the
  3424. UAS MAY silently accept the INVITE (that is, send a 2xx response
  3425. without prompting the user).
  3426. If the INVITE does not contain a session description, the UAS is
  3427. being asked to participate in a session, and the UAC has asked that
  3428. the UAS provide the offer of the session. It MUST provide the offer
  3429. in its first non-failure reliable message back to the UAC. In this
  3430. specification, that is a 2xx response to the INVITE.
  3431. The UAS can indicate progress, accept, redirect, or reject the
  3432. invitation. In all of these cases, it formulates a response using
  3433. the procedures described in Section 8.2.6.
  3434. 13.3.1.1 Progress
  3435. If the UAS is not able to answer the invitation immediately, it can
  3436. choose to indicate some kind of progress to the UAC (for example, an
  3437. indication that a phone is ringing). This is accomplished with a
  3438. provisional response between 101 and 199. These provisional
  3439. responses establish early dialogs and therefore follow the procedures
  3440. of Section 12.1.1 in addition to those of Section 8.2.6. A UAS MAY
  3441. send as many provisional responses as it likes. Each of these MUST
  3442. indicate the same dialog ID. However, these will not be delivered
  3443. reliably.
  3444. If the UAS desires an extended period of time to answer the INVITE,
  3445. it will need to ask for an "extension" in order to prevent proxies
  3446. from canceling the transaction. A proxy has the option of canceling
  3447. a transaction when there is a gap of 3 minutes between responses in a
  3448. transaction. To prevent cancellation, the UAS MUST send a non-100
  3449. provisional response at every minute, to handle the possibility of
  3450. lost provisional responses.
  3451. An INVITE transaction can go on for extended durations when the
  3452. user is placed on hold, or when interworking with PSTN systems
  3453. which allow communications to take place without answering the
  3454. call. The latter is common in Interactive Voice Response (IVR)
  3455. systems.
  3456. 13.3.1.2 The INVITE is Redirected
  3457. If the UAS decides to redirect the call, a 3xx response is sent. A
  3458. 300 (Multiple Choices), 301 (Moved Permanently) or 302 (Moved
  3459. Temporarily) response SHOULD contain a Contact header field
  3460. Rosenberg, et. al. Standards Track [Page 84]
  3461. RFC 3261 SIP: Session Initiation Protocol June 2002
  3462. containing one or more URIs of new addresses to be tried. The
  3463. response is passed to the INVITE server transaction, which will deal
  3464. with its retransmissions.
  3465. 13.3.1.3 The INVITE is Rejected
  3466. A common scenario occurs when the callee is currently not willing or
  3467. able to take additional calls at this end system. A 486 (Busy Here)
  3468. SHOULD be returned in such a scenario. If the UAS knows that no
  3469. other end system will be able to accept this call, a 600 (Busy
  3470. Everywhere) response SHOULD be sent instead. However, it is unlikely
  3471. that a UAS will be able to know this in general, and thus this
  3472. response will not usually be used. The response is passed to the
  3473. INVITE server transaction, which will deal with its retransmissions.
  3474. A UAS rejecting an offer contained in an INVITE SHOULD return a 488
  3475. (Not Acceptable Here) response. Such a response SHOULD include a
  3476. Warning header field value explaining why the offer was rejected.
  3477. 13.3.1.4 The INVITE is Accepted
  3478. The UAS core generates a 2xx response. This response establishes a
  3479. dialog, and therefore follows the procedures of Section 12.1.1 in
  3480. addition to those of Section 8.2.6.
  3481. A 2xx response to an INVITE SHOULD contain the Allow header field and
  3482. the Supported header field, and MAY contain the Accept header field.
  3483. Including these header fields allows the UAC to determine the
  3484. features and extensions supported by the UAS for the duration of the
  3485. call, without probing.
  3486. If the INVITE request contained an offer, and the UAS had not yet
  3487. sent an answer, the 2xx MUST contain an answer. If the INVITE did
  3488. not contain an offer, the 2xx MUST contain an offer if the UAS had
  3489. not yet sent an offer.
  3490. Once the response has been constructed, it is passed to the INVITE
  3491. server transaction. Note, however, that the INVITE server
  3492. transaction will be destroyed as soon as it receives this final
  3493. response and passes it to the transport. Therefore, it is necessary
  3494. to periodically pass the response directly to the transport until the
  3495. ACK arrives. The 2xx response is passed to the transport with an
  3496. interval that starts at T1 seconds and doubles for each
  3497. retransmission until it reaches T2 seconds (T1 and T2 are defined in
  3498. Section 17). Response retransmissions cease when an ACK request for
  3499. the response is received. This is independent of whatever transport
  3500. protocols are used to send the response.
  3501. Rosenberg, et. al. Standards Track [Page 85]
  3502. RFC 3261 SIP: Session Initiation Protocol June 2002
  3503. Since 2xx is retransmitted end-to-end, there may be hops between
  3504. UAS and UAC that are UDP. To ensure reliable delivery across
  3505. these hops, the response is retransmitted periodically even if the
  3506. transport at the UAS is reliable.
  3507. If the server retransmits the 2xx response for 64*T1 seconds without
  3508. receiving an ACK, the dialog is confirmed, but the session SHOULD be
  3509. terminated. This is accomplished with a BYE, as described in Section
  3510. 15.
  3511. 14 Modifying an Existing Session
  3512. A successful INVITE request (see Section 13) establishes both a
  3513. dialog between two user agents and a session using the offer-answer
  3514. model. Section 12 explains how to modify an existing dialog using a
  3515. target refresh request (for example, changing the remote target URI
  3516. of the dialog). This section describes how to modify the actual
  3517. session. This modification can involve changing addresses or ports,
  3518. adding a media stream, deleting a media stream, and so on. This is
  3519. accomplished by sending a new INVITE request within the same dialog
  3520. that established the session. An INVITE request sent within an
  3521. existing dialog is known as a re-INVITE.
  3522. Note that a single re-INVITE can modify the dialog and the
  3523. parameters of the session at the same time.
  3524. Either the caller or callee can modify an existing session.
  3525. The behavior of a UA on detection of media failure is a matter of
  3526. local policy. However, automated generation of re-INVITE or BYE is
  3527. NOT RECOMMENDED to avoid flooding the network with traffic when there
  3528. is congestion. In any case, if these messages are sent
  3529. automatically, they SHOULD be sent after some randomized interval.
  3530. Note that the paragraph above refers to automatically generated
  3531. BYEs and re-INVITEs. If the user hangs up upon media failure, the
  3532. UA would send a BYE request as usual.
  3533. 14.1 UAC Behavior
  3534. The same offer-answer model that applies to session descriptions in
  3535. INVITEs (Section 13.2.1) applies to re-INVITEs. As a result, a UAC
  3536. that wants to add a media stream, for example, will create a new
  3537. offer that contains this media stream, and send that in an INVITE
  3538. request to its peer. It is important to note that the full
  3539. description of the session, not just the change, is sent. This
  3540. supports stateless session processing in various elements, and
  3541. supports failover and recovery capabilities. Of course, a UAC MAY
  3542. Rosenberg, et. al. Standards Track [Page 86]
  3543. RFC 3261 SIP: Session Initiation Protocol June 2002
  3544. send a re-INVITE with no session description, in which case the first
  3545. reliable non-failure response to the re-INVITE will contain the offer
  3546. (in this specification, that is a 2xx response).
  3547. If the session description format has the capability for version
  3548. numbers, the offerer SHOULD indicate that the version of the session
  3549. description has changed.
  3550. The To, From, Call-ID, CSeq, and Request-URI of a re-INVITE are set
  3551. following the same rules as for regular requests within an existing
  3552. dialog, described in Section 12.
  3553. A UAC MAY choose not to add an Alert-Info header field or a body with
  3554. Content-Disposition "alert" to re-INVITEs because UASs do not
  3555. typically alert the user upon reception of a re-INVITE.
  3556. Unlike an INVITE, which can fork, a re-INVITE will never fork, and
  3557. therefore, only ever generate a single final response. The reason a
  3558. re-INVITE will never fork is that the Request-URI identifies the
  3559. target as the UA instance it established the dialog with, rather than
  3560. identifying an address-of-record for the user.
  3561. Note that a UAC MUST NOT initiate a new INVITE transaction within a
  3562. dialog while another INVITE transaction is in progress in either
  3563. direction.
  3564. 1. If there is an ongoing INVITE client transaction, the TU MUST
  3565. wait until the transaction reaches the completed or terminated
  3566. state before initiating the new INVITE.
  3567. 2. If there is an ongoing INVITE server transaction, the TU MUST
  3568. wait until the transaction reaches the confirmed or terminated
  3569. state before initiating the new INVITE.
  3570. However, a UA MAY initiate a regular transaction while an INVITE
  3571. transaction is in progress. A UA MAY also initiate an INVITE
  3572. transaction while a regular transaction is in progress.
  3573. If a UA receives a non-2xx final response to a re-INVITE, the session
  3574. parameters MUST remain unchanged, as if no re-INVITE had been issued.
  3575. Note that, as stated in Section 12.2.1.2, if the non-2xx final
  3576. response is a 481 (Call/Transaction Does Not Exist), or a 408
  3577. (Request Timeout), or no response at all is received for the re-
  3578. INVITE (that is, a timeout is returned by the INVITE client
  3579. transaction), the UAC will terminate the dialog.
  3580. Rosenberg, et. al. Standards Track [Page 87]
  3581. RFC 3261 SIP: Session Initiation Protocol June 2002
  3582. If a UAC receives a 491 response to a re-INVITE, it SHOULD start a
  3583. timer with a value T chosen as follows:
  3584. 1. If the UAC is the owner of the Call-ID of the dialog ID
  3585. (meaning it generated the value), T has a randomly chosen value
  3586. between 2.1 and 4 seconds in units of 10 ms.
  3587. 2. If the UAC is not the owner of the Call-ID of the dialog ID, T
  3588. has a randomly chosen value of between 0 and 2 seconds in units
  3589. of 10 ms.
  3590. When the timer fires, the UAC SHOULD attempt the re-INVITE once more,
  3591. if it still desires for that session modification to take place. For
  3592. example, if the call was already hung up with a BYE, the re-INVITE
  3593. would not take place.
  3594. The rules for transmitting a re-INVITE and for generating an ACK for
  3595. a 2xx response to re-INVITE are the same as for the initial INVITE
  3596. (Section 13.2.1).
  3597. 14.2 UAS Behavior
  3598. Section 13.3.1 describes the procedure for distinguishing incoming
  3599. re-INVITEs from incoming initial INVITEs and handling a re-INVITE for
  3600. an existing dialog.
  3601. A UAS that receives a second INVITE before it sends the final
  3602. response to a first INVITE with a lower CSeq sequence number on the
  3603. same dialog MUST return a 500 (Server Internal Error) response to the
  3604. second INVITE and MUST include a Retry-After header field with a
  3605. randomly chosen value of between 0 and 10 seconds.
  3606. A UAS that receives an INVITE on a dialog while an INVITE it had sent
  3607. on that dialog is in progress MUST return a 491 (Request Pending)
  3608. response to the received INVITE.
  3609. If a UA receives a re-INVITE for an existing dialog, it MUST check
  3610. any version identifiers in the session description or, if there are
  3611. no version identifiers, the content of the session description to see
  3612. if it has changed. If the session description has changed, the UAS
  3613. MUST adjust the session parameters accordingly, possibly after asking
  3614. the user for confirmation.
  3615. Versioning of the session description can be used to accommodate
  3616. the capabilities of new arrivals to a conference, add or delete
  3617. media, or change from a unicast to a multicast conference.
  3618. Rosenberg, et. al. Standards Track [Page 88]
  3619. RFC 3261 SIP: Session Initiation Protocol June 2002
  3620. If the new session description is not acceptable, the UAS can reject
  3621. it by returning a 488 (Not Acceptable Here) response for the re-
  3622. INVITE. This response SHOULD include a Warning header field.
  3623. If a UAS generates a 2xx response and never receives an ACK, it
  3624. SHOULD generate a BYE to terminate the dialog.
  3625. A UAS MAY choose not to generate 180 (Ringing) responses for a re-
  3626. INVITE because UACs do not typically render this information to the
  3627. user. For the same reason, UASs MAY choose not to use an Alert-Info
  3628. header field or a body with Content-Disposition "alert" in responses
  3629. to a re-INVITE.
  3630. A UAS providing an offer in a 2xx (because the INVITE did not contain
  3631. an offer) SHOULD construct the offer as if the UAS were making a
  3632. brand new call, subject to the constraints of sending an offer that
  3633. updates an existing session, as described in [13] in the case of SDP.
  3634. Specifically, this means that it SHOULD include as many media formats
  3635. and media types that the UA is willing to support. The UAS MUST
  3636. ensure that the session description overlaps with its previous
  3637. session description in media formats, transports, or other parameters
  3638. that require support from the peer. This is to avoid the need for
  3639. the peer to reject the session description. If, however, it is
  3640. unacceptable to the UAC, the UAC SHOULD generate an answer with a
  3641. valid session description, and then send a BYE to terminate the
  3642. session.
  3643. 15 Terminating a Session
  3644. This section describes the procedures for terminating a session
  3645. established by SIP. The state of the session and the state of the
  3646. dialog are very closely related. When a session is initiated with an
  3647. INVITE, each 1xx or 2xx response from a distinct UAS creates a
  3648. dialog, and if that response completes the offer/answer exchange, it
  3649. also creates a session. As a result, each session is "associated"
  3650. with a single dialog - the one which resulted in its creation. If an
  3651. initial INVITE generates a non-2xx final response, that terminates
  3652. all sessions (if any) and all dialogs (if any) that were created
  3653. through responses to the request. By virtue of completing the
  3654. transaction, a non-2xx final response also prevents further sessions
  3655. from being created as a result of the INVITE. The BYE request is
  3656. used to terminate a specific session or attempted session. In this
  3657. case, the specific session is the one with the peer UA on the other
  3658. side of the dialog. When a BYE is received on a dialog, any session
  3659. associated with that dialog SHOULD terminate. A UA MUST NOT send a
  3660. BYE outside of a dialog. The caller's UA MAY send a BYE for either
  3661. confirmed or early dialogs, and the callee's UA MAY send a BYE on
  3662. confirmed dialogs, but MUST NOT send a BYE on early dialogs.
  3663. Rosenberg, et. al. Standards Track [Page 89]
  3664. RFC 3261 SIP: Session Initiation Protocol June 2002
  3665. However, the callee's UA MUST NOT send a BYE on a confirmed dialog
  3666. until it has received an ACK for its 2xx response or until the server
  3667. transaction times out. If no SIP extensions have defined other
  3668. application layer states associated with the dialog, the BYE also
  3669. terminates the dialog.
  3670. The impact of a non-2xx final response to INVITE on dialogs and
  3671. sessions makes the use of CANCEL attractive. The CANCEL attempts to
  3672. force a non-2xx response to the INVITE (in particular, a 487).
  3673. Therefore, if a UAC wishes to give up on its call attempt entirely,
  3674. it can send a CANCEL. If the INVITE results in 2xx final response(s)
  3675. to the INVITE, this means that a UAS accepted the invitation while
  3676. the CANCEL was in progress. The UAC MAY continue with the sessions
  3677. established by any 2xx responses, or MAY terminate them with BYE.
  3678. The notion of "hanging up" is not well defined within SIP. It is
  3679. specific to a particular, albeit common, user interface.
  3680. Typically, when the user hangs up, it indicates a desire to
  3681. terminate the attempt to establish a session, and to terminate any
  3682. sessions already created. For the caller's UA, this would imply a
  3683. CANCEL request if the initial INVITE has not generated a final
  3684. response, and a BYE to all confirmed dialogs after a final
  3685. response. For the callee's UA, it would typically imply a BYE;
  3686. presumably, when the user picked up the phone, a 2xx was
  3687. generated, and so hanging up would result in a BYE after the ACK
  3688. is received. This does not mean a user cannot hang up before
  3689. receipt of the ACK, it just means that the software in his phone
  3690. needs to maintain state for a short while in order to clean up
  3691. properly. If the particular UI allows for the user to reject a
  3692. call before its answered, a 403 (Forbidden) is a good way to
  3693. express that. As per the rules above, a BYE can't be sent.
  3694. 15.1 Terminating a Session with a BYE Request
  3695. 15.1.1 UAC Behavior
  3696. A BYE request is constructed as would any other request within a
  3697. dialog, as described in Section 12.
  3698. Once the BYE is constructed, the UAC core creates a new non-INVITE
  3699. client transaction, and passes it the BYE request. The UAC MUST
  3700. consider the session terminated (and therefore stop sending or
  3701. listening for media) as soon as the BYE request is passed to the
  3702. client transaction. If the response for the BYE is a 481
  3703. (Call/Transaction Does Not Exist) or a 408 (Request Timeout) or no
  3704. Rosenberg, et. al. Standards Track [Page 90]
  3705. RFC 3261 SIP: Session Initiation Protocol June 2002
  3706. response at all is received for the BYE (that is, a timeout is
  3707. returned by the client transaction), the UAC MUST consider the
  3708. session and the dialog terminated.
  3709. 15.1.2 UAS Behavior
  3710. A UAS first processes the BYE request according to the general UAS
  3711. processing described in Section 8.2. A UAS core receiving a BYE
  3712. request checks if it matches an existing dialog. If the BYE does not
  3713. match an existing dialog, the UAS core SHOULD generate a 481
  3714. (Call/Transaction Does Not Exist) response and pass that to the
  3715. server transaction.
  3716. This rule means that a BYE sent without tags by a UAC will be
  3717. rejected. This is a change from RFC 2543, which allowed BYE
  3718. without tags.
  3719. A UAS core receiving a BYE request for an existing dialog MUST follow
  3720. the procedures of Section 12.2.2 to process the request. Once done,
  3721. the UAS SHOULD terminate the session (and therefore stop sending and
  3722. listening for media). The only case where it can elect not to are
  3723. multicast sessions, where participation is possible even if the other
  3724. participant in the dialog has terminated its involvement in the
  3725. session. Whether or not it ends its participation on the session,
  3726. the UAS core MUST generate a 2xx response to the BYE, and MUST pass
  3727. that to the server transaction for transmission.
  3728. The UAS MUST still respond to any pending requests received for that
  3729. dialog. It is RECOMMENDED that a 487 (Request Terminated) response
  3730. be generated to those pending requests.
  3731. 16 Proxy Behavior
  3732. 16.1 Overview
  3733. SIP proxies are elements that route SIP requests to user agent
  3734. servers and SIP responses to user agent clients. A request may
  3735. traverse several proxies on its way to a UAS. Each will make routing
  3736. decisions, modifying the request before forwarding it to the next
  3737. element. Responses will route through the same set of proxies
  3738. traversed by the request in the reverse order.
  3739. Being a proxy is a logical role for a SIP element. When a request
  3740. arrives, an element that can play the role of a proxy first decides
  3741. if it needs to respond to the request on its own. For instance, the
  3742. request may be malformed or the element may need credentials from the
  3743. client before acting as a proxy. The element MAY respond with any
  3744. Rosenberg, et. al. Standards Track [Page 91]
  3745. RFC 3261 SIP: Session Initiation Protocol June 2002
  3746. appropriate error code. When responding directly to a request, the
  3747. element is playing the role of a UAS and MUST behave as described in
  3748. Section 8.2.
  3749. A proxy can operate in either a stateful or stateless mode for each
  3750. new request. When stateless, a proxy acts as a simple forwarding
  3751. element. It forwards each request downstream to a single element
  3752. determined by making a targeting and routing decision based on the
  3753. request. It simply forwards every response it receives upstream. A
  3754. stateless proxy discards information about a message once the message
  3755. has been forwarded. A stateful proxy remembers information
  3756. (specifically, transaction state) about each incoming request and any
  3757. requests it sends as a result of processing the incoming request. It
  3758. uses this information to affect the processing of future messages
  3759. associated with that request. A stateful proxy MAY choose to "fork"
  3760. a request, routing it to multiple destinations. Any request that is
  3761. forwarded to more than one location MUST be handled statefully.
  3762. In some circumstances, a proxy MAY forward requests using stateful
  3763. transports (such as TCP) without being transaction-stateful. For
  3764. instance, a proxy MAY forward a request from one TCP connection to
  3765. another transaction statelessly as long as it places enough
  3766. information in the message to be able to forward the response down
  3767. the same connection the request arrived on. Requests forwarded
  3768. between different types of transports where the proxy's TU must take
  3769. an active role in ensuring reliable delivery on one of the transports
  3770. MUST be forwarded transaction statefully.
  3771. A stateful proxy MAY transition to stateless operation at any time
  3772. during the processing of a request, so long as it did not do anything
  3773. that would otherwise prevent it from being stateless initially
  3774. (forking, for example, or generation of a 100 response). When
  3775. performing such a transition, all state is simply discarded. The
  3776. proxy SHOULD NOT initiate a CANCEL request.
  3777. Much of the processing involved when acting statelessly or statefully
  3778. for a request is identical. The next several subsections are written
  3779. from the point of view of a stateful proxy. The last section calls
  3780. out those places where a stateless proxy behaves differently.
  3781. 16.2 Stateful Proxy
  3782. When stateful, a proxy is purely a SIP transaction processing engine.
  3783. Its behavior is modeled here in terms of the server and client
  3784. transactions defined in Section 17. A stateful proxy has a server
  3785. transaction associated with one or more client transactions by a
  3786. higher layer proxy processing component (see figure 3), known as a
  3787. proxy core. An incoming request is processed by a server
  3788. Rosenberg, et. al. Standards Track [Page 92]
  3789. RFC 3261 SIP: Session Initiation Protocol June 2002
  3790. transaction. Requests from the server transaction are passed to a
  3791. proxy core. The proxy core determines where to route the request,
  3792. choosing one or more next-hop locations. An outgoing request for
  3793. each next-hop location is processed by its own associated client
  3794. transaction. The proxy core collects the responses from the client
  3795. transactions and uses them to send responses to the server
  3796. transaction.
  3797. A stateful proxy creates a new server transaction for each new
  3798. request received. Any retransmissions of the request will then be
  3799. handled by that server transaction per Section 17. The proxy core
  3800. MUST behave as a UAS with respect to sending an immediate provisional
  3801. on that server transaction (such as 100 Trying) as described in
  3802. Section 8.2.6. Thus, a stateful proxy SHOULD NOT generate 100
  3803. (Trying) responses to non-INVITE requests.
  3804. This is a model of proxy behavior, not of software. An
  3805. implementation is free to take any approach that replicates the
  3806. external behavior this model defines.
  3807. For all new requests, including any with unknown methods, an element
  3808. intending to proxy the request MUST:
  3809. 1. Validate the request (Section 16.3)
  3810. 2. Preprocess routing information (Section 16.4)
  3811. 3. Determine target(s) for the request (Section 16.5)
  3812. +--------------------+
  3813. | | +---+
  3814. | | | C |
  3815. | | | T |
  3816. | | +---+
  3817. +---+ | Proxy | +---+ CT = Client Transaction
  3818. | S | | "Higher" Layer | | C |
  3819. | T | | | | T | ST = Server Transaction
  3820. +---+ | | +---+
  3821. | | +---+
  3822. | | | C |
  3823. | | | T |
  3824. | | +---+
  3825. +--------------------+
  3826. Figure 3: Stateful Proxy Model
  3827. Rosenberg, et. al. Standards Track [Page 93]
  3828. RFC 3261 SIP: Session Initiation Protocol June 2002
  3829. 4. Forward the request to each target (Section 16.6)
  3830. 5. Process all responses (Section 16.7)
  3831. 16.3 Request Validation
  3832. Before an element can proxy a request, it MUST verify the message's
  3833. validity. A valid message must pass the following checks:
  3834. 1. Reasonable Syntax
  3835. 2. URI scheme
  3836. 3. Max-Forwards
  3837. 4. (Optional) Loop Detection
  3838. 5. Proxy-Require
  3839. 6. Proxy-Authorization
  3840. If any of these checks fail, the element MUST behave as a user agent
  3841. server (see Section 8.2) and respond with an error code.
  3842. Notice that a proxy is not required to detect merged requests and
  3843. MUST NOT treat merged requests as an error condition. The endpoints
  3844. receiving the requests will resolve the merge as described in Section
  3845. 8.2.2.2.
  3846. 1. Reasonable syntax check
  3847. The request MUST be well-formed enough to be handled with a server
  3848. transaction. Any components involved in the remainder of these
  3849. Request Validation steps or the Request Forwarding section MUST be
  3850. well-formed. Any other components, well-formed or not, SHOULD be
  3851. ignored and remain unchanged when the message is forwarded. For
  3852. instance, an element would not reject a request because of a
  3853. malformed Date header field. Likewise, a proxy would not remove a
  3854. malformed Date header field before forwarding a request.
  3855. This protocol is designed to be extended. Future extensions may
  3856. define new methods and header fields at any time. An element MUST
  3857. NOT refuse to proxy a request because it contains a method or
  3858. header field it does not know about.
  3859. Rosenberg, et. al. Standards Track [Page 94]
  3860. RFC 3261 SIP: Session Initiation Protocol June 2002
  3861. 2. URI scheme check
  3862. If the Request-URI has a URI whose scheme is not understood by the
  3863. proxy, the proxy SHOULD reject the request with a 416 (Unsupported
  3864. URI Scheme) response.
  3865. 3. Max-Forwards check
  3866. The Max-Forwards header field (Section 20.22) is used to limit the
  3867. number of elements a SIP request can traverse.
  3868. If the request does not contain a Max-Forwards header field, this
  3869. check is passed.
  3870. If the request contains a Max-Forwards header field with a field
  3871. value greater than zero, the check is passed.
  3872. If the request contains a Max-Forwards header field with a field
  3873. value of zero (0), the element MUST NOT forward the request. If
  3874. the request was for OPTIONS, the element MAY act as the final
  3875. recipient and respond per Section 11. Otherwise, the element MUST
  3876. return a 483 (Too many hops) response.
  3877. 4. Optional Loop Detection check
  3878. An element MAY check for forwarding loops before forwarding a
  3879. request. If the request contains a Via header field with a sent-
  3880. by value that equals a value placed into previous requests by the
  3881. proxy, the request has been forwarded by this element before. The
  3882. request has either looped or is legitimately spiraling through the
  3883. element. To determine if the request has looped, the element MAY
  3884. perform the branch parameter calculation described in Step 8 of
  3885. Section 16.6 on this message and compare it to the parameter
  3886. received in that Via header field. If the parameters match, the
  3887. request has looped. If they differ, the request is spiraling, and
  3888. processing continues. If a loop is detected, the element MAY
  3889. return a 482 (Loop Detected) response.
  3890. 5. Proxy-Require check
  3891. Future extensions to this protocol may introduce features that
  3892. require special handling by proxies. Endpoints will include a
  3893. Proxy-Require header field in requests that use these features,
  3894. telling the proxy not to process the request unless the feature is
  3895. understood.
  3896. Rosenberg, et. al. Standards Track [Page 95]
  3897. RFC 3261 SIP: Session Initiation Protocol June 2002
  3898. If the request contains a Proxy-Require header field (Section
  3899. 20.29) with one or more option-tags this element does not
  3900. understand, the element MUST return a 420 (Bad Extension)
  3901. response. The response MUST include an Unsupported (Section
  3902. 20.40) header field listing those option-tags the element did not
  3903. understand.
  3904. 6. Proxy-Authorization check
  3905. If an element requires credentials before forwarding a request,
  3906. the request MUST be inspected as described in Section 22.3. That
  3907. section also defines what the element must do if the inspection
  3908. fails.
  3909. 16.4 Route Information Preprocessing
  3910. The proxy MUST inspect the Request-URI of the request. If the
  3911. Request-URI of the request contains a value this proxy previously
  3912. placed into a Record-Route header field (see Section 16.6 item 4),
  3913. the proxy MUST replace the Request-URI in the request with the last
  3914. value from the Route header field, and remove that value from the
  3915. Route header field. The proxy MUST then proceed as if it received
  3916. this modified request.
  3917. This will only happen when the element sending the request to the
  3918. proxy (which may have been an endpoint) is a strict router. This
  3919. rewrite on receive is necessary to enable backwards compatibility
  3920. with those elements. It also allows elements following this
  3921. specification to preserve the Request-URI through strict-routing
  3922. proxies (see Section 12.2.1.1).
  3923. This requirement does not obligate a proxy to keep state in order
  3924. to detect URIs it previously placed in Record-Route header fields.
  3925. Instead, a proxy need only place enough information in those URIs
  3926. to recognize them as values it provided when they later appear.
  3927. If the Request-URI contains a maddr parameter, the proxy MUST check
  3928. to see if its value is in the set of addresses or domains the proxy
  3929. is configured to be responsible for. If the Request-URI has a maddr
  3930. parameter with a value the proxy is responsible for, and the request
  3931. was received using the port and transport indicated (explicitly or by
  3932. default) in the Request-URI, the proxy MUST strip the maddr and any
  3933. non-default port or transport parameter and continue processing as if
  3934. those values had not been present in the request.
  3935. Rosenberg, et. al. Standards Track [Page 96]
  3936. RFC 3261 SIP: Session Initiation Protocol June 2002
  3937. A request may arrive with a maddr matching the proxy, but on a
  3938. port or transport different from that indicated in the URI. Such
  3939. a request needs to be forwarded to the proxy using the indicated
  3940. port and transport.
  3941. If the first value in the Route header field indicates this proxy,
  3942. the proxy MUST remove that value from the request.
  3943. 16.5 Determining Request Targets
  3944. Next, the proxy calculates the target(s) of the request. The set of
  3945. targets will either be predetermined by the contents of the request
  3946. or will be obtained from an abstract location service. Each target
  3947. in the set is represented as a URI.
  3948. If the Request-URI of the request contains an maddr parameter, the
  3949. Request-URI MUST be placed into the target set as the only target
  3950. URI, and the proxy MUST proceed to Section 16.6.
  3951. If the domain of the Request-URI indicates a domain this element is
  3952. not responsible for, the Request-URI MUST be placed into the target
  3953. set as the only target, and the element MUST proceed to the task of
  3954. Request Forwarding (Section 16.6).
  3955. There are many circumstances in which a proxy might receive a
  3956. request for a domain it is not responsible for. A firewall proxy
  3957. handling outgoing calls (the way HTTP proxies handle outgoing
  3958. requests) is an example of where this is likely to occur.
  3959. If the target set for the request has not been predetermined as
  3960. described above, this implies that the element is responsible for the
  3961. domain in the Request-URI, and the element MAY use whatever mechanism
  3962. it desires to determine where to send the request. Any of these
  3963. mechanisms can be modeled as accessing an abstract Location Service.
  3964. This may consist of obtaining information from a location service
  3965. created by a SIP Registrar, reading a database, consulting a presence
  3966. server, utilizing other protocols, or simply performing an
  3967. algorithmic substitution on the Request-URI. When accessing the
  3968. location service constructed by a registrar, the Request-URI MUST
  3969. first be canonicalized as described in Section 10.3 before being used
  3970. as an index. The output of these mechanisms is used to construct the
  3971. target set.
  3972. If the Request-URI does not provide sufficient information for the
  3973. proxy to determine the target set, it SHOULD return a 485 (Ambiguous)
  3974. response. This response SHOULD contain a Contact header field
  3975. containing URIs of new addresses to be tried. For example, an INVITE
  3976. Rosenberg, et. al. Standards Track [Page 97]
  3977. RFC 3261 SIP: Session Initiation Protocol June 2002
  3978. to sip:John.Smith@company.com may be ambiguous at a proxy whose
  3979. location service has multiple John Smiths listed. See Section
  3980. 21.4.23 for details.
  3981. Any information in or about the request or the current environment of
  3982. the element MAY be used in the construction of the target set. For
  3983. instance, different sets may be constructed depending on contents or
  3984. the presence of header fields and bodies, the time of day of the
  3985. request's arrival, the interface on which the request arrived,
  3986. failure of previous requests, or even the element's current level of
  3987. utilization.
  3988. As potential targets are located through these services, their URIs
  3989. are added to the target set. Targets can only be placed in the
  3990. target set once. If a target URI is already present in the set
  3991. (based on the definition of equality for the URI type), it MUST NOT
  3992. be added again.
  3993. A proxy MUST NOT add additional targets to the target set if the
  3994. Request-URI of the original request does not indicate a resource this
  3995. proxy is responsible for.
  3996. A proxy can only change the Request-URI of a request during
  3997. forwarding if it is responsible for that URI. If the proxy is not
  3998. responsible for that URI, it will not recurse on 3xx or 416
  3999. responses as described below.
  4000. If the Request-URI of the original request indicates a resource this
  4001. proxy is responsible for, the proxy MAY continue to add targets to
  4002. the set after beginning Request Forwarding. It MAY use any
  4003. information obtained during that processing to determine new targets.
  4004. For instance, a proxy may choose to incorporate contacts obtained in
  4005. a redirect response (3xx) into the target set. If a proxy uses a
  4006. dynamic source of information while building the target set (for
  4007. instance, if it consults a SIP Registrar), it SHOULD monitor that
  4008. source for the duration of processing the request. New locations
  4009. SHOULD be added to the target set as they become available. As
  4010. above, any given URI MUST NOT be added to the set more than once.
  4011. Allowing a URI to be added to the set only once reduces
  4012. unnecessary network traffic, and in the case of incorporating
  4013. contacts from redirect requests prevents infinite recursion.
  4014. For example, a trivial location service is a "no-op", where the
  4015. target URI is equal to the incoming request URI. The request is sent
  4016. to a specific next hop proxy for further processing. During request
  4017. Rosenberg, et. al. Standards Track [Page 98]
  4018. RFC 3261 SIP: Session Initiation Protocol June 2002
  4019. forwarding of Section 16.6, Item 6, the identity of that next hop,
  4020. expressed as a SIP or SIPS URI, is inserted as the top-most Route
  4021. header field value into the request.
  4022. If the Request-URI indicates a resource at this proxy that does not
  4023. exist, the proxy MUST return a 404 (Not Found) response.
  4024. If the target set remains empty after applying all of the above, the
  4025. proxy MUST return an error response, which SHOULD be the 480
  4026. (Temporarily Unavailable) response.
  4027. 16.6 Request Forwarding
  4028. As soon as the target set is non-empty, a proxy MAY begin forwarding
  4029. the request. A stateful proxy MAY process the set in any order. It
  4030. MAY process multiple targets serially, allowing each client
  4031. transaction to complete before starting the next. It MAY start
  4032. client transactions with every target in parallel. It also MAY
  4033. arbitrarily divide the set into groups, processing the groups
  4034. serially and processing the targets in each group in parallel.
  4035. A common ordering mechanism is to use the qvalue parameter of targets
  4036. obtained from Contact header fields (see Section 20.10). Targets are
  4037. processed from highest qvalue to lowest. Targets with equal qvalues
  4038. may be processed in parallel.
  4039. A stateful proxy must have a mechanism to maintain the target set as
  4040. responses are received and associate the responses to each forwarded
  4041. request with the original request. For the purposes of this model,
  4042. this mechanism is a "response context" created by the proxy layer
  4043. before forwarding the first request.
  4044. For each target, the proxy forwards the request following these
  4045. steps:
  4046. 1. Make a copy of the received request
  4047. 2. Update the Request-URI
  4048. 3. Update the Max-Forwards header field
  4049. 4. Optionally add a Record-route header field value
  4050. 5. Optionally add additional header fields
  4051. 6. Postprocess routing information
  4052. 7. Determine the next-hop address, port, and transport
  4053. Rosenberg, et. al. Standards Track [Page 99]
  4054. RFC 3261 SIP: Session Initiation Protocol June 2002
  4055. 8. Add a Via header field value
  4056. 9. Add a Content-Length header field if necessary
  4057. 10. Forward the new request
  4058. 11. Set timer C
  4059. Each of these steps is detailed below:
  4060. 1. Copy request
  4061. The proxy starts with a copy of the received request. The copy
  4062. MUST initially contain all of the header fields from the
  4063. received request. Fields not detailed in the processing
  4064. described below MUST NOT be removed. The copy SHOULD maintain
  4065. the ordering of the header fields as in the received request.
  4066. The proxy MUST NOT reorder field values with a common field
  4067. name (See Section 7.3.1). The proxy MUST NOT add to, modify,
  4068. or remove the message body.
  4069. An actual implementation need not perform a copy; the primary
  4070. requirement is that the processing for each next hop begin with
  4071. the same request.
  4072. 2. Request-URI
  4073. The Request-URI in the copy's start line MUST be replaced with
  4074. the URI for this target. If the URI contains any parameters
  4075. not allowed in a Request-URI, they MUST be removed.
  4076. This is the essence of a proxy's role. This is the mechanism
  4077. through which a proxy routes a request toward its destination.
  4078. In some circumstances, the received Request-URI is placed into
  4079. the target set without being modified. For that target, the
  4080. replacement above is effectively a no-op.
  4081. 3. Max-Forwards
  4082. If the copy contains a Max-Forwards header field, the proxy
  4083. MUST decrement its value by one (1).
  4084. If the copy does not contain a Max-Forwards header field, the
  4085. proxy MUST add one with a field value, which SHOULD be 70.
  4086. Some existing UAs will not provide a Max-Forwards header field
  4087. in a request.
  4088. Rosenberg, et. al. Standards Track [Page 100]
  4089. RFC 3261 SIP: Session Initiation Protocol June 2002
  4090. 4. Record-Route
  4091. If this proxy wishes to remain on the path of future requests
  4092. in a dialog created by this request (assuming the request
  4093. creates a dialog), it MUST insert a Record-Route header field
  4094. value into the copy before any existing Record-Route header
  4095. field values, even if a Route header field is already present.
  4096. Requests establishing a dialog may contain a preloaded Route
  4097. header field.
  4098. If this request is already part of a dialog, the proxy SHOULD
  4099. insert a Record-Route header field value if it wishes to remain
  4100. on the path of future requests in the dialog. In normal
  4101. endpoint operation as described in Section 12, these Record-
  4102. Route header field values will not have any effect on the route
  4103. sets used by the endpoints.
  4104. The proxy will remain on the path if it chooses to not insert a
  4105. Record-Route header field value into requests that are already
  4106. part of a dialog. However, it would be removed from the path
  4107. when an endpoint that has failed reconstitutes the dialog.
  4108. A proxy MAY insert a Record-Route header field value into any
  4109. request. If the request does not initiate a dialog, the
  4110. endpoints will ignore the value. See Section 12 for details on
  4111. how endpoints use the Record-Route header field values to
  4112. construct Route header fields.
  4113. Each proxy in the path of a request chooses whether to add a
  4114. Record-Route header field value independently - the presence of
  4115. a Record-Route header field in a request does not obligate this
  4116. proxy to add a value.
  4117. The URI placed in the Record-Route header field value MUST be a
  4118. SIP or SIPS URI. This URI MUST contain an lr parameter (see
  4119. Section 19.1.1). This URI MAY be different for each
  4120. destination the request is forwarded to. The URI SHOULD NOT
  4121. contain the transport parameter unless the proxy has knowledge
  4122. (such as in a private network) that the next downstream element
  4123. that will be in the path of subsequent requests supports that
  4124. transport.
  4125. The URI this proxy provides will be used by some other element
  4126. to make a routing decision. This proxy, in general, has no way
  4127. of knowing the capabilities of that element, so it must
  4128. restrict itself to the mandatory elements of a SIP
  4129. implementation: SIP URIs and either the TCP or UDP transports.
  4130. Rosenberg, et. al. Standards Track [Page 101]
  4131. RFC 3261 SIP: Session Initiation Protocol June 2002
  4132. The URI placed in the Record-Route header field MUST resolve to
  4133. the element inserting it (or a suitable stand-in) when the
  4134. server location procedures of [4] are applied to it, so that
  4135. subsequent requests reach the same SIP element. If the
  4136. Request-URI contains a SIPS URI, or the topmost Route header
  4137. field value (after the post processing of bullet 6) contains a
  4138. SIPS URI, the URI placed into the Record-Route header field
  4139. MUST be a SIPS URI. Furthermore, if the request was not
  4140. received over TLS, the proxy MUST insert a Record-Route header
  4141. field. In a similar fashion, a proxy that receives a request
  4142. over TLS, but generates a request without a SIPS URI in the
  4143. Request-URI or topmost Route header field value (after the post
  4144. processing of bullet 6), MUST insert a Record-Route header
  4145. field that is not a SIPS URI.
  4146. A proxy at a security perimeter must remain on the perimeter
  4147. throughout the dialog.
  4148. If the URI placed in the Record-Route header field needs to be
  4149. rewritten when it passes back through in a response, the URI
  4150. MUST be distinct enough to locate at that time. (The request
  4151. may spiral through this proxy, resulting in more than one
  4152. Record-Route header field value being added). Item 8 of
  4153. Section 16.7 recommends a mechanism to make the URI
  4154. sufficiently distinct.
  4155. The proxy MAY include parameters in the Record-Route header
  4156. field value. These will be echoed in some responses to the
  4157. request such as the 200 (OK) responses to INVITE. Such
  4158. parameters may be useful for keeping state in the message
  4159. rather than the proxy.
  4160. If a proxy needs to be in the path of any type of dialog (such
  4161. as one straddling a firewall), it SHOULD add a Record-Route
  4162. header field value to every request with a method it does not
  4163. understand since that method may have dialog semantics.
  4164. The URI a proxy places into a Record-Route header field is only
  4165. valid for the lifetime of any dialog created by the transaction
  4166. in which it occurs. A dialog-stateful proxy, for example, MAY
  4167. refuse to accept future requests with that value in the
  4168. Request-URI after the dialog has terminated. Non-dialog-
  4169. stateful proxies, of course, have no concept of when the dialog
  4170. has terminated, but they MAY encode enough information in the
  4171. value to compare it against the dialog identifier of future
  4172. requests and MAY reject requests not matching that information.
  4173. Endpoints MUST NOT use a URI obtained from a Record-Route
  4174. header field outside the dialog in which it was provided. See
  4175. Rosenberg, et. al. Standards Track [Page 102]
  4176. RFC 3261 SIP: Session Initiation Protocol June 2002
  4177. Section 12 for more information on an endpoint's use of
  4178. Record-Route header fields.
  4179. Record-routing may be required by certain services where the
  4180. proxy needs to observe all messages in a dialog. However, it
  4181. slows down processing and impairs scalability and thus proxies
  4182. should only record-route if required for a particular service.
  4183. The Record-Route process is designed to work for any SIP
  4184. request that initiates a dialog. INVITE is the only such
  4185. request in this specification, but extensions to the protocol
  4186. MAY define others.
  4187. 5. Add Additional Header Fields
  4188. The proxy MAY add any other appropriate header fields to the
  4189. copy at this point.
  4190. 6. Postprocess routing information
  4191. A proxy MAY have a local policy that mandates that a request
  4192. visit a specific set of proxies before being delivered to the
  4193. destination. A proxy MUST ensure that all such proxies are
  4194. loose routers. Generally, this can only be known with
  4195. certainty if the proxies are within the same administrative
  4196. domain. This set of proxies is represented by a set of URIs
  4197. (each of which contains the lr parameter). This set MUST be
  4198. pushed into the Route header field of the copy ahead of any
  4199. existing values, if present. If the Route header field is
  4200. absent, it MUST be added, containing that list of URIs.
  4201. If the proxy has a local policy that mandates that the request
  4202. visit one specific proxy, an alternative to pushing a Route
  4203. value into the Route header field is to bypass the forwarding
  4204. logic of item 10 below, and instead just send the request to
  4205. the address, port, and transport for that specific proxy. If
  4206. the request has a Route header field, this alternative MUST NOT
  4207. be used unless it is known that next hop proxy is a loose
  4208. router. Otherwise, this approach MAY be used, but the Route
  4209. insertion mechanism above is preferred for its robustness,
  4210. flexibility, generality and consistency of operation.
  4211. Furthermore, if the Request-URI contains a SIPS URI, TLS MUST
  4212. be used to communicate with that proxy.
  4213. If the copy contains a Route header field, the proxy MUST
  4214. inspect the URI in its first value. If that URI does not
  4215. contain an lr parameter, the proxy MUST modify the copy as
  4216. follows:
  4217. Rosenberg, et. al. Standards Track [Page 103]
  4218. RFC 3261 SIP: Session Initiation Protocol June 2002
  4219. - The proxy MUST place the Request-URI into the Route header
  4220. field as the last value.
  4221. - The proxy MUST then place the first Route header field value
  4222. into the Request-URI and remove that value from the Route
  4223. header field.
  4224. Appending the Request-URI to the Route header field is part of
  4225. a mechanism used to pass the information in that Request-URI
  4226. through strict-routing elements. "Popping" the first Route
  4227. header field value into the Request-URI formats the message the
  4228. way a strict-routing element expects to receive it (with its
  4229. own URI in the Request-URI and the next location to visit in
  4230. the first Route header field value).
  4231. 7. Determine Next-Hop Address, Port, and Transport
  4232. The proxy MAY have a local policy to send the request to a
  4233. specific IP address, port, and transport, independent of the
  4234. values of the Route and Request-URI. Such a policy MUST NOT be
  4235. used if the proxy is not certain that the IP address, port, and
  4236. transport correspond to a server that is a loose router.
  4237. However, this mechanism for sending the request through a
  4238. specific next hop is NOT RECOMMENDED; instead a Route header
  4239. field should be used for that purpose as described above.
  4240. In the absence of such an overriding mechanism, the proxy
  4241. applies the procedures listed in [4] as follows to determine
  4242. where to send the request. If the proxy has reformatted the
  4243. request to send to a strict-routing element as described in
  4244. step 6 above, the proxy MUST apply those procedures to the
  4245. Request-URI of the request. Otherwise, the proxy MUST apply
  4246. the procedures to the first value in the Route header field, if
  4247. present, else the Request-URI. The procedures will produce an
  4248. ordered set of (address, port, transport) tuples.
  4249. Independently of which URI is being used as input to the
  4250. procedures of [4], if the Request-URI specifies a SIPS
  4251. resource, the proxy MUST follow the procedures of [4] as if the
  4252. input URI were a SIPS URI.
  4253. As described in [4], the proxy MUST attempt to deliver the
  4254. message to the first tuple in that set, and proceed through the
  4255. set in order until the delivery attempt succeeds.
  4256. For each tuple attempted, the proxy MUST format the message as
  4257. appropriate for the tuple and send the request using a new
  4258. client transaction as detailed in steps 8 through 10.
  4259. Rosenberg, et. al. Standards Track [Page 104]
  4260. RFC 3261 SIP: Session Initiation Protocol June 2002
  4261. Since each attempt uses a new client transaction, it represents
  4262. a new branch. Thus, the branch parameter provided with the Via
  4263. header field inserted in step 8 MUST be different for each
  4264. attempt.
  4265. If the client transaction reports failure to send the request
  4266. or a timeout from its state machine, the proxy continues to the
  4267. next address in that ordered set. If the ordered set is
  4268. exhausted, the request cannot be forwarded to this element in
  4269. the target set. The proxy does not need to place anything in
  4270. the response context, but otherwise acts as if this element of
  4271. the target set returned a 408 (Request Timeout) final response.
  4272. 8. Add a Via header field value
  4273. The proxy MUST insert a Via header field value into the copy
  4274. before the existing Via header field values. The construction
  4275. of this value follows the same guidelines of Section 8.1.1.7.
  4276. This implies that the proxy will compute its own branch
  4277. parameter, which will be globally unique for that branch, and
  4278. contain the requisite magic cookie. Note that this implies that
  4279. the branch parameter will be different for different instances
  4280. of a spiraled or looped request through a proxy.
  4281. Proxies choosing to detect loops have an additional constraint
  4282. in the value they use for construction of the branch parameter.
  4283. A proxy choosing to detect loops SHOULD create a branch
  4284. parameter separable into two parts by the implementation. The
  4285. first part MUST satisfy the constraints of Section 8.1.1.7 as
  4286. described above. The second is used to perform loop detection
  4287. and distinguish loops from spirals.
  4288. Loop detection is performed by verifying that, when a request
  4289. returns to a proxy, those fields having an impact on the
  4290. processing of the request have not changed. The value placed
  4291. in this part of the branch parameter SHOULD reflect all of
  4292. those fields (including any Route, Proxy-Require and Proxy-
  4293. Authorization header fields). This is to ensure that if the
  4294. request is routed back to the proxy and one of those fields
  4295. changes, it is treated as a spiral and not a loop (see Section
  4296. 16.3). A common way to create this value is to compute a
  4297. cryptographic hash of the To tag, From tag, Call-ID header
  4298. field, the Request-URI of the request received (before
  4299. translation), the topmost Via header, and the sequence number
  4300. from the CSeq header field, in addition to any Proxy-Require
  4301. and Proxy-Authorization header fields that may be present. The
  4302. Rosenberg, et. al. Standards Track [Page 105]
  4303. RFC 3261 SIP: Session Initiation Protocol June 2002
  4304. algorithm used to compute the hash is implementation-dependent,
  4305. but MD5 (RFC 1321 [35]), expressed in hexadecimal, is a
  4306. reasonable choice. (Base64 is not permissible for a token.)
  4307. If a proxy wishes to detect loops, the "branch" parameter it
  4308. supplies MUST depend on all information affecting processing of
  4309. a request, including the incoming Request-URI and any header
  4310. fields affecting the request's admission or routing. This is
  4311. necessary to distinguish looped requests from requests whose
  4312. routing parameters have changed before returning to this
  4313. server.
  4314. The request method MUST NOT be included in the calculation of
  4315. the branch parameter. In particular, CANCEL and ACK requests
  4316. (for non-2xx responses) MUST have the same branch value as the
  4317. corresponding request they cancel or acknowledge. The branch
  4318. parameter is used in correlating those requests at the server
  4319. handling them (see Sections 17.2.3 and 9.2).
  4320. 9. Add a Content-Length header field if necessary
  4321. If the request will be sent to the next hop using a stream-
  4322. based transport and the copy contains no Content-Length header
  4323. field, the proxy MUST insert one with the correct value for the
  4324. body of the request (see Section 20.14).
  4325. 10. Forward Request
  4326. A stateful proxy MUST create a new client transaction for this
  4327. request as described in Section 17.1 and instructs the
  4328. transaction to send the request using the address, port and
  4329. transport determined in step 7.
  4330. 11. Set timer C
  4331. In order to handle the case where an INVITE request never
  4332. generates a final response, the TU uses a timer which is called
  4333. timer C. Timer C MUST be set for each client transaction when
  4334. an INVITE request is proxied. The timer MUST be larger than 3
  4335. minutes. Section 16.7 bullet 2 discusses how this timer is
  4336. updated with provisional responses, and Section 16.8 discusses
  4337. processing when it fires.
  4338. Rosenberg, et. al. Standards Track [Page 106]
  4339. RFC 3261 SIP: Session Initiation Protocol June 2002
  4340. 16.7 Response Processing
  4341. When a response is received by an element, it first tries to locate a
  4342. client transaction (Section 17.1.3) matching the response. If none
  4343. is found, the element MUST process the response (even if it is an
  4344. informational response) as a stateless proxy (described below). If a
  4345. match is found, the response is handed to the client transaction.
  4346. Forwarding responses for which a client transaction (or more
  4347. generally any knowledge of having sent an associated request) is
  4348. not found improves robustness. In particular, it ensures that
  4349. "late" 2xx responses to INVITE requests are forwarded properly.
  4350. As client transactions pass responses to the proxy layer, the
  4351. following processing MUST take place:
  4352. 1. Find the appropriate response context
  4353. 2. Update timer C for provisional responses
  4354. 3. Remove the topmost Via
  4355. 4. Add the response to the response context
  4356. 5. Check to see if this response should be forwarded immediately
  4357. 6. When necessary, choose the best final response from the
  4358. response context
  4359. If no final response has been forwarded after every client
  4360. transaction associated with the response context has been terminated,
  4361. the proxy must choose and forward the "best" response from those it
  4362. has seen so far.
  4363. The following processing MUST be performed on each response that is
  4364. forwarded. It is likely that more than one response to each request
  4365. will be forwarded: at least each provisional and one final response.
  4366. 7. Aggregate authorization header field values if necessary
  4367. 8. Optionally rewrite Record-Route header field values
  4368. 9. Forward the response
  4369. 10. Generate any necessary CANCEL requests
  4370. Rosenberg, et. al. Standards Track [Page 107]
  4371. RFC 3261 SIP: Session Initiation Protocol June 2002
  4372. Each of the above steps are detailed below:
  4373. 1. Find Context
  4374. The proxy locates the "response context" it created before
  4375. forwarding the original request using the key described in
  4376. Section 16.6. The remaining processing steps take place in
  4377. this context.
  4378. 2. Update timer C for provisional responses
  4379. For an INVITE transaction, if the response is a provisional
  4380. response with status codes 101 to 199 inclusive (i.e., anything
  4381. but 100), the proxy MUST reset timer C for that client
  4382. transaction. The timer MAY be reset to a different value, but
  4383. this value MUST be greater than 3 minutes.
  4384. 3. Via
  4385. The proxy removes the topmost Via header field value from the
  4386. response.
  4387. If no Via header field values remain in the response, the
  4388. response was meant for this element and MUST NOT be forwarded.
  4389. The remainder of the processing described in this section is
  4390. not performed on this message, the UAC processing rules
  4391. described in Section 8.1.3 are followed instead (transport
  4392. layer processing has already occurred).
  4393. This will happen, for instance, when the element generates
  4394. CANCEL requests as described in Section 10.
  4395. 4. Add response to context
  4396. Final responses received are stored in the response context
  4397. until a final response is generated on the server transaction
  4398. associated with this context. The response may be a candidate
  4399. for the best final response to be returned on that server
  4400. transaction. Information from this response may be needed in
  4401. forming the best response, even if this response is not chosen.
  4402. If the proxy chooses to recurse on any contacts in a 3xx
  4403. response by adding them to the target set, it MUST remove them
  4404. from the response before adding the response to the response
  4405. context. However, a proxy SHOULD NOT recurse to a non-SIPS URI
  4406. if the Request-URI of the original request was a SIPS URI. If
  4407. Rosenberg, et. al. Standards Track [Page 108]
  4408. RFC 3261 SIP: Session Initiation Protocol June 2002
  4409. the proxy recurses on all of the contacts in a 3xx response,
  4410. the proxy SHOULD NOT add the resulting contactless response to
  4411. the response context.
  4412. Removing the contact before adding the response to the response
  4413. context prevents the next element upstream from retrying a
  4414. location this proxy has already attempted.
  4415. 3xx responses may contain a mixture of SIP, SIPS, and non-SIP
  4416. URIs. A proxy may choose to recurse on the SIP and SIPS URIs
  4417. and place the remainder into the response context to be
  4418. returned, potentially in the final response.
  4419. If a proxy receives a 416 (Unsupported URI Scheme) response to
  4420. a request whose Request-URI scheme was not SIP, but the scheme
  4421. in the original received request was SIP or SIPS (that is, the
  4422. proxy changed the scheme from SIP or SIPS to something else
  4423. when it proxied a request), the proxy SHOULD add a new URI to
  4424. the target set. This URI SHOULD be a SIP URI version of the
  4425. non-SIP URI that was just tried. In the case of the tel URL,
  4426. this is accomplished by placing the telephone-subscriber part
  4427. of the tel URL into the user part of the SIP URI, and setting
  4428. the hostpart to the domain where the prior request was sent.
  4429. See Section 19.1.6 for more detail on forming SIP URIs from tel
  4430. URLs.
  4431. As with a 3xx response, if a proxy "recurses" on the 416 by
  4432. trying a SIP or SIPS URI instead, the 416 response SHOULD NOT
  4433. be added to the response context.
  4434. 5. Check response for forwarding
  4435. Until a final response has been sent on the server transaction,
  4436. the following responses MUST be forwarded immediately:
  4437. - Any provisional response other than 100 (Trying)
  4438. - Any 2xx response
  4439. If a 6xx response is received, it is not immediately forwarded,
  4440. but the stateful proxy SHOULD cancel all client pending
  4441. transactions as described in Section 10, and it MUST NOT create
  4442. any new branches in this context.
  4443. This is a change from RFC 2543, which mandated that the proxy
  4444. was to forward the 6xx response immediately. For an INVITE
  4445. transaction, this approach had the problem that a 2xx response
  4446. could arrive on another branch, in which case the proxy would
  4447. Rosenberg, et. al. Standards Track [Page 109]
  4448. RFC 3261 SIP: Session Initiation Protocol June 2002
  4449. have to forward the 2xx. The result was that the UAC could
  4450. receive a 6xx response followed by a 2xx response, which should
  4451. never be allowed to happen. Under the new rules, upon
  4452. receiving a 6xx, a proxy will issue a CANCEL request, which
  4453. will generally result in 487 responses from all outstanding
  4454. client transactions, and then at that point the 6xx is
  4455. forwarded upstream.
  4456. After a final response has been sent on the server transaction,
  4457. the following responses MUST be forwarded immediately:
  4458. - Any 2xx response to an INVITE request
  4459. A stateful proxy MUST NOT immediately forward any other
  4460. responses. In particular, a stateful proxy MUST NOT forward
  4461. any 100 (Trying) response. Those responses that are candidates
  4462. for forwarding later as the "best" response have been gathered
  4463. as described in step "Add Response to Context".
  4464. Any response chosen for immediate forwarding MUST be processed
  4465. as described in steps "Aggregate Authorization Header Field
  4466. Values" through "Record-Route".
  4467. This step, combined with the next, ensures that a stateful
  4468. proxy will forward exactly one final response to a non-INVITE
  4469. request, and either exactly one non-2xx response or one or more
  4470. 2xx responses to an INVITE request.
  4471. 6. Choosing the best response
  4472. A stateful proxy MUST send a final response to a response
  4473. context's server transaction if no final responses have been
  4474. immediately forwarded by the above rules and all client
  4475. transactions in this response context have been terminated.
  4476. The stateful proxy MUST choose the "best" final response among
  4477. those received and stored in the response context.
  4478. If there are no final responses in the context, the proxy MUST
  4479. send a 408 (Request Timeout) response to the server
  4480. transaction.
  4481. Otherwise, the proxy MUST forward a response from the responses
  4482. stored in the response context. It MUST choose from the 6xx
  4483. class responses if any exist in the context. If no 6xx class
  4484. responses are present, the proxy SHOULD choose from the lowest
  4485. response class stored in the response context. The proxy MAY
  4486. select any response within that chosen class. The proxy SHOULD
  4487. Rosenberg, et. al. Standards Track [Page 110]
  4488. RFC 3261 SIP: Session Initiation Protocol June 2002
  4489. give preference to responses that provide information affecting
  4490. resubmission of this request, such as 401, 407, 415, 420, and
  4491. 484 if the 4xx class is chosen.
  4492. A proxy which receives a 503 (Service Unavailable) response
  4493. SHOULD NOT forward it upstream unless it can determine that any
  4494. subsequent requests it might proxy will also generate a 503.
  4495. In other words, forwarding a 503 means that the proxy knows it
  4496. cannot service any requests, not just the one for the Request-
  4497. URI in the request which generated the 503. If the only
  4498. response that was received is a 503, the proxy SHOULD generate
  4499. a 500 response and forward that upstream.
  4500. The forwarded response MUST be processed as described in steps
  4501. "Aggregate Authorization Header Field Values" through "Record-
  4502. Route".
  4503. For example, if a proxy forwarded a request to 4 locations, and
  4504. received 503, 407, 501, and 404 responses, it may choose to
  4505. forward the 407 (Proxy Authentication Required) response.
  4506. 1xx and 2xx responses may be involved in the establishment of
  4507. dialogs. When a request does not contain a To tag, the To tag
  4508. in the response is used by the UAC to distinguish multiple
  4509. responses to a dialog creating request. A proxy MUST NOT
  4510. insert a tag into the To header field of a 1xx or 2xx response
  4511. if the request did not contain one. A proxy MUST NOT modify
  4512. the tag in the To header field of a 1xx or 2xx response.
  4513. Since a proxy may not insert a tag into the To header field of
  4514. a 1xx response to a request that did not contain one, it cannot
  4515. issue non-100 provisional responses on its own. However, it
  4516. can branch the request to a UAS sharing the same element as the
  4517. proxy. This UAS can return its own provisional responses,
  4518. entering into an early dialog with the initiator of the
  4519. request. The UAS does not have to be a discreet process from
  4520. the proxy. It could be a virtual UAS implemented in the same
  4521. code space as the proxy.
  4522. 3-6xx responses are delivered hop-by-hop. When issuing a 3-6xx
  4523. response, the element is effectively acting as a UAS, issuing
  4524. its own response, usually based on the responses received from
  4525. downstream elements. An element SHOULD preserve the To tag
  4526. when simply forwarding a 3-6xx response to a request that did
  4527. not contain a To tag.
  4528. A proxy MUST NOT modify the To tag in any forwarded response to
  4529. a request that contains a To tag.
  4530. Rosenberg, et. al. Standards Track [Page 111]
  4531. RFC 3261 SIP: Session Initiation Protocol June 2002
  4532. While it makes no difference to the upstream elements if the
  4533. proxy replaced the To tag in a forwarded 3-6xx response,
  4534. preserving the original tag may assist with debugging.
  4535. When the proxy is aggregating information from several
  4536. responses, choosing a To tag from among them is arbitrary, and
  4537. generating a new To tag may make debugging easier. This
  4538. happens, for instance, when combining 401 (Unauthorized) and
  4539. 407 (Proxy Authentication Required) challenges, or combining
  4540. Contact values from unencrypted and unauthenticated 3xx
  4541. responses.
  4542. 7. Aggregate Authorization Header Field Values
  4543. If the selected response is a 401 (Unauthorized) or 407 (Proxy
  4544. Authentication Required), the proxy MUST collect any WWW-
  4545. Authenticate and Proxy-Authenticate header field values from
  4546. all other 401 (Unauthorized) and 407 (Proxy Authentication
  4547. Required) responses received so far in this response context
  4548. and add them to this response without modification before
  4549. forwarding. The resulting 401 (Unauthorized) or 407 (Proxy
  4550. Authentication Required) response could have several WWW-
  4551. Authenticate AND Proxy-Authenticate header field values.
  4552. This is necessary because any or all of the destinations the
  4553. request was forwarded to may have requested credentials. The
  4554. client needs to receive all of those challenges and supply
  4555. credentials for each of them when it retries the request.
  4556. Motivation for this behavior is provided in Section 26.
  4557. 8. Record-Route
  4558. If the selected response contains a Record-Route header field
  4559. value originally provided by this proxy, the proxy MAY choose
  4560. to rewrite the value before forwarding the response. This
  4561. allows the proxy to provide different URIs for itself to the
  4562. next upstream and downstream elements. A proxy may choose to
  4563. use this mechanism for any reason. For instance, it is useful
  4564. for multi-homed hosts.
  4565. If the proxy received the request over TLS, and sent it out
  4566. over a non-TLS connection, the proxy MUST rewrite the URI in
  4567. the Record-Route header field to be a SIPS URI. If the proxy
  4568. received the request over a non-TLS connection, and sent it out
  4569. over TLS, the proxy MUST rewrite the URI in the Record-Route
  4570. header field to be a SIP URI.
  4571. Rosenberg, et. al. Standards Track [Page 112]
  4572. RFC 3261 SIP: Session Initiation Protocol June 2002
  4573. The new URI provided by the proxy MUST satisfy the same
  4574. constraints on URIs placed in Record-Route header fields in
  4575. requests (see Step 4 of Section 16.6) with the following
  4576. modifications:
  4577. The URI SHOULD NOT contain the transport parameter unless the
  4578. proxy has knowledge that the next upstream (as opposed to
  4579. downstream) element that will be in the path of subsequent
  4580. requests supports that transport.
  4581. When a proxy does decide to modify the Record-Route header
  4582. field in the response, one of the operations it performs is
  4583. locating the Record-Route value that it had inserted. If the
  4584. request spiraled, and the proxy inserted a Record-Route value
  4585. in each iteration of the spiral, locating the correct value in
  4586. the response (which must be the proper iteration in the reverse
  4587. direction) is tricky. The rules above recommend that a proxy
  4588. wishing to rewrite Record-Route header field values insert
  4589. sufficiently distinct URIs into the Record-Route header field
  4590. so that the right one may be selected for rewriting. A
  4591. RECOMMENDED mechanism to achieve this is for the proxy to
  4592. append a unique identifier for the proxy instance to the user
  4593. portion of the URI.
  4594. When the response arrives, the proxy modifies the first
  4595. Record-Route whose identifier matches the proxy instance. The
  4596. modification results in a URI without this piece of data
  4597. appended to the user portion of the URI. Upon the next
  4598. iteration, the same algorithm (find the topmost Record-Route
  4599. header field value with the parameter) will correctly extract
  4600. the next Record-Route header field value inserted by that
  4601. proxy.
  4602. Not every response to a request to which a proxy adds a
  4603. Record-Route header field value will contain a Record-Route
  4604. header field. If the response does contain a Record-Route
  4605. header field, it will contain the value the proxy added.
  4606. 9. Forward response
  4607. After performing the processing described in steps "Aggregate
  4608. Authorization Header Field Values" through "Record-Route", the
  4609. proxy MAY perform any feature specific manipulations on the
  4610. selected response. The proxy MUST NOT add to, modify, or
  4611. remove the message body. Unless otherwise specified, the proxy
  4612. MUST NOT remove any header field values other than the Via
  4613. header field value discussed in Section 16.7 Item 3. In
  4614. particular, the proxy MUST NOT remove any "received" parameter
  4615. Rosenberg, et. al. Standards Track [Page 113]
  4616. RFC 3261 SIP: Session Initiation Protocol June 2002
  4617. it may have added to the next Via header field value while
  4618. processing the request associated with this response. The
  4619. proxy MUST pass the response to the server transaction
  4620. associated with the response context. This will result in the
  4621. response being sent to the location now indicated in the
  4622. topmost Via header field value. If the server transaction is
  4623. no longer available to handle the transmission, the element
  4624. MUST forward the response statelessly by sending it to the
  4625. server transport. The server transaction might indicate
  4626. failure to send the response or signal a timeout in its state
  4627. machine. These errors would be logged for diagnostic purposes
  4628. as appropriate, but the protocol requires no remedial action
  4629. from the proxy.
  4630. The proxy MUST maintain the response context until all of its
  4631. associated transactions have been terminated, even after
  4632. forwarding a final response.
  4633. 10. Generate CANCELs
  4634. If the forwarded response was a final response, the proxy MUST
  4635. generate a CANCEL request for all pending client transactions
  4636. associated with this response context. A proxy SHOULD also
  4637. generate a CANCEL request for all pending client transactions
  4638. associated with this response context when it receives a 6xx
  4639. response. A pending client transaction is one that has
  4640. received a provisional response, but no final response (it is
  4641. in the proceeding state) and has not had an associated CANCEL
  4642. generated for it. Generating CANCEL requests is described in
  4643. Section 9.1.
  4644. The requirement to CANCEL pending client transactions upon
  4645. forwarding a final response does not guarantee that an endpoint
  4646. will not receive multiple 200 (OK) responses to an INVITE. 200
  4647. (OK) responses on more than one branch may be generated before
  4648. the CANCEL requests can be sent and processed. Further, it is
  4649. reasonable to expect that a future extension may override this
  4650. requirement to issue CANCEL requests.
  4651. 16.8 Processing Timer C
  4652. If timer C should fire, the proxy MUST either reset the timer with
  4653. any value it chooses, or terminate the client transaction. If the
  4654. client transaction has received a provisional response, the proxy
  4655. MUST generate a CANCEL request matching that transaction. If the
  4656. client transaction has not received a provisional response, the proxy
  4657. MUST behave as if the transaction received a 408 (Request Timeout)
  4658. response.
  4659. Rosenberg, et. al. Standards Track [Page 114]
  4660. RFC 3261 SIP: Session Initiation Protocol June 2002
  4661. Allowing the proxy to reset the timer allows the proxy to dynamically
  4662. extend the transaction's lifetime based on current conditions (such
  4663. as utilization) when the timer fires.
  4664. 16.9 Handling Transport Errors
  4665. If the transport layer notifies a proxy of an error when it tries to
  4666. forward a request (see Section 18.4), the proxy MUST behave as if the
  4667. forwarded request received a 503 (Service Unavailable) response.
  4668. If the proxy is notified of an error when forwarding a response, it
  4669. drops the response. The proxy SHOULD NOT cancel any outstanding
  4670. client transactions associated with this response context due to this
  4671. notification.
  4672. If a proxy cancels its outstanding client transactions, a single
  4673. malicious or misbehaving client can cause all transactions to fail
  4674. through its Via header field.
  4675. 16.10 CANCEL Processing
  4676. A stateful proxy MAY generate a CANCEL to any other request it has
  4677. generated at any time (subject to receiving a provisional response to
  4678. that request as described in section 9.1). A proxy MUST cancel any
  4679. pending client transactions associated with a response context when
  4680. it receives a matching CANCEL request.
  4681. A stateful proxy MAY generate CANCEL requests for pending INVITE
  4682. client transactions based on the period specified in the INVITE's
  4683. Expires header field elapsing. However, this is generally
  4684. unnecessary since the endpoints involved will take care of signaling
  4685. the end of the transaction.
  4686. While a CANCEL request is handled in a stateful proxy by its own
  4687. server transaction, a new response context is not created for it.
  4688. Instead, the proxy layer searches its existing response contexts for
  4689. the server transaction handling the request associated with this
  4690. CANCEL. If a matching response context is found, the element MUST
  4691. immediately return a 200 (OK) response to the CANCEL request. In
  4692. this case, the element is acting as a user agent server as defined in
  4693. Section 8.2. Furthermore, the element MUST generate CANCEL requests
  4694. for all pending client transactions in the context as described in
  4695. Section 16.7 step 10.
  4696. If a response context is not found, the element does not have any
  4697. knowledge of the request to apply the CANCEL to. It MUST statelessly
  4698. forward the CANCEL request (it may have statelessly forwarded the
  4699. associated request previously).
  4700. Rosenberg, et. al. Standards Track [Page 115]
  4701. RFC 3261 SIP: Session Initiation Protocol June 2002
  4702. 16.11 Stateless Proxy
  4703. When acting statelessly, a proxy is a simple message forwarder. Much
  4704. of the processing performed when acting statelessly is the same as
  4705. when behaving statefully. The differences are detailed here.
  4706. A stateless proxy does not have any notion of a transaction, or of
  4707. the response context used to describe stateful proxy behavior.
  4708. Instead, the stateless proxy takes messages, both requests and
  4709. responses, directly from the transport layer (See section 18). As a
  4710. result, stateless proxies do not retransmit messages on their own.
  4711. They do, however, forward all retransmissions they receive (they do
  4712. not have the ability to distinguish a retransmission from the
  4713. original message). Furthermore, when handling a request statelessly,
  4714. an element MUST NOT generate its own 100 (Trying) or any other
  4715. provisional response.
  4716. A stateless proxy MUST validate a request as described in Section
  4717. 16.3
  4718. A stateless proxy MUST follow the request processing steps described
  4719. in Sections 16.4 through 16.5 with the following exception:
  4720. o A stateless proxy MUST choose one and only one target from the
  4721. target set. This choice MUST only rely on fields in the
  4722. message and time-invariant properties of the server. In
  4723. particular, a retransmitted request MUST be forwarded to the
  4724. same destination each time it is processed. Furthermore,
  4725. CANCEL and non-Routed ACK requests MUST generate the same
  4726. choice as their associated INVITE.
  4727. A stateless proxy MUST follow the request processing steps described
  4728. in Section 16.6 with the following exceptions:
  4729. o The requirement for unique branch IDs across space and time
  4730. applies to stateless proxies as well. However, a stateless
  4731. proxy cannot simply use a random number generator to compute
  4732. the first component of the branch ID, as described in Section
  4733. 16.6 bullet 8. This is because retransmissions of a request
  4734. need to have the same value, and a stateless proxy cannot tell
  4735. a retransmission from the original request. Therefore, the
  4736. component of the branch parameter that makes it unique MUST be
  4737. the same each time a retransmitted request is forwarded. Thus
  4738. for a stateless proxy, the branch parameter MUST be computed as
  4739. a combinatoric function of message parameters which are
  4740. invariant on retransmission.
  4741. Rosenberg, et. al. Standards Track [Page 116]
  4742. RFC 3261 SIP: Session Initiation Protocol June 2002
  4743. The stateless proxy MAY use any technique it likes to guarantee
  4744. uniqueness of its branch IDs across transactions. However, the
  4745. following procedure is RECOMMENDED. The proxy examines the
  4746. branch ID in the topmost Via header field of the received
  4747. request. If it begins with the magic cookie, the first
  4748. component of the branch ID of the outgoing request is computed
  4749. as a hash of the received branch ID. Otherwise, the first
  4750. component of the branch ID is computed as a hash of the topmost
  4751. Via, the tag in the To header field, the tag in the From header
  4752. field, the Call-ID header field, the CSeq number (but not
  4753. method), and the Request-URI from the received request. One of
  4754. these fields will always vary across two different
  4755. transactions.
  4756. o All other message transformations specified in Section 16.6
  4757. MUST result in the same transformation of a retransmitted
  4758. request. In particular, if the proxy inserts a Record-Route
  4759. value or pushes URIs into the Route header field, it MUST place
  4760. the same values in retransmissions of the request. As for the
  4761. Via branch parameter, this implies that the transformations
  4762. MUST be based on time-invariant configuration or
  4763. retransmission-invariant properties of the request.
  4764. o A stateless proxy determines where to forward the request as
  4765. described for stateful proxies in Section 16.6 Item 10. The
  4766. request is sent directly to the transport layer instead of
  4767. through a client transaction.
  4768. Since a stateless proxy must forward retransmitted requests to
  4769. the same destination and add identical branch parameters to
  4770. each of them, it can only use information from the message
  4771. itself and time-invariant configuration data for those
  4772. calculations. If the configuration state is not time-invariant
  4773. (for example, if a routing table is updated) any requests that
  4774. could be affected by the change may not be forwarded
  4775. statelessly during an interval equal to the transaction timeout
  4776. window before or after the change. The method of processing
  4777. the affected requests in that interval is an implementation
  4778. decision. A common solution is to forward them transaction
  4779. statefully.
  4780. Stateless proxies MUST NOT perform special processing for CANCEL
  4781. requests. They are processed by the above rules as any other
  4782. requests. In particular, a stateless proxy applies the same Route
  4783. header field processing to CANCEL requests that it applies to any
  4784. other request.
  4785. Rosenberg, et. al. Standards Track [Page 117]
  4786. RFC 3261 SIP: Session Initiation Protocol June 2002
  4787. Response processing as described in Section 16.7 does not apply to a
  4788. proxy behaving statelessly. When a response arrives at a stateless
  4789. proxy, the proxy MUST inspect the sent-by value in the first
  4790. (topmost) Via header field value. If that address matches the proxy,
  4791. (it equals a value this proxy has inserted into previous requests)
  4792. the proxy MUST remove that header field value from the response and
  4793. forward the result to the location indicated in the next Via header
  4794. field value. The proxy MUST NOT add to, modify, or remove the
  4795. message body. Unless specified otherwise, the proxy MUST NOT remove
  4796. any other header field values. If the address does not match the
  4797. proxy, the message MUST be silently discarded.
  4798. 16.12 Summary of Proxy Route Processing
  4799. In the absence of local policy to the contrary, the processing a
  4800. proxy performs on a request containing a Route header field can be
  4801. summarized in the following steps.
  4802. 1. The proxy will inspect the Request-URI. If it indicates a
  4803. resource owned by this proxy, the proxy will replace it with
  4804. the results of running a location service. Otherwise, the
  4805. proxy will not change the Request-URI.
  4806. 2. The proxy will inspect the URI in the topmost Route header
  4807. field value. If it indicates this proxy, the proxy removes it
  4808. from the Route header field (this route node has been
  4809. reached).
  4810. 3. The proxy will forward the request to the resource indicated
  4811. by the URI in the topmost Route header field value or in the
  4812. Request-URI if no Route header field is present. The proxy
  4813. determines the address, port and transport to use when
  4814. forwarding the request by applying the procedures in [4] to
  4815. that URI.
  4816. If no strict-routing elements are encountered on the path of the
  4817. request, the Request-URI will always indicate the target of the
  4818. request.
  4819. 16.12.1 Examples
  4820. 16.12.1.1 Basic SIP Trapezoid
  4821. This scenario is the basic SIP trapezoid, U1 -> P1 -> P2 -> U2, with
  4822. both proxies record-routing. Here is the flow.
  4823. Rosenberg, et. al. Standards Track [Page 118]
  4824. RFC 3261 SIP: Session Initiation Protocol June 2002
  4825. U1 sends:
  4826. INVITE sip:callee@domain.com SIP/2.0
  4827. Contact: sip:caller@u1.example.com
  4828. to P1. P1 is an outbound proxy. P1 is not responsible for
  4829. domain.com, so it looks it up in DNS and sends it there. It also
  4830. adds a Record-Route header field value:
  4831. INVITE sip:callee@domain.com SIP/2.0
  4832. Contact: sip:caller@u1.example.com
  4833. Record-Route: <sip:p1.example.com;lr>
  4834. P2 gets this. It is responsible for domain.com so it runs a location
  4835. service and rewrites the Request-URI. It also adds a Record-Route
  4836. header field value. There is no Route header field, so it resolves
  4837. the new Request-URI to determine where to send the request:
  4838. INVITE sip:callee@u2.domain.com SIP/2.0
  4839. Contact: sip:caller@u1.example.com
  4840. Record-Route: <sip:p2.domain.com;lr>
  4841. Record-Route: <sip:p1.example.com;lr>
  4842. The callee at u2.domain.com gets this and responds with a 200 OK:
  4843. SIP/2.0 200 OK
  4844. Contact: sip:callee@u2.domain.com
  4845. Record-Route: <sip:p2.domain.com;lr>
  4846. Record-Route: <sip:p1.example.com;lr>
  4847. The callee at u2 also sets its dialog state's remote target URI to
  4848. sip:caller@u1.example.com and its route set to:
  4849. (<sip:p2.domain.com;lr>,<sip:p1.example.com;lr>)
  4850. This is forwarded by P2 to P1 to U1 as normal. Now, U1 sets its
  4851. dialog state's remote target URI to sip:callee@u2.domain.com and its
  4852. route set to:
  4853. (<sip:p1.example.com;lr>,<sip:p2.domain.com;lr>)
  4854. Since all the route set elements contain the lr parameter, U1
  4855. constructs the following BYE request:
  4856. BYE sip:callee@u2.domain.com SIP/2.0
  4857. Route: <sip:p1.example.com;lr>,<sip:p2.domain.com;lr>
  4858. Rosenberg, et. al. Standards Track [Page 119]
  4859. RFC 3261 SIP: Session Initiation Protocol June 2002
  4860. As any other element (including proxies) would do, it resolves the
  4861. URI in the topmost Route header field value using DNS to determine
  4862. where to send the request. This goes to P1. P1 notices that it is
  4863. not responsible for the resource indicated in the Request-URI so it
  4864. doesn't change it. It does see that it is the first value in the
  4865. Route header field, so it removes that value, and forwards the
  4866. request to P2:
  4867. BYE sip:callee@u2.domain.com SIP/2.0
  4868. Route: <sip:p2.domain.com;lr>
  4869. P2 also notices it is not responsible for the resource indicated by
  4870. the Request-URI (it is responsible for domain.com, not
  4871. u2.domain.com), so it doesn't change it. It does see itself in the
  4872. first Route header field value, so it removes it and forwards the
  4873. following to u2.domain.com based on a DNS lookup against the
  4874. Request-URI:
  4875. BYE sip:callee@u2.domain.com SIP/2.0
  4876. 16.12.1.2 Traversing a Strict-Routing Proxy
  4877. In this scenario, a dialog is established across four proxies, each
  4878. of which adds Record-Route header field values. The third proxy
  4879. implements the strict-routing procedures specified in RFC 2543 and
  4880. many works in progress.
  4881. U1->P1->P2->P3->P4->U2
  4882. The INVITE arriving at U2 contains:
  4883. INVITE sip:callee@u2.domain.com SIP/2.0
  4884. Contact: sip:caller@u1.example.com
  4885. Record-Route: <sip:p4.domain.com;lr>
  4886. Record-Route: <sip:p3.middle.com>
  4887. Record-Route: <sip:p2.example.com;lr>
  4888. Record-Route: <sip:p1.example.com;lr>
  4889. Which U2 responds to with a 200 OK. Later, U2 sends the following
  4890. BYE request to P4 based on the first Route header field value.
  4891. BYE sip:caller@u1.example.com SIP/2.0
  4892. Route: <sip:p4.domain.com;lr>
  4893. Route: <sip:p3.middle.com>
  4894. Route: <sip:p2.example.com;lr>
  4895. Route: <sip:p1.example.com;lr>
  4896. Rosenberg, et. al. Standards Track [Page 120]
  4897. RFC 3261 SIP: Session Initiation Protocol June 2002
  4898. P4 is not responsible for the resource indicated in the Request-URI
  4899. so it will leave it alone. It notices that it is the element in the
  4900. first Route header field value so it removes it. It then prepares to
  4901. send the request based on the now first Route header field value of
  4902. sip:p3.middle.com, but it notices that this URI does not contain the
  4903. lr parameter, so before sending, it reformats the request to be:
  4904. BYE sip:p3.middle.com SIP/2.0
  4905. Route: <sip:p2.example.com;lr>
  4906. Route: <sip:p1.example.com;lr>
  4907. Route: <sip:caller@u1.example.com>
  4908. P3 is a strict router, so it forwards the following to P2:
  4909. BYE sip:p2.example.com;lr SIP/2.0
  4910. Route: <sip:p1.example.com;lr>
  4911. Route: <sip:caller@u1.example.com>
  4912. P2 sees the request-URI is a value it placed into a Record-Route
  4913. header field, so before further processing, it rewrites the request
  4914. to be:
  4915. BYE sip:caller@u1.example.com SIP/2.0
  4916. Route: <sip:p1.example.com;lr>
  4917. P2 is not responsible for u1.example.com, so it sends the request to
  4918. P1 based on the resolution of the Route header field value.
  4919. P1 notices itself in the topmost Route header field value, so it
  4920. removes it, resulting in:
  4921. BYE sip:caller@u1.example.com SIP/2.0
  4922. Since P1 is not responsible for u1.example.com and there is no Route
  4923. header field, P1 will forward the request to u1.example.com based on
  4924. the Request-URI.
  4925. 16.12.1.3 Rewriting Record-Route Header Field Values
  4926. In this scenario, U1 and U2 are in different private namespaces and
  4927. they enter a dialog through a proxy P1, which acts as a gateway
  4928. between the namespaces.
  4929. U1->P1->U2
  4930. Rosenberg, et. al. Standards Track [Page 121]
  4931. RFC 3261 SIP: Session Initiation Protocol June 2002
  4932. U1 sends:
  4933. INVITE sip:callee@gateway.leftprivatespace.com SIP/2.0
  4934. Contact: <sip:caller@u1.leftprivatespace.com>
  4935. P1 uses its location service and sends the following to U2:
  4936. INVITE sip:callee@rightprivatespace.com SIP/2.0
  4937. Contact: <sip:caller@u1.leftprivatespace.com>
  4938. Record-Route: <sip:gateway.rightprivatespace.com;lr>
  4939. U2 sends this 200 (OK) back to P1:
  4940. SIP/2.0 200 OK
  4941. Contact: <sip:callee@u2.rightprivatespace.com>
  4942. Record-Route: <sip:gateway.rightprivatespace.com;lr>
  4943. P1 rewrites its Record-Route header parameter to provide a value that
  4944. U1 will find useful, and sends the following to U1:
  4945. SIP/2.0 200 OK
  4946. Contact: <sip:callee@u2.rightprivatespace.com>
  4947. Record-Route: <sip:gateway.leftprivatespace.com;lr>
  4948. Later, U1 sends the following BYE request to P1:
  4949. BYE sip:callee@u2.rightprivatespace.com SIP/2.0
  4950. Route: <sip:gateway.leftprivatespace.com;lr>
  4951. which P1 forwards to U2 as:
  4952. BYE sip:callee@u2.rightprivatespace.com SIP/2.0
  4953. 17 Transactions
  4954. SIP is a transactional protocol: interactions between components take
  4955. place in a series of independent message exchanges. Specifically, a
  4956. SIP transaction consists of a single request and any responses to
  4957. that request, which include zero or more provisional responses and
  4958. one or more final responses. In the case of a transaction where the
  4959. request was an INVITE (known as an INVITE transaction), the
  4960. transaction also includes the ACK only if the final response was not
  4961. a 2xx response. If the response was a 2xx, the ACK is not considered
  4962. part of the transaction.
  4963. The reason for this separation is rooted in the importance of
  4964. delivering all 200 (OK) responses to an INVITE to the UAC. To
  4965. deliver them all to the UAC, the UAS alone takes responsibility
  4966. Rosenberg, et. al. Standards Track [Page 122]
  4967. RFC 3261 SIP: Session Initiation Protocol June 2002
  4968. for retransmitting them (see Section 13.3.1.4), and the UAC alone
  4969. takes responsibility for acknowledging them with ACK (see Section
  4970. 13.2.2.4). Since this ACK is retransmitted only by the UAC, it is
  4971. effectively considered its own transaction.
  4972. Transactions have a client side and a server side. The client side
  4973. is known as a client transaction and the server side as a server
  4974. transaction. The client transaction sends the request, and the
  4975. server transaction sends the response. The client and server
  4976. transactions are logical functions that are embedded in any number of
  4977. elements. Specifically, they exist within user agents and stateful
  4978. proxy servers. Consider the example in Section 4. In this example,
  4979. the UAC executes the client transaction, and its outbound proxy
  4980. executes the server transaction. The outbound proxy also executes a
  4981. client transaction, which sends the request to a server transaction
  4982. in the inbound proxy. That proxy also executes a client transaction,
  4983. which in turn sends the request to a server transaction in the UAS.
  4984. This is shown in Figure 4.
  4985. +---------+ +---------+ +---------+ +---------+
  4986. | +-+|Request |+-+ +-+|Request |+-+ +-+|Request |+-+ |
  4987. | |C||------->||S| |C||------->||S| |C||------->||S| |
  4988. | |l|| ||e| |l|| ||e| |l|| ||e| |
  4989. | |i|| ||r| |i|| ||r| |i|| ||r| |
  4990. | |e|| ||v| |e|| ||v| |e|| ||v| |
  4991. | |n|| ||e| |n|| ||e| |n|| ||e| |
  4992. | |t|| ||r| |t|| ||r| |t|| ||r| |
  4993. | | || || | | || || | | || || | |
  4994. | |T|| ||T| |T|| ||T| |T|| ||T| |
  4995. | |r|| ||r| |r|| ||r| |r|| ||r| |
  4996. | |a|| ||a| |a|| ||a| |a|| ||a| |
  4997. | |n|| ||n| |n|| ||n| |n|| ||n| |
  4998. | |s||Response||s| |s||Response||s| |s||Response||s| |
  4999. | +-+|<-------|+-+ +-+|<-------|+-+ +-+|<-------|+-+ |
  5000. +---------+ +---------+ +---------+ +---------+
  5001. UAC Outbound Inbound UAS
  5002. Proxy Proxy
  5003. Figure 4: Transaction relationships
  5004. A stateless proxy does not contain a client or server transaction.
  5005. The transaction exists between the UA or stateful proxy on one side,
  5006. and the UA or stateful proxy on the other side. As far as SIP
  5007. transactions are concerned, stateless proxies are effectively
  5008. transparent. The purpose of the client transaction is to receive a
  5009. request from the element in which the client is embedded (call this
  5010. element the "Transaction User" or TU; it can be a UA or a stateful
  5011. proxy), and reliably deliver the request to a server transaction.
  5012. Rosenberg, et. al. Standards Track [Page 123]
  5013. RFC 3261 SIP: Session Initiation Protocol June 2002
  5014. The client transaction is also responsible for receiving responses
  5015. and delivering them to the TU, filtering out any response
  5016. retransmissions or disallowed responses (such as a response to ACK).
  5017. Additionally, in the case of an INVITE request, the client
  5018. transaction is responsible for generating the ACK request for any
  5019. final response accepting a 2xx response.
  5020. Similarly, the purpose of the server transaction is to receive
  5021. requests from the transport layer and deliver them to the TU. The
  5022. server transaction filters any request retransmissions from the
  5023. network. The server transaction accepts responses from the TU and
  5024. delivers them to the transport layer for transmission over the
  5025. network. In the case of an INVITE transaction, it absorbs the ACK
  5026. request for any final response excepting a 2xx response.
  5027. The 2xx response and its ACK receive special treatment. This
  5028. response is retransmitted only by a UAS, and its ACK generated only
  5029. by the UAC. This end-to-end treatment is needed so that a caller
  5030. knows the entire set of users that have accepted the call. Because
  5031. of this special handling, retransmissions of the 2xx response are
  5032. handled by the UA core, not the transaction layer. Similarly,
  5033. generation of the ACK for the 2xx is handled by the UA core. Each
  5034. proxy along the path merely forwards each 2xx response to INVITE and
  5035. its corresponding ACK.
  5036. 17.1 Client Transaction
  5037. The client transaction provides its functionality through the
  5038. maintenance of a state machine.
  5039. The TU communicates with the client transaction through a simple
  5040. interface. When the TU wishes to initiate a new transaction, it
  5041. creates a client transaction and passes it the SIP request to send
  5042. and an IP address, port, and transport to which to send it. The
  5043. client transaction begins execution of its state machine. Valid
  5044. responses are passed up to the TU from the client transaction.
  5045. There are two types of client transaction state machines, depending
  5046. on the method of the request passed by the TU. One handles client
  5047. transactions for INVITE requests. This type of machine is referred
  5048. to as an INVITE client transaction. Another type handles client
  5049. transactions for all requests except INVITE and ACK. This is
  5050. referred to as a non-INVITE client transaction. There is no client
  5051. transaction for ACK. If the TU wishes to send an ACK, it passes one
  5052. directly to the transport layer for transmission.
  5053. Rosenberg, et. al. Standards Track [Page 124]
  5054. RFC 3261 SIP: Session Initiation Protocol June 2002
  5055. The INVITE transaction is different from those of other methods
  5056. because of its extended duration. Normally, human input is required
  5057. in order to respond to an INVITE. The long delays expected for
  5058. sending a response argue for a three-way handshake. On the other
  5059. hand, requests of other methods are expected to complete rapidly.
  5060. Because of the non-INVITE transaction's reliance on a two-way
  5061. handshake, TUs SHOULD respond immediately to non-INVITE requests.
  5062. 17.1.1 INVITE Client Transaction
  5063. 17.1.1.1 Overview of INVITE Transaction
  5064. The INVITE transaction consists of a three-way handshake. The client
  5065. transaction sends an INVITE, the server transaction sends responses,
  5066. and the client transaction sends an ACK. For unreliable transports
  5067. (such as UDP), the client transaction retransmits requests at an
  5068. interval that starts at T1 seconds and doubles after every
  5069. retransmission. T1 is an estimate of the round-trip time (RTT), and
  5070. it defaults to 500 ms. Nearly all of the transaction timers
  5071. described here scale with T1, and changing T1 adjusts their values.
  5072. The request is not retransmitted over reliable transports. After
  5073. receiving a 1xx response, any retransmissions cease altogether, and
  5074. the client waits for further responses. The server transaction can
  5075. send additional 1xx responses, which are not transmitted reliably by
  5076. the server transaction. Eventually, the server transaction decides
  5077. to send a final response. For unreliable transports, that response
  5078. is retransmitted periodically, and for reliable transports, it is
  5079. sent once. For each final response that is received at the client
  5080. transaction, the client transaction sends an ACK, the purpose of
  5081. which is to quench retransmissions of the response.
  5082. 17.1.1.2 Formal Description
  5083. The state machine for the INVITE client transaction is shown in
  5084. Figure 5. The initial state, "calling", MUST be entered when the TU
  5085. initiates a new client transaction with an INVITE request. The
  5086. client transaction MUST pass the request to the transport layer for
  5087. transmission (see Section 18). If an unreliable transport is being
  5088. used, the client transaction MUST start timer A with a value of T1.
  5089. If a reliable transport is being used, the client transaction SHOULD
  5090. NOT start timer A (Timer A controls request retransmissions). For
  5091. any transport, the client transaction MUST start timer B with a value
  5092. of 64*T1 seconds (Timer B controls transaction timeouts).
  5093. When timer A fires, the client transaction MUST retransmit the
  5094. request by passing it to the transport layer, and MUST reset the
  5095. timer with a value of 2*T1. The formal definition of retransmit
  5096. Rosenberg, et. al. Standards Track [Page 125]
  5097. RFC 3261 SIP: Session Initiation Protocol June 2002
  5098. within the context of the transaction layer is to take the message
  5099. previously sent to the transport layer and pass it to the transport
  5100. layer once more.
  5101. When timer A fires 2*T1 seconds later, the request MUST be
  5102. retransmitted again (assuming the client transaction is still in this
  5103. state). This process MUST continue so that the request is
  5104. retransmitted with intervals that double after each transmission.
  5105. These retransmissions SHOULD only be done while the client
  5106. transaction is in the "calling" state.
  5107. The default value for T1 is 500 ms. T1 is an estimate of the RTT
  5108. between the client and server transactions. Elements MAY (though it
  5109. is NOT RECOMMENDED) use smaller values of T1 within closed, private
  5110. networks that do not permit general Internet connection. T1 MAY be
  5111. chosen larger, and this is RECOMMENDED if it is known in advance
  5112. (such as on high latency access links) that the RTT is larger.
  5113. Whatever the value of T1, the exponential backoffs on retransmissions
  5114. described in this section MUST be used.
  5115. If the client transaction is still in the "Calling" state when timer
  5116. B fires, the client transaction SHOULD inform the TU that a timeout
  5117. has occurred. The client transaction MUST NOT generate an ACK. The
  5118. value of 64*T1 is equal to the amount of time required to send seven
  5119. requests in the case of an unreliable transport.
  5120. If the client transaction receives a provisional response while in
  5121. the "Calling" state, it transitions to the "Proceeding" state. In the
  5122. "Proceeding" state, the client transaction SHOULD NOT retransmit the
  5123. request any longer. Furthermore, the provisional response MUST be
  5124. passed to the TU. Any further provisional responses MUST be passed
  5125. up to the TU while in the "Proceeding" state.
  5126. When in either the "Calling" or "Proceeding" states, reception of a
  5127. response with status code from 300-699 MUST cause the client
  5128. transaction to transition to "Completed". The client transaction
  5129. MUST pass the received response up to the TU, and the client
  5130. transaction MUST generate an ACK request, even if the transport is
  5131. reliable (guidelines for constructing the ACK from the response are
  5132. given in Section 17.1.1.3) and then pass the ACK to the transport
  5133. layer for transmission. The ACK MUST be sent to the same address,
  5134. port, and transport to which the original request was sent. The
  5135. client transaction SHOULD start timer D when it enters the
  5136. "Completed" state, with a value of at least 32 seconds for unreliable
  5137. transports, and a value of zero seconds for reliable transports.
  5138. Timer D reflects the amount of time that the server transaction can
  5139. remain in the "Completed" state when unreliable transports are used.
  5140. This is equal to Timer H in the INVITE server transaction, whose
  5141. Rosenberg, et. al. Standards Track [Page 126]
  5142. RFC 3261 SIP: Session Initiation Protocol June 2002
  5143. default is 64*T1. However, the client transaction does not know the
  5144. value of T1 in use by the server transaction, so an absolute minimum
  5145. of 32s is used instead of basing Timer D on T1.
  5146. Any retransmissions of the final response that are received while in
  5147. the "Completed" state MUST cause the ACK to be re-passed to the
  5148. transport layer for retransmission, but the newly received response
  5149. MUST NOT be passed up to the TU. A retransmission of the response is
  5150. defined as any response which would match the same client transaction
  5151. based on the rules of Section 17.1.3.
  5152. Rosenberg, et. al. Standards Track [Page 127]
  5153. RFC 3261 SIP: Session Initiation Protocol June 2002
  5154. |INVITE from TU
  5155. Timer A fires |INVITE sent
  5156. Reset A, V Timer B fires
  5157. INVITE sent +-----------+ or Transport Err.
  5158. +---------| |---------------+inform TU
  5159. | | Calling | |
  5160. +-------->| |-------------->|
  5161. +-----------+ 2xx |
  5162. | | 2xx to TU |
  5163. | |1xx |
  5164. 300-699 +---------------+ |1xx to TU |
  5165. ACK sent | | |
  5166. resp. to TU | 1xx V |
  5167. | 1xx to TU -----------+ |
  5168. | +---------| | |
  5169. | | |Proceeding |-------------->|
  5170. | +-------->| | 2xx |
  5171. | +-----------+ 2xx to TU |
  5172. | 300-699 | |
  5173. | ACK sent, | |
  5174. | resp. to TU| |
  5175. | | | NOTE:
  5176. | 300-699 V |
  5177. | ACK sent +-----------+Transport Err. | transitions
  5178. | +---------| |Inform TU | labeled with
  5179. | | | Completed |-------------->| the event
  5180. | +-------->| | | over the action
  5181. | +-----------+ | to take
  5182. | ^ | |
  5183. | | | Timer D fires |
  5184. +--------------+ | - |
  5185. | |
  5186. V |
  5187. +-----------+ |
  5188. | | |
  5189. | Terminated|<--------------+
  5190. | |
  5191. +-----------+
  5192. Figure 5: INVITE client transaction
  5193. If timer D fires while the client transaction is in the "Completed"
  5194. state, the client transaction MUST move to the terminated state.
  5195. When in either the "Calling" or "Proceeding" states, reception of a
  5196. 2xx response MUST cause the client transaction to enter the
  5197. "Terminated" state, and the response MUST be passed up to the TU.
  5198. The handling of this response depends on whether the TU is a proxy
  5199. Rosenberg, et. al. Standards Track [Page 128]
  5200. RFC 3261 SIP: Session Initiation Protocol June 2002
  5201. core or a UAC core. A UAC core will handle generation of the ACK for
  5202. this response, while a proxy core will always forward the 200 (OK)
  5203. upstream. The differing treatment of 200 (OK) between proxy and UAC
  5204. is the reason that handling of it does not take place in the
  5205. transaction layer.
  5206. The client transaction MUST be destroyed the instant it enters the
  5207. "Terminated" state. This is actually necessary to guarantee correct
  5208. operation. The reason is that 2xx responses to an INVITE are treated
  5209. differently; each one is forwarded by proxies, and the ACK handling
  5210. in a UAC is different. Thus, each 2xx needs to be passed to a proxy
  5211. core (so that it can be forwarded) and to a UAC core (so it can be
  5212. acknowledged). No transaction layer processing takes place.
  5213. Whenever a response is received by the transport, if the transport
  5214. layer finds no matching client transaction (using the rules of
  5215. Section 17.1.3), the response is passed directly to the core. Since
  5216. the matching client transaction is destroyed by the first 2xx,
  5217. subsequent 2xx will find no match and therefore be passed to the
  5218. core.
  5219. 17.1.1.3 Construction of the ACK Request
  5220. This section specifies the construction of ACK requests sent within
  5221. the client transaction. A UAC core that generates an ACK for 2xx
  5222. MUST instead follow the rules described in Section 13.
  5223. The ACK request constructed by the client transaction MUST contain
  5224. values for the Call-ID, From, and Request-URI that are equal to the
  5225. values of those header fields in the request passed to the transport
  5226. by the client transaction (call this the "original request"). The To
  5227. header field in the ACK MUST equal the To header field in the
  5228. response being acknowledged, and therefore will usually differ from
  5229. the To header field in the original request by the addition of the
  5230. tag parameter. The ACK MUST contain a single Via header field, and
  5231. this MUST be equal to the top Via header field of the original
  5232. request. The CSeq header field in the ACK MUST contain the same
  5233. value for the sequence number as was present in the original request,
  5234. but the method parameter MUST be equal to "ACK".
  5235. Rosenberg, et. al. Standards Track [Page 129]
  5236. RFC 3261 SIP: Session Initiation Protocol June 2002
  5237. If the INVITE request whose response is being acknowledged had Route
  5238. header fields, those header fields MUST appear in the ACK. This is
  5239. to ensure that the ACK can be routed properly through any downstream
  5240. stateless proxies.
  5241. Although any request MAY contain a body, a body in an ACK is special
  5242. since the request cannot be rejected if the body is not understood.
  5243. Therefore, placement of bodies in ACK for non-2xx is NOT RECOMMENDED,
  5244. but if done, the body types are restricted to any that appeared in
  5245. the INVITE, assuming that the response to the INVITE was not 415. If
  5246. it was, the body in the ACK MAY be any type listed in the Accept
  5247. header field in the 415.
  5248. For example, consider the following request:
  5249. INVITE sip:bob@biloxi.com SIP/2.0
  5250. Via: SIP/2.0/UDP pc33.atlanta.com;branch=z9hG4bKkjshdyff
  5251. To: Bob <sip:bob@biloxi.com>
  5252. From: Alice <sip:alice@atlanta.com>;tag=88sja8x
  5253. Max-Forwards: 70
  5254. Call-ID: 987asjd97y7atg
  5255. CSeq: 986759 INVITE
  5256. The ACK request for a non-2xx final response to this request would
  5257. look like this:
  5258. ACK sip:bob@biloxi.com SIP/2.0
  5259. Via: SIP/2.0/UDP pc33.atlanta.com;branch=z9hG4bKkjshdyff
  5260. To: Bob <sip:bob@biloxi.com>;tag=99sa0xk
  5261. From: Alice <sip:alice@atlanta.com>;tag=88sja8x
  5262. Max-Forwards: 70
  5263. Call-ID: 987asjd97y7atg
  5264. CSeq: 986759 ACK
  5265. 17.1.2 Non-INVITE Client Transaction
  5266. 17.1.2.1 Overview of the non-INVITE Transaction
  5267. Non-INVITE transactions do not make use of ACK. They are simple
  5268. request-response interactions. For unreliable transports, requests
  5269. are retransmitted at an interval which starts at T1 and doubles until
  5270. it hits T2. If a provisional response is received, retransmissions
  5271. continue for unreliable transports, but at an interval of T2. The
  5272. server transaction retransmits the last response it sent, which can
  5273. be a provisional or final response, only when a retransmission of the
  5274. request is received. This is why request retransmissions need to
  5275. continue even after a provisional response; they are to ensure
  5276. reliable delivery of the final response.
  5277. Rosenberg, et. al. Standards Track [Page 130]
  5278. RFC 3261 SIP: Session Initiation Protocol June 2002
  5279. Unlike an INVITE transaction, a non-INVITE transaction has no special
  5280. handling for the 2xx response. The result is that only a single 2xx
  5281. response to a non-INVITE is ever delivered to a UAC.
  5282. 17.1.2.2 Formal Description
  5283. The state machine for the non-INVITE client transaction is shown in
  5284. Figure 6. It is very similar to the state machine for INVITE.
  5285. The "Trying" state is entered when the TU initiates a new client
  5286. transaction with a request. When entering this state, the client
  5287. transaction SHOULD set timer F to fire in 64*T1 seconds. The request
  5288. MUST be passed to the transport layer for transmission. If an
  5289. unreliable transport is in use, the client transaction MUST set timer
  5290. E to fire in T1 seconds. If timer E fires while still in this state,
  5291. the timer is reset, but this time with a value of MIN(2*T1, T2).
  5292. When the timer fires again, it is reset to a MIN(4*T1, T2). This
  5293. process continues so that retransmissions occur with an exponentially
  5294. increasing interval that caps at T2. The default value of T2 is 4s,
  5295. and it represents the amount of time a non-INVITE server transaction
  5296. will take to respond to a request, if it does not respond
  5297. immediately. For the default values of T1 and T2, this results in
  5298. intervals of 500 ms, 1 s, 2 s, 4 s, 4 s, 4 s, etc.
  5299. If Timer F fires while the client transaction is still in the
  5300. "Trying" state, the client transaction SHOULD inform the TU about the
  5301. timeout, and then it SHOULD enter the "Terminated" state. If a
  5302. provisional response is received while in the "Trying" state, the
  5303. response MUST be passed to the TU, and then the client transaction
  5304. SHOULD move to the "Proceeding" state. If a final response (status
  5305. codes 200-699) is received while in the "Trying" state, the response
  5306. MUST be passed to the TU, and the client transaction MUST transition
  5307. to the "Completed" state.
  5308. If Timer E fires while in the "Proceeding" state, the request MUST be
  5309. passed to the transport layer for retransmission, and Timer E MUST be
  5310. reset with a value of T2 seconds. If timer F fires while in the
  5311. "Proceeding" state, the TU MUST be informed of a timeout, and the
  5312. client transaction MUST transition to the terminated state. If a
  5313. final response (status codes 200-699) is received while in the
  5314. "Proceeding" state, the response MUST be passed to the TU, and the
  5315. client transaction MUST transition to the "Completed" state.
  5316. Once the client transaction enters the "Completed" state, it MUST set
  5317. Timer K to fire in T4 seconds for unreliable transports, and zero
  5318. seconds for reliable transports. The "Completed" state exists to
  5319. buffer any additional response retransmissions that may be received
  5320. (which is why the client transaction remains there only for
  5321. Rosenberg, et. al. Standards Track [Page 131]
  5322. RFC 3261 SIP: Session Initiation Protocol June 2002
  5323. unreliable transports). T4 represents the amount of time the network
  5324. will take to clear messages between client and server transactions.
  5325. The default value of T4 is 5s. A response is a retransmission when
  5326. it matches the same transaction, using the rules specified in Section
  5327. 17.1.3. If Timer K fires while in this state, the client transaction
  5328. MUST transition to the "Terminated" state.
  5329. Once the transaction is in the terminated state, it MUST be destroyed
  5330. immediately.
  5331. 17.1.3 Matching Responses to Client Transactions
  5332. When the transport layer in the client receives a response, it has to
  5333. determine which client transaction will handle the response, so that
  5334. the processing of Sections 17.1.1 and 17.1.2 can take place. The
  5335. branch parameter in the top Via header field is used for this
  5336. purpose. A response matches a client transaction under two
  5337. conditions:
  5338. 1. If the response has the same value of the branch parameter in
  5339. the top Via header field as the branch parameter in the top
  5340. Via header field of the request that created the transaction.
  5341. 2. If the method parameter in the CSeq header field matches the
  5342. method of the request that created the transaction. The
  5343. method is needed since a CANCEL request constitutes a
  5344. different transaction, but shares the same value of the branch
  5345. parameter.
  5346. If a request is sent via multicast, it is possible that it will
  5347. generate multiple responses from different servers. These responses
  5348. will all have the same branch parameter in the topmost Via, but vary
  5349. in the To tag. The first response received, based on the rules
  5350. above, will be used, and others will be viewed as retransmissions.
  5351. That is not an error; multicast SIP provides only a rudimentary
  5352. "single-hop-discovery-like" service that is limited to processing a
  5353. single response. See Section 18.1.1 for details.
  5354. Rosenberg, et. al. Standards Track [Page 132]
  5355. RFC 3261 SIP: Session Initiation Protocol June 2002
  5356. 17.1.4 Handling Transport Errors
  5357. |Request from TU
  5358. |send request
  5359. Timer E V
  5360. send request +-----------+
  5361. +---------| |-------------------+
  5362. | | Trying | Timer F |
  5363. +-------->| | or Transport Err.|
  5364. +-----------+ inform TU |
  5365. 200-699 | | |
  5366. resp. to TU | |1xx |
  5367. +---------------+ |resp. to TU |
  5368. | | |
  5369. | Timer E V Timer F |
  5370. | send req +-----------+ or Transport Err. |
  5371. | +---------| | inform TU |
  5372. | | |Proceeding |------------------>|
  5373. | +-------->| |-----+ |
  5374. | +-----------+ |1xx |
  5375. | | ^ |resp to TU |
  5376. | 200-699 | +--------+ |
  5377. | resp. to TU | |
  5378. | | |
  5379. | V |
  5380. | +-----------+ |
  5381. | | | |
  5382. | | Completed | |
  5383. | | | |
  5384. | +-----------+ |
  5385. | ^ | |
  5386. | | | Timer K |
  5387. +--------------+ | - |
  5388. | |
  5389. V |
  5390. NOTE: +-----------+ |
  5391. | | |
  5392. transitions | Terminated|<------------------+
  5393. labeled with | |
  5394. the event +-----------+
  5395. over the action
  5396. to take
  5397. Figure 6: non-INVITE client transaction
  5398. When the client transaction sends a request to the transport layer to
  5399. be sent, the following procedures are followed if the transport layer
  5400. indicates a failure.
  5401. Rosenberg, et. al. Standards Track [Page 133]
  5402. RFC 3261 SIP: Session Initiation Protocol June 2002
  5403. The client transaction SHOULD inform the TU that a transport failure
  5404. has occurred, and the client transaction SHOULD transition directly
  5405. to the "Terminated" state. The TU will handle the failover
  5406. mechanisms described in [4].
  5407. 17.2 Server Transaction
  5408. The server transaction is responsible for the delivery of requests to
  5409. the TU and the reliable transmission of responses. It accomplishes
  5410. this through a state machine. Server transactions are created by the
  5411. core when a request is received, and transaction handling is desired
  5412. for that request (this is not always the case).
  5413. As with the client transactions, the state machine depends on whether
  5414. the received request is an INVITE request.
  5415. 17.2.1 INVITE Server Transaction
  5416. The state diagram for the INVITE server transaction is shown in
  5417. Figure 7.
  5418. When a server transaction is constructed for a request, it enters the
  5419. "Proceeding" state. The server transaction MUST generate a 100
  5420. (Trying) response unless it knows that the TU will generate a
  5421. provisional or final response within 200 ms, in which case it MAY
  5422. generate a 100 (Trying) response. This provisional response is
  5423. needed to quench request retransmissions rapidly in order to avoid
  5424. network congestion. The 100 (Trying) response is constructed
  5425. according to the procedures in Section 8.2.6, except that the
  5426. insertion of tags in the To header field of the response (when none
  5427. was present in the request) is downgraded from MAY to SHOULD NOT.
  5428. The request MUST be passed to the TU.
  5429. The TU passes any number of provisional responses to the server
  5430. transaction. So long as the server transaction is in the
  5431. "Proceeding" state, each of these MUST be passed to the transport
  5432. layer for transmission. They are not sent reliably by the
  5433. transaction layer (they are not retransmitted by it) and do not cause
  5434. a change in the state of the server transaction. If a request
  5435. retransmission is received while in the "Proceeding" state, the most
  5436. recent provisional response that was received from the TU MUST be
  5437. passed to the transport layer for retransmission. A request is a
  5438. retransmission if it matches the same server transaction based on the
  5439. rules of Section 17.2.3.
  5440. If, while in the "Proceeding" state, the TU passes a 2xx response to
  5441. the server transaction, the server transaction MUST pass this
  5442. response to the transport layer for transmission. It is not
  5443. Rosenberg, et. al. Standards Track [Page 134]
  5444. RFC 3261 SIP: Session Initiation Protocol June 2002
  5445. retransmitted by the server transaction; retransmissions of 2xx
  5446. responses are handled by the TU. The server transaction MUST then
  5447. transition to the "Terminated" state.
  5448. While in the "Proceeding" state, if the TU passes a response with
  5449. status code from 300 to 699 to the server transaction, the response
  5450. MUST be passed to the transport layer for transmission, and the state
  5451. machine MUST enter the "Completed" state. For unreliable transports,
  5452. timer G is set to fire in T1 seconds, and is not set to fire for
  5453. reliable transports.
  5454. This is a change from RFC 2543, where responses were always
  5455. retransmitted, even over reliable transports.
  5456. When the "Completed" state is entered, timer H MUST be set to fire in
  5457. 64*T1 seconds for all transports. Timer H determines when the server
  5458. transaction abandons retransmitting the response. Its value is
  5459. chosen to equal Timer B, the amount of time a client transaction will
  5460. continue to retry sending a request. If timer G fires, the response
  5461. is passed to the transport layer once more for retransmission, and
  5462. timer G is set to fire in MIN(2*T1, T2) seconds. From then on, when
  5463. timer G fires, the response is passed to the transport again for
  5464. transmission, and timer G is reset with a value that doubles, unless
  5465. that value exceeds T2, in which case it is reset with the value of
  5466. T2. This is identical to the retransmit behavior for requests in the
  5467. "Trying" state of the non-INVITE client transaction. Furthermore,
  5468. while in the "Completed" state, if a request retransmission is
  5469. received, the server SHOULD pass the response to the transport for
  5470. retransmission.
  5471. If an ACK is received while the server transaction is in the
  5472. "Completed" state, the server transaction MUST transition to the
  5473. "Confirmed" state. As Timer G is ignored in this state, any
  5474. retransmissions of the response will cease.
  5475. If timer H fires while in the "Completed" state, it implies that the
  5476. ACK was never received. In this case, the server transaction MUST
  5477. transition to the "Terminated" state, and MUST indicate to the TU
  5478. that a transaction failure has occurred.
  5479. Rosenberg, et. al. Standards Track [Page 135]
  5480. RFC 3261 SIP: Session Initiation Protocol June 2002
  5481. |INVITE
  5482. |pass INV to TU
  5483. INVITE V send 100 if TU won't in 200ms
  5484. send response+-----------+
  5485. +--------| |--------+101-199 from TU
  5486. | | Proceeding| |send response
  5487. +------->| |<-------+
  5488. | | Transport Err.
  5489. | | Inform TU
  5490. | |--------------->+
  5491. +-----------+ |
  5492. 300-699 from TU | |2xx from TU |
  5493. send response | |send response |
  5494. | +------------------>+
  5495. | |
  5496. INVITE V Timer G fires |
  5497. send response+-----------+ send response |
  5498. +--------| |--------+ |
  5499. | | Completed | | |
  5500. +------->| |<-------+ |
  5501. +-----------+ |
  5502. | | |
  5503. ACK | | |
  5504. - | +------------------>+
  5505. | Timer H fires |
  5506. V or Transport Err.|
  5507. +-----------+ Inform TU |
  5508. | | |
  5509. | Confirmed | |
  5510. | | |
  5511. +-----------+ |
  5512. | |
  5513. |Timer I fires |
  5514. |- |
  5515. | |
  5516. V |
  5517. +-----------+ |
  5518. | | |
  5519. | Terminated|<---------------+
  5520. | |
  5521. +-----------+
  5522. Figure 7: INVITE server transaction
  5523. Rosenberg, et. al. Standards Track [Page 136]
  5524. RFC 3261 SIP: Session Initiation Protocol June 2002
  5525. The purpose of the "Confirmed" state is to absorb any additional ACK
  5526. messages that arrive, triggered from retransmissions of the final
  5527. response. When this state is entered, timer I is set to fire in T4
  5528. seconds for unreliable transports, and zero seconds for reliable
  5529. transports. Once timer I fires, the server MUST transition to the
  5530. "Terminated" state.
  5531. Once the transaction is in the "Terminated" state, it MUST be
  5532. destroyed immediately. As with client transactions, this is needed
  5533. to ensure reliability of the 2xx responses to INVITE.
  5534. 17.2.2 Non-INVITE Server Transaction
  5535. The state machine for the non-INVITE server transaction is shown in
  5536. Figure 8.
  5537. The state machine is initialized in the "Trying" state and is passed
  5538. a request other than INVITE or ACK when initialized. This request is
  5539. passed up to the TU. Once in the "Trying" state, any further request
  5540. retransmissions are discarded. A request is a retransmission if it
  5541. matches the same server transaction, using the rules specified in
  5542. Section 17.2.3.
  5543. While in the "Trying" state, if the TU passes a provisional response
  5544. to the server transaction, the server transaction MUST enter the
  5545. "Proceeding" state. The response MUST be passed to the transport
  5546. layer for transmission. Any further provisional responses that are
  5547. received from the TU while in the "Proceeding" state MUST be passed
  5548. to the transport layer for transmission. If a retransmission of the
  5549. request is received while in the "Proceeding" state, the most
  5550. recently sent provisional response MUST be passed to the transport
  5551. layer for retransmission. If the TU passes a final response (status
  5552. codes 200-699) to the server while in the "Proceeding" state, the
  5553. transaction MUST enter the "Completed" state, and the response MUST
  5554. be passed to the transport layer for transmission.
  5555. When the server transaction enters the "Completed" state, it MUST set
  5556. Timer J to fire in 64*T1 seconds for unreliable transports, and zero
  5557. seconds for reliable transports. While in the "Completed" state, the
  5558. server transaction MUST pass the final response to the transport
  5559. layer for retransmission whenever a retransmission of the request is
  5560. received. Any other final responses passed by the TU to the server
  5561. transaction MUST be discarded while in the "Completed" state. The
  5562. server transaction remains in this state until Timer J fires, at
  5563. which point it MUST transition to the "Terminated" state.
  5564. The server transaction MUST be destroyed the instant it enters the
  5565. "Terminated" state.
  5566. Rosenberg, et. al. Standards Track [Page 137]
  5567. RFC 3261 SIP: Session Initiation Protocol June 2002
  5568. 17.2.3 Matching Requests to Server Transactions
  5569. When a request is received from the network by the server, it has to
  5570. be matched to an existing transaction. This is accomplished in the
  5571. following manner.
  5572. The branch parameter in the topmost Via header field of the request
  5573. is examined. If it is present and begins with the magic cookie
  5574. "z9hG4bK", the request was generated by a client transaction
  5575. compliant to this specification. Therefore, the branch parameter
  5576. will be unique across all transactions sent by that client. The
  5577. request matches a transaction if:
  5578. 1. the branch parameter in the request is equal to the one in the
  5579. top Via header field of the request that created the
  5580. transaction, and
  5581. 2. the sent-by value in the top Via of the request is equal to the
  5582. one in the request that created the transaction, and
  5583. 3. the method of the request matches the one that created the
  5584. transaction, except for ACK, where the method of the request
  5585. that created the transaction is INVITE.
  5586. This matching rule applies to both INVITE and non-INVITE transactions
  5587. alike.
  5588. The sent-by value is used as part of the matching process because
  5589. there could be accidental or malicious duplication of branch
  5590. parameters from different clients.
  5591. If the branch parameter in the top Via header field is not present,
  5592. or does not contain the magic cookie, the following procedures are
  5593. used. These exist to handle backwards compatibility with RFC 2543
  5594. compliant implementations.
  5595. The INVITE request matches a transaction if the Request-URI, To tag,
  5596. From tag, Call-ID, CSeq, and top Via header field match those of the
  5597. INVITE request which created the transaction. In this case, the
  5598. INVITE is a retransmission of the original one that created the
  5599. transaction. The ACK request matches a transaction if the Request-
  5600. URI, From tag, Call-ID, CSeq number (not the method), and top Via
  5601. header field match those of the INVITE request which created the
  5602. transaction, and the To tag of the ACK matches the To tag of the
  5603. response sent by the server transaction. Matching is done based on
  5604. the matching rules defined for each of those header fields.
  5605. Inclusion of the tag in the To header field in the ACK matching
  5606. process helps disambiguate ACK for 2xx from ACK for other responses
  5607. Rosenberg, et. al. Standards Track [Page 138]
  5608. RFC 3261 SIP: Session Initiation Protocol June 2002
  5609. at a proxy, which may have forwarded both responses (This can occur
  5610. in unusual conditions. Specifically, when a proxy forked a request,
  5611. and then crashes, the responses may be delivered to another proxy,
  5612. which might end up forwarding multiple responses upstream). An ACK
  5613. request that matches an INVITE transaction matched by a previous ACK
  5614. is considered a retransmission of that previous ACK.
  5615. Rosenberg, et. al. Standards Track [Page 139]
  5616. RFC 3261 SIP: Session Initiation Protocol June 2002
  5617. |Request received
  5618. |pass to TU
  5619. V
  5620. +-----------+
  5621. | |
  5622. | Trying |-------------+
  5623. | | |
  5624. +-----------+ |200-699 from TU
  5625. | |send response
  5626. |1xx from TU |
  5627. |send response |
  5628. | |
  5629. Request V 1xx from TU |
  5630. send response+-----------+send response|
  5631. +--------| |--------+ |
  5632. | | Proceeding| | |
  5633. +------->| |<-------+ |
  5634. +<--------------| | |
  5635. |Trnsprt Err +-----------+ |
  5636. |Inform TU | |
  5637. | | |
  5638. | |200-699 from TU |
  5639. | |send response |
  5640. | Request V |
  5641. | send response+-----------+ |
  5642. | +--------| | |
  5643. | | | Completed |<------------+
  5644. | +------->| |
  5645. +<--------------| |
  5646. |Trnsprt Err +-----------+
  5647. |Inform TU |
  5648. | |Timer J fires
  5649. | |-
  5650. | |
  5651. | V
  5652. | +-----------+
  5653. | | |
  5654. +-------------->| Terminated|
  5655. | |
  5656. +-----------+
  5657. Figure 8: non-INVITE server transaction
  5658. For all other request methods, a request is matched to a transaction
  5659. if the Request-URI, To tag, From tag, Call-ID, CSeq (including the
  5660. method), and top Via header field match those of the request that
  5661. created the transaction. Matching is done based on the matching
  5662. Rosenberg, et. al. Standards Track [Page 140]
  5663. RFC 3261 SIP: Session Initiation Protocol June 2002
  5664. rules defined for each of those header fields. When a non-INVITE
  5665. request matches an existing transaction, it is a retransmission of
  5666. the request that created that transaction.
  5667. Because the matching rules include the Request-URI, the server cannot
  5668. match a response to a transaction. When the TU passes a response to
  5669. the server transaction, it must pass it to the specific server
  5670. transaction for which the response is targeted.
  5671. 17.2.4 Handling Transport Errors
  5672. When the server transaction sends a response to the transport layer
  5673. to be sent, the following procedures are followed if the transport
  5674. layer indicates a failure.
  5675. First, the procedures in [4] are followed, which attempt to deliver
  5676. the response to a backup. If those should all fail, based on the
  5677. definition of failure in [4], the server transaction SHOULD inform
  5678. the TU that a failure has occurred, and SHOULD transition to the
  5679. terminated state.
  5680. 18 Transport
  5681. The transport layer is responsible for the actual transmission of
  5682. requests and responses over network transports. This includes
  5683. determination of the connection to use for a request or response in
  5684. the case of connection-oriented transports.
  5685. The transport layer is responsible for managing persistent
  5686. connections for transport protocols like TCP and SCTP, or TLS over
  5687. those, including ones opened to the transport layer. This includes
  5688. connections opened by the client or server transports, so that
  5689. connections are shared between client and server transport functions.
  5690. These connections are indexed by the tuple formed from the address,
  5691. port, and transport protocol at the far end of the connection. When
  5692. a connection is opened by the transport layer, this index is set to
  5693. the destination IP, port and transport. When the connection is
  5694. accepted by the transport layer, this index is set to the source IP
  5695. address, port number, and transport. Note that, because the source
  5696. port is often ephemeral, but it cannot be known whether it is
  5697. ephemeral or selected through procedures in [4], connections accepted
  5698. by the transport layer will frequently not be reused. The result is
  5699. that two proxies in a "peering" relationship using a connection-
  5700. oriented transport frequently will have two connections in use, one
  5701. for transactions initiated in each direction.
  5702. Rosenberg, et. al. Standards Track [Page 141]
  5703. RFC 3261 SIP: Session Initiation Protocol June 2002
  5704. It is RECOMMENDED that connections be kept open for some
  5705. implementation-defined duration after the last message was sent or
  5706. received over that connection. This duration SHOULD at least equal
  5707. the longest amount of time the element would need in order to bring a
  5708. transaction from instantiation to the terminated state. This is to
  5709. make it likely that transactions are completed over the same
  5710. connection on which they are initiated (for example, request,
  5711. response, and in the case of INVITE, ACK for non-2xx responses).
  5712. This usually means at least 64*T1 (see Section 17.1.1.1 for a
  5713. definition of T1). However, it could be larger in an element that
  5714. has a TU using a large value for timer C (bullet 11 of Section 16.6),
  5715. for example.
  5716. All SIP elements MUST implement UDP and TCP. SIP elements MAY
  5717. implement other protocols.
  5718. Making TCP mandatory for the UA is a substantial change from RFC
  5719. 2543. It has arisen out of the need to handle larger messages,
  5720. which MUST use TCP, as discussed below. Thus, even if an element
  5721. never sends large messages, it may receive one and needs to be
  5722. able to handle them.
  5723. 18.1 Clients
  5724. 18.1.1 Sending Requests
  5725. The client side of the transport layer is responsible for sending the
  5726. request and receiving responses. The user of the transport layer
  5727. passes the client transport the request, an IP address, port,
  5728. transport, and possibly TTL for multicast destinations.
  5729. If a request is within 200 bytes of the path MTU, or if it is larger
  5730. than 1300 bytes and the path MTU is unknown, the request MUST be sent
  5731. using an RFC 2914 [43] congestion controlled transport protocol, such
  5732. as TCP. If this causes a change in the transport protocol from the
  5733. one indicated in the top Via, the value in the top Via MUST be
  5734. changed. This prevents fragmentation of messages over UDP and
  5735. provides congestion control for larger messages. However,
  5736. implementations MUST be able to handle messages up to the maximum
  5737. datagram packet size. For UDP, this size is 65,535 bytes, including
  5738. IP and UDP headers.
  5739. The 200 byte "buffer" between the message size and the MTU
  5740. accommodates the fact that the response in SIP can be larger than
  5741. the request. This happens due to the addition of Record-Route
  5742. header field values to the responses to INVITE, for example. With
  5743. the extra buffer, the response can be about 170 bytes larger than
  5744. the request, and still not be fragmented on IPv4 (about 30 bytes
  5745. Rosenberg, et. al. Standards Track [Page 142]
  5746. RFC 3261 SIP: Session Initiation Protocol June 2002
  5747. is consumed by IP/UDP, assuming no IPSec). 1300 is chosen when
  5748. path MTU is not known, based on the assumption of a 1500 byte
  5749. Ethernet MTU.
  5750. If an element sends a request over TCP because of these message size
  5751. constraints, and that request would have otherwise been sent over
  5752. UDP, if the attempt to establish the connection generates either an
  5753. ICMP Protocol Not Supported, or results in a TCP reset, the element
  5754. SHOULD retry the request, using UDP. This is only to provide
  5755. backwards compatibility with RFC 2543 compliant implementations that
  5756. do not support TCP. It is anticipated that this behavior will be
  5757. deprecated in a future revision of this specification.
  5758. A client that sends a request to a multicast address MUST add the
  5759. "maddr" parameter to its Via header field value containing the
  5760. destination multicast address, and for IPv4, SHOULD add the "ttl"
  5761. parameter with a value of 1. Usage of IPv6 multicast is not defined
  5762. in this specification, and will be a subject of future
  5763. standardization when the need arises.
  5764. These rules result in a purposeful limitation of multicast in SIP.
  5765. Its primary function is to provide a "single-hop-discovery-like"
  5766. service, delivering a request to a group of homogeneous servers,
  5767. where it is only required to process the response from any one of
  5768. them. This functionality is most useful for registrations. In fact,
  5769. based on the transaction processing rules in Section 17.1.3, the
  5770. client transaction will accept the first response, and view any
  5771. others as retransmissions because they all contain the same Via
  5772. branch identifier.
  5773. Before a request is sent, the client transport MUST insert a value of
  5774. the "sent-by" field into the Via header field. This field contains
  5775. an IP address or host name, and port. The usage of an FQDN is
  5776. RECOMMENDED. This field is used for sending responses under certain
  5777. conditions, described below. If the port is absent, the default
  5778. value depends on the transport. It is 5060 for UDP, TCP and SCTP,
  5779. 5061 for TLS.
  5780. For reliable transports, the response is normally sent on the
  5781. connection on which the request was received. Therefore, the client
  5782. transport MUST be prepared to receive the response on the same
  5783. connection used to send the request. Under error conditions, the
  5784. server may attempt to open a new connection to send the response. To
  5785. handle this case, the transport layer MUST also be prepared to
  5786. receive an incoming connection on the source IP address from which
  5787. the request was sent and port number in the "sent-by" field. It also
  5788. Rosenberg, et. al. Standards Track [Page 143]
  5789. RFC 3261 SIP: Session Initiation Protocol June 2002
  5790. MUST be prepared to receive incoming connections on any address and
  5791. port that would be selected by a server based on the procedures
  5792. described in Section 5 of [4].
  5793. For unreliable unicast transports, the client transport MUST be
  5794. prepared to receive responses on the source IP address from which the
  5795. request is sent (as responses are sent back to the source address)
  5796. and the port number in the "sent-by" field. Furthermore, as with
  5797. reliable transports, in certain cases the response will be sent
  5798. elsewhere. The client MUST be prepared to receive responses on any
  5799. address and port that would be selected by a server based on the
  5800. procedures described in Section 5 of [4].
  5801. For multicast, the client transport MUST be prepared to receive
  5802. responses on the same multicast group and port to which the request
  5803. is sent (that is, it needs to be a member of the multicast group it
  5804. sent the request to.)
  5805. If a request is destined to an IP address, port, and transport to
  5806. which an existing connection is open, it is RECOMMENDED that this
  5807. connection be used to send the request, but another connection MAY be
  5808. opened and used.
  5809. If a request is sent using multicast, it is sent to the group
  5810. address, port, and TTL provided by the transport user. If a request
  5811. is sent using unicast unreliable transports, it is sent to the IP
  5812. address and port provided by the transport user.
  5813. 18.1.2 Receiving Responses
  5814. When a response is received, the client transport examines the top
  5815. Via header field value. If the value of the "sent-by" parameter in
  5816. that header field value does not correspond to a value that the
  5817. client transport is configured to insert into requests, the response
  5818. MUST be silently discarded.
  5819. If there are any client transactions in existence, the client
  5820. transport uses the matching procedures of Section 17.1.3 to attempt
  5821. to match the response to an existing transaction. If there is a
  5822. match, the response MUST be passed to that transaction. Otherwise,
  5823. the response MUST be passed to the core (whether it be stateless
  5824. proxy, stateful proxy, or UA) for further processing. Handling of
  5825. these "stray" responses is dependent on the core (a proxy will
  5826. forward them, while a UA will discard, for example).
  5827. Rosenberg, et. al. Standards Track [Page 144]
  5828. RFC 3261 SIP: Session Initiation Protocol June 2002
  5829. 18.2 Servers
  5830. 18.2.1 Receiving Requests
  5831. A server SHOULD be prepared to receive requests on any IP address,
  5832. port and transport combination that can be the result of a DNS lookup
  5833. on a SIP or SIPS URI [4] that is handed out for the purposes of
  5834. communicating with that server. In this context, "handing out"
  5835. includes placing a URI in a Contact header field in a REGISTER
  5836. request or a redirect response, or in a Record-Route header field in
  5837. a request or response. A URI can also be "handed out" by placing it
  5838. on a web page or business card. It is also RECOMMENDED that a server
  5839. listen for requests on the default SIP ports (5060 for TCP and UDP,
  5840. 5061 for TLS over TCP) on all public interfaces. The typical
  5841. exception would be private networks, or when multiple server
  5842. instances are running on the same host. For any port and interface
  5843. that a server listens on for UDP, it MUST listen on that same port
  5844. and interface for TCP. This is because a message may need to be sent
  5845. using TCP, rather than UDP, if it is too large. As a result, the
  5846. converse is not true. A server need not listen for UDP on a
  5847. particular address and port just because it is listening on that same
  5848. address and port for TCP. There may, of course, be other reasons why
  5849. a server needs to listen for UDP on a particular address and port.
  5850. When the server transport receives a request over any transport, it
  5851. MUST examine the value of the "sent-by" parameter in the top Via
  5852. header field value. If the host portion of the "sent-by" parameter
  5853. contains a domain name, or if it contains an IP address that differs
  5854. from the packet source address, the server MUST add a "received"
  5855. parameter to that Via header field value. This parameter MUST
  5856. contain the source address from which the packet was received. This
  5857. is to assist the server transport layer in sending the response,
  5858. since it must be sent to the source IP address from which the request
  5859. came.
  5860. Consider a request received by the server transport which looks like,
  5861. in part:
  5862. INVITE sip:bob@Biloxi.com SIP/2.0
  5863. Via: SIP/2.0/UDP bobspc.biloxi.com:5060
  5864. The request is received with a source IP address of 192.0.2.4.
  5865. Before passing the request up, the transport adds a "received"
  5866. parameter, so that the request would look like, in part:
  5867. INVITE sip:bob@Biloxi.com SIP/2.0
  5868. Via: SIP/2.0/UDP bobspc.biloxi.com:5060;received=192.0.2.4
  5869. Rosenberg, et. al. Standards Track [Page 145]
  5870. RFC 3261 SIP: Session Initiation Protocol June 2002
  5871. Next, the server transport attempts to match the request to a server
  5872. transaction. It does so using the matching rules described in
  5873. Section 17.2.3. If a matching server transaction is found, the
  5874. request is passed to that transaction for processing. If no match is
  5875. found, the request is passed to the core, which may decide to
  5876. construct a new server transaction for that request. Note that when
  5877. a UAS core sends a 2xx response to INVITE, the server transaction is
  5878. destroyed. This means that when the ACK arrives, there will be no
  5879. matching server transaction, and based on this rule, the ACK is
  5880. passed to the UAS core, where it is processed.
  5881. 18.2.2 Sending Responses
  5882. The server transport uses the value of the top Via header field in
  5883. order to determine where to send a response. It MUST follow the
  5884. following process:
  5885. o If the "sent-protocol" is a reliable transport protocol such as
  5886. TCP or SCTP, or TLS over those, the response MUST be sent using
  5887. the existing connection to the source of the original request
  5888. that created the transaction, if that connection is still open.
  5889. This requires the server transport to maintain an association
  5890. between server transactions and transport connections. If that
  5891. connection is no longer open, the server SHOULD open a
  5892. connection to the IP address in the "received" parameter, if
  5893. present, using the port in the "sent-by" value, or the default
  5894. port for that transport, if no port is specified. If that
  5895. connection attempt fails, the server SHOULD use the procedures
  5896. in [4] for servers in order to determine the IP address and
  5897. port to open the connection and send the response to.
  5898. o Otherwise, if the Via header field value contains a "maddr"
  5899. parameter, the response MUST be forwarded to the address listed
  5900. there, using the port indicated in "sent-by", or port 5060 if
  5901. none is present. If the address is a multicast address, the
  5902. response SHOULD be sent using the TTL indicated in the "ttl"
  5903. parameter, or with a TTL of 1 if that parameter is not present.
  5904. o Otherwise (for unreliable unicast transports), if the top Via
  5905. has a "received" parameter, the response MUST be sent to the
  5906. address in the "received" parameter, using the port indicated
  5907. in the "sent-by" value, or using port 5060 if none is specified
  5908. explicitly. If this fails, for example, elicits an ICMP "port
  5909. unreachable" response, the procedures of Section 5 of [4]
  5910. SHOULD be used to determine where to send the response.
  5911. Rosenberg, et. al. Standards Track [Page 146]
  5912. RFC 3261 SIP: Session Initiation Protocol June 2002
  5913. o Otherwise, if it is not receiver-tagged, the response MUST be
  5914. sent to the address indicated by the "sent-by" value, using the
  5915. procedures in Section 5 of [4].
  5916. 18.3 Framing
  5917. In the case of message-oriented transports (such as UDP), if the
  5918. message has a Content-Length header field, the message body is
  5919. assumed to contain that many bytes. If there are additional bytes in
  5920. the transport packet beyond the end of the body, they MUST be
  5921. discarded. If the transport packet ends before the end of the
  5922. message body, this is considered an error. If the message is a
  5923. response, it MUST be discarded. If the message is a request, the
  5924. element SHOULD generate a 400 (Bad Request) response. If the message
  5925. has no Content-Length header field, the message body is assumed to
  5926. end at the end of the transport packet.
  5927. In the case of stream-oriented transports such as TCP, the Content-
  5928. Length header field indicates the size of the body. The Content-
  5929. Length header field MUST be used with stream oriented transports.
  5930. 18.4 Error Handling
  5931. Error handling is independent of whether the message was a request or
  5932. response.
  5933. If the transport user asks for a message to be sent over an
  5934. unreliable transport, and the result is an ICMP error, the behavior
  5935. depends on the type of ICMP error. Host, network, port or protocol
  5936. unreachable errors, or parameter problem errors SHOULD cause the
  5937. transport layer to inform the transport user of a failure in sending.
  5938. Source quench and TTL exceeded ICMP errors SHOULD be ignored.
  5939. If the transport user asks for a request to be sent over a reliable
  5940. transport, and the result is a connection failure, the transport
  5941. layer SHOULD inform the transport user of a failure in sending.
  5942. 19 Common Message Components
  5943. There are certain components of SIP messages that appear in various
  5944. places within SIP messages (and sometimes, outside of them) that
  5945. merit separate discussion.
  5946. Rosenberg, et. al. Standards Track [Page 147]
  5947. RFC 3261 SIP: Session Initiation Protocol June 2002
  5948. 19.1 SIP and SIPS Uniform Resource Indicators
  5949. A SIP or SIPS URI identifies a communications resource. Like all
  5950. URIs, SIP and SIPS URIs may be placed in web pages, email messages,
  5951. or printed literature. They contain sufficient information to
  5952. initiate and maintain a communication session with the resource.
  5953. Examples of communications resources include the following:
  5954. o a user of an online service
  5955. o an appearance on a multi-line phone
  5956. o a mailbox on a messaging system
  5957. o a PSTN number at a gateway service
  5958. o a group (such as "sales" or "helpdesk") in an organization
  5959. A SIPS URI specifies that the resource be contacted securely. This
  5960. means, in particular, that TLS is to be used between the UAC and the
  5961. domain that owns the URI. From there, secure communications are used
  5962. to reach the user, where the specific security mechanism depends on
  5963. the policy of the domain. Any resource described by a SIP URI can be
  5964. "upgraded" to a SIPS URI by just changing the scheme, if it is
  5965. desired to communicate with that resource securely.
  5966. 19.1.1 SIP and SIPS URI Components
  5967. The "sip:" and "sips:" schemes follow the guidelines in RFC 2396 [5].
  5968. They use a form similar to the mailto URL, allowing the specification
  5969. of SIP request-header fields and the SIP message-body. This makes it
  5970. possible to specify the subject, media type, or urgency of sessions
  5971. initiated by using a URI on a web page or in an email message. The
  5972. formal syntax for a SIP or SIPS URI is presented in Section 25. Its
  5973. general form, in the case of a SIP URI, is:
  5974. sip:user:password@host:port;uri-parameters?headers
  5975. The format for a SIPS URI is the same, except that the scheme is
  5976. "sips" instead of sip. These tokens, and some of the tokens in their
  5977. expansions, have the following meanings:
  5978. user: The identifier of a particular resource at the host being
  5979. addressed. The term "host" in this context frequently refers
  5980. to a domain. The "userinfo" of a URI consists of this user
  5981. field, the password field, and the @ sign following them. The
  5982. userinfo part of a URI is optional and MAY be absent when the
  5983. Rosenberg, et. al. Standards Track [Page 148]
  5984. RFC 3261 SIP: Session Initiation Protocol June 2002
  5985. destination host does not have a notion of users or when the
  5986. host itself is the resource being identified. If the @ sign is
  5987. present in a SIP or SIPS URI, the user field MUST NOT be empty.
  5988. If the host being addressed can process telephone numbers, for
  5989. instance, an Internet telephony gateway, a telephone-
  5990. subscriber field defined in RFC 2806 [9] MAY be used to
  5991. populate the user field. There are special escaping rules for
  5992. encoding telephone-subscriber fields in SIP and SIPS URIs
  5993. described in Section 19.1.2.
  5994. password: A password associated with the user. While the SIP and
  5995. SIPS URI syntax allows this field to be present, its use is NOT
  5996. RECOMMENDED, because the passing of authentication information
  5997. in clear text (such as URIs) has proven to be a security risk
  5998. in almost every case where it has been used. For instance,
  5999. transporting a PIN number in this field exposes the PIN.
  6000. Note that the password field is just an extension of the user
  6001. portion. Implementations not wishing to give special
  6002. significance to the password portion of the field MAY simply
  6003. treat "user:password" as a single string.
  6004. host: The host providing the SIP resource. The host part contains
  6005. either a fully-qualified domain name or numeric IPv4 or IPv6
  6006. address. Using the fully-qualified domain name form is
  6007. RECOMMENDED whenever possible.
  6008. port: The port number where the request is to be sent.
  6009. URI parameters: Parameters affecting a request constructed from
  6010. the URI.
  6011. URI parameters are added after the hostport component and are
  6012. separated by semi-colons.
  6013. URI parameters take the form:
  6014. parameter-name "=" parameter-value
  6015. Even though an arbitrary number of URI parameters may be
  6016. included in a URI, any given parameter-name MUST NOT appear
  6017. more than once.
  6018. This extensible mechanism includes the transport, maddr, ttl,
  6019. user, method and lr parameters.
  6020. Rosenberg, et. al. Standards Track [Page 149]
  6021. RFC 3261 SIP: Session Initiation Protocol June 2002
  6022. The transport parameter determines the transport mechanism to
  6023. be used for sending SIP messages, as specified in [4]. SIP can
  6024. use any network transport protocol. Parameter names are
  6025. defined for UDP (RFC 768 [14]), TCP (RFC 761 [15]), and SCTP
  6026. (RFC 2960 [16]). For a SIPS URI, the transport parameter MUST
  6027. indicate a reliable transport.
  6028. The maddr parameter indicates the server address to be
  6029. contacted for this user, overriding any address derived from
  6030. the host field. When an maddr parameter is present, the port
  6031. and transport components of the URI apply to the address
  6032. indicated in the maddr parameter value. [4] describes the
  6033. proper interpretation of the transport, maddr, and hostport in
  6034. order to obtain the destination address, port, and transport
  6035. for sending a request.
  6036. The maddr field has been used as a simple form of loose source
  6037. routing. It allows a URI to specify a proxy that must be
  6038. traversed en-route to the destination. Continuing to use the
  6039. maddr parameter this way is strongly discouraged (the
  6040. mechanisms that enable it are deprecated). Implementations
  6041. should instead use the Route mechanism described in this
  6042. document, establishing a pre-existing route set if necessary
  6043. (see Section 8.1.1.1). This provides a full URI to describe
  6044. the node to be traversed.
  6045. The ttl parameter determines the time-to-live value of the UDP
  6046. multicast packet and MUST only be used if maddr is a multicast
  6047. address and the transport protocol is UDP. For example, to
  6048. specify a call to alice@atlanta.com using multicast to
  6049. 239.255.255.1 with a ttl of 15, the following URI would be
  6050. used:
  6051. sip:alice@atlanta.com;maddr=239.255.255.1;ttl=15
  6052. The set of valid telephone-subscriber strings is a subset of
  6053. valid user strings. The user URI parameter exists to
  6054. distinguish telephone numbers from user names that happen to
  6055. look like telephone numbers. If the user string contains a
  6056. telephone number formatted as a telephone-subscriber, the user
  6057. parameter value "phone" SHOULD be present. Even without this
  6058. parameter, recipients of SIP and SIPS URIs MAY interpret the
  6059. pre-@ part as a telephone number if local restrictions on the
  6060. name space for user name allow it.
  6061. The method of the SIP request constructed from the URI can be
  6062. specified with the method parameter.
  6063. Rosenberg, et. al. Standards Track [Page 150]
  6064. RFC 3261 SIP: Session Initiation Protocol June 2002
  6065. The lr parameter, when present, indicates that the element
  6066. responsible for this resource implements the routing mechanisms
  6067. specified in this document. This parameter will be used in the
  6068. URIs proxies place into Record-Route header field values, and
  6069. may appear in the URIs in a pre-existing route set.
  6070. This parameter is used to achieve backwards compatibility with
  6071. systems implementing the strict-routing mechanisms of RFC 2543
  6072. and the rfc2543bis drafts up to bis-05. An element preparing
  6073. to send a request based on a URI not containing this parameter
  6074. can assume the receiving element implements strict-routing and
  6075. reformat the message to preserve the information in the
  6076. Request-URI.
  6077. Since the uri-parameter mechanism is extensible, SIP elements
  6078. MUST silently ignore any uri-parameters that they do not
  6079. understand.
  6080. Headers: Header fields to be included in a request constructed
  6081. from the URI.
  6082. Headers fields in the SIP request can be specified with the "?"
  6083. mechanism within a URI. The header names and values are
  6084. encoded in ampersand separated hname = hvalue pairs. The
  6085. special hname "body" indicates that the associated hvalue is
  6086. the message-body of the SIP request.
  6087. Table 1 summarizes the use of SIP and SIPS URI components based on
  6088. the context in which the URI appears. The external column describes
  6089. URIs appearing anywhere outside of a SIP message, for instance on a
  6090. web page or business card. Entries marked "m" are mandatory, those
  6091. marked "o" are optional, and those marked "-" are not allowed.
  6092. Elements processing URIs SHOULD ignore any disallowed components if
  6093. they are present. The second column indicates the default value of
  6094. an optional element if it is not present. "--" indicates that the
  6095. element is either not optional, or has no default value.
  6096. URIs in Contact header fields have different restrictions depending
  6097. on the context in which the header field appears. One set applies to
  6098. messages that establish and maintain dialogs (INVITE and its 200 (OK)
  6099. response). The other applies to registration and redirection
  6100. messages (REGISTER, its 200 (OK) response, and 3xx class responses to
  6101. any method).
  6102. Rosenberg, et. al. Standards Track [Page 151]
  6103. RFC 3261 SIP: Session Initiation Protocol June 2002
  6104. 19.1.2 Character Escaping Requirements
  6105. dialog
  6106. reg./redir. Contact/
  6107. default Req.-URI To From Contact R-R/Route external
  6108. user -- o o o o o o
  6109. password -- o o o o o o
  6110. host -- m m m m m m
  6111. port (1) o - - o o o
  6112. user-param ip o o o o o o
  6113. method INVITE - - - - - o
  6114. maddr-param -- o - - o o o
  6115. ttl-param 1 o - - o - o
  6116. transp.-param (2) o - - o o o
  6117. lr-param -- o - - - o o
  6118. other-param -- o o o o o o
  6119. headers -- - - - o - o
  6120. (1): The default port value is transport and scheme dependent. The
  6121. default is 5060 for sip: using UDP, TCP, or SCTP. The default is
  6122. 5061 for sip: using TLS over TCP and sips: over TCP.
  6123. (2): The default transport is scheme dependent. For sip:, it is UDP.
  6124. For sips:, it is TCP.
  6125. Table 1: Use and default values of URI components for SIP header
  6126. field values, Request-URI and references
  6127. SIP follows the requirements and guidelines of RFC 2396 [5] when
  6128. defining the set of characters that must be escaped in a SIP URI, and
  6129. uses its ""%" HEX HEX" mechanism for escaping. From RFC 2396 [5]:
  6130. The set of characters actually reserved within any given URI
  6131. component is defined by that component. In general, a character
  6132. is reserved if the semantics of the URI changes if the character
  6133. is replaced with its escaped US-ASCII encoding [5]. Excluded US-
  6134. ASCII characters (RFC 2396 [5]), such as space and control
  6135. characters and characters used as URI delimiters, also MUST be
  6136. escaped. URIs MUST NOT contain unescaped space and control
  6137. characters.
  6138. For each component, the set of valid BNF expansions defines exactly
  6139. which characters may appear unescaped. All other characters MUST be
  6140. escaped.
  6141. For example, "@" is not in the set of characters in the user
  6142. component, so the user "j@s0n" must have at least the @ sign encoded,
  6143. as in "j%40s0n".
  6144. Rosenberg, et. al. Standards Track [Page 152]
  6145. RFC 3261 SIP: Session Initiation Protocol June 2002
  6146. Expanding the hname and hvalue tokens in Section 25 show that all URI
  6147. reserved characters in header field names and values MUST be escaped.
  6148. The telephone-subscriber subset of the user component has special
  6149. escaping considerations. The set of characters not reserved in the
  6150. RFC 2806 [9] description of telephone-subscriber contains a number of
  6151. characters in various syntax elements that need to be escaped when
  6152. used in SIP URIs. Any characters occurring in a telephone-subscriber
  6153. that do not appear in an expansion of the BNF for the user rule MUST
  6154. be escaped.
  6155. Note that character escaping is not allowed in the host component of
  6156. a SIP or SIPS URI (the % character is not valid in its expansion).
  6157. This is likely to change in the future as requirements for
  6158. Internationalized Domain Names are finalized. Current
  6159. implementations MUST NOT attempt to improve robustness by treating
  6160. received escaped characters in the host component as literally
  6161. equivalent to their unescaped counterpart. The behavior required to
  6162. meet the requirements of IDN may be significantly different.
  6163. 19.1.3 Example SIP and SIPS URIs
  6164. sip:alice@atlanta.com
  6165. sip:alice:secretword@atlanta.com;transport=tcp
  6166. sips:alice@atlanta.com?subject=project%20x&priority=urgent
  6167. sip:+1-212-555-1212:1234@gateway.com;user=phone
  6168. sips:1212@gateway.com
  6169. sip:alice@192.0.2.4
  6170. sip:atlanta.com;method=REGISTER?to=alice%40atlanta.com
  6171. sip:alice;day=tuesday@atlanta.com
  6172. The last sample URI above has a user field value of
  6173. "alice;day=tuesday". The escaping rules defined above allow a
  6174. semicolon to appear unescaped in this field. For the purposes of
  6175. this protocol, the field is opaque. The structure of that value is
  6176. only useful to the SIP element responsible for the resource.
  6177. 19.1.4 URI Comparison
  6178. Some operations in this specification require determining whether two
  6179. SIP or SIPS URIs are equivalent. In this specification, registrars
  6180. need to compare bindings in Contact URIs in REGISTER requests (see
  6181. Section 10.3.). SIP and SIPS URIs are compared for equality
  6182. according to the following rules:
  6183. o A SIP and SIPS URI are never equivalent.
  6184. Rosenberg, et. al. Standards Track [Page 153]
  6185. RFC 3261 SIP: Session Initiation Protocol June 2002
  6186. o Comparison of the userinfo of SIP and SIPS URIs is case-
  6187. sensitive. This includes userinfo containing passwords or
  6188. formatted as telephone-subscribers. Comparison of all other
  6189. components of the URI is case-insensitive unless explicitly
  6190. defined otherwise.
  6191. o The ordering of parameters and header fields is not significant
  6192. in comparing SIP and SIPS URIs.
  6193. o Characters other than those in the "reserved" set (see RFC 2396
  6194. [5]) are equivalent to their ""%" HEX HEX" encoding.
  6195. o An IP address that is the result of a DNS lookup of a host name
  6196. does not match that host name.
  6197. o For two URIs to be equal, the user, password, host, and port
  6198. components must match.
  6199. A URI omitting the user component will not match a URI that
  6200. includes one. A URI omitting the password component will not
  6201. match a URI that includes one.
  6202. A URI omitting any component with a default value will not
  6203. match a URI explicitly containing that component with its
  6204. default value. For instance, a URI omitting the optional port
  6205. component will not match a URI explicitly declaring port 5060.
  6206. The same is true for the transport-parameter, ttl-parameter,
  6207. user-parameter, and method components.
  6208. Defining sip:user@host to not be equivalent to
  6209. sip:user@host:5060 is a change from RFC 2543. When deriving
  6210. addresses from URIs, equivalent addresses are expected from
  6211. equivalent URIs. The URI sip:user@host:5060 will always
  6212. resolve to port 5060. The URI sip:user@host may resolve to
  6213. other ports through the DNS SRV mechanisms detailed in [4].
  6214. o URI uri-parameter components are compared as follows:
  6215. - Any uri-parameter appearing in both URIs must match.
  6216. - A user, ttl, or method uri-parameter appearing in only one
  6217. URI never matches, even if it contains the default value.
  6218. - A URI that includes an maddr parameter will not match a URI
  6219. that contains no maddr parameter.
  6220. - All other uri-parameters appearing in only one URI are
  6221. ignored when comparing the URIs.
  6222. Rosenberg, et. al. Standards Track [Page 154]
  6223. RFC 3261 SIP: Session Initiation Protocol June 2002
  6224. o URI header components are never ignored. Any present header
  6225. component MUST be present in both URIs and match for the URIs
  6226. to match. The matching rules are defined for each header field
  6227. in Section 20.
  6228. The URIs within each of the following sets are equivalent:
  6229. sip:%61lice@atlanta.com;transport=TCP
  6230. sip:alice@AtLanTa.CoM;Transport=tcp
  6231. sip:carol@chicago.com
  6232. sip:carol@chicago.com;newparam=5
  6233. sip:carol@chicago.com;security=on
  6234. sip:biloxi.com;transport=tcp;method=REGISTER?to=sip:bob%40biloxi.com
  6235. sip:biloxi.com;method=REGISTER;transport=tcp?to=sip:bob%40biloxi.com
  6236. sip:alice@atlanta.com?subject=project%20x&priority=urgent
  6237. sip:alice@atlanta.com?priority=urgent&subject=project%20x
  6238. The URIs within each of the following sets are not equivalent:
  6239. SIP:ALICE@AtLanTa.CoM;Transport=udp (different usernames)
  6240. sip:alice@AtLanTa.CoM;Transport=UDP
  6241. sip:bob@biloxi.com (can resolve to different ports)
  6242. sip:bob@biloxi.com:5060
  6243. sip:bob@biloxi.com (can resolve to different transports)
  6244. sip:bob@biloxi.com;transport=udp
  6245. sip:bob@biloxi.com (can resolve to different port and transports)
  6246. sip:bob@biloxi.com:6000;transport=tcp
  6247. sip:carol@chicago.com (different header component)
  6248. sip:carol@chicago.com?Subject=next%20meeting
  6249. sip:bob@phone21.boxesbybob.com (even though that's what
  6250. sip:bob@192.0.2.4 phone21.boxesbybob.com resolves to)
  6251. Note that equality is not transitive:
  6252. o sip:carol@chicago.com and sip:carol@chicago.com;security=on are
  6253. equivalent
  6254. o sip:carol@chicago.com and sip:carol@chicago.com;security=off
  6255. are equivalent
  6256. Rosenberg, et. al. Standards Track [Page 155]
  6257. RFC 3261 SIP: Session Initiation Protocol June 2002
  6258. o sip:carol@chicago.com;security=on and
  6259. sip:carol@chicago.com;security=off are not equivalent
  6260. 19.1.5 Forming Requests from a URI
  6261. An implementation needs to take care when forming requests directly
  6262. from a URI. URIs from business cards, web pages, and even from
  6263. sources inside the protocol such as registered contacts may contain
  6264. inappropriate header fields or body parts.
  6265. An implementation MUST include any provided transport, maddr, ttl, or
  6266. user parameter in the Request-URI of the formed request. If the URI
  6267. contains a method parameter, its value MUST be used as the method of
  6268. the request. The method parameter MUST NOT be placed in the
  6269. Request-URI. Unknown URI parameters MUST be placed in the message's
  6270. Request-URI.
  6271. An implementation SHOULD treat the presence of any headers or body
  6272. parts in the URI as a desire to include them in the message, and
  6273. choose to honor the request on a per-component basis.
  6274. An implementation SHOULD NOT honor these obviously dangerous header
  6275. fields: From, Call-ID, CSeq, Via, and Record-Route.
  6276. An implementation SHOULD NOT honor any requested Route header field
  6277. values in order to not be used as an unwitting agent in malicious
  6278. attacks.
  6279. An implementation SHOULD NOT honor requests to include header fields
  6280. that may cause it to falsely advertise its location or capabilities.
  6281. These include: Accept, Accept-Encoding, Accept-Language, Allow,
  6282. Contact (in its dialog usage), Organization, Supported, and User-
  6283. Agent.
  6284. An implementation SHOULD verify the accuracy of any requested
  6285. descriptive header fields, including: Content-Disposition, Content-
  6286. Encoding, Content-Language, Content-Length, Content-Type, Date,
  6287. Mime-Version, and Timestamp.
  6288. If the request formed from constructing a message from a given URI is
  6289. not a valid SIP request, the URI is invalid. An implementation MUST
  6290. NOT proceed with transmitting the request. It should instead pursue
  6291. the course of action due an invalid URI in the context it occurs.
  6292. The constructed request can be invalid in many ways. These
  6293. include, but are not limited to, syntax error in header fields,
  6294. invalid combinations of URI parameters, or an incorrect
  6295. description of the message body.
  6296. Rosenberg, et. al. Standards Track [Page 156]
  6297. RFC 3261 SIP: Session Initiation Protocol June 2002
  6298. Sending a request formed from a given URI may require capabilities
  6299. unavailable to the implementation. The URI might indicate use of an
  6300. unimplemented transport or extension, for example. An implementation
  6301. SHOULD refuse to send these requests rather than modifying them to
  6302. match their capabilities. An implementation MUST NOT send a request
  6303. requiring an extension that it does not support.
  6304. For example, such a request can be formed through the presence of
  6305. a Require header parameter or a method URI parameter with an
  6306. unknown or explicitly unsupported value.
  6307. 19.1.6 Relating SIP URIs and tel URLs
  6308. When a tel URL (RFC 2806 [9]) is converted to a SIP or SIPS URI, the
  6309. entire telephone-subscriber portion of the tel URL, including any
  6310. parameters, is placed into the userinfo part of the SIP or SIPS URI.
  6311. Thus, tel:+358-555-1234567;postd=pp22 becomes
  6312. sip:+358-555-1234567;postd=pp22@foo.com;user=phone
  6313. or
  6314. sips:+358-555-1234567;postd=pp22@foo.com;user=phone
  6315. not
  6316. sip:+358-555-1234567@foo.com;postd=pp22;user=phone
  6317. or
  6318. sips:+358-555-1234567@foo.com;postd=pp22;user=phone
  6319. In general, equivalent "tel" URLs converted to SIP or SIPS URIs in
  6320. this fashion may not produce equivalent SIP or SIPS URIs. The
  6321. userinfo of SIP and SIPS URIs are compared as a case-sensitive
  6322. string. Variance in case-insensitive portions of tel URLs and
  6323. reordering of tel URL parameters does not affect tel URL equivalence,
  6324. but does affect the equivalence of SIP URIs formed from them.
  6325. For example,
  6326. tel:+358-555-1234567;postd=pp22
  6327. tel:+358-555-1234567;POSTD=PP22
  6328. are equivalent, while
  6329. sip:+358-555-1234567;postd=pp22@foo.com;user=phone
  6330. sip:+358-555-1234567;POSTD=PP22@foo.com;user=phone
  6331. Rosenberg, et. al. Standards Track [Page 157]
  6332. RFC 3261 SIP: Session Initiation Protocol June 2002
  6333. are not.
  6334. Likewise,
  6335. tel:+358-555-1234567;postd=pp22;isub=1411
  6336. tel:+358-555-1234567;isub=1411;postd=pp22
  6337. are equivalent, while
  6338. sip:+358-555-1234567;postd=pp22;isub=1411@foo.com;user=phone
  6339. sip:+358-555-1234567;isub=1411;postd=pp22@foo.com;user=phone
  6340. are not.
  6341. To mitigate this problem, elements constructing telephone-subscriber
  6342. fields to place in the userinfo part of a SIP or SIPS URI SHOULD fold
  6343. any case-insensitive portion of telephone-subscriber to lower case,
  6344. and order the telephone-subscriber parameters lexically by parameter
  6345. name, excepting isdn-subaddress and post-dial, which occur first and
  6346. in that order. (All components of a tel URL except for future-
  6347. extension parameters are defined to be compared case-insensitive.)
  6348. Following this suggestion, both
  6349. tel:+358-555-1234567;postd=pp22
  6350. tel:+358-555-1234567;POSTD=PP22
  6351. become
  6352. sip:+358-555-1234567;postd=pp22@foo.com;user=phone
  6353. and both
  6354. tel:+358-555-1234567;tsp=a.b;phone-context=5
  6355. tel:+358-555-1234567;phone-context=5;tsp=a.b
  6356. become
  6357. sip:+358-555-1234567;phone-context=5;tsp=a.b@foo.com;user=phone
  6358. 19.2 Option Tags
  6359. Option tags are unique identifiers used to designate new options
  6360. (extensions) in SIP. These tags are used in Require (Section 20.32),
  6361. Proxy-Require (Section 20.29), Supported (Section 20.37) and
  6362. Unsupported (Section 20.40) header fields. Note that these options
  6363. appear as parameters in those header fields in an option-tag = token
  6364. form (see Section 25 for the definition of token).
  6365. Rosenberg, et. al. Standards Track [Page 158]
  6366. RFC 3261 SIP: Session Initiation Protocol June 2002
  6367. Option tags are defined in standards track RFCs. This is a change
  6368. from past practice, and is instituted to ensure continuing multi-
  6369. vendor interoperability (see discussion in Section 20.32 and Section
  6370. 20.37). An IANA registry of option tags is used to ensure easy
  6371. reference.
  6372. 19.3 Tags
  6373. The "tag" parameter is used in the To and From header fields of SIP
  6374. messages. It serves as a general mechanism to identify a dialog,
  6375. which is the combination of the Call-ID along with two tags, one from
  6376. each participant in the dialog. When a UA sends a request outside of
  6377. a dialog, it contains a From tag only, providing "half" of the dialog
  6378. ID. The dialog is completed from the response(s), each of which
  6379. contributes the second half in the To header field. The forking of
  6380. SIP requests means that multiple dialogs can be established from a
  6381. single request. This also explains the need for the two-sided dialog
  6382. identifier; without a contribution from the recipients, the
  6383. originator could not disambiguate the multiple dialogs established
  6384. from a single request.
  6385. When a tag is generated by a UA for insertion into a request or
  6386. response, it MUST be globally unique and cryptographically random
  6387. with at least 32 bits of randomness. A property of this selection
  6388. requirement is that a UA will place a different tag into the From
  6389. header of an INVITE than it would place into the To header of the
  6390. response to the same INVITE. This is needed in order for a UA to
  6391. invite itself to a session, a common case for "hairpinning" of calls
  6392. in PSTN gateways. Similarly, two INVITEs for different calls will
  6393. have different From tags, and two responses for different calls will
  6394. have different To tags.
  6395. Besides the requirement for global uniqueness, the algorithm for
  6396. generating a tag is implementation-specific. Tags are helpful in
  6397. fault tolerant systems, where a dialog is to be recovered on an
  6398. alternate server after a failure. A UAS can select the tag in such a
  6399. way that a backup can recognize a request as part of a dialog on the
  6400. failed server, and therefore determine that it should attempt to
  6401. recover the dialog and any other state associated with it.
  6402. 20 Header Fields
  6403. The general syntax for header fields is covered in Section 7.3. This
  6404. section lists the full set of header fields along with notes on
  6405. syntax, meaning, and usage. Throughout this section, we use [HX.Y]
  6406. to refer to Section X.Y of the current HTTP/1.1 specification RFC
  6407. 2616 [8]. Examples of each header field are given.
  6408. Rosenberg, et. al. Standards Track [Page 159]
  6409. RFC 3261 SIP: Session Initiation Protocol June 2002
  6410. Information about header fields in relation to methods and proxy
  6411. processing is summarized in Tables 2 and 3.
  6412. The "where" column describes the request and response types in which
  6413. the header field can be used. Values in this column are:
  6414. R: header field may only appear in requests;
  6415. r: header field may only appear in responses;
  6416. 2xx, 4xx, etc.: A numerical value or range indicates response
  6417. codes with which the header field can be used;
  6418. c: header field is copied from the request to the response.
  6419. An empty entry in the "where" column indicates that the header
  6420. field may be present in all requests and responses.
  6421. The "proxy" column describes the operations a proxy may perform on a
  6422. header field:
  6423. a: A proxy can add or concatenate the header field if not present.
  6424. m: A proxy can modify an existing header field value.
  6425. d: A proxy can delete a header field value.
  6426. r: A proxy must be able to read the header field, and thus this
  6427. header field cannot be encrypted.
  6428. The next six columns relate to the presence of a header field in a
  6429. method:
  6430. c: Conditional; requirements on the header field depend on the
  6431. context of the message.
  6432. m: The header field is mandatory.
  6433. m*: The header field SHOULD be sent, but clients/servers need to
  6434. be prepared to receive messages without that header field.
  6435. o: The header field is optional.
  6436. t: The header field SHOULD be sent, but clients/servers need to be
  6437. prepared to receive messages without that header field.
  6438. If a stream-based protocol (such as TCP) is used as a
  6439. transport, then the header field MUST be sent.
  6440. Rosenberg, et. al. Standards Track [Page 160]
  6441. RFC 3261 SIP: Session Initiation Protocol June 2002
  6442. *: The header field is required if the message body is not empty.
  6443. See Sections 20.14, 20.15 and 7.4 for details.
  6444. -: The header field is not applicable.
  6445. "Optional" means that an element MAY include the header field in a
  6446. request or response, and a UA MAY ignore the header field if present
  6447. in the request or response (The exception to this rule is the Require
  6448. header field discussed in 20.32). A "mandatory" header field MUST be
  6449. present in a request, and MUST be understood by the UAS receiving the
  6450. request. A mandatory response header field MUST be present in the
  6451. response, and the header field MUST be understood by the UAC
  6452. processing the response. "Not applicable" means that the header
  6453. field MUST NOT be present in a request. If one is placed in a
  6454. request by mistake, it MUST be ignored by the UAS receiving the
  6455. request. Similarly, a header field labeled "not applicable" for a
  6456. response means that the UAS MUST NOT place the header field in the
  6457. response, and the UAC MUST ignore the header field in the response.
  6458. A UA SHOULD ignore extension header parameters that are not
  6459. understood.
  6460. A compact form of some common header field names is also defined for
  6461. use when overall message size is an issue.
  6462. The Contact, From, and To header fields contain a URI. If the URI
  6463. contains a comma, question mark or semicolon, the URI MUST be
  6464. enclosed in angle brackets (< and >). Any URI parameters are
  6465. contained within these brackets. If the URI is not enclosed in angle
  6466. brackets, any semicolon-delimited parameters are header-parameters,
  6467. not URI parameters.
  6468. 20.1 Accept
  6469. The Accept header field follows the syntax defined in [H14.1]. The
  6470. semantics are also identical, with the exception that if no Accept
  6471. header field is present, the server SHOULD assume a default value of
  6472. application/sdp.
  6473. An empty Accept header field means that no formats are acceptable.
  6474. Rosenberg, et. al. Standards Track [Page 161]
  6475. RFC 3261 SIP: Session Initiation Protocol June 2002
  6476. Example:
  6477. Header field where proxy ACK BYE CAN INV OPT REG
  6478. ___________________________________________________________
  6479. Accept R - o - o m* o
  6480. Accept 2xx - - - o m* o
  6481. Accept 415 - c - c c c
  6482. Accept-Encoding R - o - o o o
  6483. Accept-Encoding 2xx - - - o m* o
  6484. Accept-Encoding 415 - c - c c c
  6485. Accept-Language R - o - o o o
  6486. Accept-Language 2xx - - - o m* o
  6487. Accept-Language 415 - c - c c c
  6488. Alert-Info R ar - - - o - -
  6489. Alert-Info 180 ar - - - o - -
  6490. Allow R - o - o o o
  6491. Allow 2xx - o - m* m* o
  6492. Allow r - o - o o o
  6493. Allow 405 - m - m m m
  6494. Authentication-Info 2xx - o - o o o
  6495. Authorization R o o o o o o
  6496. Call-ID c r m m m m m m
  6497. Call-Info ar - - - o o o
  6498. Contact R o - - m o o
  6499. Contact 1xx - - - o - -
  6500. Contact 2xx - - - m o o
  6501. Contact 3xx d - o - o o o
  6502. Contact 485 - o - o o o
  6503. Content-Disposition o o - o o o
  6504. Content-Encoding o o - o o o
  6505. Content-Language o o - o o o
  6506. Content-Length ar t t t t t t
  6507. Content-Type * * - * * *
  6508. CSeq c r m m m m m m
  6509. Date a o o o o o o
  6510. Error-Info 300-699 a - o o o o o
  6511. Expires - - - o - o
  6512. From c r m m m m m m
  6513. In-Reply-To R - - - o - -
  6514. Max-Forwards R amr m m m m m m
  6515. Min-Expires 423 - - - - - m
  6516. MIME-Version o o - o o o
  6517. Organization ar - - - o o o
  6518. Table 2: Summary of header fields, A--O
  6519. Rosenberg, et. al. Standards Track [Page 162]
  6520. RFC 3261 SIP: Session Initiation Protocol June 2002
  6521. Header field where proxy ACK BYE CAN INV OPT REG
  6522. ___________________________________________________________________
  6523. Priority R ar - - - o - -
  6524. Proxy-Authenticate 407 ar - m - m m m
  6525. Proxy-Authenticate 401 ar - o o o o o
  6526. Proxy-Authorization R dr o o - o o o
  6527. Proxy-Require R ar - o - o o o
  6528. Record-Route R ar o o o o o -
  6529. Record-Route 2xx,18x mr - o o o o -
  6530. Reply-To - - - o - -
  6531. Require ar - c - c c c
  6532. Retry-After 404,413,480,486 - o o o o o
  6533. 500,503 - o o o o o
  6534. 600,603 - o o o o o
  6535. Route R adr c c c c c c
  6536. Server r - o o o o o
  6537. Subject R - - - o - -
  6538. Supported R - o o m* o o
  6539. Supported 2xx - o o m* m* o
  6540. Timestamp o o o o o o
  6541. To c(1) r m m m m m m
  6542. Unsupported 420 - m - m m m
  6543. User-Agent o o o o o o
  6544. Via R amr m m m m m m
  6545. Via rc dr m m m m m m
  6546. Warning r - o o o o o
  6547. WWW-Authenticate 401 ar - m - m m m
  6548. WWW-Authenticate 407 ar - o - o o o
  6549. Table 3: Summary of header fields, P--Z; (1): copied with possible
  6550. addition of tag
  6551. Accept: application/sdp;level=1, application/x-private, text/html
  6552. 20.2 Accept-Encoding
  6553. The Accept-Encoding header field is similar to Accept, but restricts
  6554. the content-codings [H3.5] that are acceptable in the response. See
  6555. [H14.3]. The semantics in SIP are identical to those defined in
  6556. [H14.3].
  6557. An empty Accept-Encoding header field is permissible. It is
  6558. equivalent to Accept-Encoding: identity, that is, only the identity
  6559. encoding, meaning no encoding, is permissible.
  6560. If no Accept-Encoding header field is present, the server SHOULD
  6561. assume a default value of identity.
  6562. Rosenberg, et. al. Standards Track [Page 163]
  6563. RFC 3261 SIP: Session Initiation Protocol June 2002
  6564. This differs slightly from the HTTP definition, which indicates that
  6565. when not present, any encoding can be used, but the identity encoding
  6566. is preferred.
  6567. Example:
  6568. Accept-Encoding: gzip
  6569. 20.3 Accept-Language
  6570. The Accept-Language header field is used in requests to indicate the
  6571. preferred languages for reason phrases, session descriptions, or
  6572. status responses carried as message bodies in the response. If no
  6573. Accept-Language header field is present, the server SHOULD assume all
  6574. languages are acceptable to the client.
  6575. The Accept-Language header field follows the syntax defined in
  6576. [H14.4]. The rules for ordering the languages based on the "q"
  6577. parameter apply to SIP as well.
  6578. Example:
  6579. Accept-Language: da, en-gb;q=0.8, en;q=0.7
  6580. 20.4 Alert-Info
  6581. When present in an INVITE request, the Alert-Info header field
  6582. specifies an alternative ring tone to the UAS. When present in a 180
  6583. (Ringing) response, the Alert-Info header field specifies an
  6584. alternative ringback tone to the UAC. A typical usage is for a proxy
  6585. to insert this header field to provide a distinctive ring feature.
  6586. The Alert-Info header field can introduce security risks. These
  6587. risks and the ways to handle them are discussed in Section 20.9,
  6588. which discusses the Call-Info header field since the risks are
  6589. identical.
  6590. In addition, a user SHOULD be able to disable this feature
  6591. selectively.
  6592. This helps prevent disruptions that could result from the use of
  6593. this header field by untrusted elements.
  6594. Example:
  6595. Alert-Info: <http://www.example.com/sounds/moo.wav>
  6596. Rosenberg, et. al. Standards Track [Page 164]
  6597. RFC 3261 SIP: Session Initiation Protocol June 2002
  6598. 20.5 Allow
  6599. The Allow header field lists the set of methods supported by the UA
  6600. generating the message.
  6601. All methods, including ACK and CANCEL, understood by the UA MUST be
  6602. included in the list of methods in the Allow header field, when
  6603. present. The absence of an Allow header field MUST NOT be
  6604. interpreted to mean that the UA sending the message supports no
  6605. methods. Rather, it implies that the UA is not providing any
  6606. information on what methods it supports.
  6607. Supplying an Allow header field in responses to methods other than
  6608. OPTIONS reduces the number of messages needed.
  6609. Example:
  6610. Allow: INVITE, ACK, OPTIONS, CANCEL, BYE
  6611. 20.6 Authentication-Info
  6612. The Authentication-Info header field provides for mutual
  6613. authentication with HTTP Digest. A UAS MAY include this header field
  6614. in a 2xx response to a request that was successfully authenticated
  6615. using digest based on the Authorization header field.
  6616. Syntax and semantics follow those specified in RFC 2617 [17].
  6617. Example:
  6618. Authentication-Info: nextnonce="47364c23432d2e131a5fb210812c"
  6619. 20.7 Authorization
  6620. The Authorization header field contains authentication credentials of
  6621. a UA. Section 22.2 overviews the use of the Authorization header
  6622. field, and Section 22.4 describes the syntax and semantics when used
  6623. with HTTP authentication.
  6624. This header field, along with Proxy-Authorization, breaks the general
  6625. rules about multiple header field values. Although not a comma-
  6626. separated list, this header field name may be present multiple times,
  6627. and MUST NOT be combined into a single header line using the usual
  6628. rules described in Section 7.3.
  6629. Rosenberg, et. al. Standards Track [Page 165]
  6630. RFC 3261 SIP: Session Initiation Protocol June 2002
  6631. In the example below, there are no quotes around the Digest
  6632. parameter:
  6633. Authorization: Digest username="Alice", realm="atlanta.com",
  6634. nonce="84a4cc6f3082121f32b42a2187831a9e",
  6635. response="7587245234b3434cc3412213e5f113a5432"
  6636. 20.8 Call-ID
  6637. The Call-ID header field uniquely identifies a particular invitation
  6638. or all registrations of a particular client. A single multimedia
  6639. conference can give rise to several calls with different Call-IDs,
  6640. for example, if a user invites a single individual several times to
  6641. the same (long-running) conference. Call-IDs are case-sensitive and
  6642. are simply compared byte-by-byte.
  6643. The compact form of the Call-ID header field is i.
  6644. Examples:
  6645. Call-ID: f81d4fae-7dec-11d0-a765-00a0c91e6bf6@biloxi.com
  6646. i:f81d4fae-7dec-11d0-a765-00a0c91e6bf6@192.0.2.4
  6647. 20.9 Call-Info
  6648. The Call-Info header field provides additional information about the
  6649. caller or callee, depending on whether it is found in a request or
  6650. response. The purpose of the URI is described by the "purpose"
  6651. parameter. The "icon" parameter designates an image suitable as an
  6652. iconic representation of the caller or callee. The "info" parameter
  6653. describes the caller or callee in general, for example, through a web
  6654. page. The "card" parameter provides a business card, for example, in
  6655. vCard [36] or LDIF [37] formats. Additional tokens can be registered
  6656. using IANA and the procedures in Section 27.
  6657. Use of the Call-Info header field can pose a security risk. If a
  6658. callee fetches the URIs provided by a malicious caller, the callee
  6659. may be at risk for displaying inappropriate or offensive content,
  6660. dangerous or illegal content, and so on. Therefore, it is
  6661. RECOMMENDED that a UA only render the information in the Call-Info
  6662. header field if it can verify the authenticity of the element that
  6663. originated the header field and trusts that element. This need not
  6664. be the peer UA; a proxy can insert this header field into requests.
  6665. Example:
  6666. Call-Info: <http://wwww.example.com/alice/photo.jpg> ;purpose=icon,
  6667. <http://www.example.com/alice/> ;purpose=info
  6668. Rosenberg, et. al. Standards Track [Page 166]
  6669. RFC 3261 SIP: Session Initiation Protocol June 2002
  6670. 20.10 Contact
  6671. A Contact header field value provides a URI whose meaning depends on
  6672. the type of request or response it is in.
  6673. A Contact header field value can contain a display name, a URI with
  6674. URI parameters, and header parameters.
  6675. This document defines the Contact parameters "q" and "expires".
  6676. These parameters are only used when the Contact is present in a
  6677. REGISTER request or response, or in a 3xx response. Additional
  6678. parameters may be defined in other specifications.
  6679. When the header field value contains a display name, the URI
  6680. including all URI parameters is enclosed in "<" and ">". If no "<"
  6681. and ">" are present, all parameters after the URI are header
  6682. parameters, not URI parameters. The display name can be tokens, or a
  6683. quoted string, if a larger character set is desired.
  6684. Even if the "display-name" is empty, the "name-addr" form MUST be
  6685. used if the "addr-spec" contains a comma, semicolon, or question
  6686. mark. There may or may not be LWS between the display-name and the
  6687. "<".
  6688. These rules for parsing a display name, URI and URI parameters, and
  6689. header parameters also apply for the header fields To and From.
  6690. The Contact header field has a role similar to the Location header
  6691. field in HTTP. However, the HTTP header field only allows one
  6692. address, unquoted. Since URIs can contain commas and semicolons
  6693. as reserved characters, they can be mistaken for header or
  6694. parameter delimiters, respectively.
  6695. The compact form of the Contact header field is m (for "moved").
  6696. Examples:
  6697. Contact: "Mr. Watson" <sip:watson@worcester.bell-telephone.com>
  6698. ;q=0.7; expires=3600,
  6699. "Mr. Watson" <mailto:watson@bell-telephone.com> ;q=0.1
  6700. m: <sips:bob@192.0.2.4>;expires=60
  6701. Rosenberg, et. al. Standards Track [Page 167]
  6702. RFC 3261 SIP: Session Initiation Protocol June 2002
  6703. 20.11 Content-Disposition
  6704. The Content-Disposition header field describes how the message body
  6705. or, for multipart messages, a message body part is to be interpreted
  6706. by the UAC or UAS. This SIP header field extends the MIME Content-
  6707. Type (RFC 2183 [18]).
  6708. Several new "disposition-types" of the Content-Disposition header are
  6709. defined by SIP. The value "session" indicates that the body part
  6710. describes a session, for either calls or early (pre-call) media. The
  6711. value "render" indicates that the body part should be displayed or
  6712. otherwise rendered to the user. Note that the value "render" is used
  6713. rather than "inline" to avoid the connotation that the MIME body is
  6714. displayed as a part of the rendering of the entire message (since the
  6715. MIME bodies of SIP messages oftentimes are not displayed to users).
  6716. For backward-compatibility, if the Content-Disposition header field
  6717. is missing, the server SHOULD assume bodies of Content-Type
  6718. application/sdp are the disposition "session", while other content
  6719. types are "render".
  6720. The disposition type "icon" indicates that the body part contains an
  6721. image suitable as an iconic representation of the caller or callee
  6722. that could be rendered informationally by a user agent when a message
  6723. has been received, or persistently while a dialog takes place. The
  6724. value "alert" indicates that the body part contains information, such
  6725. as an audio clip, that should be rendered by the user agent in an
  6726. attempt to alert the user to the receipt of a request, generally a
  6727. request that initiates a dialog; this alerting body could for example
  6728. be rendered as a ring tone for a phone call after a 180 Ringing
  6729. provisional response has been sent.
  6730. Any MIME body with a "disposition-type" that renders content to the
  6731. user should only be processed when a message has been properly
  6732. authenticated.
  6733. The handling parameter, handling-param, describes how the UAS should
  6734. react if it receives a message body whose content type or disposition
  6735. type it does not understand. The parameter has defined values of
  6736. "optional" and "required". If the handling parameter is missing, the
  6737. value "required" SHOULD be assumed. The handling parameter is
  6738. described in RFC 3204 [19].
  6739. If this header field is missing, the MIME type determines the default
  6740. content disposition. If there is none, "render" is assumed.
  6741. Example:
  6742. Content-Disposition: session
  6743. Rosenberg, et. al. Standards Track [Page 168]
  6744. RFC 3261 SIP: Session Initiation Protocol June 2002
  6745. 20.12 Content-Encoding
  6746. The Content-Encoding header field is used as a modifier to the
  6747. "media-type". When present, its value indicates what additional
  6748. content codings have been applied to the entity-body, and thus what
  6749. decoding mechanisms MUST be applied in order to obtain the media-type
  6750. referenced by the Content-Type header field. Content-Encoding is
  6751. primarily used to allow a body to be compressed without losing the
  6752. identity of its underlying media type.
  6753. If multiple encodings have been applied to an entity-body, the
  6754. content codings MUST be listed in the order in which they were
  6755. applied.
  6756. All content-coding values are case-insensitive. IANA acts as a
  6757. registry for content-coding value tokens. See [H3.5] for a
  6758. definition of the syntax for content-coding.
  6759. Clients MAY apply content encodings to the body in requests. A
  6760. server MAY apply content encodings to the bodies in responses. The
  6761. server MUST only use encodings listed in the Accept-Encoding header
  6762. field in the request.
  6763. The compact form of the Content-Encoding header field is e.
  6764. Examples:
  6765. Content-Encoding: gzip
  6766. e: tar
  6767. 20.13 Content-Language
  6768. See [H14.12]. Example:
  6769. Content-Language: fr
  6770. 20.14 Content-Length
  6771. The Content-Length header field indicates the size of the message-
  6772. body, in decimal number of octets, sent to the recipient.
  6773. Applications SHOULD use this field to indicate the size of the
  6774. message-body to be transferred, regardless of the media type of the
  6775. entity. If a stream-based protocol (such as TCP) is used as
  6776. transport, the header field MUST be used.
  6777. The size of the message-body does not include the CRLF separating
  6778. header fields and body. Any Content-Length greater than or equal to
  6779. zero is a valid value. If no body is present in a message, then the
  6780. Content-Length header field value MUST be set to zero.
  6781. Rosenberg, et. al. Standards Track [Page 169]
  6782. RFC 3261 SIP: Session Initiation Protocol June 2002
  6783. The ability to omit Content-Length simplifies the creation of
  6784. cgi-like scripts that dynamically generate responses.
  6785. The compact form of the header field is l.
  6786. Examples:
  6787. Content-Length: 349
  6788. l: 173
  6789. 20.15 Content-Type
  6790. The Content-Type header field indicates the media type of the
  6791. message-body sent to the recipient. The "media-type" element is
  6792. defined in [H3.7]. The Content-Type header field MUST be present if
  6793. the body is not empty. If the body is empty, and a Content-Type
  6794. header field is present, it indicates that the body of the specific
  6795. type has zero length (for example, an empty audio file).
  6796. The compact form of the header field is c.
  6797. Examples:
  6798. Content-Type: application/sdp
  6799. c: text/html; charset=ISO-8859-4
  6800. 20.16 CSeq
  6801. A CSeq header field in a request contains a single decimal sequence
  6802. number and the request method. The sequence number MUST be
  6803. expressible as a 32-bit unsigned integer. The method part of CSeq is
  6804. case-sensitive. The CSeq header field serves to order transactions
  6805. within a dialog, to provide a means to uniquely identify
  6806. transactions, and to differentiate between new requests and request
  6807. retransmissions. Two CSeq header fields are considered equal if the
  6808. sequence number and the request method are identical. Example:
  6809. CSeq: 4711 INVITE
  6810. 20.17 Date
  6811. The Date header field contains the date and time. Unlike HTTP/1.1,
  6812. SIP only supports the most recent RFC 1123 [20] format for dates. As
  6813. in [H3.3], SIP restricts the time zone in SIP-date to "GMT", while
  6814. RFC 1123 allows any time zone. An RFC 1123 date is case-sensitive.
  6815. The Date header field reflects the time when the request or response
  6816. is first sent.
  6817. Rosenberg, et. al. Standards Track [Page 170]
  6818. RFC 3261 SIP: Session Initiation Protocol June 2002
  6819. The Date header field can be used by simple end systems without a
  6820. battery-backed clock to acquire a notion of current time.
  6821. However, in its GMT form, it requires clients to know their offset
  6822. from GMT.
  6823. Example:
  6824. Date: Sat, 13 Nov 2010 23:29:00 GMT
  6825. 20.18 Error-Info
  6826. The Error-Info header field provides a pointer to additional
  6827. information about the error status response.
  6828. SIP UACs have user interface capabilities ranging from pop-up
  6829. windows and audio on PC softclients to audio-only on "black"
  6830. phones or endpoints connected via gateways. Rather than forcing a
  6831. server generating an error to choose between sending an error
  6832. status code with a detailed reason phrase and playing an audio
  6833. recording, the Error-Info header field allows both to be sent.
  6834. The UAC then has the choice of which error indicator to render to
  6835. the caller.
  6836. A UAC MAY treat a SIP or SIPS URI in an Error-Info header field as if
  6837. it were a Contact in a redirect and generate a new INVITE, resulting
  6838. in a recorded announcement session being established. A non-SIP URI
  6839. MAY be rendered to the user.
  6840. Examples:
  6841. SIP/2.0 404 The number you have dialed is not in service
  6842. Error-Info: <sip:not-in-service-recording@atlanta.com>
  6843. 20.19 Expires
  6844. The Expires header field gives the relative time after which the
  6845. message (or content) expires.
  6846. The precise meaning of this is method dependent.
  6847. The expiration time in an INVITE does not affect the duration of the
  6848. actual session that may result from the invitation. Session
  6849. description protocols may offer the ability to express time limits on
  6850. the session duration, however.
  6851. The value of this field is an integral number of seconds (in decimal)
  6852. between 0 and (2**32)-1, measured from the receipt of the request.
  6853. Rosenberg, et. al. Standards Track [Page 171]
  6854. RFC 3261 SIP: Session Initiation Protocol June 2002
  6855. Example:
  6856. Expires: 5
  6857. 20.20 From
  6858. The From header field indicates the initiator of the request. This
  6859. may be different from the initiator of the dialog. Requests sent by
  6860. the callee to the caller use the callee's address in the From header
  6861. field.
  6862. The optional "display-name" is meant to be rendered by a human user
  6863. interface. A system SHOULD use the display name "Anonymous" if the
  6864. identity of the client is to remain hidden. Even if the "display-
  6865. name" is empty, the "name-addr" form MUST be used if the "addr-spec"
  6866. contains a comma, question mark, or semicolon. Syntax issues are
  6867. discussed in Section 7.3.1.
  6868. Two From header fields are equivalent if their URIs match, and their
  6869. parameters match. Extension parameters in one header field, not
  6870. present in the other are ignored for the purposes of comparison. This
  6871. means that the display name and presence or absence of angle brackets
  6872. do not affect matching.
  6873. See Section 20.10 for the rules for parsing a display name, URI and
  6874. URI parameters, and header field parameters.
  6875. The compact form of the From header field is f.
  6876. Examples:
  6877. From: "A. G. Bell" <sip:agb@bell-telephone.com> ;tag=a48s
  6878. From: sip:+12125551212@server.phone2net.com;tag=887s
  6879. f: Anonymous <sip:c8oqz84zk7z@privacy.org>;tag=hyh8
  6880. 20.21 In-Reply-To
  6881. The In-Reply-To header field enumerates the Call-IDs that this call
  6882. references or returns. These Call-IDs may have been cached by the
  6883. client then included in this header field in a return call.
  6884. This allows automatic call distribution systems to route return
  6885. calls to the originator of the first call. This also allows
  6886. callees to filter calls, so that only return calls for calls they
  6887. originated will be accepted. This field is not a substitute for
  6888. request authentication.
  6889. Rosenberg, et. al. Standards Track [Page 172]
  6890. RFC 3261 SIP: Session Initiation Protocol June 2002
  6891. Example:
  6892. In-Reply-To: 70710@saturn.bell-tel.com, 17320@saturn.bell-tel.com
  6893. 20.22 Max-Forwards
  6894. The Max-Forwards header field must be used with any SIP method to
  6895. limit the number of proxies or gateways that can forward the request
  6896. to the next downstream server. This can also be useful when the
  6897. client is attempting to trace a request chain that appears to be
  6898. failing or looping in mid-chain.
  6899. The Max-Forwards value is an integer in the range 0-255 indicating
  6900. the remaining number of times this request message is allowed to be
  6901. forwarded. This count is decremented by each server that forwards
  6902. the request. The recommended initial value is 70.
  6903. This header field should be inserted by elements that can not
  6904. otherwise guarantee loop detection. For example, a B2BUA should
  6905. insert a Max-Forwards header field.
  6906. Example:
  6907. Max-Forwards: 6
  6908. 20.23 Min-Expires
  6909. The Min-Expires header field conveys the minimum refresh interval
  6910. supported for soft-state elements managed by that server. This
  6911. includes Contact header fields that are stored by a registrar. The
  6912. header field contains a decimal integer number of seconds from 0 to
  6913. (2**32)-1. The use of the header field in a 423 (Interval Too Brief)
  6914. response is described in Sections 10.2.8, 10.3, and 21.4.17.
  6915. Example:
  6916. Min-Expires: 60
  6917. 20.24 MIME-Version
  6918. See [H19.4.1].
  6919. Example:
  6920. MIME-Version: 1.0
  6921. Rosenberg, et. al. Standards Track [Page 173]
  6922. RFC 3261 SIP: Session Initiation Protocol June 2002
  6923. 20.25 Organization
  6924. The Organization header field conveys the name of the organization to
  6925. which the SIP element issuing the request or response belongs.
  6926. The field MAY be used by client software to filter calls.
  6927. Example:
  6928. Organization: Boxes by Bob
  6929. 20.26 Priority
  6930. The Priority header field indicates the urgency of the request as
  6931. perceived by the client. The Priority header field describes the
  6932. priority that the SIP request should have to the receiving human or
  6933. its agent. For example, it may be factored into decisions about call
  6934. routing and acceptance. For these decisions, a message containing no
  6935. Priority header field SHOULD be treated as if it specified a Priority
  6936. of "normal". The Priority header field does not influence the use of
  6937. communications resources such as packet forwarding priority in
  6938. routers or access to circuits in PSTN gateways. The header field can
  6939. have the values "non-urgent", "normal", "urgent", and "emergency",
  6940. but additional values can be defined elsewhere. It is RECOMMENDED
  6941. that the value of "emergency" only be used when life, limb, or
  6942. property are in imminent danger. Otherwise, there are no semantics
  6943. defined for this header field.
  6944. These are the values of RFC 2076 [38], with the addition of
  6945. "emergency".
  6946. Examples:
  6947. Subject: A tornado is heading our way!
  6948. Priority: emergency
  6949. or
  6950. Subject: Weekend plans
  6951. Priority: non-urgent
  6952. 20.27 Proxy-Authenticate
  6953. A Proxy-Authenticate header field value contains an authentication
  6954. challenge.
  6955. The use of this header field is defined in [H14.33]. See Section
  6956. 22.3 for further details on its usage.
  6957. Rosenberg, et. al. Standards Track [Page 174]
  6958. RFC 3261 SIP: Session Initiation Protocol June 2002
  6959. Example:
  6960. Proxy-Authenticate: Digest realm="atlanta.com",
  6961. domain="sip:ss1.carrier.com", qop="auth",
  6962. nonce="f84f1cec41e6cbe5aea9c8e88d359",
  6963. opaque="", stale=FALSE, algorithm=MD5
  6964. 20.28 Proxy-Authorization
  6965. The Proxy-Authorization header field allows the client to identify
  6966. itself (or its user) to a proxy that requires authentication. A
  6967. Proxy-Authorization field value consists of credentials containing
  6968. the authentication information of the user agent for the proxy and/or
  6969. realm of the resource being requested.
  6970. See Section 22.3 for a definition of the usage of this header field.
  6971. This header field, along with Authorization, breaks the general rules
  6972. about multiple header field names. Although not a comma-separated
  6973. list, this header field name may be present multiple times, and MUST
  6974. NOT be combined into a single header line using the usual rules
  6975. described in Section 7.3.1.
  6976. Example:
  6977. Proxy-Authorization: Digest username="Alice", realm="atlanta.com",
  6978. nonce="c60f3082ee1212b402a21831ae",
  6979. response="245f23415f11432b3434341c022"
  6980. 20.29 Proxy-Require
  6981. The Proxy-Require header field is used to indicate proxy-sensitive
  6982. features that must be supported by the proxy. See Section 20.32 for
  6983. more details on the mechanics of this message and a usage example.
  6984. Example:
  6985. Proxy-Require: foo
  6986. 20.30 Record-Route
  6987. The Record-Route header field is inserted by proxies in a request to
  6988. force future requests in the dialog to be routed through the proxy.
  6989. Examples of its use with the Route header field are described in
  6990. Sections 16.12.1.
  6991. Rosenberg, et. al. Standards Track [Page 175]
  6992. RFC 3261 SIP: Session Initiation Protocol June 2002
  6993. Example:
  6994. Record-Route: <sip:server10.biloxi.com;lr>,
  6995. <sip:bigbox3.site3.atlanta.com;lr>
  6996. 20.31 Reply-To
  6997. The Reply-To header field contains a logical return URI that may be
  6998. different from the From header field. For example, the URI MAY be
  6999. used to return missed calls or unestablished sessions. If the user
  7000. wished to remain anonymous, the header field SHOULD either be omitted
  7001. from the request or populated in such a way that does not reveal any
  7002. private information.
  7003. Even if the "display-name" is empty, the "name-addr" form MUST be
  7004. used if the "addr-spec" contains a comma, question mark, or
  7005. semicolon. Syntax issues are discussed in Section 7.3.1.
  7006. Example:
  7007. Reply-To: Bob <sip:bob@biloxi.com>
  7008. 20.32 Require
  7009. The Require header field is used by UACs to tell UASs about options
  7010. that the UAC expects the UAS to support in order to process the
  7011. request. Although an optional header field, the Require MUST NOT be
  7012. ignored if it is present.
  7013. The Require header field contains a list of option tags, described in
  7014. Section 19.2. Each option tag defines a SIP extension that MUST be
  7015. understood to process the request. Frequently, this is used to
  7016. indicate that a specific set of extension header fields need to be
  7017. understood. A UAC compliant to this specification MUST only include
  7018. option tags corresponding to standards-track RFCs.
  7019. Example:
  7020. Require: 100rel
  7021. 20.33 Retry-After
  7022. The Retry-After header field can be used with a 500 (Server Internal
  7023. Error) or 503 (Service Unavailable) response to indicate how long the
  7024. service is expected to be unavailable to the requesting client and
  7025. with a 404 (Not Found), 413 (Request Entity Too Large), 480
  7026. (Temporarily Unavailable), 486 (Busy Here), 600 (Busy), or 603
  7027. Rosenberg, et. al. Standards Track [Page 176]
  7028. RFC 3261 SIP: Session Initiation Protocol June 2002
  7029. (Decline) response to indicate when the called party anticipates
  7030. being available again. The value of this field is a positive integer
  7031. number of seconds (in decimal) after the time of the response.
  7032. An optional comment can be used to indicate additional information
  7033. about the time of callback. An optional "duration" parameter
  7034. indicates how long the called party will be reachable starting at the
  7035. initial time of availability. If no duration parameter is given, the
  7036. service is assumed to be available indefinitely.
  7037. Examples:
  7038. Retry-After: 18000;duration=3600
  7039. Retry-After: 120 (I'm in a meeting)
  7040. 20.34 Route
  7041. The Route header field is used to force routing for a request through
  7042. the listed set of proxies. Examples of the use of the Route header
  7043. field are in Section 16.12.1.
  7044. Example:
  7045. Route: <sip:bigbox3.site3.atlanta.com;lr>,
  7046. <sip:server10.biloxi.com;lr>
  7047. 20.35 Server
  7048. The Server header field contains information about the software used
  7049. by the UAS to handle the request.
  7050. Revealing the specific software version of the server might allow the
  7051. server to become more vulnerable to attacks against software that is
  7052. known to contain security holes. Implementers SHOULD make the Server
  7053. header field a configurable option.
  7054. Example:
  7055. Server: HomeServer v2
  7056. 20.36 Subject
  7057. The Subject header field provides a summary or indicates the nature
  7058. of the call, allowing call filtering without having to parse the
  7059. session description. The session description does not have to use
  7060. the same subject indication as the invitation.
  7061. The compact form of the Subject header field is s.
  7062. Rosenberg, et. al. Standards Track [Page 177]
  7063. RFC 3261 SIP: Session Initiation Protocol June 2002
  7064. Example:
  7065. Subject: Need more boxes
  7066. s: Tech Support
  7067. 20.37 Supported
  7068. The Supported header field enumerates all the extensions supported by
  7069. the UAC or UAS.
  7070. The Supported header field contains a list of option tags, described
  7071. in Section 19.2, that are understood by the UAC or UAS. A UA
  7072. compliant to this specification MUST only include option tags
  7073. corresponding to standards-track RFCs. If empty, it means that no
  7074. extensions are supported.
  7075. The compact form of the Supported header field is k.
  7076. Example:
  7077. Supported: 100rel
  7078. 20.38 Timestamp
  7079. The Timestamp header field describes when the UAC sent the request to
  7080. the UAS.
  7081. See Section 8.2.6 for details on how to generate a response to a
  7082. request that contains the header field. Although there is no
  7083. normative behavior defined here that makes use of the header, it
  7084. allows for extensions or SIP applications to obtain RTT estimates.
  7085. Example:
  7086. Timestamp: 54
  7087. 20.39 To
  7088. The To header field specifies the logical recipient of the request.
  7089. The optional "display-name" is meant to be rendered by a human-user
  7090. interface. The "tag" parameter serves as a general mechanism for
  7091. dialog identification.
  7092. See Section 19.3 for details of the "tag" parameter.
  7093. Rosenberg, et. al. Standards Track [Page 178]
  7094. RFC 3261 SIP: Session Initiation Protocol June 2002
  7095. Comparison of To header fields for equality is identical to
  7096. comparison of From header fields. See Section 20.10 for the rules
  7097. for parsing a display name, URI and URI parameters, and header field
  7098. parameters.
  7099. The compact form of the To header field is t.
  7100. The following are examples of valid To header fields:
  7101. To: The Operator <sip:operator@cs.columbia.edu>;tag=287447
  7102. t: sip:+12125551212@server.phone2net.com
  7103. 20.40 Unsupported
  7104. The Unsupported header field lists the features not supported by the
  7105. UAS. See Section 20.32 for motivation.
  7106. Example:
  7107. Unsupported: foo
  7108. 20.41 User-Agent
  7109. The User-Agent header field contains information about the UAC
  7110. originating the request. The semantics of this header field are
  7111. defined in [H14.43].
  7112. Revealing the specific software version of the user agent might allow
  7113. the user agent to become more vulnerable to attacks against software
  7114. that is known to contain security holes. Implementers SHOULD make
  7115. the User-Agent header field a configurable option.
  7116. Example:
  7117. User-Agent: Softphone Beta1.5
  7118. 20.42 Via
  7119. The Via header field indicates the path taken by the request so far
  7120. and indicates the path that should be followed in routing responses.
  7121. The branch ID parameter in the Via header field values serves as a
  7122. transaction identifier, and is used by proxies to detect loops.
  7123. A Via header field value contains the transport protocol used to send
  7124. the message, the client's host name or network address, and possibly
  7125. the port number at which it wishes to receive responses. A Via
  7126. header field value can also contain parameters such as "maddr",
  7127. "ttl", "received", and "branch", whose meaning and use are described
  7128. Rosenberg, et. al. Standards Track [Page 179]
  7129. RFC 3261 SIP: Session Initiation Protocol June 2002
  7130. in other sections. For implementations compliant to this
  7131. specification, the value of the branch parameter MUST start with the
  7132. magic cookie "z9hG4bK", as discussed in Section 8.1.1.7.
  7133. Transport protocols defined here are "UDP", "TCP", "TLS", and "SCTP".
  7134. "TLS" means TLS over TCP. When a request is sent to a SIPS URI, the
  7135. protocol still indicates "SIP", and the transport protocol is TLS.
  7136. Via: SIP/2.0/UDP erlang.bell-telephone.com:5060;branch=z9hG4bK87asdks7
  7137. Via: SIP/2.0/UDP 192.0.2.1:5060 ;received=192.0.2.207
  7138. ;branch=z9hG4bK77asjd
  7139. The compact form of the Via header field is v.
  7140. In this example, the message originated from a multi-homed host with
  7141. two addresses, 192.0.2.1 and 192.0.2.207. The sender guessed wrong
  7142. as to which network interface would be used. Erlang.bell-
  7143. telephone.com noticed the mismatch and added a parameter to the
  7144. previous hop's Via header field value, containing the address that
  7145. the packet actually came from.
  7146. The host or network address and port number are not required to
  7147. follow the SIP URI syntax. Specifically, LWS on either side of the
  7148. ":" or "/" is allowed, as shown here:
  7149. Via: SIP / 2.0 / UDP first.example.com: 4000;ttl=16
  7150. ;maddr=224.2.0.1 ;branch=z9hG4bKa7c6a8dlze.1
  7151. Even though this specification mandates that the branch parameter be
  7152. present in all requests, the BNF for the header field indicates that
  7153. it is optional. This allows interoperation with RFC 2543 elements,
  7154. which did not have to insert the branch parameter.
  7155. Two Via header fields are equal if their sent-protocol and sent-by
  7156. fields are equal, both have the same set of parameters, and the
  7157. values of all parameters are equal.
  7158. 20.43 Warning
  7159. The Warning header field is used to carry additional information
  7160. about the status of a response. Warning header field values are sent
  7161. with responses and contain a three-digit warning code, host name, and
  7162. warning text.
  7163. The "warn-text" should be in a natural language that is most likely
  7164. to be intelligible to the human user receiving the response. This
  7165. decision can be based on any available knowledge, such as the
  7166. location of the user, the Accept-Language field in a request, or the
  7167. Rosenberg, et. al. Standards Track [Page 180]
  7168. RFC 3261 SIP: Session Initiation Protocol June 2002
  7169. Content-Language field in a response. The default language is i-
  7170. default [21].
  7171. The currently-defined "warn-code"s are listed below, with a
  7172. recommended warn-text in English and a description of their meaning.
  7173. These warnings describe failures induced by the session description.
  7174. The first digit of warning codes beginning with "3" indicates
  7175. warnings specific to SIP. Warnings 300 through 329 are reserved for
  7176. indicating problems with keywords in the session description, 330
  7177. through 339 are warnings related to basic network services requested
  7178. in the session description, 370 through 379 are warnings related to
  7179. quantitative QoS parameters requested in the session description, and
  7180. 390 through 399 are miscellaneous warnings that do not fall into one
  7181. of the above categories.
  7182. 300 Incompatible network protocol: One or more network protocols
  7183. contained in the session description are not available.
  7184. 301 Incompatible network address formats: One or more network
  7185. address formats contained in the session description are not
  7186. available.
  7187. 302 Incompatible transport protocol: One or more transport
  7188. protocols described in the session description are not
  7189. available.
  7190. 303 Incompatible bandwidth units: One or more bandwidth
  7191. measurement units contained in the session description were
  7192. not understood.
  7193. 304 Media type not available: One or more media types contained in
  7194. the session description are not available.
  7195. 305 Incompatible media format: One or more media formats contained
  7196. in the session description are not available.
  7197. 306 Attribute not understood: One or more of the media attributes
  7198. in the session description are not supported.
  7199. 307 Session description parameter not understood: A parameter
  7200. other than those listed above was not understood.
  7201. 330 Multicast not available: The site where the user is located
  7202. does not support multicast.
  7203. 331 Unicast not available: The site where the user is located does
  7204. not support unicast communication (usually due to the presence
  7205. of a firewall).
  7206. Rosenberg, et. al. Standards Track [Page 181]
  7207. RFC 3261 SIP: Session Initiation Protocol June 2002
  7208. 370 Insufficient bandwidth: The bandwidth specified in the session
  7209. description or defined by the media exceeds that known to be
  7210. available.
  7211. 399 Miscellaneous warning: The warning text can include arbitrary
  7212. information to be presented to a human user or logged. A
  7213. system receiving this warning MUST NOT take any automated
  7214. action.
  7215. 1xx and 2xx have been taken by HTTP/1.1.
  7216. Additional "warn-code"s can be defined through IANA, as defined in
  7217. Section 27.2.
  7218. Examples:
  7219. Warning: 307 isi.edu "Session parameter 'foo' not understood"
  7220. Warning: 301 isi.edu "Incompatible network address type 'E.164'"
  7221. 20.44 WWW-Authenticate
  7222. A WWW-Authenticate header field value contains an authentication
  7223. challenge. See Section 22.2 for further details on its usage.
  7224. Example:
  7225. WWW-Authenticate: Digest realm="atlanta.com",
  7226. domain="sip:boxesbybob.com", qop="auth",
  7227. nonce="f84f1cec41e6cbe5aea9c8e88d359",
  7228. opaque="", stale=FALSE, algorithm=MD5
  7229. 21 Response Codes
  7230. The response codes are consistent with, and extend, HTTP/1.1 response
  7231. codes. Not all HTTP/1.1 response codes are appropriate, and only
  7232. those that are appropriate are given here. Other HTTP/1.1 response
  7233. codes SHOULD NOT be used. Also, SIP defines a new class, 6xx.
  7234. 21.1 Provisional 1xx
  7235. Provisional responses, also known as informational responses,
  7236. indicate that the server contacted is performing some further action
  7237. and does not yet have a definitive response. A server sends a 1xx
  7238. response if it expects to take more than 200 ms to obtain a final
  7239. response. Note that 1xx responses are not transmitted reliably.
  7240. They never cause the client to send an ACK. Provisional (1xx)
  7241. responses MAY contain message bodies, including session descriptions.
  7242. Rosenberg, et. al. Standards Track [Page 182]
  7243. RFC 3261 SIP: Session Initiation Protocol June 2002
  7244. 21.1.1 100 Trying
  7245. This response indicates that the request has been received by the
  7246. next-hop server and that some unspecified action is being taken on
  7247. behalf of this call (for example, a database is being consulted).
  7248. This response, like all other provisional responses, stops
  7249. retransmissions of an INVITE by a UAC. The 100 (Trying) response is
  7250. different from other provisional responses, in that it is never
  7251. forwarded upstream by a stateful proxy.
  7252. 21.1.2 180 Ringing
  7253. The UA receiving the INVITE is trying to alert the user. This
  7254. response MAY be used to initiate local ringback.
  7255. 21.1.3 181 Call Is Being Forwarded
  7256. A server MAY use this status code to indicate that the call is being
  7257. forwarded to a different set of destinations.
  7258. 21.1.4 182 Queued
  7259. The called party is temporarily unavailable, but the server has
  7260. decided to queue the call rather than reject it. When the callee
  7261. becomes available, it will return the appropriate final status
  7262. response. The reason phrase MAY give further details about the
  7263. status of the call, for example, "5 calls queued; expected waiting
  7264. time is 15 minutes". The server MAY issue several 182 (Queued)
  7265. responses to update the caller about the status of the queued call.
  7266. 21.1.5 183 Session Progress
  7267. The 183 (Session Progress) response is used to convey information
  7268. about the progress of the call that is not otherwise classified. The
  7269. Reason-Phrase, header fields, or message body MAY be used to convey
  7270. more details about the call progress.
  7271. 21.2 Successful 2xx
  7272. The request was successful.
  7273. 21.2.1 200 OK
  7274. The request has succeeded. The information returned with the
  7275. response depends on the method used in the request.
  7276. Rosenberg, et. al. Standards Track [Page 183]
  7277. RFC 3261 SIP: Session Initiation Protocol June 2002
  7278. 21.3 Redirection 3xx
  7279. 3xx responses give information about the user's new location, or
  7280. about alternative services that might be able to satisfy the call.
  7281. 21.3.1 300 Multiple Choices
  7282. The address in the request resolved to several choices, each with its
  7283. own specific location, and the user (or UA) can select a preferred
  7284. communication end point and redirect its request to that location.
  7285. The response MAY include a message body containing a list of resource
  7286. characteristics and location(s) from which the user or UA can choose
  7287. the one most appropriate, if allowed by the Accept request header
  7288. field. However, no MIME types have been defined for this message
  7289. body.
  7290. The choices SHOULD also be listed as Contact fields (Section 20.10).
  7291. Unlike HTTP, the SIP response MAY contain several Contact fields or a
  7292. list of addresses in a Contact field. UAs MAY use the Contact header
  7293. field value for automatic redirection or MAY ask the user to confirm
  7294. a choice. However, this specification does not define any standard
  7295. for such automatic selection.
  7296. This status response is appropriate if the callee can be reached
  7297. at several different locations and the server cannot or prefers
  7298. not to proxy the request.
  7299. 21.3.2 301 Moved Permanently
  7300. The user can no longer be found at the address in the Request-URI,
  7301. and the requesting client SHOULD retry at the new address given by
  7302. the Contact header field (Section 20.10). The requestor SHOULD
  7303. update any local directories, address books, and user location caches
  7304. with this new value and redirect future requests to the address(es)
  7305. listed.
  7306. 21.3.3 302 Moved Temporarily
  7307. The requesting client SHOULD retry the request at the new address(es)
  7308. given by the Contact header field (Section 20.10). The Request-URI
  7309. of the new request uses the value of the Contact header field in the
  7310. response.
  7311. Rosenberg, et. al. Standards Track [Page 184]
  7312. RFC 3261 SIP: Session Initiation Protocol June 2002
  7313. The duration of the validity of the Contact URI can be indicated
  7314. through an Expires (Section 20.19) header field or an expires
  7315. parameter in the Contact header field. Both proxies and UAs MAY
  7316. cache this URI for the duration of the expiration time. If there is
  7317. no explicit expiration time, the address is only valid once for
  7318. recursing, and MUST NOT be cached for future transactions.
  7319. If the URI cached from the Contact header field fails, the Request-
  7320. URI from the redirected request MAY be tried again a single time.
  7321. The temporary URI may have become out-of-date sooner than the
  7322. expiration time, and a new temporary URI may be available.
  7323. 21.3.4 305 Use Proxy
  7324. The requested resource MUST be accessed through the proxy given by
  7325. the Contact field. The Contact field gives the URI of the proxy.
  7326. The recipient is expected to repeat this single request via the
  7327. proxy. 305 (Use Proxy) responses MUST only be generated by UASs.
  7328. 21.3.5 380 Alternative Service
  7329. The call was not successful, but alternative services are possible.
  7330. The alternative services are described in the message body of the
  7331. response. Formats for such bodies are not defined here, and may be
  7332. the subject of future standardization.
  7333. 21.4 Request Failure 4xx
  7334. 4xx responses are definite failure responses from a particular
  7335. server. The client SHOULD NOT retry the same request without
  7336. modification (for example, adding appropriate authorization).
  7337. However, the same request to a different server might be successful.
  7338. 21.4.1 400 Bad Request
  7339. The request could not be understood due to malformed syntax. The
  7340. Reason-Phrase SHOULD identify the syntax problem in more detail, for
  7341. example, "Missing Call-ID header field".
  7342. 21.4.2 401 Unauthorized
  7343. The request requires user authentication. This response is issued by
  7344. UASs and registrars, while 407 (Proxy Authentication Required) is
  7345. used by proxy servers.
  7346. Rosenberg, et. al. Standards Track [Page 185]
  7347. RFC 3261 SIP: Session Initiation Protocol June 2002
  7348. 21.4.3 402 Payment Required
  7349. Reserved for future use.
  7350. 21.4.4 403 Forbidden
  7351. The server understood the request, but is refusing to fulfill it.
  7352. Authorization will not help, and the request SHOULD NOT be repeated.
  7353. 21.4.5 404 Not Found
  7354. The server has definitive information that the user does not exist at
  7355. the domain specified in the Request-URI. This status is also
  7356. returned if the domain in the Request-URI does not match any of the
  7357. domains handled by the recipient of the request.
  7358. 21.4.6 405 Method Not Allowed
  7359. The method specified in the Request-Line is understood, but not
  7360. allowed for the address identified by the Request-URI.
  7361. The response MUST include an Allow header field containing a list of
  7362. valid methods for the indicated address.
  7363. 21.4.7 406 Not Acceptable
  7364. The resource identified by the request is only capable of generating
  7365. response entities that have content characteristics not acceptable
  7366. according to the Accept header field sent in the request.
  7367. 21.4.8 407 Proxy Authentication Required
  7368. This code is similar to 401 (Unauthorized), but indicates that the
  7369. client MUST first authenticate itself with the proxy. SIP access
  7370. authentication is explained in Sections 26 and 22.3.
  7371. This status code can be used for applications where access to the
  7372. communication channel (for example, a telephony gateway) rather than
  7373. the callee requires authentication.
  7374. 21.4.9 408 Request Timeout
  7375. The server could not produce a response within a suitable amount of
  7376. time, for example, if it could not determine the location of the user
  7377. in time. The client MAY repeat the request without modifications at
  7378. any later time.
  7379. Rosenberg, et. al. Standards Track [Page 186]
  7380. RFC 3261 SIP: Session Initiation Protocol June 2002
  7381. 21.4.10 410 Gone
  7382. The requested resource is no longer available at the server and no
  7383. forwarding address is known. This condition is expected to be
  7384. considered permanent. If the server does not know, or has no
  7385. facility to determine, whether or not the condition is permanent, the
  7386. status code 404 (Not Found) SHOULD be used instead.
  7387. 21.4.11 413 Request Entity Too Large
  7388. The server is refusing to process a request because the request
  7389. entity-body is larger than the server is willing or able to process.
  7390. The server MAY close the connection to prevent the client from
  7391. continuing the request.
  7392. If the condition is temporary, the server SHOULD include a Retry-
  7393. After header field to indicate that it is temporary and after what
  7394. time the client MAY try again.
  7395. 21.4.12 414 Request-URI Too Long
  7396. The server is refusing to service the request because the Request-URI
  7397. is longer than the server is willing to interpret.
  7398. 21.4.13 415 Unsupported Media Type
  7399. The server is refusing to service the request because the message
  7400. body of the request is in a format not supported by the server for
  7401. the requested method. The server MUST return a list of acceptable
  7402. formats using the Accept, Accept-Encoding, or Accept-Language header
  7403. field, depending on the specific problem with the content. UAC
  7404. processing of this response is described in Section 8.1.3.5.
  7405. 21.4.14 416 Unsupported URI Scheme
  7406. The server cannot process the request because the scheme of the URI
  7407. in the Request-URI is unknown to the server. Client processing of
  7408. this response is described in Section 8.1.3.5.
  7409. 21.4.15 420 Bad Extension
  7410. The server did not understand the protocol extension specified in a
  7411. Proxy-Require (Section 20.29) or Require (Section 20.32) header
  7412. field. The server MUST include a list of the unsupported extensions
  7413. in an Unsupported header field in the response. UAC processing of
  7414. this response is described in Section 8.1.3.5.
  7415. Rosenberg, et. al. Standards Track [Page 187]
  7416. RFC 3261 SIP: Session Initiation Protocol June 2002
  7417. 21.4.16 421 Extension Required
  7418. The UAS needs a particular extension to process the request, but this
  7419. extension is not listed in a Supported header field in the request.
  7420. Responses with this status code MUST contain a Require header field
  7421. listing the required extensions.
  7422. A UAS SHOULD NOT use this response unless it truly cannot provide any
  7423. useful service to the client. Instead, if a desirable extension is
  7424. not listed in the Supported header field, servers SHOULD process the
  7425. request using baseline SIP capabilities and any extensions supported
  7426. by the client.
  7427. 21.4.17 423 Interval Too Brief
  7428. The server is rejecting the request because the expiration time of
  7429. the resource refreshed by the request is too short. This response
  7430. can be used by a registrar to reject a registration whose Contact
  7431. header field expiration time was too small. The use of this response
  7432. and the related Min-Expires header field are described in Sections
  7433. 10.2.8, 10.3, and 20.23.
  7434. 21.4.18 480 Temporarily Unavailable
  7435. The callee's end system was contacted successfully but the callee is
  7436. currently unavailable (for example, is not logged in, logged in but
  7437. in a state that precludes communication with the callee, or has
  7438. activated the "do not disturb" feature). The response MAY indicate a
  7439. better time to call in the Retry-After header field. The user could
  7440. also be available elsewhere (unbeknownst to this server). The reason
  7441. phrase SHOULD indicate a more precise cause as to why the callee is
  7442. unavailable. This value SHOULD be settable by the UA. Status 486
  7443. (Busy Here) MAY be used to more precisely indicate a particular
  7444. reason for the call failure.
  7445. This status is also returned by a redirect or proxy server that
  7446. recognizes the user identified by the Request-URI, but does not
  7447. currently have a valid forwarding location for that user.
  7448. 21.4.19 481 Call/Transaction Does Not Exist
  7449. This status indicates that the UAS received a request that does not
  7450. match any existing dialog or transaction.
  7451. 21.4.20 482 Loop Detected
  7452. The server has detected a loop (Section 16.3 Item 4).
  7453. Rosenberg, et. al. Standards Track [Page 188]
  7454. RFC 3261 SIP: Session Initiation Protocol June 2002
  7455. 21.4.21 483 Too Many Hops
  7456. The server received a request that contains a Max-Forwards (Section
  7457. 20.22) header field with the value zero.
  7458. 21.4.22 484 Address Incomplete
  7459. The server received a request with a Request-URI that was incomplete.
  7460. Additional information SHOULD be provided in the reason phrase.
  7461. This status code allows overlapped dialing. With overlapped
  7462. dialing, the client does not know the length of the dialing
  7463. string. It sends strings of increasing lengths, prompting the
  7464. user for more input, until it no longer receives a 484 (Address
  7465. Incomplete) status response.
  7466. 21.4.23 485 Ambiguous
  7467. The Request-URI was ambiguous. The response MAY contain a listing of
  7468. possible unambiguous addresses in Contact header fields. Revealing
  7469. alternatives can infringe on privacy of the user or the organization.
  7470. It MUST be possible to configure a server to respond with status 404
  7471. (Not Found) or to suppress the listing of possible choices for
  7472. ambiguous Request-URIs.
  7473. Example response to a request with the Request-URI
  7474. sip:lee@example.com:
  7475. SIP/2.0 485 Ambiguous
  7476. Contact: Carol Lee <sip:carol.lee@example.com>
  7477. Contact: Ping Lee <sip:p.lee@example.com>
  7478. Contact: Lee M. Foote <sips:lee.foote@example.com>
  7479. Some email and voice mail systems provide this functionality. A
  7480. status code separate from 3xx is used since the semantics are
  7481. different: for 300, it is assumed that the same person or service
  7482. will be reached by the choices provided. While an automated
  7483. choice or sequential search makes sense for a 3xx response, user
  7484. intervention is required for a 485 (Ambiguous) response.
  7485. 21.4.24 486 Busy Here
  7486. The callee's end system was contacted successfully, but the callee is
  7487. currently not willing or able to take additional calls at this end
  7488. system. The response MAY indicate a better time to call in the
  7489. Retry-After header field. The user could also be available
  7490. Rosenberg, et. al. Standards Track [Page 189]
  7491. RFC 3261 SIP: Session Initiation Protocol June 2002
  7492. elsewhere, such as through a voice mail service. Status 600 (Busy
  7493. Everywhere) SHOULD be used if the client knows that no other end
  7494. system will be able to accept this call.
  7495. 21.4.25 487 Request Terminated
  7496. The request was terminated by a BYE or CANCEL request. This response
  7497. is never returned for a CANCEL request itself.
  7498. 21.4.26 488 Not Acceptable Here
  7499. The response has the same meaning as 606 (Not Acceptable), but only
  7500. applies to the specific resource addressed by the Request-URI and the
  7501. request may succeed elsewhere.
  7502. A message body containing a description of media capabilities MAY be
  7503. present in the response, which is formatted according to the Accept
  7504. header field in the INVITE (or application/sdp if not present), the
  7505. same as a message body in a 200 (OK) response to an OPTIONS request.
  7506. 21.4.27 491 Request Pending
  7507. The request was received by a UAS that had a pending request within
  7508. the same dialog. Section 14.2 describes how such "glare" situations
  7509. are resolved.
  7510. 21.4.28 493 Undecipherable
  7511. The request was received by a UAS that contained an encrypted MIME
  7512. body for which the recipient does not possess or will not provide an
  7513. appropriate decryption key. This response MAY have a single body
  7514. containing an appropriate public key that should be used to encrypt
  7515. MIME bodies sent to this UA. Details of the usage of this response
  7516. code can be found in Section 23.2.
  7517. 21.5 Server Failure 5xx
  7518. 5xx responses are failure responses given when a server itself has
  7519. erred.
  7520. 21.5.1 500 Server Internal Error
  7521. The server encountered an unexpected condition that prevented it from
  7522. fulfilling the request. The client MAY display the specific error
  7523. condition and MAY retry the request after several seconds.
  7524. If the condition is temporary, the server MAY indicate when the
  7525. client may retry the request using the Retry-After header field.
  7526. Rosenberg, et. al. Standards Track [Page 190]
  7527. RFC 3261 SIP: Session Initiation Protocol June 2002
  7528. 21.5.2 501 Not Implemented
  7529. The server does not support the functionality required to fulfill the
  7530. request. This is the appropriate response when a UAS does not
  7531. recognize the request method and is not capable of supporting it for
  7532. any user. (Proxies forward all requests regardless of method.)
  7533. Note that a 405 (Method Not Allowed) is sent when the server
  7534. recognizes the request method, but that method is not allowed or
  7535. supported.
  7536. 21.5.3 502 Bad Gateway
  7537. The server, while acting as a gateway or proxy, received an invalid
  7538. response from the downstream server it accessed in attempting to
  7539. fulfill the request.
  7540. 21.5.4 503 Service Unavailable
  7541. The server is temporarily unable to process the request due to a
  7542. temporary overloading or maintenance of the server. The server MAY
  7543. indicate when the client should retry the request in a Retry-After
  7544. header field. If no Retry-After is given, the client MUST act as if
  7545. it had received a 500 (Server Internal Error) response.
  7546. A client (proxy or UAC) receiving a 503 (Service Unavailable) SHOULD
  7547. attempt to forward the request to an alternate server. It SHOULD NOT
  7548. forward any other requests to that server for the duration specified
  7549. in the Retry-After header field, if present.
  7550. Servers MAY refuse the connection or drop the request instead of
  7551. responding with 503 (Service Unavailable).
  7552. 21.5.5 504 Server Time-out
  7553. The server did not receive a timely response from an external server
  7554. it accessed in attempting to process the request. 408 (Request
  7555. Timeout) should be used instead if there was no response within the
  7556. period specified in the Expires header field from the upstream
  7557. server.
  7558. 21.5.6 505 Version Not Supported
  7559. The server does not support, or refuses to support, the SIP protocol
  7560. version that was used in the request. The server is indicating that
  7561. it is unable or unwilling to complete the request using the same
  7562. major version as the client, other than with this error message.
  7563. Rosenberg, et. al. Standards Track [Page 191]
  7564. RFC 3261 SIP: Session Initiation Protocol June 2002
  7565. 21.5.7 513 Message Too Large
  7566. The server was unable to process the request since the message length
  7567. exceeded its capabilities.
  7568. 21.6 Global Failures 6xx
  7569. 6xx responses indicate that a server has definitive information about
  7570. a particular user, not just the particular instance indicated in the
  7571. Request-URI.
  7572. 21.6.1 600 Busy Everywhere
  7573. The callee's end system was contacted successfully but the callee is
  7574. busy and does not wish to take the call at this time. The response
  7575. MAY indicate a better time to call in the Retry-After header field.
  7576. If the callee does not wish to reveal the reason for declining the
  7577. call, the callee uses status code 603 (Decline) instead. This status
  7578. response is returned only if the client knows that no other end point
  7579. (such as a voice mail system) will answer the request. Otherwise,
  7580. 486 (Busy Here) should be returned.
  7581. 21.6.2 603 Decline
  7582. The callee's machine was successfully contacted but the user
  7583. explicitly does not wish to or cannot participate. The response MAY
  7584. indicate a better time to call in the Retry-After header field. This
  7585. status response is returned only if the client knows that no other
  7586. end point will answer the request.
  7587. 21.6.3 604 Does Not Exist Anywhere
  7588. The server has authoritative information that the user indicated in
  7589. the Request-URI does not exist anywhere.
  7590. 21.6.4 606 Not Acceptable
  7591. The user's agent was contacted successfully but some aspects of the
  7592. session description such as the requested media, bandwidth, or
  7593. addressing style were not acceptable.
  7594. A 606 (Not Acceptable) response means that the user wishes to
  7595. communicate, but cannot adequately support the session described.
  7596. The 606 (Not Acceptable) response MAY contain a list of reasons in a
  7597. Warning header field describing why the session described cannot be
  7598. supported. Warning reason codes are listed in Section 20.43.
  7599. Rosenberg, et. al. Standards Track [Page 192]
  7600. RFC 3261 SIP: Session Initiation Protocol June 2002
  7601. A message body containing a description of media capabilities MAY be
  7602. present in the response, which is formatted according to the Accept
  7603. header field in the INVITE (or application/sdp if not present), the
  7604. same as a message body in a 200 (OK) response to an OPTIONS request.
  7605. It is hoped that negotiation will not frequently be needed, and when
  7606. a new user is being invited to join an already existing conference,
  7607. negotiation may not be possible. It is up to the invitation
  7608. initiator to decide whether or not to act on a 606 (Not Acceptable)
  7609. response.
  7610. This status response is returned only if the client knows that no
  7611. other end point will answer the request.
  7612. 22 Usage of HTTP Authentication
  7613. SIP provides a stateless, challenge-based mechanism for
  7614. authentication that is based on authentication in HTTP. Any time
  7615. that a proxy server or UA receives a request (with the exceptions
  7616. given in Section 22.1), it MAY challenge the initiator of the request
  7617. to provide assurance of its identity. Once the originator has been
  7618. identified, the recipient of the request SHOULD ascertain whether or
  7619. not this user is authorized to make the request in question. No
  7620. authorization systems are recommended or discussed in this document.
  7621. The "Digest" authentication mechanism described in this section
  7622. provides message authentication and replay protection only, without
  7623. message integrity or confidentiality. Protective measures above and
  7624. beyond those provided by Digest need to be taken to prevent active
  7625. attackers from modifying SIP requests and responses.
  7626. Note that due to its weak security, the usage of "Basic"
  7627. authentication has been deprecated. Servers MUST NOT accept
  7628. credentials using the "Basic" authorization scheme, and servers also
  7629. MUST NOT challenge with "Basic". This is a change from RFC 2543.
  7630. 22.1 Framework
  7631. The framework for SIP authentication closely parallels that of HTTP
  7632. (RFC 2617 [17]). In particular, the BNF for auth-scheme, auth-param,
  7633. challenge, realm, realm-value, and credentials is identical (although
  7634. the usage of "Basic" as a scheme is not permitted). In SIP, a UAS
  7635. uses the 401 (Unauthorized) response to challenge the identity of a
  7636. UAC. Additionally, registrars and redirect servers MAY make use of
  7637. 401 (Unauthorized) responses for authentication, but proxies MUST
  7638. NOT, and instead MAY use the 407 (Proxy Authentication Required)
  7639. Rosenberg, et. al. Standards Track [Page 193]
  7640. RFC 3261 SIP: Session Initiation Protocol June 2002
  7641. response. The requirements for inclusion of the Proxy-Authenticate,
  7642. Proxy-Authorization, WWW-Authenticate, and Authorization in the
  7643. various messages are identical to those described in RFC 2617 [17].
  7644. Since SIP does not have the concept of a canonical root URL, the
  7645. notion of protection spaces is interpreted differently in SIP. The
  7646. realm string alone defines the protection domain. This is a change
  7647. from RFC 2543, in which the Request-URI and the realm together
  7648. defined the protection domain.
  7649. This previous definition of protection domain caused some amount
  7650. of confusion since the Request-URI sent by the UAC and the
  7651. Request-URI received by the challenging server might be different,
  7652. and indeed the final form of the Request-URI might not be known to
  7653. the UAC. Also, the previous definition depended on the presence
  7654. of a SIP URI in the Request-URI and seemed to rule out alternative
  7655. URI schemes (for example, the tel URL).
  7656. Operators of user agents or proxy servers that will authenticate
  7657. received requests MUST adhere to the following guidelines for
  7658. creation of a realm string for their server:
  7659. o Realm strings MUST be globally unique. It is RECOMMENDED that
  7660. a realm string contain a hostname or domain name, following the
  7661. recommendation in Section 3.2.1 of RFC 2617 [17].
  7662. o Realm strings SHOULD present a human-readable identifier that
  7663. can be rendered to a user.
  7664. For example:
  7665. INVITE sip:bob@biloxi.com SIP/2.0
  7666. Authorization: Digest realm="biloxi.com", <...>
  7667. Generally, SIP authentication is meaningful for a specific realm, a
  7668. protection domain. Thus, for Digest authentication, each such
  7669. protection domain has its own set of usernames and passwords. If a
  7670. server does not require authentication for a particular request, it
  7671. MAY accept a default username, "anonymous", which has no password
  7672. (password of ""). Similarly, UACs representing many users, such as
  7673. PSTN gateways, MAY have their own device-specific username and
  7674. password, rather than accounts for particular users, for their realm.
  7675. While a server can legitimately challenge most SIP requests, there
  7676. are two requests defined by this document that require special
  7677. handling for authentication: ACK and CANCEL.
  7678. Rosenberg, et. al. Standards Track [Page 194]
  7679. RFC 3261 SIP: Session Initiation Protocol June 2002
  7680. Under an authentication scheme that uses responses to carry values
  7681. used to compute nonces (such as Digest), some problems come up for
  7682. any requests that take no response, including ACK. For this reason,
  7683. any credentials in the INVITE that were accepted by a server MUST be
  7684. accepted by that server for the ACK. UACs creating an ACK message
  7685. will duplicate all of the Authorization and Proxy-Authorization
  7686. header field values that appeared in the INVITE to which the ACK
  7687. corresponds. Servers MUST NOT attempt to challenge an ACK.
  7688. Although the CANCEL method does take a response (a 2xx), servers MUST
  7689. NOT attempt to challenge CANCEL requests since these requests cannot
  7690. be resubmitted. Generally, a CANCEL request SHOULD be accepted by a
  7691. server if it comes from the same hop that sent the request being
  7692. canceled (provided that some sort of transport or network layer
  7693. security association, as described in Section 26.2.1, is in place).
  7694. When a UAC receives a challenge, it SHOULD render to the user the
  7695. contents of the "realm" parameter in the challenge (which appears in
  7696. either a WWW-Authenticate header field or Proxy-Authenticate header
  7697. field) if the UAC device does not already know of a credential for
  7698. the realm in question. A service provider that pre-configures UAs
  7699. with credentials for its realm should be aware that users will not
  7700. have the opportunity to present their own credentials for this realm
  7701. when challenged at a pre-configured device.
  7702. Finally, note that even if a UAC can locate credentials that are
  7703. associated with the proper realm, the potential exists that these
  7704. credentials may no longer be valid or that the challenging server
  7705. will not accept these credentials for whatever reason (especially
  7706. when "anonymous" with no password is submitted). In this instance a
  7707. server may repeat its challenge, or it may respond with a 403
  7708. Forbidden. A UAC MUST NOT re-attempt requests with the credentials
  7709. that have just been rejected (though the request may be retried if
  7710. the nonce was stale).
  7711. 22.2 User-to-User Authentication
  7712. When a UAS receives a request from a UAC, the UAS MAY authenticate
  7713. the originator before the request is processed. If no credentials
  7714. (in the Authorization header field) are provided in the request, the
  7715. UAS can challenge the originator to provide credentials by rejecting
  7716. the request with a 401 (Unauthorized) status code.
  7717. The WWW-Authenticate response-header field MUST be included in 401
  7718. (Unauthorized) response messages. The field value consists of at
  7719. least one challenge that indicates the authentication scheme(s) and
  7720. parameters applicable to the realm.
  7721. Rosenberg, et. al. Standards Track [Page 195]
  7722. RFC 3261 SIP: Session Initiation Protocol June 2002
  7723. An example of the WWW-Authenticate header field in a 401 challenge
  7724. is:
  7725. WWW-Authenticate: Digest
  7726. realm="biloxi.com",
  7727. qop="auth,auth-int",
  7728. nonce="dcd98b7102dd2f0e8b11d0f600bfb0c093",
  7729. opaque="5ccc069c403ebaf9f0171e9517f40e41"
  7730. When the originating UAC receives the 401 (Unauthorized), it SHOULD,
  7731. if it is able, re-originate the request with the proper credentials.
  7732. The UAC may require input from the originating user before
  7733. proceeding. Once authentication credentials have been supplied
  7734. (either directly by the user, or discovered in an internal keyring),
  7735. UAs SHOULD cache the credentials for a given value of the To header
  7736. field and "realm" and attempt to re-use these values on the next
  7737. request for that destination. UAs MAY cache credentials in any way
  7738. they would like.
  7739. If no credentials for a realm can be located, UACs MAY attempt to
  7740. retry the request with a username of "anonymous" and no password (a
  7741. password of "").
  7742. Once credentials have been located, any UA that wishes to
  7743. authenticate itself with a UAS or registrar -- usually, but not
  7744. necessarily, after receiving a 401 (Unauthorized) response -- MAY do
  7745. so by including an Authorization header field with the request. The
  7746. Authorization field value consists of credentials containing the
  7747. authentication information of the UA for the realm of the resource
  7748. being requested as well as parameters required in support of
  7749. authentication and replay protection.
  7750. An example of the Authorization header field is:
  7751. Authorization: Digest username="bob",
  7752. realm="biloxi.com",
  7753. nonce="dcd98b7102dd2f0e8b11d0f600bfb0c093",
  7754. uri="sip:bob@biloxi.com",
  7755. qop=auth,
  7756. nc=00000001,
  7757. cnonce="0a4f113b",
  7758. response="6629fae49393a05397450978507c4ef1",
  7759. opaque="5ccc069c403ebaf9f0171e9517f40e41"
  7760. When a UAC resubmits a request with its credentials after receiving a
  7761. 401 (Unauthorized) or 407 (Proxy Authentication Required) response,
  7762. it MUST increment the CSeq header field value as it would normally
  7763. when sending an updated request.
  7764. Rosenberg, et. al. Standards Track [Page 196]
  7765. RFC 3261 SIP: Session Initiation Protocol June 2002
  7766. 22.3 Proxy-to-User Authentication
  7767. Similarly, when a UAC sends a request to a proxy server, the proxy
  7768. server MAY authenticate the originator before the request is
  7769. processed. If no credentials (in the Proxy-Authorization header
  7770. field) are provided in the request, the proxy can challenge the
  7771. originator to provide credentials by rejecting the request with a 407
  7772. (Proxy Authentication Required) status code. The proxy MUST populate
  7773. the 407 (Proxy Authentication Required) message with a Proxy-
  7774. Authenticate header field value applicable to the proxy for the
  7775. requested resource.
  7776. The use of Proxy-Authenticate and Proxy-Authorization parallel that
  7777. described in [17], with one difference. Proxies MUST NOT add values
  7778. to the Proxy-Authorization header field. All 407 (Proxy
  7779. Authentication Required) responses MUST be forwarded upstream toward
  7780. the UAC following the procedures for any other response. It is the
  7781. UAC's responsibility to add the Proxy-Authorization header field
  7782. value containing credentials for the realm of the proxy that has
  7783. asked for authentication.
  7784. If a proxy were to resubmit a request adding a Proxy-Authorization
  7785. header field value, it would need to increment the CSeq in the new
  7786. request. However, this would cause the UAC that submitted the
  7787. original request to discard a response from the UAS, as the CSeq
  7788. value would be different.
  7789. When the originating UAC receives the 407 (Proxy Authentication
  7790. Required) it SHOULD, if it is able, re-originate the request with the
  7791. proper credentials. It should follow the same procedures for the
  7792. display of the "realm" parameter that are given above for responding
  7793. to 401.
  7794. If no credentials for a realm can be located, UACs MAY attempt to
  7795. retry the request with a username of "anonymous" and no password (a
  7796. password of "").
  7797. The UAC SHOULD also cache the credentials used in the re-originated
  7798. request.
  7799. The following rule is RECOMMENDED for proxy credential caching:
  7800. If a UA receives a Proxy-Authenticate header field value in a 401/407
  7801. response to a request with a particular Call-ID, it should
  7802. incorporate credentials for that realm in all subsequent requests
  7803. that contain the same Call-ID. These credentials MUST NOT be cached
  7804. across dialogs; however, if a UA is configured with the realm of its
  7805. local outbound proxy, when one exists, then the UA MAY cache
  7806. Rosenberg, et. al. Standards Track [Page 197]
  7807. RFC 3261 SIP: Session Initiation Protocol June 2002
  7808. credentials for that realm across dialogs. Note that this does mean
  7809. a future request in a dialog could contain credentials that are not
  7810. needed by any proxy along the Route header path.
  7811. Any UA that wishes to authenticate itself to a proxy server --
  7812. usually, but not necessarily, after receiving a 407 (Proxy
  7813. Authentication Required) response -- MAY do so by including a Proxy-
  7814. Authorization header field value with the request. The Proxy-
  7815. Authorization request-header field allows the client to identify
  7816. itself (or its user) to a proxy that requires authentication. The
  7817. Proxy-Authorization header field value consists of credentials
  7818. containing the authentication information of the UA for the proxy
  7819. and/or realm of the resource being requested.
  7820. A Proxy-Authorization header field value applies only to the proxy
  7821. whose realm is identified in the "realm" parameter (this proxy may
  7822. previously have demanded authentication using the Proxy-Authenticate
  7823. field). When multiple proxies are used in a chain, a Proxy-
  7824. Authorization header field value MUST NOT be consumed by any proxy
  7825. whose realm does not match the "realm" parameter specified in that
  7826. value.
  7827. Note that if an authentication scheme that does not support realms is
  7828. used in the Proxy-Authorization header field, a proxy server MUST
  7829. attempt to parse all Proxy-Authorization header field values to
  7830. determine whether one of them has what the proxy server considers to
  7831. be valid credentials. Because this is potentially very time-
  7832. consuming in large networks, proxy servers SHOULD use an
  7833. authentication scheme that supports realms in the Proxy-Authorization
  7834. header field.
  7835. If a request is forked (as described in Section 16.7), various proxy
  7836. servers and/or UAs may wish to challenge the UAC. In this case, the
  7837. forking proxy server is responsible for aggregating these challenges
  7838. into a single response. Each WWW-Authenticate and Proxy-Authenticate
  7839. value received in responses to the forked request MUST be placed into
  7840. the single response that is sent by the forking proxy to the UA; the
  7841. ordering of these header field values is not significant.
  7842. When a proxy server issues a challenge in response to a request,
  7843. it will not proxy the request until the UAC has retried the
  7844. request with valid credentials. A forking proxy may forward a
  7845. request simultaneously to multiple proxy servers that require
  7846. authentication, each of which in turn will not forward the request
  7847. until the originating UAC has authenticated itself in their
  7848. respective realm. If the UAC does not provide credentials for
  7849. Rosenberg, et. al. Standards Track [Page 198]
  7850. RFC 3261 SIP: Session Initiation Protocol June 2002
  7851. each challenge, the proxy servers that issued the challenges will
  7852. not forward requests to the UA where the destination user might be
  7853. located, and therefore, the virtues of forking are largely lost.
  7854. When resubmitting its request in response to a 401 (Unauthorized) or
  7855. 407 (Proxy Authentication Required) that contains multiple
  7856. challenges, a UAC MAY include an Authorization value for each WWW-
  7857. Authenticate value and a Proxy-Authorization value for each Proxy-
  7858. Authenticate value for which the UAC wishes to supply a credential.
  7859. As noted above, multiple credentials in a request SHOULD be
  7860. differentiated by the "realm" parameter.
  7861. It is possible for multiple challenges associated with the same realm
  7862. to appear in the same 401 (Unauthorized) or 407 (Proxy Authentication
  7863. Required). This can occur, for example, when multiple proxies within
  7864. the same administrative domain, which use a common realm, are reached
  7865. by a forking request. When it retries a request, a UAC MAY therefore
  7866. supply multiple credentials in Authorization or Proxy-Authorization
  7867. header fields with the same "realm" parameter value. The same
  7868. credentials SHOULD be used for the same realm.
  7869. 22.4 The Digest Authentication Scheme
  7870. This section describes the modifications and clarifications required
  7871. to apply the HTTP Digest authentication scheme to SIP. The SIP
  7872. scheme usage is almost completely identical to that for HTTP [17].
  7873. Since RFC 2543 is based on HTTP Digest as defined in RFC 2069 [39],
  7874. SIP servers supporting RFC 2617 MUST ensure they are backwards
  7875. compatible with RFC 2069. Procedures for this backwards
  7876. compatibility are specified in RFC 2617. Note, however, that SIP
  7877. servers MUST NOT accept or request Basic authentication.
  7878. The rules for Digest authentication follow those defined in [17],
  7879. with "HTTP/1.1" replaced by "SIP/2.0" in addition to the following
  7880. differences:
  7881. 1. The URI included in the challenge has the following BNF:
  7882. URI = SIP-URI / SIPS-URI
  7883. 2. The BNF in RFC 2617 has an error in that the 'uri' parameter
  7884. of the Authorization header field for HTTP Digest
  7885. Rosenberg, et. al. Standards Track [Page 199]
  7886. RFC 3261 SIP: Session Initiation Protocol June 2002
  7887. authentication is not enclosed in quotation marks. (The
  7888. example in Section 3.5 of RFC 2617 is correct.) For SIP, the
  7889. 'uri' MUST be enclosed in quotation marks.
  7890. 3. The BNF for digest-uri-value is:
  7891. digest-uri-value = Request-URI ; as defined in Section 25
  7892. 4. The example procedure for choosing a nonce based on Etag does
  7893. not work for SIP.
  7894. 5. The text in RFC 2617 [17] regarding cache operation does not
  7895. apply to SIP.
  7896. 6. RFC 2617 [17] requires that a server check that the URI in the
  7897. request line and the URI included in the Authorization header
  7898. field point to the same resource. In a SIP context, these two
  7899. URIs may refer to different users, due to forwarding at some
  7900. proxy. Therefore, in SIP, a server MAY check that the
  7901. Request-URI in the Authorization header field value
  7902. corresponds to a user for whom the server is willing to accept
  7903. forwarded or direct requests, but it is not necessarily a
  7904. failure if the two fields are not equivalent.
  7905. 7. As a clarification to the calculation of the A2 value for
  7906. message integrity assurance in the Digest authentication
  7907. scheme, implementers should assume, when the entity-body is
  7908. empty (that is, when SIP messages have no body) that the hash
  7909. of the entity-body resolves to the MD5 hash of an empty
  7910. string, or:
  7911. H(entity-body) = MD5("") =
  7912. "d41d8cd98f00b204e9800998ecf8427e"
  7913. 8. RFC 2617 notes that a cnonce value MUST NOT be sent in an
  7914. Authorization (and by extension Proxy-Authorization) header
  7915. field if no qop directive has been sent. Therefore, any
  7916. algorithms that have a dependency on the cnonce (including
  7917. "MD5-Sess") require that the qop directive be sent. Use of
  7918. the "qop" parameter is optional in RFC 2617 for the purposes
  7919. of backwards compatibility with RFC 2069; since RFC 2543 was
  7920. based on RFC 2069, the "qop" parameter must unfortunately
  7921. remain optional for clients and servers to receive. However,
  7922. servers MUST always send a "qop" parameter in WWW-Authenticate
  7923. and Proxy-Authenticate header field values. If a client
  7924. receives a "qop" parameter in a challenge header field, it
  7925. MUST send the "qop" parameter in any resulting authorization
  7926. header field.
  7927. Rosenberg, et. al. Standards Track [Page 200]
  7928. RFC 3261 SIP: Session Initiation Protocol June 2002
  7929. RFC 2543 did not allow usage of the Authentication-Info header field
  7930. (it effectively used RFC 2069). However, we now allow usage of this
  7931. header field, since it provides integrity checks over the bodies and
  7932. provides mutual authentication. RFC 2617 [17] defines mechanisms for
  7933. backwards compatibility using the qop attribute in the request.
  7934. These mechanisms MUST be used by a server to determine if the client
  7935. supports the new mechanisms in RFC 2617 that were not specified in
  7936. RFC 2069.
  7937. 23 S/MIME
  7938. SIP messages carry MIME bodies and the MIME standard includes
  7939. mechanisms for securing MIME contents to ensure both integrity and
  7940. confidentiality (including the 'multipart/signed' and
  7941. 'application/pkcs7-mime' MIME types, see RFC 1847 [22], RFC 2630 [23]
  7942. and RFC 2633 [24]). Implementers should note, however, that there
  7943. may be rare network intermediaries (not typical proxy servers) that
  7944. rely on viewing or modifying the bodies of SIP messages (especially
  7945. SDP), and that secure MIME may prevent these sorts of intermediaries
  7946. from functioning.
  7947. This applies particularly to certain types of firewalls.
  7948. The PGP mechanism for encrypting the header fields and bodies of
  7949. SIP messages described in RFC 2543 has been deprecated.
  7950. 23.1 S/MIME Certificates
  7951. The certificates that are used to identify an end-user for the
  7952. purposes of S/MIME differ from those used by servers in one important
  7953. respect - rather than asserting that the identity of the holder
  7954. corresponds to a particular hostname, these certificates assert that
  7955. the holder is identified by an end-user address. This address is
  7956. composed of the concatenation of the "userinfo" "@" and "domainname"
  7957. portions of a SIP or SIPS URI (in other words, an email address of
  7958. the form "bob@biloxi.com"), most commonly corresponding to a user's
  7959. address-of-record.
  7960. These certificates are also associated with keys that are used to
  7961. sign or encrypt bodies of SIP messages. Bodies are signed with the
  7962. private key of the sender (who may include their public key with the
  7963. message as appropriate), but bodies are encrypted with the public key
  7964. of the intended recipient. Obviously, senders must have
  7965. foreknowledge of the public key of recipients in order to encrypt
  7966. message bodies. Public keys can be stored within a UA on a virtual
  7967. keyring.
  7968. Rosenberg, et. al. Standards Track [Page 201]
  7969. RFC 3261 SIP: Session Initiation Protocol June 2002
  7970. Each user agent that supports S/MIME MUST contain a keyring
  7971. specifically for end-users' certificates. This keyring should map
  7972. between addresses of record and corresponding certificates. Over
  7973. time, users SHOULD use the same certificate when they populate the
  7974. originating URI of signaling (the From header field) with the same
  7975. address-of-record.
  7976. Any mechanisms depending on the existence of end-user certificates
  7977. are seriously limited in that there is virtually no consolidated
  7978. authority today that provides certificates for end-user applications.
  7979. However, users SHOULD acquire certificates from known public
  7980. certificate authorities. As an alternative, users MAY create self-
  7981. signed certificates. The implications of self-signed certificates
  7982. are explored further in Section 26.4.2. Implementations may also use
  7983. pre-configured certificates in deployments in which a previous trust
  7984. relationship exists between all SIP entities.
  7985. Above and beyond the problem of acquiring an end-user certificate,
  7986. there are few well-known centralized directories that distribute
  7987. end-user certificates. However, the holder of a certificate SHOULD
  7988. publish their certificate in any public directories as appropriate.
  7989. Similarly, UACs SHOULD support a mechanism for importing (manually or
  7990. automatically) certificates discovered in public directories
  7991. corresponding to the target URIs of SIP requests.
  7992. 23.2 S/MIME Key Exchange
  7993. SIP itself can also be used as a means to distribute public keys in
  7994. the following manner.
  7995. Whenever the CMS SignedData message is used in S/MIME for SIP, it
  7996. MUST contain the certificate bearing the public key necessary to
  7997. verify the signature.
  7998. When a UAC sends a request containing an S/MIME body that initiates a
  7999. dialog, or sends a non-INVITE request outside the context of a
  8000. dialog, the UAC SHOULD structure the body as an S/MIME
  8001. 'multipart/signed' CMS SignedData body. If the desired CMS service
  8002. is EnvelopedData (and the public key of the target user is known),
  8003. the UAC SHOULD send the EnvelopedData message encapsulated within a
  8004. SignedData message.
  8005. When a UAS receives a request containing an S/MIME CMS body that
  8006. includes a certificate, the UAS SHOULD first validate the
  8007. certificate, if possible, with any available root certificates for
  8008. certificate authorities. The UAS SHOULD also determine the subject
  8009. of the certificate (for S/MIME, the SubjectAltName will contain the
  8010. appropriate identity) and compare this value to the From header field
  8011. Rosenberg, et. al. Standards Track [Page 202]
  8012. RFC 3261 SIP: Session Initiation Protocol June 2002
  8013. of the request. If the certificate cannot be verified, because it is
  8014. self-signed, or signed by no known authority, or if it is verifiable
  8015. but its subject does not correspond to the From header field of
  8016. request, the UAS MUST notify its user of the status of the
  8017. certificate (including the subject of the certificate, its signer,
  8018. and any key fingerprint information) and request explicit permission
  8019. before proceeding. If the certificate was successfully verified and
  8020. the subject of the certificate corresponds to the From header field
  8021. of the SIP request, or if the user (after notification) explicitly
  8022. authorizes the use of the certificate, the UAS SHOULD add this
  8023. certificate to a local keyring, indexed by the address-of-record of
  8024. the holder of the certificate.
  8025. When a UAS sends a response containing an S/MIME body that answers
  8026. the first request in a dialog, or a response to a non-INVITE request
  8027. outside the context of a dialog, the UAS SHOULD structure the body as
  8028. an S/MIME 'multipart/signed' CMS SignedData body. If the desired CMS
  8029. service is EnvelopedData, the UAS SHOULD send the EnvelopedData
  8030. message encapsulated within a SignedData message.
  8031. When a UAC receives a response containing an S/MIME CMS body that
  8032. includes a certificate, the UAC SHOULD first validate the
  8033. certificate, if possible, with any appropriate root certificate. The
  8034. UAC SHOULD also determine the subject of the certificate and compare
  8035. this value to the To field of the response; although the two may very
  8036. well be different, and this is not necessarily indicative of a
  8037. security breach. If the certificate cannot be verified because it is
  8038. self-signed, or signed by no known authority, the UAC MUST notify its
  8039. user of the status of the certificate (including the subject of the
  8040. certificate, its signator, and any key fingerprint information) and
  8041. request explicit permission before proceeding. If the certificate
  8042. was successfully verified, and the subject of the certificate
  8043. corresponds to the To header field in the response, or if the user
  8044. (after notification) explicitly authorizes the use of the
  8045. certificate, the UAC SHOULD add this certificate to a local keyring,
  8046. indexed by the address-of-record of the holder of the certificate.
  8047. If the UAC had not transmitted its own certificate to the UAS in any
  8048. previous transaction, it SHOULD use a CMS SignedData body for its
  8049. next request or response.
  8050. On future occasions, when the UA receives requests or responses that
  8051. contain a From header field corresponding to a value in its keyring,
  8052. the UA SHOULD compare the certificate offered in these messages with
  8053. the existing certificate in its keyring. If there is a discrepancy,
  8054. the UA MUST notify its user of a change of the certificate
  8055. (preferably in terms that indicate that this is a potential security
  8056. breach) and acquire the user's permission before continuing to
  8057. Rosenberg, et. al. Standards Track [Page 203]
  8058. RFC 3261 SIP: Session Initiation Protocol June 2002
  8059. process the signaling. If the user authorizes this certificate, it
  8060. SHOULD be added to the keyring alongside any previous value(s) for
  8061. this address-of-record.
  8062. Note well however, that this key exchange mechanism does not
  8063. guarantee the secure exchange of keys when self-signed certificates,
  8064. or certificates signed by an obscure authority, are used - it is
  8065. vulnerable to well-known attacks. In the opinion of the authors,
  8066. however, the security it provides is proverbially better than
  8067. nothing; it is in fact comparable to the widely used SSH application.
  8068. These limitations are explored in greater detail in Section 26.4.2.
  8069. If a UA receives an S/MIME body that has been encrypted with a public
  8070. key unknown to the recipient, it MUST reject the request with a 493
  8071. (Undecipherable) response. This response SHOULD contain a valid
  8072. certificate for the respondent (corresponding, if possible, to any
  8073. address of record given in the To header field of the rejected
  8074. request) within a MIME body with a 'certs-only' "smime-type"
  8075. parameter.
  8076. A 493 (Undecipherable) sent without any certificate indicates that
  8077. the respondent cannot or will not utilize S/MIME encrypted messages,
  8078. though they may still support S/MIME signatures.
  8079. Note that a user agent that receives a request containing an S/MIME
  8080. body that is not optional (with a Content-Disposition header
  8081. "handling" parameter of "required") MUST reject the request with a
  8082. 415 Unsupported Media Type response if the MIME type is not
  8083. understood. A user agent that receives such a response when S/MIME
  8084. is sent SHOULD notify its user that the remote device does not
  8085. support S/MIME, and it MAY subsequently resend the request without
  8086. S/MIME, if appropriate; however, this 415 response may constitute a
  8087. downgrade attack.
  8088. If a user agent sends an S/MIME body in a request, but receives a
  8089. response that contains a MIME body that is not secured, the UAC
  8090. SHOULD notify its user that the session could not be secured.
  8091. However, if a user agent that supports S/MIME receives a request with
  8092. an unsecured body, it SHOULD NOT respond with a secured body, but if
  8093. it expects S/MIME from the sender (for example, because the sender's
  8094. From header field value corresponds to an identity on its keychain),
  8095. the UAS SHOULD notify its user that the session could not be secured.
  8096. A number of conditions that arise in the previous text call for the
  8097. notification of the user when an anomalous certificate-management
  8098. event occurs. Users might well ask what they should do under these
  8099. circumstances. First and foremost, an unexpected change in a
  8100. certificate, or an absence of security when security is expected, are
  8101. Rosenberg, et. al. Standards Track [Page 204]
  8102. RFC 3261 SIP: Session Initiation Protocol June 2002
  8103. causes for caution but not necessarily indications that an attack is
  8104. in progress. Users might abort any connection attempt or refuse a
  8105. connection request they have received; in telephony parlance, they
  8106. could hang up and call back. Users may wish to find an alternate
  8107. means to contact the other party and confirm that their key has
  8108. legitimately changed. Note that users are sometimes compelled to
  8109. change their certificates, for example when they suspect that the
  8110. secrecy of their private key has been compromised. When their
  8111. private key is no longer private, users must legitimately generate a
  8112. new key and re-establish trust with any users that held their old
  8113. key.
  8114. Finally, if during the course of a dialog a UA receives a certificate
  8115. in a CMS SignedData message that does not correspond with the
  8116. certificates previously exchanged during a dialog, the UA MUST notify
  8117. its user of the change, preferably in terms that indicate that this
  8118. is a potential security breach.
  8119. 23.3 Securing MIME bodies
  8120. There are two types of secure MIME bodies that are of interest to
  8121. SIP: use of these bodies should follow the S/MIME specification [24]
  8122. with a few variations.
  8123. o "multipart/signed" MUST be used only with CMS detached
  8124. signatures.
  8125. This allows backwards compatibility with non-S/MIME-
  8126. compliant recipients.
  8127. o S/MIME bodies SHOULD have a Content-Disposition header field,
  8128. and the value of the "handling" parameter SHOULD be "required."
  8129. o If a UAC has no certificate on its keyring associated with the
  8130. address-of-record to which it wants to send a request, it
  8131. cannot send an encrypted "application/pkcs7-mime" MIME message.
  8132. UACs MAY send an initial request such as an OPTIONS message
  8133. with a CMS detached signature in order to solicit the
  8134. certificate of the remote side (the signature SHOULD be over a
  8135. "message/sip" body of the type described in Section 23.4).
  8136. Note that future standardization work on S/MIME may define
  8137. non-certificate based keys.
  8138. o Senders of S/MIME bodies SHOULD use the "SMIMECapabilities"
  8139. (see Section 2.5.2 of [24]) attribute to express their
  8140. capabilities and preferences for further communications. Note
  8141. especially that senders MAY use the "preferSignedData"
  8142. Rosenberg, et. al. Standards Track [Page 205]
  8143. RFC 3261 SIP: Session Initiation Protocol June 2002
  8144. capability to encourage receivers to respond with CMS
  8145. SignedData messages (for example, when sending an OPTIONS
  8146. request as described above).
  8147. o S/MIME implementations MUST at a minimum support SHA1 as a
  8148. digital signature algorithm, and 3DES as an encryption
  8149. algorithm. All other signature and encryption algorithms MAY
  8150. be supported. Implementations can negotiate support for these
  8151. algorithms with the "SMIMECapabilities" attribute.
  8152. o Each S/MIME body in a SIP message SHOULD be signed with only
  8153. one certificate. If a UA receives a message with multiple
  8154. signatures, the outermost signature should be treated as the
  8155. single certificate for this body. Parallel signatures SHOULD
  8156. NOT be used.
  8157. The following is an example of an encrypted S/MIME SDP body
  8158. within a SIP message:
  8159. INVITE sip:bob@biloxi.com SIP/2.0
  8160. Via: SIP/2.0/UDP pc33.atlanta.com;branch=z9hG4bKnashds8
  8161. To: Bob <sip:bob@biloxi.com>
  8162. From: Alice <sip:alice@atlanta.com>;tag=1928301774
  8163. Call-ID: a84b4c76e66710
  8164. CSeq: 314159 INVITE
  8165. Max-Forwards: 70
  8166. Contact: <sip:alice@pc33.atlanta.com>
  8167. Content-Type: application/pkcs7-mime; smime-type=enveloped-data;
  8168. name=smime.p7m
  8169. Content-Disposition: attachment; filename=smime.p7m
  8170. handling=required
  8171. *******************************************************
  8172. * Content-Type: application/sdp *
  8173. * *
  8174. * v=0 *
  8175. * o=alice 53655765 2353687637 IN IP4 pc33.atlanta.com *
  8176. * s=- *
  8177. * t=0 0 *
  8178. * c=IN IP4 pc33.atlanta.com *
  8179. * m=audio 3456 RTP/AVP 0 1 3 99 *
  8180. * a=rtpmap:0 PCMU/8000 *
  8181. *******************************************************
  8182. Rosenberg, et. al. Standards Track [Page 206]
  8183. RFC 3261 SIP: Session Initiation Protocol June 2002
  8184. 23.4 SIP Header Privacy and Integrity using S/MIME: Tunneling SIP
  8185. As a means of providing some degree of end-to-end authentication,
  8186. integrity or confidentiality for SIP header fields, S/MIME can
  8187. encapsulate entire SIP messages within MIME bodies of type
  8188. "message/sip" and then apply MIME security to these bodies in the
  8189. same manner as typical SIP bodies. These encapsulated SIP requests
  8190. and responses do not constitute a separate dialog or transaction,
  8191. they are a copy of the "outer" message that is used to verify
  8192. integrity or to supply additional information.
  8193. If a UAS receives a request that contains a tunneled "message/sip"
  8194. S/MIME body, it SHOULD include a tunneled "message/sip" body in the
  8195. response with the same smime-type.
  8196. Any traditional MIME bodies (such as SDP) SHOULD be attached to the
  8197. "inner" message so that they can also benefit from S/MIME security.
  8198. Note that "message/sip" bodies can be sent as a part of a MIME
  8199. "multipart/mixed" body if any unsecured MIME types should also be
  8200. transmitted in a request.
  8201. 23.4.1 Integrity and Confidentiality Properties of SIP Headers
  8202. When the S/MIME integrity or confidentiality mechanisms are used,
  8203. there may be discrepancies between the values in the "inner" message
  8204. and values in the "outer" message. The rules for handling any such
  8205. differences for all of the header fields described in this document
  8206. are given in this section.
  8207. Note that for the purposes of loose timestamping, all SIP messages
  8208. that tunnel "message/sip" SHOULD contain a Date header in both the
  8209. "inner" and "outer" headers.
  8210. 23.4.1.1 Integrity
  8211. Whenever integrity checks are performed, the integrity of a header
  8212. field should be determined by matching the value of the header field
  8213. in the signed body with that in the "outer" messages using the
  8214. comparison rules of SIP as described in 20.
  8215. Header fields that can be legitimately modified by proxy servers are:
  8216. Request-URI, Via, Record-Route, Route, Max-Forwards, and Proxy-
  8217. Authorization. If these header fields are not intact end-to-end,
  8218. implementations SHOULD NOT consider this a breach of security.
  8219. Changes to any other header fields defined in this document
  8220. constitute an integrity violation; users MUST be notified of a
  8221. discrepancy.
  8222. Rosenberg, et. al. Standards Track [Page 207]
  8223. RFC 3261 SIP: Session Initiation Protocol June 2002
  8224. 23.4.1.2 Confidentiality
  8225. When messages are encrypted, header fields may be included in the
  8226. encrypted body that are not present in the "outer" message.
  8227. Some header fields must always have a plaintext version because they
  8228. are required header fields in requests and responses - these include:
  8229. To, From, Call-ID, CSeq, Contact. While it is probably not useful to
  8230. provide an encrypted alternative for the Call-ID, CSeq, or Contact,
  8231. providing an alternative to the information in the "outer" To or From
  8232. is permitted. Note that the values in an encrypted body are not used
  8233. for the purposes of identifying transactions or dialogs - they are
  8234. merely informational. If the From header field in an encrypted body
  8235. differs from the value in the "outer" message, the value within the
  8236. encrypted body SHOULD be displayed to the user, but MUST NOT be used
  8237. in the "outer" header fields of any future messages.
  8238. Primarily, a user agent will want to encrypt header fields that have
  8239. an end-to-end semantic, including: Subject, Reply-To, Organization,
  8240. Accept, Accept-Encoding, Accept-Language, Alert-Info, Error-Info,
  8241. Authentication-Info, Expires, In-Reply-To, Require, Supported,
  8242. Unsupported, Retry-After, User-Agent, Server, and Warning. If any of
  8243. these header fields are present in an encrypted body, they should be
  8244. used instead of any "outer" header fields, whether this entails
  8245. displaying the header field values to users or setting internal
  8246. states in the UA. They SHOULD NOT however be used in the "outer"
  8247. headers of any future messages.
  8248. If present, the Date header field MUST always be the same in the
  8249. "inner" and "outer" headers.
  8250. Since MIME bodies are attached to the "inner" message,
  8251. implementations will usually encrypt MIME-specific header fields,
  8252. including: MIME-Version, Content-Type, Content-Length, Content-
  8253. Language, Content-Encoding and Content-Disposition. The "outer"
  8254. message will have the proper MIME header fields for S/MIME bodies.
  8255. These header fields (and any MIME bodies they preface) should be
  8256. treated as normal MIME header fields and bodies received in a SIP
  8257. message.
  8258. It is not particularly useful to encrypt the following header fields:
  8259. Min-Expires, Timestamp, Authorization, Priority, and WWW-
  8260. Authenticate. This category also includes those header fields that
  8261. can be changed by proxy servers (described in the preceding section).
  8262. UAs SHOULD never include these in an "inner" message if they are not
  8263. Rosenberg, et. al. Standards Track [Page 208]
  8264. RFC 3261 SIP: Session Initiation Protocol June 2002
  8265. included in the "outer" message. UAs that receive any of these
  8266. header fields in an encrypted body SHOULD ignore the encrypted
  8267. values.
  8268. Note that extensions to SIP may define additional header fields; the
  8269. authors of these extensions should describe the integrity and
  8270. confidentiality properties of such header fields. If a SIP UA
  8271. encounters an unknown header field with an integrity violation, it
  8272. MUST ignore the header field.
  8273. 23.4.2 Tunneling Integrity and Authentication
  8274. Tunneling SIP messages within S/MIME bodies can provide integrity for
  8275. SIP header fields if the header fields that the sender wishes to
  8276. secure are replicated in a "message/sip" MIME body signed with a CMS
  8277. detached signature.
  8278. Provided that the "message/sip" body contains at least the
  8279. fundamental dialog identifiers (To, From, Call-ID, CSeq), then a
  8280. signed MIME body can provide limited authentication. At the very
  8281. least, if the certificate used to sign the body is unknown to the
  8282. recipient and cannot be verified, the signature can be used to
  8283. ascertain that a later request in a dialog was transmitted by the
  8284. same certificate-holder that initiated the dialog. If the recipient
  8285. of the signed MIME body has some stronger incentive to trust the
  8286. certificate (they were able to validate it, they acquired it from a
  8287. trusted repository, or they have used it frequently) then the
  8288. signature can be taken as a stronger assertion of the identity of the
  8289. subject of the certificate.
  8290. In order to eliminate possible confusions about the addition or
  8291. subtraction of entire header fields, senders SHOULD replicate all
  8292. header fields from the request within the signed body. Any message
  8293. bodies that require integrity protection MUST be attached to the
  8294. "inner" message.
  8295. If a Date header is present in a message with a signed body, the
  8296. recipient SHOULD compare the header field value with its own internal
  8297. clock, if applicable. If a significant time discrepancy is detected
  8298. (on the order of an hour or more), the user agent SHOULD alert the
  8299. user to the anomaly, and note that it is a potential security breach.
  8300. If an integrity violation in a message is detected by its recipient,
  8301. the message MAY be rejected with a 403 (Forbidden) response if it is
  8302. a request, or any existing dialog MAY be terminated. UAs SHOULD
  8303. notify users of this circumstance and request explicit guidance on
  8304. how to proceed.
  8305. Rosenberg, et. al. Standards Track [Page 209]
  8306. RFC 3261 SIP: Session Initiation Protocol June 2002
  8307. The following is an example of the use of a tunneled "message/sip"
  8308. body:
  8309. INVITE sip:bob@biloxi.com SIP/2.0
  8310. Via: SIP/2.0/UDP pc33.atlanta.com;branch=z9hG4bKnashds8
  8311. To: Bob <sip:bob@biloxi.com>
  8312. From: Alice <sip:alice@atlanta.com>;tag=1928301774
  8313. Call-ID: a84b4c76e66710
  8314. CSeq: 314159 INVITE
  8315. Max-Forwards: 70
  8316. Date: Thu, 21 Feb 2002 13:02:03 GMT
  8317. Contact: <sip:alice@pc33.atlanta.com>
  8318. Content-Type: multipart/signed;
  8319. protocol="application/pkcs7-signature";
  8320. micalg=sha1; boundary=boundary42
  8321. Content-Length: 568
  8322. --boundary42
  8323. Content-Type: message/sip
  8324. INVITE sip:bob@biloxi.com SIP/2.0
  8325. Via: SIP/2.0/UDP pc33.atlanta.com;branch=z9hG4bKnashds8
  8326. To: Bob <bob@biloxi.com>
  8327. From: Alice <alice@atlanta.com>;tag=1928301774
  8328. Call-ID: a84b4c76e66710
  8329. CSeq: 314159 INVITE
  8330. Max-Forwards: 70
  8331. Date: Thu, 21 Feb 2002 13:02:03 GMT
  8332. Contact: <sip:alice@pc33.atlanta.com>
  8333. Content-Type: application/sdp
  8334. Content-Length: 147
  8335. v=0
  8336. o=UserA 2890844526 2890844526 IN IP4 here.com
  8337. s=Session SDP
  8338. c=IN IP4 pc33.atlanta.com
  8339. t=0 0
  8340. m=audio 49172 RTP/AVP 0
  8341. a=rtpmap:0 PCMU/8000
  8342. --boundary42
  8343. Content-Type: application/pkcs7-signature; name=smime.p7s
  8344. Content-Transfer-Encoding: base64
  8345. Content-Disposition: attachment; filename=smime.p7s;
  8346. handling=required
  8347. Rosenberg, et. al. Standards Track [Page 210]
  8348. RFC 3261 SIP: Session Initiation Protocol June 2002
  8349. ghyHhHUujhJhjH77n8HHGTrfvbnj756tbB9HG4VQpfyF467GhIGfHfYT6
  8350. 4VQpfyF467GhIGfHfYT6jH77n8HHGghyHhHUujhJh756tbB9HGTrfvbnj
  8351. n8HHGTrfvhJhjH776tbB9HG4VQbnj7567GhIGfHfYT6ghyHhHUujpfyF4
  8352. 7GhIGfHfYT64VQbnj756
  8353. --boundary42-
  8354. 23.4.3 Tunneling Encryption
  8355. It may also be desirable to use this mechanism to encrypt a
  8356. "message/sip" MIME body within a CMS EnvelopedData message S/MIME
  8357. body, but in practice, most header fields are of at least some use to
  8358. the network; the general use of encryption with S/MIME is to secure
  8359. message bodies like SDP rather than message headers. Some
  8360. informational header fields, such as the Subject or Organization
  8361. could perhaps warrant end-to-end security. Headers defined by future
  8362. SIP applications might also require obfuscation.
  8363. Another possible application of encrypting header fields is selective
  8364. anonymity. A request could be constructed with a From header field
  8365. that contains no personal information (for example,
  8366. sip:anonymous@anonymizer.invalid). However, a second From header
  8367. field containing the genuine address-of-record of the originator
  8368. could be encrypted within a "message/sip" MIME body where it will
  8369. only be visible to the endpoints of a dialog.
  8370. Note that if this mechanism is used for anonymity, the From header
  8371. field will no longer be usable by the recipient of a message as an
  8372. index to their certificate keychain for retrieving the proper
  8373. S/MIME key to associated with the sender. The message must first
  8374. be decrypted, and the "inner" From header field MUST be used as an
  8375. index.
  8376. In order to provide end-to-end integrity, encrypted "message/sip"
  8377. MIME bodies SHOULD be signed by the sender. This creates a
  8378. "multipart/signed" MIME body that contains an encrypted body and a
  8379. signature, both of type "application/pkcs7-mime".
  8380. Rosenberg, et. al. Standards Track [Page 211]
  8381. RFC 3261 SIP: Session Initiation Protocol June 2002
  8382. In the following example, of an encrypted and signed message, the
  8383. text boxed in asterisks ("*") is encrypted:
  8384. INVITE sip:bob@biloxi.com SIP/2.0
  8385. Via: SIP/2.0/UDP pc33.atlanta.com;branch=z9hG4bKnashds8
  8386. To: Bob <sip:bob@biloxi.com>
  8387. From: Anonymous <sip:anonymous@atlanta.com>;tag=1928301774
  8388. Call-ID: a84b4c76e66710
  8389. CSeq: 314159 INVITE
  8390. Max-Forwards: 70
  8391. Date: Thu, 21 Feb 2002 13:02:03 GMT
  8392. Contact: <sip:pc33.atlanta.com>
  8393. Content-Type: multipart/signed;
  8394. protocol="application/pkcs7-signature";
  8395. micalg=sha1; boundary=boundary42
  8396. Content-Length: 568
  8397. --boundary42
  8398. Content-Type: application/pkcs7-mime; smime-type=enveloped-data;
  8399. name=smime.p7m
  8400. Content-Transfer-Encoding: base64
  8401. Content-Disposition: attachment; filename=smime.p7m
  8402. handling=required
  8403. Content-Length: 231
  8404. ***********************************************************
  8405. * Content-Type: message/sip *
  8406. * *
  8407. * INVITE sip:bob@biloxi.com SIP/2.0 *
  8408. * Via: SIP/2.0/UDP pc33.atlanta.com;branch=z9hG4bKnashds8 *
  8409. * To: Bob <bob@biloxi.com> *
  8410. * From: Alice <alice@atlanta.com>;tag=1928301774 *
  8411. * Call-ID: a84b4c76e66710 *
  8412. * CSeq: 314159 INVITE *
  8413. * Max-Forwards: 70 *
  8414. * Date: Thu, 21 Feb 2002 13:02:03 GMT *
  8415. * Contact: <sip:alice@pc33.atlanta.com> *
  8416. * *
  8417. * Content-Type: application/sdp *
  8418. * *
  8419. * v=0 *
  8420. * o=alice 53655765 2353687637 IN IP4 pc33.atlanta.com *
  8421. * s=Session SDP *
  8422. * t=0 0 *
  8423. * c=IN IP4 pc33.atlanta.com *
  8424. * m=audio 3456 RTP/AVP 0 1 3 99 *
  8425. * a=rtpmap:0 PCMU/8000 *
  8426. ***********************************************************
  8427. Rosenberg, et. al. Standards Track [Page 212]
  8428. RFC 3261 SIP: Session Initiation Protocol June 2002
  8429. --boundary42
  8430. Content-Type: application/pkcs7-signature; name=smime.p7s
  8431. Content-Transfer-Encoding: base64
  8432. Content-Disposition: attachment; filename=smime.p7s;
  8433. handling=required
  8434. ghyHhHUujhJhjH77n8HHGTrfvbnj756tbB9HG4VQpfyF467GhIGfHfYT6
  8435. 4VQpfyF467GhIGfHfYT6jH77n8HHGghyHhHUujhJh756tbB9HGTrfvbnj
  8436. n8HHGTrfvhJhjH776tbB9HG4VQbnj7567GhIGfHfYT6ghyHhHUujpfyF4
  8437. 7GhIGfHfYT64VQbnj756
  8438. --boundary42-
  8439. 24 Examples
  8440. In the following examples, we often omit the message body and the
  8441. corresponding Content-Length and Content-Type header fields for
  8442. brevity.
  8443. 24.1 Registration
  8444. Bob registers on start-up. The message flow is shown in Figure 9.
  8445. Note that the authentication usually required for registration is not
  8446. shown for simplicity.
  8447. biloxi.com Bob's
  8448. registrar softphone
  8449. | |
  8450. | REGISTER F1 |
  8451. |<---------------|
  8452. | 200 OK F2 |
  8453. |--------------->|
  8454. Figure 9: SIP Registration Example
  8455. F1 REGISTER Bob -> Registrar
  8456. REGISTER sip:registrar.biloxi.com SIP/2.0
  8457. Via: SIP/2.0/UDP bobspc.biloxi.com:5060;branch=z9hG4bKnashds7
  8458. Max-Forwards: 70
  8459. To: Bob <sip:bob@biloxi.com>
  8460. From: Bob <sip:bob@biloxi.com>;tag=456248
  8461. Call-ID: 843817637684230@998sdasdh09
  8462. CSeq: 1826 REGISTER
  8463. Contact: <sip:bob@192.0.2.4>
  8464. Expires: 7200
  8465. Content-Length: 0
  8466. Rosenberg, et. al. Standards Track [Page 213]
  8467. RFC 3261 SIP: Session Initiation Protocol June 2002
  8468. The registration expires after two hours. The registrar responds
  8469. with a 200 OK:
  8470. F2 200 OK Registrar -> Bob
  8471. SIP/2.0 200 OK
  8472. Via: SIP/2.0/UDP bobspc.biloxi.com:5060;branch=z9hG4bKnashds7
  8473. ;received=192.0.2.4
  8474. To: Bob <sip:bob@biloxi.com>;tag=2493k59kd
  8475. From: Bob <sip:bob@biloxi.com>;tag=456248
  8476. Call-ID: 843817637684230@998sdasdh09
  8477. CSeq: 1826 REGISTER
  8478. Contact: <sip:bob@192.0.2.4>
  8479. Expires: 7200
  8480. Content-Length: 0
  8481. 24.2 Session Setup
  8482. This example contains the full details of the example session setup
  8483. in Section 4. The message flow is shown in Figure 1. Note that
  8484. these flows show the minimum required set of header fields - some
  8485. other header fields such as Allow and Supported would normally be
  8486. present.
  8487. F1 INVITE Alice -> atlanta.com proxy
  8488. INVITE sip:bob@biloxi.com SIP/2.0
  8489. Via: SIP/2.0/UDP pc33.atlanta.com;branch=z9hG4bKnashds8
  8490. Max-Forwards: 70
  8491. To: Bob <sip:bob@biloxi.com>
  8492. From: Alice <sip:alice@atlanta.com>;tag=1928301774
  8493. Call-ID: a84b4c76e66710
  8494. CSeq: 314159 INVITE
  8495. Contact: <sip:alice@pc33.atlanta.com>
  8496. Content-Type: application/sdp
  8497. Content-Length: 142
  8498. (Alice's SDP not shown)
  8499. Rosenberg, et. al. Standards Track [Page 214]
  8500. RFC 3261 SIP: Session Initiation Protocol June 2002
  8501. F2 100 Trying atlanta.com proxy -> Alice
  8502. SIP/2.0 100 Trying
  8503. Via: SIP/2.0/UDP pc33.atlanta.com;branch=z9hG4bKnashds8
  8504. ;received=192.0.2.1
  8505. To: Bob <sip:bob@biloxi.com>
  8506. From: Alice <sip:alice@atlanta.com>;tag=1928301774
  8507. Call-ID: a84b4c76e66710
  8508. CSeq: 314159 INVITE
  8509. Content-Length: 0
  8510. F3 INVITE atlanta.com proxy -> biloxi.com proxy
  8511. INVITE sip:bob@biloxi.com SIP/2.0
  8512. Via: SIP/2.0/UDP bigbox3.site3.atlanta.com;branch=z9hG4bK77ef4c2312983.1
  8513. Via: SIP/2.0/UDP pc33.atlanta.com;branch=z9hG4bKnashds8
  8514. ;received=192.0.2.1
  8515. Max-Forwards: 69
  8516. To: Bob <sip:bob@biloxi.com>
  8517. From: Alice <sip:alice@atlanta.com>;tag=1928301774
  8518. Call-ID: a84b4c76e66710
  8519. CSeq: 314159 INVITE
  8520. Contact: <sip:alice@pc33.atlanta.com>
  8521. Content-Type: application/sdp
  8522. Content-Length: 142
  8523. (Alice's SDP not shown)
  8524. F4 100 Trying biloxi.com proxy -> atlanta.com proxy
  8525. SIP/2.0 100 Trying
  8526. Via: SIP/2.0/UDP bigbox3.site3.atlanta.com;branch=z9hG4bK77ef4c2312983.1
  8527. ;received=192.0.2.2
  8528. Via: SIP/2.0/UDP pc33.atlanta.com;branch=z9hG4bKnashds8
  8529. ;received=192.0.2.1
  8530. To: Bob <sip:bob@biloxi.com>
  8531. From: Alice <sip:alice@atlanta.com>;tag=1928301774
  8532. Call-ID: a84b4c76e66710
  8533. CSeq: 314159 INVITE
  8534. Content-Length: 0
  8535. Rosenberg, et. al. Standards Track [Page 215]
  8536. RFC 3261 SIP: Session Initiation Protocol June 2002
  8537. F5 INVITE biloxi.com proxy -> Bob
  8538. INVITE sip:bob@192.0.2.4 SIP/2.0
  8539. Via: SIP/2.0/UDP server10.biloxi.com;branch=z9hG4bK4b43c2ff8.1
  8540. Via: SIP/2.0/UDP bigbox3.site3.atlanta.com;branch=z9hG4bK77ef4c2312983.1
  8541. ;received=192.0.2.2
  8542. Via: SIP/2.0/UDP pc33.atlanta.com;branch=z9hG4bKnashds8
  8543. ;received=192.0.2.1
  8544. Max-Forwards: 68
  8545. To: Bob <sip:bob@biloxi.com>
  8546. From: Alice <sip:alice@atlanta.com>;tag=1928301774
  8547. Call-ID: a84b4c76e66710
  8548. CSeq: 314159 INVITE
  8549. Contact: <sip:alice@pc33.atlanta.com>
  8550. Content-Type: application/sdp
  8551. Content-Length: 142
  8552. (Alice's SDP not shown)
  8553. F6 180 Ringing Bob -> biloxi.com proxy
  8554. SIP/2.0 180 Ringing
  8555. Via: SIP/2.0/UDP server10.biloxi.com;branch=z9hG4bK4b43c2ff8.1
  8556. ;received=192.0.2.3
  8557. Via: SIP/2.0/UDP bigbox3.site3.atlanta.com;branch=z9hG4bK77ef4c2312983.1
  8558. ;received=192.0.2.2
  8559. Via: SIP/2.0/UDP pc33.atlanta.com;branch=z9hG4bKnashds8
  8560. ;received=192.0.2.1
  8561. To: Bob <sip:bob@biloxi.com>;tag=a6c85cf
  8562. From: Alice <sip:alice@atlanta.com>;tag=1928301774
  8563. Call-ID: a84b4c76e66710
  8564. Contact: <sip:bob@192.0.2.4>
  8565. CSeq: 314159 INVITE
  8566. Content-Length: 0
  8567. F7 180 Ringing biloxi.com proxy -> atlanta.com proxy
  8568. SIP/2.0 180 Ringing
  8569. Via: SIP/2.0/UDP bigbox3.site3.atlanta.com;branch=z9hG4bK77ef4c2312983.1
  8570. ;received=192.0.2.2
  8571. Via: SIP/2.0/UDP pc33.atlanta.com;branch=z9hG4bKnashds8
  8572. ;received=192.0.2.1
  8573. To: Bob <sip:bob@biloxi.com>;tag=a6c85cf
  8574. From: Alice <sip:alice@atlanta.com>;tag=1928301774
  8575. Call-ID: a84b4c76e66710
  8576. Contact: <sip:bob@192.0.2.4>
  8577. CSeq: 314159 INVITE
  8578. Content-Length: 0
  8579. Rosenberg, et. al. Standards Track [Page 216]
  8580. RFC 3261 SIP: Session Initiation Protocol June 2002
  8581. F8 180 Ringing atlanta.com proxy -> Alice
  8582. SIP/2.0 180 Ringing
  8583. Via: SIP/2.0/UDP pc33.atlanta.com;branch=z9hG4bKnashds8
  8584. ;received=192.0.2.1
  8585. To: Bob <sip:bob@biloxi.com>;tag=a6c85cf
  8586. From: Alice <sip:alice@atlanta.com>;tag=1928301774
  8587. Call-ID: a84b4c76e66710
  8588. Contact: <sip:bob@192.0.2.4>
  8589. CSeq: 314159 INVITE
  8590. Content-Length: 0
  8591. F9 200 OK Bob -> biloxi.com proxy
  8592. SIP/2.0 200 OK
  8593. Via: SIP/2.0/UDP server10.biloxi.com;branch=z9hG4bK4b43c2ff8.1
  8594. ;received=192.0.2.3
  8595. Via: SIP/2.0/UDP bigbox3.site3.atlanta.com;branch=z9hG4bK77ef4c2312983.1
  8596. ;received=192.0.2.2
  8597. Via: SIP/2.0/UDP pc33.atlanta.com;branch=z9hG4bKnashds8
  8598. ;received=192.0.2.1
  8599. To: Bob <sip:bob@biloxi.com>;tag=a6c85cf
  8600. From: Alice <sip:alice@atlanta.com>;tag=1928301774
  8601. Call-ID: a84b4c76e66710
  8602. CSeq: 314159 INVITE
  8603. Contact: <sip:bob@192.0.2.4>
  8604. Content-Type: application/sdp
  8605. Content-Length: 131
  8606. (Bob's SDP not shown)
  8607. F10 200 OK biloxi.com proxy -> atlanta.com proxy
  8608. SIP/2.0 200 OK
  8609. Via: SIP/2.0/UDP bigbox3.site3.atlanta.com;branch=z9hG4bK77ef4c2312983.1
  8610. ;received=192.0.2.2
  8611. Via: SIP/2.0/UDP pc33.atlanta.com;branch=z9hG4bKnashds8
  8612. ;received=192.0.2.1
  8613. To: Bob <sip:bob@biloxi.com>;tag=a6c85cf
  8614. From: Alice <sip:alice@atlanta.com>;tag=1928301774
  8615. Call-ID: a84b4c76e66710
  8616. CSeq: 314159 INVITE
  8617. Contact: <sip:bob@192.0.2.4>
  8618. Content-Type: application/sdp
  8619. Content-Length: 131
  8620. (Bob's SDP not shown)
  8621. Rosenberg, et. al. Standards Track [Page 217]
  8622. RFC 3261 SIP: Session Initiation Protocol June 2002
  8623. F11 200 OK atlanta.com proxy -> Alice
  8624. SIP/2.0 200 OK
  8625. Via: SIP/2.0/UDP pc33.atlanta.com;branch=z9hG4bKnashds8
  8626. ;received=192.0.2.1
  8627. To: Bob <sip:bob@biloxi.com>;tag=a6c85cf
  8628. From: Alice <sip:alice@atlanta.com>;tag=1928301774
  8629. Call-ID: a84b4c76e66710
  8630. CSeq: 314159 INVITE
  8631. Contact: <sip:bob@192.0.2.4>
  8632. Content-Type: application/sdp
  8633. Content-Length: 131
  8634. (Bob's SDP not shown)
  8635. F12 ACK Alice -> Bob
  8636. ACK sip:bob@192.0.2.4 SIP/2.0
  8637. Via: SIP/2.0/UDP pc33.atlanta.com;branch=z9hG4bKnashds9
  8638. Max-Forwards: 70
  8639. To: Bob <sip:bob@biloxi.com>;tag=a6c85cf
  8640. From: Alice <sip:alice@atlanta.com>;tag=1928301774
  8641. Call-ID: a84b4c76e66710
  8642. CSeq: 314159 ACK
  8643. Content-Length: 0
  8644. The media session between Alice and Bob is now established.
  8645. Bob hangs up first. Note that Bob's SIP phone maintains its own CSeq
  8646. numbering space, which, in this example, begins with 231. Since Bob
  8647. is making the request, the To and From URIs and tags have been
  8648. swapped.
  8649. F13 BYE Bob -> Alice
  8650. BYE sip:alice@pc33.atlanta.com SIP/2.0
  8651. Via: SIP/2.0/UDP 192.0.2.4;branch=z9hG4bKnashds10
  8652. Max-Forwards: 70
  8653. From: Bob <sip:bob@biloxi.com>;tag=a6c85cf
  8654. To: Alice <sip:alice@atlanta.com>;tag=1928301774
  8655. Call-ID: a84b4c76e66710
  8656. CSeq: 231 BYE
  8657. Content-Length: 0
  8658. Rosenberg, et. al. Standards Track [Page 218]
  8659. RFC 3261 SIP: Session Initiation Protocol June 2002
  8660. F14 200 OK Alice -> Bob
  8661. SIP/2.0 200 OK
  8662. Via: SIP/2.0/UDP 192.0.2.4;branch=z9hG4bKnashds10
  8663. From: Bob <sip:bob@biloxi.com>;tag=a6c85cf
  8664. To: Alice <sip:alice@atlanta.com>;tag=1928301774
  8665. Call-ID: a84b4c76e66710
  8666. CSeq: 231 BYE
  8667. Content-Length: 0
  8668. The SIP Call Flows document [40] contains further examples of SIP
  8669. messages.
  8670. 25 Augmented BNF for the SIP Protocol
  8671. All of the mechanisms specified in this document are described in
  8672. both prose and an augmented Backus-Naur Form (BNF) defined in RFC
  8673. 2234 [10]. Section 6.1 of RFC 2234 defines a set of core rules that
  8674. are used by this specification, and not repeated here. Implementers
  8675. need to be familiar with the notation and content of RFC 2234 in
  8676. order to understand this specification. Certain basic rules are in
  8677. uppercase, such as SP, LWS, HTAB, CRLF, DIGIT, ALPHA, etc. Angle
  8678. brackets are used within definitions to clarify the use of rule
  8679. names.
  8680. The use of square brackets is redundant syntactically. It is used as
  8681. a semantic hint that the specific parameter is optional to use.
  8682. 25.1 Basic Rules
  8683. The following rules are used throughout this specification to
  8684. describe basic parsing constructs. The US-ASCII coded character set
  8685. is defined by ANSI X3.4-1986.
  8686. alphanum = ALPHA / DIGIT
  8687. Rosenberg, et. al. Standards Track [Page 219]
  8688. RFC 3261 SIP: Session Initiation Protocol June 2002
  8689. Several rules are incorporated from RFC 2396 [5] but are updated to
  8690. make them compliant with RFC 2234 [10]. These include:
  8691. reserved = ";" / "/" / "?" / ":" / "@" / "&" / "=" / "+"
  8692. / "$" / ","
  8693. unreserved = alphanum / mark
  8694. mark = "-" / "_" / "." / "!" / "~" / "*" / "'"
  8695. / "(" / ")"
  8696. escaped = "%" HEXDIG HEXDIG
  8697. SIP header field values can be folded onto multiple lines if the
  8698. continuation line begins with a space or horizontal tab. All linear
  8699. white space, including folding, has the same semantics as SP. A
  8700. recipient MAY replace any linear white space with a single SP before
  8701. interpreting the field value or forwarding the message downstream.
  8702. This is intended to behave exactly as HTTP/1.1 as described in RFC
  8703. 2616 [8]. The SWS construct is used when linear white space is
  8704. optional, generally between tokens and separators.
  8705. LWS = [*WSP CRLF] 1*WSP ; linear whitespace
  8706. SWS = [LWS] ; sep whitespace
  8707. To separate the header name from the rest of value, a colon is used,
  8708. which, by the above rule, allows whitespace before, but no line
  8709. break, and whitespace after, including a linebreak. The HCOLON
  8710. defines this construct.
  8711. HCOLON = *( SP / HTAB ) ":" SWS
  8712. The TEXT-UTF8 rule is only used for descriptive field contents and
  8713. values that are not intended to be interpreted by the message parser.
  8714. Words of *TEXT-UTF8 contain characters from the UTF-8 charset (RFC
  8715. 2279 [7]). The TEXT-UTF8-TRIM rule is used for descriptive field
  8716. contents that are n t quoted strings, where leading and trailing LWS
  8717. is not meaningful. In this regard, SIP differs from HTTP, which uses
  8718. the ISO 8859-1 character set.
  8719. TEXT-UTF8-TRIM = 1*TEXT-UTF8char *(*LWS TEXT-UTF8char)
  8720. TEXT-UTF8char = %x21-7E / UTF8-NONASCII
  8721. UTF8-NONASCII = %xC0-DF 1UTF8-CONT
  8722. / %xE0-EF 2UTF8-CONT
  8723. / %xF0-F7 3UTF8-CONT
  8724. / %xF8-Fb 4UTF8-CONT
  8725. / %xFC-FD 5UTF8-CONT
  8726. UTF8-CONT = %x80-BF
  8727. Rosenberg, et. al. Standards Track [Page 220]
  8728. RFC 3261 SIP: Session Initiation Protocol June 2002
  8729. A CRLF is allowed in the definition of TEXT-UTF8-TRIM only as part of
  8730. a header field continuation. It is expected that the folding LWS
  8731. will be replaced with a single SP before interpretation of the TEXT-
  8732. UTF8-TRIM value.
  8733. Hexadecimal numeric characters are used in several protocol elements.
  8734. Some elements (authentication) force hex alphas to be lower case.
  8735. LHEX = DIGIT / %x61-66 ;lowercase a-f
  8736. Many SIP header field values consist of words separated by LWS or
  8737. special characters. Unless otherwise stated, tokens are case-
  8738. insensitive. These special characters MUST be in a quoted string to
  8739. be used within a parameter value. The word construct is used in
  8740. Call-ID to allow most separators to be used.
  8741. token = 1*(alphanum / "-" / "." / "!" / "%" / "*"
  8742. / "_" / "+" / "`" / "'" / "~" )
  8743. separators = "(" / ")" / "<" / ">" / "@" /
  8744. "," / ";" / ":" / "\" / DQUOTE /
  8745. "/" / "[" / "]" / "?" / "=" /
  8746. "{" / "}" / SP / HTAB
  8747. word = 1*(alphanum / "-" / "." / "!" / "%" / "*" /
  8748. "_" / "+" / "`" / "'" / "~" /
  8749. "(" / ")" / "<" / ">" /
  8750. ":" / "\" / DQUOTE /
  8751. "/" / "[" / "]" / "?" /
  8752. "{" / "}" )
  8753. When tokens are used or separators are used between elements,
  8754. whitespace is often allowed before or after these characters:
  8755. STAR = SWS "*" SWS ; asterisk
  8756. SLASH = SWS "/" SWS ; slash
  8757. EQUAL = SWS "=" SWS ; equal
  8758. LPAREN = SWS "(" SWS ; left parenthesis
  8759. RPAREN = SWS ")" SWS ; right parenthesis
  8760. RAQUOT = ">" SWS ; right angle quote
  8761. LAQUOT = SWS "<"; left angle quote
  8762. COMMA = SWS "," SWS ; comma
  8763. SEMI = SWS ";" SWS ; semicolon
  8764. COLON = SWS ":" SWS ; colon
  8765. LDQUOT = SWS DQUOTE; open double quotation mark
  8766. RDQUOT = DQUOTE SWS ; close double quotation mark
  8767. Rosenberg, et. al. Standards Track [Page 221]
  8768. RFC 3261 SIP: Session Initiation Protocol June 2002
  8769. Comments can be included in some SIP header fields by surrounding the
  8770. comment text with parentheses. Comments are only allowed in fields
  8771. containing "comment" as part of their field value definition. In all
  8772. other fields, parentheses are considered part of the field value.
  8773. comment = LPAREN *(ctext / quoted-pair / comment) RPAREN
  8774. ctext = %x21-27 / %x2A-5B / %x5D-7E / UTF8-NONASCII
  8775. / LWS
  8776. ctext includes all chars except left and right parens and backslash.
  8777. A string of text is parsed as a single word if it is quoted using
  8778. double-quote marks. In quoted strings, quotation marks (") and
  8779. backslashes (\) need to be escaped.
  8780. quoted-string = SWS DQUOTE *(qdtext / quoted-pair ) DQUOTE
  8781. qdtext = LWS / %x21 / %x23-5B / %x5D-7E
  8782. / UTF8-NONASCII
  8783. The backslash character ("\") MAY be used as a single-character
  8784. quoting mechanism only within quoted-string and comment constructs.
  8785. Unlike HTTP/1.1, the characters CR and LF cannot be escaped by this
  8786. mechanism to avoid conflict with line folding and header separation.
  8787. quoted-pair = "\" (%x00-09 / %x0B-0C
  8788. / %x0E-7F)
  8789. SIP-URI = "sip:" [ userinfo ] hostport
  8790. uri-parameters [ headers ]
  8791. SIPS-URI = "sips:" [ userinfo ] hostport
  8792. uri-parameters [ headers ]
  8793. userinfo = ( user / telephone-subscriber ) [ ":" password ] "@"
  8794. user = 1*( unreserved / escaped / user-unreserved )
  8795. user-unreserved = "&" / "=" / "+" / "$" / "," / ";" / "?" / "/"
  8796. password = *( unreserved / escaped /
  8797. "&" / "=" / "+" / "$" / "," )
  8798. hostport = host [ ":" port ]
  8799. host = hostname / IPv4address / IPv6reference
  8800. hostname = *( domainlabel "." ) toplabel [ "." ]
  8801. domainlabel = alphanum
  8802. / alphanum *( alphanum / "-" ) alphanum
  8803. toplabel = ALPHA / ALPHA *( alphanum / "-" ) alphanum
  8804. Rosenberg, et. al. Standards Track [Page 222]
  8805. RFC 3261 SIP: Session Initiation Protocol June 2002
  8806. IPv4address = 1*3DIGIT "." 1*3DIGIT "." 1*3DIGIT "." 1*3DIGIT
  8807. IPv6reference = "[" IPv6address "]"
  8808. IPv6address = hexpart [ ":" IPv4address ]
  8809. hexpart = hexseq / hexseq "::" [ hexseq ] / "::" [ hexseq ]
  8810. hexseq = hex4 *( ":" hex4)
  8811. hex4 = 1*4HEXDIG
  8812. port = 1*DIGIT
  8813. The BNF for telephone-subscriber can be found in RFC 2806 [9]. Note,
  8814. however, that any characters allowed there that are not allowed in
  8815. the user part of the SIP URI MUST be escaped.
  8816. uri-parameters = *( ";" uri-parameter)
  8817. uri-parameter = transport-param / user-param / method-param
  8818. / ttl-param / maddr-param / lr-param / other-param
  8819. transport-param = "transport="
  8820. ( "udp" / "tcp" / "sctp" / "tls"
  8821. / other-transport)
  8822. other-transport = token
  8823. user-param = "user=" ( "phone" / "ip" / other-user)
  8824. other-user = token
  8825. method-param = "method=" Method
  8826. ttl-param = "ttl=" ttl
  8827. maddr-param = "maddr=" host
  8828. lr-param = "lr"
  8829. other-param = pname [ "=" pvalue ]
  8830. pname = 1*paramchar
  8831. pvalue = 1*paramchar
  8832. paramchar = param-unreserved / unreserved / escaped
  8833. param-unreserved = "[" / "]" / "/" / ":" / "&" / "+" / "$"
  8834. headers = "?" header *( "&" header )
  8835. header = hname "=" hvalue
  8836. hname = 1*( hnv-unreserved / unreserved / escaped )
  8837. hvalue = *( hnv-unreserved / unreserved / escaped )
  8838. hnv-unreserved = "[" / "]" / "/" / "?" / ":" / "+" / "$"
  8839. SIP-message = Request / Response
  8840. Request = Request-Line
  8841. *( message-header )
  8842. CRLF
  8843. [ message-body ]
  8844. Request-Line = Method SP Request-URI SP SIP-Version CRLF
  8845. Request-URI = SIP-URI / SIPS-URI / absoluteURI
  8846. absoluteURI = scheme ":" ( hier-part / opaque-part )
  8847. hier-part = ( net-path / abs-path ) [ "?" query ]
  8848. net-path = "//" authority [ abs-path ]
  8849. abs-path = "/" path-segments
  8850. Rosenberg, et. al. Standards Track [Page 223]
  8851. RFC 3261 SIP: Session Initiation Protocol June 2002
  8852. opaque-part = uric-no-slash *uric
  8853. uric = reserved / unreserved / escaped
  8854. uric-no-slash = unreserved / escaped / ";" / "?" / ":" / "@"
  8855. / "&" / "=" / "+" / "$" / ","
  8856. path-segments = segment *( "/" segment )
  8857. segment = *pchar *( ";" param )
  8858. param = *pchar
  8859. pchar = unreserved / escaped /
  8860. ":" / "@" / "&" / "=" / "+" / "$" / ","
  8861. scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
  8862. authority = srvr / reg-name
  8863. srvr = [ [ userinfo "@" ] hostport ]
  8864. reg-name = 1*( unreserved / escaped / "$" / ","
  8865. / ";" / ":" / "@" / "&" / "=" / "+" )
  8866. query = *uric
  8867. SIP-Version = "SIP" "/" 1*DIGIT "." 1*DIGIT
  8868. message-header = (Accept
  8869. / Accept-Encoding
  8870. / Accept-Language
  8871. / Alert-Info
  8872. / Allow
  8873. / Authentication-Info
  8874. / Authorization
  8875. / Call-ID
  8876. / Call-Info
  8877. / Contact
  8878. / Content-Disposition
  8879. / Content-Encoding
  8880. / Content-Language
  8881. / Content-Length
  8882. / Content-Type
  8883. / CSeq
  8884. / Date
  8885. / Error-Info
  8886. / Expires
  8887. / From
  8888. / In-Reply-To
  8889. / Max-Forwards
  8890. / MIME-Version
  8891. / Min-Expires
  8892. / Organization
  8893. / Priority
  8894. / Proxy-Authenticate
  8895. / Proxy-Authorization
  8896. / Proxy-Require
  8897. / Record-Route
  8898. / Reply-To
  8899. Rosenberg, et. al. Standards Track [Page 224]
  8900. RFC 3261 SIP: Session Initiation Protocol June 2002
  8901. / Require
  8902. / Retry-After
  8903. / Route
  8904. / Server
  8905. / Subject
  8906. / Supported
  8907. / Timestamp
  8908. / To
  8909. / Unsupported
  8910. / User-Agent
  8911. / Via
  8912. / Warning
  8913. / WWW-Authenticate
  8914. / extension-header) CRLF
  8915. INVITEm = %x49.4E.56.49.54.45 ; INVITE in caps
  8916. ACKm = %x41.43.4B ; ACK in caps
  8917. OPTIONSm = %x4F.50.54.49.4F.4E.53 ; OPTIONS in caps
  8918. BYEm = %x42.59.45 ; BYE in caps
  8919. CANCELm = %x43.41.4E.43.45.4C ; CANCEL in caps
  8920. REGISTERm = %x52.45.47.49.53.54.45.52 ; REGISTER in caps
  8921. Method = INVITEm / ACKm / OPTIONSm / BYEm
  8922. / CANCELm / REGISTERm
  8923. / extension-method
  8924. extension-method = token
  8925. Response = Status-Line
  8926. *( message-header )
  8927. CRLF
  8928. [ message-body ]
  8929. Status-Line = SIP-Version SP Status-Code SP Reason-Phrase CRLF
  8930. Status-Code = Informational
  8931. / Redirection
  8932. / Success
  8933. / Client-Error
  8934. / Server-Error
  8935. / Global-Failure
  8936. / extension-code
  8937. extension-code = 3DIGIT
  8938. Reason-Phrase = *(reserved / unreserved / escaped
  8939. / UTF8-NONASCII / UTF8-CONT / SP / HTAB)
  8940. Informational = "100" ; Trying
  8941. / "180" ; Ringing
  8942. / "181" ; Call Is Being Forwarded
  8943. / "182" ; Queued
  8944. / "183" ; Session Progress
  8945. Rosenberg, et. al. Standards Track [Page 225]
  8946. RFC 3261 SIP: Session Initiation Protocol June 2002
  8947. Success = "200" ; OK
  8948. Redirection = "300" ; Multiple Choices
  8949. / "301" ; Moved Permanently
  8950. / "302" ; Moved Temporarily
  8951. / "305" ; Use Proxy
  8952. / "380" ; Alternative Service
  8953. Client-Error = "400" ; Bad Request
  8954. / "401" ; Unauthorized
  8955. / "402" ; Payment Required
  8956. / "403" ; Forbidden
  8957. / "404" ; Not Found
  8958. / "405" ; Method Not Allowed
  8959. / "406" ; Not Acceptable
  8960. / "407" ; Proxy Authentication Required
  8961. / "408" ; Request Timeout
  8962. / "410" ; Gone
  8963. / "413" ; Request Entity Too Large
  8964. / "414" ; Request-URI Too Large
  8965. / "415" ; Unsupported Media Type
  8966. / "416" ; Unsupported URI Scheme
  8967. / "420" ; Bad Extension
  8968. / "421" ; Extension Required
  8969. / "423" ; Interval Too Brief
  8970. / "480" ; Temporarily not available
  8971. / "481" ; Call Leg/Transaction Does Not Exist
  8972. / "482" ; Loop Detected
  8973. / "483" ; Too Many Hops
  8974. / "484" ; Address Incomplete
  8975. / "485" ; Ambiguous
  8976. / "486" ; Busy Here
  8977. / "487" ; Request Terminated
  8978. / "488" ; Not Acceptable Here
  8979. / "491" ; Request Pending
  8980. / "493" ; Undecipherable
  8981. Server-Error = "500" ; Internal Server Error
  8982. / "501" ; Not Implemented
  8983. / "502" ; Bad Gateway
  8984. / "503" ; Service Unavailable
  8985. / "504" ; Server Time-out
  8986. / "505" ; SIP Version not supported
  8987. / "513" ; Message Too Large
  8988. Rosenberg, et. al. Standards Track [Page 226]
  8989. RFC 3261 SIP: Session Initiation Protocol June 2002
  8990. Global-Failure = "600" ; Busy Everywhere
  8991. / "603" ; Decline
  8992. / "604" ; Does not exist anywhere
  8993. / "606" ; Not Acceptable
  8994. Accept = "Accept" HCOLON
  8995. [ accept-range *(COMMA accept-range) ]
  8996. accept-range = media-range *(SEMI accept-param)
  8997. media-range = ( "*/*"
  8998. / ( m-type SLASH "*" )
  8999. / ( m-type SLASH m-subtype )
  9000. ) *( SEMI m-parameter )
  9001. accept-param = ("q" EQUAL qvalue) / generic-param
  9002. qvalue = ( "0" [ "." 0*3DIGIT ] )
  9003. / ( "1" [ "." 0*3("0") ] )
  9004. generic-param = token [ EQUAL gen-value ]
  9005. gen-value = token / host / quoted-string
  9006. Accept-Encoding = "Accept-Encoding" HCOLON
  9007. [ encoding *(COMMA encoding) ]
  9008. encoding = codings *(SEMI accept-param)
  9009. codings = content-coding / "*"
  9010. content-coding = token
  9011. Accept-Language = "Accept-Language" HCOLON
  9012. [ language *(COMMA language) ]
  9013. language = language-range *(SEMI accept-param)
  9014. language-range = ( ( 1*8ALPHA *( "-" 1*8ALPHA ) ) / "*" )
  9015. Alert-Info = "Alert-Info" HCOLON alert-param *(COMMA alert-param)
  9016. alert-param = LAQUOT absoluteURI RAQUOT *( SEMI generic-param )
  9017. Allow = "Allow" HCOLON [Method *(COMMA Method)]
  9018. Authorization = "Authorization" HCOLON credentials
  9019. credentials = ("Digest" LWS digest-response)
  9020. / other-response
  9021. digest-response = dig-resp *(COMMA dig-resp)
  9022. dig-resp = username / realm / nonce / digest-uri
  9023. / dresponse / algorithm / cnonce
  9024. / opaque / message-qop
  9025. / nonce-count / auth-param
  9026. username = "username" EQUAL username-value
  9027. username-value = quoted-string
  9028. digest-uri = "uri" EQUAL LDQUOT digest-uri-value RDQUOT
  9029. digest-uri-value = rquest-uri ; Equal to request-uri as specified
  9030. by HTTP/1.1
  9031. message-qop = "qop" EQUAL qop-value
  9032. Rosenberg, et. al. Standards Track [Page 227]
  9033. RFC 3261 SIP: Session Initiation Protocol June 2002
  9034. cnonce = "cnonce" EQUAL cnonce-value
  9035. cnonce-value = nonce-value
  9036. nonce-count = "nc" EQUAL nc-value
  9037. nc-value = 8LHEX
  9038. dresponse = "response" EQUAL request-digest
  9039. request-digest = LDQUOT 32LHEX RDQUOT
  9040. auth-param = auth-param-name EQUAL
  9041. ( token / quoted-string )
  9042. auth-param-name = token
  9043. other-response = auth-scheme LWS auth-param
  9044. *(COMMA auth-param)
  9045. auth-scheme = token
  9046. Authentication-Info = "Authentication-Info" HCOLON ainfo
  9047. *(COMMA ainfo)
  9048. ainfo = nextnonce / message-qop
  9049. / response-auth / cnonce
  9050. / nonce-count
  9051. nextnonce = "nextnonce" EQUAL nonce-value
  9052. response-auth = "rspauth" EQUAL response-digest
  9053. response-digest = LDQUOT *LHEX RDQUOT
  9054. Call-ID = ( "Call-ID" / "i" ) HCOLON callid
  9055. callid = word [ "@" word ]
  9056. Call-Info = "Call-Info" HCOLON info *(COMMA info)
  9057. info = LAQUOT absoluteURI RAQUOT *( SEMI info-param)
  9058. info-param = ( "purpose" EQUAL ( "icon" / "info"
  9059. / "card" / token ) ) / generic-param
  9060. Contact = ("Contact" / "m" ) HCOLON
  9061. ( STAR / (contact-param *(COMMA contact-param)))
  9062. contact-param = (name-addr / addr-spec) *(SEMI contact-params)
  9063. name-addr = [ display-name ] LAQUOT addr-spec RAQUOT
  9064. addr-spec = SIP-URI / SIPS-URI / absoluteURI
  9065. display-name = *(token LWS)/ quoted-string
  9066. contact-params = c-p-q / c-p-expires
  9067. / contact-extension
  9068. c-p-q = "q" EQUAL qvalue
  9069. c-p-expires = "expires" EQUAL delta-seconds
  9070. contact-extension = generic-param
  9071. delta-seconds = 1*DIGIT
  9072. Content-Disposition = "Content-Disposition" HCOLON
  9073. disp-type *( SEMI disp-param )
  9074. disp-type = "render" / "session" / "icon" / "alert"
  9075. / disp-extension-token
  9076. Rosenberg, et. al. Standards Track [Page 228]
  9077. RFC 3261 SIP: Session Initiation Protocol June 2002
  9078. disp-param = handling-param / generic-param
  9079. handling-param = "handling" EQUAL
  9080. ( "optional" / "required"
  9081. / other-handling )
  9082. other-handling = token
  9083. disp-extension-token = token
  9084. Content-Encoding = ( "Content-Encoding" / "e" ) HCOLON
  9085. content-coding *(COMMA content-coding)
  9086. Content-Language = "Content-Language" HCOLON
  9087. language-tag *(COMMA language-tag)
  9088. language-tag = primary-tag *( "-" subtag )
  9089. primary-tag = 1*8ALPHA
  9090. subtag = 1*8ALPHA
  9091. Content-Length = ( "Content-Length" / "l" ) HCOLON 1*DIGIT
  9092. Content-Type = ( "Content-Type" / "c" ) HCOLON media-type
  9093. media-type = m-type SLASH m-subtype *(SEMI m-parameter)
  9094. m-type = discrete-type / composite-type
  9095. discrete-type = "text" / "image" / "audio" / "video"
  9096. / "application" / extension-token
  9097. composite-type = "message" / "multipart" / extension-token
  9098. extension-token = ietf-token / x-token
  9099. ietf-token = token
  9100. x-token = "x-" token
  9101. m-subtype = extension-token / iana-token
  9102. iana-token = token
  9103. m-parameter = m-attribute EQUAL m-value
  9104. m-attribute = token
  9105. m-value = token / quoted-string
  9106. CSeq = "CSeq" HCOLON 1*DIGIT LWS Method
  9107. Date = "Date" HCOLON SIP-date
  9108. SIP-date = rfc1123-date
  9109. rfc1123-date = wkday "," SP date1 SP time SP "GMT"
  9110. date1 = 2DIGIT SP month SP 4DIGIT
  9111. ; day month year (e.g., 02 Jun 1982)
  9112. time = 2DIGIT ":" 2DIGIT ":" 2DIGIT
  9113. ; 00:00:00 - 23:59:59
  9114. wkday = "Mon" / "Tue" / "Wed"
  9115. / "Thu" / "Fri" / "Sat" / "Sun"
  9116. month = "Jan" / "Feb" / "Mar" / "Apr"
  9117. / "May" / "Jun" / "Jul" / "Aug"
  9118. / "Sep" / "Oct" / "Nov" / "Dec"
  9119. Error-Info = "Error-Info" HCOLON error-uri *(COMMA error-uri)
  9120. Rosenberg, et. al. Standards Track [Page 229]
  9121. RFC 3261 SIP: Session Initiation Protocol June 2002
  9122. error-uri = LAQUOT absoluteURI RAQUOT *( SEMI generic-param )
  9123. Expires = "Expires" HCOLON delta-seconds
  9124. From = ( "From" / "f" ) HCOLON from-spec
  9125. from-spec = ( name-addr / addr-spec )
  9126. *( SEMI from-param )
  9127. from-param = tag-param / generic-param
  9128. tag-param = "tag" EQUAL token
  9129. In-Reply-To = "In-Reply-To" HCOLON callid *(COMMA callid)
  9130. Max-Forwards = "Max-Forwards" HCOLON 1*DIGIT
  9131. MIME-Version = "MIME-Version" HCOLON 1*DIGIT "." 1*DIGIT
  9132. Min-Expires = "Min-Expires" HCOLON delta-seconds
  9133. Organization = "Organization" HCOLON [TEXT-UTF8-TRIM]
  9134. Priority = "Priority" HCOLON priority-value
  9135. priority-value = "emergency" / "urgent" / "normal"
  9136. / "non-urgent" / other-priority
  9137. other-priority = token
  9138. Proxy-Authenticate = "Proxy-Authenticate" HCOLON challenge
  9139. challenge = ("Digest" LWS digest-cln *(COMMA digest-cln))
  9140. / other-challenge
  9141. other-challenge = auth-scheme LWS auth-param
  9142. *(COMMA auth-param)
  9143. digest-cln = realm / domain / nonce
  9144. / opaque / stale / algorithm
  9145. / qop-options / auth-param
  9146. realm = "realm" EQUAL realm-value
  9147. realm-value = quoted-string
  9148. domain = "domain" EQUAL LDQUOT URI
  9149. *( 1*SP URI ) RDQUOT
  9150. URI = absoluteURI / abs-path
  9151. nonce = "nonce" EQUAL nonce-value
  9152. nonce-value = quoted-string
  9153. opaque = "opaque" EQUAL quoted-string
  9154. stale = "stale" EQUAL ( "true" / "false" )
  9155. algorithm = "algorithm" EQUAL ( "MD5" / "MD5-sess"
  9156. / token )
  9157. qop-options = "qop" EQUAL LDQUOT qop-value
  9158. *("," qop-value) RDQUOT
  9159. qop-value = "auth" / "auth-int" / token
  9160. Proxy-Authorization = "Proxy-Authorization" HCOLON credentials
  9161. Rosenberg, et. al. Standards Track [Page 230]
  9162. RFC 3261 SIP: Session Initiation Protocol June 2002
  9163. Proxy-Require = "Proxy-Require" HCOLON option-tag
  9164. *(COMMA option-tag)
  9165. option-tag = token
  9166. Record-Route = "Record-Route" HCOLON rec-route *(COMMA rec-route)
  9167. rec-route = name-addr *( SEMI rr-param )
  9168. rr-param = generic-param
  9169. Reply-To = "Reply-To" HCOLON rplyto-spec
  9170. rplyto-spec = ( name-addr / addr-spec )
  9171. *( SEMI rplyto-param )
  9172. rplyto-param = generic-param
  9173. Require = "Require" HCOLON option-tag *(COMMA option-tag)
  9174. Retry-After = "Retry-After" HCOLON delta-seconds
  9175. [ comment ] *( SEMI retry-param )
  9176. retry-param = ("duration" EQUAL delta-seconds)
  9177. / generic-param
  9178. Route = "Route" HCOLON route-param *(COMMA route-param)
  9179. route-param = name-addr *( SEMI rr-param )
  9180. Server = "Server" HCOLON server-val *(LWS server-val)
  9181. server-val = product / comment
  9182. product = token [SLASH product-version]
  9183. product-version = token
  9184. Subject = ( "Subject" / "s" ) HCOLON [TEXT-UTF8-TRIM]
  9185. Supported = ( "Supported" / "k" ) HCOLON
  9186. [option-tag *(COMMA option-tag)]
  9187. Timestamp = "Timestamp" HCOLON 1*(DIGIT)
  9188. [ "." *(DIGIT) ] [ LWS delay ]
  9189. delay = *(DIGIT) [ "." *(DIGIT) ]
  9190. To = ( "To" / "t" ) HCOLON ( name-addr
  9191. / addr-spec ) *( SEMI to-param )
  9192. to-param = tag-param / generic-param
  9193. Unsupported = "Unsupported" HCOLON option-tag *(COMMA option-tag)
  9194. User-Agent = "User-Agent" HCOLON server-val *(LWS server-val)
  9195. Rosenberg, et. al. Standards Track [Page 231]
  9196. RFC 3261 SIP: Session Initiation Protocol June 2002
  9197. Via = ( "Via" / "v" ) HCOLON via-parm *(COMMA via-parm)
  9198. via-parm = sent-protocol LWS sent-by *( SEMI via-params )
  9199. via-params = via-ttl / via-maddr
  9200. / via-received / via-branch
  9201. / via-extension
  9202. via-ttl = "ttl" EQUAL ttl
  9203. via-maddr = "maddr" EQUAL host
  9204. via-received = "received" EQUAL (IPv4address / IPv6address)
  9205. via-branch = "branch" EQUAL token
  9206. via-extension = generic-param
  9207. sent-protocol = protocol-name SLASH protocol-version
  9208. SLASH transport
  9209. protocol-name = "SIP" / token
  9210. protocol-version = token
  9211. transport = "UDP" / "TCP" / "TLS" / "SCTP"
  9212. / other-transport
  9213. sent-by = host [ COLON port ]
  9214. ttl = 1*3DIGIT ; 0 to 255
  9215. Warning = "Warning" HCOLON warning-value *(COMMA warning-value)
  9216. warning-value = warn-code SP warn-agent SP warn-text
  9217. warn-code = 3DIGIT
  9218. warn-agent = hostport / pseudonym
  9219. ; the name or pseudonym of the server adding
  9220. ; the Warning header, for use in debugging
  9221. warn-text = quoted-string
  9222. pseudonym = token
  9223. WWW-Authenticate = "WWW-Authenticate" HCOLON challenge
  9224. extension-header = header-name HCOLON header-value
  9225. header-name = token
  9226. header-value = *(TEXT-UTF8char / UTF8-CONT / LWS)
  9227. message-body = *OCTET
  9228. 26 Security Considerations: Threat Model and Security Usage
  9229. Recommendations
  9230. SIP is not an easy protocol to secure. Its use of intermediaries,
  9231. its multi-faceted trust relationships, its expected usage between
  9232. elements with no trust at all, and its user-to-user operation make
  9233. security far from trivial. Security solutions are needed that are
  9234. deployable today, without extensive coordination, in a wide variety
  9235. of environments and usages. In order to meet these diverse needs,
  9236. several distinct mechanisms applicable to different aspects and
  9237. usages of SIP will be required.
  9238. Rosenberg, et. al. Standards Track [Page 232]
  9239. RFC 3261 SIP: Session Initiation Protocol June 2002
  9240. Note that the security of SIP signaling itself has no bearing on the
  9241. security of protocols used in concert with SIP such as RTP, or with
  9242. the security implications of any specific bodies SIP might carry
  9243. (although MIME security plays a substantial role in securing SIP).
  9244. Any media associated with a session can be encrypted end-to-end
  9245. independently of any associated SIP signaling. Media encryption is
  9246. outside the scope of this document.
  9247. The considerations that follow first examine a set of classic threat
  9248. models that broadly identify the security needs of SIP. The set of
  9249. security services required to address these threats is then detailed,
  9250. followed by an explanation of several security mechanisms that can be
  9251. used to provide these services. Next, the requirements for
  9252. implementers of SIP are enumerated, along with exemplary deployments
  9253. in which these security mechanisms could be used to improve the
  9254. security of SIP. Some notes on privacy conclude this section.
  9255. 26.1 Attacks and Threat Models
  9256. This section details some threats that should be common to most
  9257. deployments of SIP. These threats have been chosen specifically to
  9258. illustrate each of the security services that SIP requires.
  9259. The following examples by no means provide an exhaustive list of the
  9260. threats against SIP; rather, these are "classic" threats that
  9261. demonstrate the need for particular security services that can
  9262. potentially prevent whole categories of threats.
  9263. These attacks assume an environment in which attackers can
  9264. potentially read any packet on the network - it is anticipated that
  9265. SIP will frequently be used on the public Internet. Attackers on the
  9266. network may be able to modify packets (perhaps at some compromised
  9267. intermediary). Attackers may wish to steal services, eavesdrop on
  9268. communications, or disrupt sessions.
  9269. 26.1.1 Registration Hijacking
  9270. The SIP registration mechanism allows a user agent to identify itself
  9271. to a registrar as a device at which a user (designated by an address
  9272. of record) is located. A registrar assesses the identity asserted in
  9273. the From header field of a REGISTER message to determine whether this
  9274. request can modify the contact addresses associated with the
  9275. address-of-record in the To header field. While these two fields are
  9276. frequently the same, there are many valid deployments in which a
  9277. third-party may register contacts on a user's behalf.
  9278. Rosenberg, et. al. Standards Track [Page 233]
  9279. RFC 3261 SIP: Session Initiation Protocol June 2002
  9280. The From header field of a SIP request, however, can be modified
  9281. arbitrarily by the owner of a UA, and this opens the door to
  9282. malicious registrations. An attacker that successfully impersonates
  9283. a party authorized to change contacts associated with an address-of-
  9284. record could, for example, de-register all existing contacts for a
  9285. URI and then register their own device as the appropriate contact
  9286. address, thereby directing all requests for the affected user to the
  9287. attacker's device.
  9288. This threat belongs to a family of threats that rely on the absence
  9289. of cryptographic assurance of a request's originator. Any SIP UAS
  9290. that represents a valuable service (a gateway that interworks SIP
  9291. requests with traditional telephone calls, for example) might want to
  9292. control access to its resources by authenticating requests that it
  9293. receives. Even end-user UAs, for example SIP phones, have an
  9294. interest in ascertaining the identities of originators of requests.
  9295. This threat demonstrates the need for security services that enable
  9296. SIP entities to authenticate the originators of requests.
  9297. 26.1.2 Impersonating a Server
  9298. The domain to which a request is destined is generally specified in
  9299. the Request-URI. UAs commonly contact a server in this domain
  9300. directly in order to deliver a request. However, there is always a
  9301. possibility that an attacker could impersonate the remote server, and
  9302. that the UA's request could be intercepted by some other party.
  9303. For example, consider a case in which a redirect server at one
  9304. domain, chicago.com, impersonates a redirect server at another
  9305. domain, biloxi.com. A user agent sends a request to biloxi.com, but
  9306. the redirect server at chicago.com answers with a forged response
  9307. that has appropriate SIP header fields for a response from
  9308. biloxi.com. The forged contact addresses in the redirection response
  9309. could direct the originating UA to inappropriate or insecure
  9310. resources, or simply prevent requests for biloxi.com from succeeding.
  9311. This family of threats has a vast membership, many of which are
  9312. critical. As a converse to the registration hijacking threat,
  9313. consider the case in which a registration sent to biloxi.com is
  9314. intercepted by chicago.com, which replies to the intercepted
  9315. registration with a forged 301 (Moved Permanently) response. This
  9316. response might seem to come from biloxi.com yet designate chicago.com
  9317. as the appropriate registrar. All future REGISTER requests from the
  9318. originating UA would then go to chicago.com.
  9319. Prevention of this threat requires a means by which UAs can
  9320. authenticate the servers to whom they send requests.
  9321. Rosenberg, et. al. Standards Track [Page 234]
  9322. RFC 3261 SIP: Session Initiation Protocol June 2002
  9323. 26.1.3 Tampering with Message Bodies
  9324. As a matter of course, SIP UAs route requests through trusted proxy
  9325. servers. Regardless of how that trust is established (authentication
  9326. of proxies is discussed elsewhere in this section), a UA may trust a
  9327. proxy server to route a request, but not to inspect or possibly
  9328. modify the bodies contained in that request.
  9329. Consider a UA that is using SIP message bodies to communicate session
  9330. encryption keys for a media session. Although it trusts the proxy
  9331. server of the domain it is contacting to deliver signaling properly,
  9332. it may not want the administrators of that domain to be capable of
  9333. decrypting any subsequent media session. Worse yet, if the proxy
  9334. server were actively malicious, it could modify the session key,
  9335. either acting as a man-in-the-middle, or perhaps changing the
  9336. security characteristics requested by the originating UA.
  9337. This family of threats applies not only to session keys, but to most
  9338. conceivable forms of content carried end-to-end in SIP. These might
  9339. include MIME bodies that should be rendered to the user, SDP, or
  9340. encapsulated telephony signals, among others. Attackers might
  9341. attempt to modify SDP bodies, for example, in order to point RTP
  9342. media streams to a wiretapping device in order to eavesdrop on
  9343. subsequent voice communications.
  9344. Also note that some header fields in SIP are meaningful end-to-end,
  9345. for example, Subject. UAs might be protective of these header fields
  9346. as well as bodies (a malicious intermediary changing the Subject
  9347. header field might make an important request appear to be spam, for
  9348. example). However, since many header fields are legitimately
  9349. inspected or altered by proxy servers as a request is routed, not all
  9350. header fields should be secured end-to-end.
  9351. For these reasons, the UA might want to secure SIP message bodies,
  9352. and in some limited cases header fields, end-to-end. The security
  9353. services required for bodies include confidentiality, integrity, and
  9354. authentication. These end-to-end services should be independent of
  9355. the means used to secure interactions with intermediaries such as
  9356. proxy servers.
  9357. 26.1.4 Tearing Down Sessions
  9358. Once a dialog has been established by initial messaging, subsequent
  9359. requests can be sent that modify the state of the dialog and/or
  9360. session. It is critical that principals in a session can be certain
  9361. that such requests are not forged by attackers.
  9362. Rosenberg, et. al. Standards Track [Page 235]
  9363. RFC 3261 SIP: Session Initiation Protocol June 2002
  9364. Consider a case in which a third-party attacker captures some initial
  9365. messages in a dialog shared by two parties in order to learn the
  9366. parameters of the session (To tag, From tag, and so forth) and then
  9367. inserts a BYE request into the session. The attacker could opt to
  9368. forge the request such that it seemed to come from either
  9369. participant. Once the BYE is received by its target, the session
  9370. will be torn down prematurely.
  9371. Similar mid-session threats include the transmission of forged re-
  9372. INVITEs that alter the session (possibly to reduce session security
  9373. or redirect media streams as part of a wiretapping attack).
  9374. The most effective countermeasure to this threat is the
  9375. authentication of the sender of the BYE. In this instance, the
  9376. recipient needs only know that the BYE came from the same party with
  9377. whom the corresponding dialog was established (as opposed to
  9378. ascertaining the absolute identity of the sender). Also, if the
  9379. attacker is unable to learn the parameters of the session due to
  9380. confidentiality, it would not be possible to forge the BYE. However,
  9381. some intermediaries (like proxy servers) will need to inspect those
  9382. parameters as the session is established.
  9383. 26.1.5 Denial of Service and Amplification
  9384. Denial-of-service attacks focus on rendering a particular network
  9385. element unavailable, usually by directing an excessive amount of
  9386. network traffic at its interfaces. A distributed denial-of-service
  9387. attack allows one network user to cause multiple network hosts to
  9388. flood a target host with a large amount of network traffic.
  9389. In many architectures, SIP proxy servers face the public Internet in
  9390. order to accept requests from worldwide IP endpoints. SIP creates a
  9391. number of potential opportunities for distributed denial-of-service
  9392. attacks that must be recognized and addressed by the implementers and
  9393. operators of SIP systems.
  9394. Attackers can create bogus requests that contain a falsified source
  9395. IP address and a corresponding Via header field that identify a
  9396. targeted host as the originator of the request and then send this
  9397. request to a large number of SIP network elements, thereby using
  9398. hapless SIP UAs or proxies to generate denial-of-service traffic
  9399. aimed at the target.
  9400. Similarly, attackers might use falsified Route header field values in
  9401. a request that identify the target host and then send such messages
  9402. to forking proxies that will amplify messaging sent to the target.
  9403. Rosenberg, et. al. Standards Track [Page 236]
  9404. RFC 3261 SIP: Session Initiation Protocol June 2002
  9405. Record-Route could be used to similar effect when the attacker is
  9406. certain that the SIP dialog initiated by the request will result in
  9407. numerous transactions originating in the backwards direction.
  9408. A number of denial-of-service attacks open up if REGISTER requests
  9409. are not properly authenticated and authorized by registrars.
  9410. Attackers could de-register some or all users in an administrative
  9411. domain, thereby preventing these users from being invited to new
  9412. sessions. An attacker could also register a large number of contacts
  9413. designating the same host for a given address-of-record in order to
  9414. use the registrar and any associated proxy servers as amplifiers in a
  9415. denial-of-service attack. Attackers might also attempt to deplete
  9416. available memory and disk resources of a registrar by registering
  9417. huge numbers of bindings.
  9418. The use of multicast to transmit SIP requests can greatly increase
  9419. the potential for denial-of-service attacks.
  9420. These problems demonstrate a general need to define architectures
  9421. that minimize the risks of denial-of-service, and the need to be
  9422. mindful in recommendations for security mechanisms of this class of
  9423. attacks.
  9424. 26.2 Security Mechanisms
  9425. From the threats described above, we gather that the fundamental
  9426. security services required for the SIP protocol are: preserving the
  9427. confidentiality and integrity of messaging, preventing replay attacks
  9428. or message spoofing, providing for the authentication and privacy of
  9429. the participants in a session, and preventing denial-of-service
  9430. attacks. Bodies within SIP messages separately require the security
  9431. services of confidentiality, integrity, and authentication.
  9432. Rather than defining new security mechanisms specific to SIP, SIP
  9433. reuses wherever possible existing security models derived from the
  9434. HTTP and SMTP space.
  9435. Full encryption of messages provides the best means to preserve the
  9436. confidentiality of signaling - it can also guarantee that messages
  9437. are not modified by any malicious intermediaries. However, SIP
  9438. requests and responses cannot be naively encrypted end-to-end in
  9439. their entirety because message fields such as the Request-URI, Route,
  9440. and Via need to be visible to proxies in most network architectures
  9441. so that SIP requests are routed correctly. Note that proxy servers
  9442. need to modify some features of messages as well (such as adding Via
  9443. header field values) in order for SIP to function. Proxy servers
  9444. must therefore be trusted, to some degree, by SIP UAs. To this
  9445. purpose, low-layer security mechanisms for SIP are recommended, which
  9446. Rosenberg, et. al. Standards Track [Page 237]
  9447. RFC 3261 SIP: Session Initiation Protocol June 2002
  9448. encrypt the entire SIP requests or responses on the wire on a hop-
  9449. by-hop basis, and that allow endpoints to verify the identity of
  9450. proxy servers to whom they send requests.
  9451. SIP entities also have a need to identify one another in a secure
  9452. fashion. When a SIP endpoint asserts the identity of its user to a
  9453. peer UA or to a proxy server, that identity should in some way be
  9454. verifiable. A cryptographic authentication mechanism is provided in
  9455. SIP to address this requirement.
  9456. An independent security mechanism for SIP message bodies supplies an
  9457. alternative means of end-to-end mutual authentication, as well as
  9458. providing a limit on the degree to which user agents must trust
  9459. intermediaries.
  9460. 26.2.1 Transport and Network Layer Security
  9461. Transport or network layer security encrypts signaling traffic,
  9462. guaranteeing message confidentiality and integrity.
  9463. Oftentimes, certificates are used in the establishment of lower-layer
  9464. security, and these certificates can also be used to provide a means
  9465. of authentication in many architectures.
  9466. Two popular alternatives for providing security at the transport and
  9467. network layer are, respectively, TLS [25] and IPSec [26].
  9468. IPSec is a set of network-layer protocol tools that collectively can
  9469. be used as a secure replacement for traditional IP (Internet
  9470. Protocol). IPSec is most commonly used in architectures in which a
  9471. set of hosts or administrative domains have an existing trust
  9472. relationship with one another. IPSec is usually implemented at the
  9473. operating system level in a host, or on a security gateway that
  9474. provides confidentiality and integrity for all traffic it receives
  9475. from a particular interface (as in a VPN architecture). IPSec can
  9476. also be used on a hop-by-hop basis.
  9477. In many architectures IPSec does not require integration with SIP
  9478. applications; IPSec is perhaps best suited to deployments in which
  9479. adding security directly to SIP hosts would be arduous. UAs that
  9480. have a pre-shared keying relationship with their first-hop proxy
  9481. server are also good candidates to use IPSec. Any deployment of
  9482. IPSec for SIP would require an IPSec profile describing the protocol
  9483. tools that would be required to secure SIP. No such profile is given
  9484. in this document.
  9485. Rosenberg, et. al. Standards Track [Page 238]
  9486. RFC 3261 SIP: Session Initiation Protocol June 2002
  9487. TLS provides transport-layer security over connection-oriented
  9488. protocols (for the purposes of this document, TCP); "tls" (signifying
  9489. TLS over TCP) can be specified as the desired transport protocol
  9490. within a Via header field value or a SIP-URI. TLS is most suited to
  9491. architectures in which hop-by-hop security is required between hosts
  9492. with no pre-existing trust association. For example, Alice trusts
  9493. her local proxy server, which after a certificate exchange decides to
  9494. trust Bob's local proxy server, which Bob trusts, hence Bob and Alice
  9495. can communicate securely.
  9496. TLS must be tightly coupled with a SIP application. Note that
  9497. transport mechanisms are specified on a hop-by-hop basis in SIP, thus
  9498. a UA that sends requests over TLS to a proxy server has no assurance
  9499. that TLS will be used end-to-end.
  9500. The TLS_RSA_WITH_AES_128_CBC_SHA ciphersuite [6] MUST be supported at
  9501. a minimum by implementers when TLS is used in a SIP application. For
  9502. purposes of backwards compatibility, proxy servers, redirect servers,
  9503. and registrars SHOULD support TLS_RSA_WITH_3DES_EDE_CBC_SHA.
  9504. Implementers MAY also support any other ciphersuite.
  9505. 26.2.2 SIPS URI Scheme
  9506. The SIPS URI scheme adheres to the syntax of the SIP URI (described
  9507. in 19), although the scheme string is "sips" rather than "sip". The
  9508. semantics of SIPS are very different from the SIP URI, however. SIPS
  9509. allows resources to specify that they should be reached securely.
  9510. A SIPS URI can be used as an address-of-record for a particular user
  9511. - the URI by which the user is canonically known (on their business
  9512. cards, in the From header field of their requests, in the To header
  9513. field of REGISTER requests). When used as the Request-URI of a
  9514. request, the SIPS scheme signifies that each hop over which the
  9515. request is forwarded, until the request reaches the SIP entity
  9516. responsible for the domain portion of the Request-URI, must be
  9517. secured with TLS; once it reaches the domain in question it is
  9518. handled in accordance with local security and routing policy, quite
  9519. possibly using TLS for any last hop to a UAS. When used by the
  9520. originator of a request (as would be the case if they employed a SIPS
  9521. URI as the address-of-record of the target), SIPS dictates that the
  9522. entire request path to the target domain be so secured.
  9523. The SIPS scheme is applicable to many of the other ways in which SIP
  9524. URIs are used in SIP today in addition to the Request-URI, including
  9525. in addresses-of-record, contact addresses (the contents of Contact
  9526. headers, including those of REGISTER methods), and Route headers. In
  9527. each instance, the SIPS URI scheme allows these existing fields to
  9528. Rosenberg, et. al. Standards Track [Page 239]
  9529. RFC 3261 SIP: Session Initiation Protocol June 2002
  9530. designate secure resources. The manner in which a SIPS URI is
  9531. dereferenced in any of these contexts has its own security properties
  9532. which are detailed in [4].
  9533. The use of SIPS in particular entails that mutual TLS authentication
  9534. SHOULD be employed, as SHOULD the ciphersuite
  9535. TLS_RSA_WITH_AES_128_CBC_SHA. Certificates received in the
  9536. authentication process SHOULD be validated with root certificates
  9537. held by the client; failure to validate a certificate SHOULD result
  9538. in the failure of the request.
  9539. Note that in the SIPS URI scheme, transport is independent of TLS,
  9540. and thus "sips:alice@atlanta.com;transport=tcp" and
  9541. "sips:alice@atlanta.com;transport=sctp" are both valid (although
  9542. note that UDP is not a valid transport for SIPS). The use of
  9543. "transport=tls" has consequently been deprecated, partly because
  9544. it was specific to a single hop of the request. This is a change
  9545. since RFC 2543.
  9546. Users that distribute a SIPS URI as an address-of-record may elect to
  9547. operate devices that refuse requests over insecure transports.
  9548. 26.2.3 HTTP Authentication
  9549. SIP provides a challenge capability, based on HTTP authentication,
  9550. that relies on the 401 and 407 response codes as well as header
  9551. fields for carrying challenges and credentials. Without significant
  9552. modification, the reuse of the HTTP Digest authentication scheme in
  9553. SIP allows for replay protection and one-way authentication.
  9554. The usage of Digest authentication in SIP is detailed in Section 22.
  9555. 26.2.4 S/MIME
  9556. As is discussed above, encrypting entire SIP messages end-to-end for
  9557. the purpose of confidentiality is not appropriate because network
  9558. intermediaries (like proxy servers) need to view certain header
  9559. fields in order to route messages correctly, and if these
  9560. intermediaries are excluded from security associations, then SIP
  9561. messages will essentially be non-routable.
  9562. However, S/MIME allows SIP UAs to encrypt MIME bodies within SIP,
  9563. securing these bodies end-to-end without affecting message headers.
  9564. S/MIME can provide end-to-end confidentiality and integrity for
  9565. message bodies, as well as mutual authentication. It is also
  9566. possible to use S/MIME to provide a form of integrity and
  9567. confidentiality for SIP header fields through SIP message tunneling.
  9568. Rosenberg, et. al. Standards Track [Page 240]
  9569. RFC 3261 SIP: Session Initiation Protocol June 2002
  9570. The usage of S/MIME in SIP is detailed in Section 23.
  9571. 26.3 Implementing Security Mechanisms
  9572. 26.3.1 Requirements for Implementers of SIP
  9573. Proxy servers, redirect servers, and registrars MUST implement TLS,
  9574. and MUST support both mutual and one-way authentication. It is
  9575. strongly RECOMMENDED that UAs be capable initiating TLS; UAs MAY also
  9576. be capable of acting as a TLS server. Proxy servers, redirect
  9577. servers, and registrars SHOULD possess a site certificate whose
  9578. subject corresponds to their canonical hostname. UAs MAY have
  9579. certificates of their own for mutual authentication with TLS, but no
  9580. provisions are set forth in this document for their use. All SIP
  9581. elements that support TLS MUST have a mechanism for validating
  9582. certificates received during TLS negotiation; this entails possession
  9583. of one or more root certificates issued by certificate authorities
  9584. (preferably well-known distributors of site certificates comparable
  9585. to those that issue root certificates for web browsers).
  9586. All SIP elements that support TLS MUST also support the SIPS URI
  9587. scheme.
  9588. Proxy servers, redirect servers, registrars, and UAs MAY also
  9589. implement IPSec or other lower-layer security protocols.
  9590. When a UA attempts to contact a proxy server, redirect server, or
  9591. registrar, the UAC SHOULD initiate a TLS connection over which it
  9592. will send SIP messages. In some architectures, UASs MAY receive
  9593. requests over such TLS connections as well.
  9594. Proxy servers, redirect servers, registrars, and UAs MUST implement
  9595. Digest Authorization, encompassing all of the aspects required in 22.
  9596. Proxy servers, redirect servers, and registrars SHOULD be configured
  9597. with at least one Digest realm, and at least one "realm" string
  9598. supported by a given server SHOULD correspond to the server's
  9599. hostname or domainname.
  9600. UAs MAY support the signing and encrypting of MIME bodies, and
  9601. transference of credentials with S/MIME as described in Section 23.
  9602. If a UA holds one or more root certificates of certificate
  9603. authorities in order to validate certificates for TLS or IPSec, it
  9604. SHOULD be capable of reusing these to verify S/MIME certificates, as
  9605. appropriate. A UA MAY hold root certificates specifically for
  9606. validating S/MIME certificates.
  9607. Rosenberg, et. al. Standards Track [Page 241]
  9608. RFC 3261 SIP: Session Initiation Protocol June 2002
  9609. Note that is it anticipated that future security extensions may
  9610. upgrade the normative strength associated with S/MIME as S/MIME
  9611. implementations appear and the problem space becomes better
  9612. understood.
  9613. 26.3.2 Security Solutions
  9614. The operation of these security mechanisms in concert can follow the
  9615. existing web and email security models to some degree. At a high
  9616. level, UAs authenticate themselves to servers (proxy servers,
  9617. redirect servers, and registrars) with a Digest username and
  9618. password; servers authenticate themselves to UAs one hop away, or to
  9619. another server one hop away (and vice versa), with a site certificate
  9620. delivered by TLS.
  9621. On a peer-to-peer level, UAs trust the network to authenticate one
  9622. another ordinarily; however, S/MIME can also be used to provide
  9623. direct authentication when the network does not, or if the network
  9624. itself is not trusted.
  9625. The following is an illustrative example in which these security
  9626. mechanisms are used by various UAs and servers to prevent the sorts
  9627. of threats described in Section 26.1. While implementers and network
  9628. administrators MAY follow the normative guidelines given in the
  9629. remainder of this section, these are provided only as example
  9630. implementations.
  9631. 26.3.2.1 Registration
  9632. When a UA comes online and registers with its local administrative
  9633. domain, it SHOULD establish a TLS connection with its registrar
  9634. (Section 10 describes how the UA reaches its registrar). The
  9635. registrar SHOULD offer a certificate to the UA, and the site
  9636. identified by the certificate MUST correspond with the domain in
  9637. which the UA intends to register; for example, if the UA intends to
  9638. register the address-of-record 'alice@atlanta.com', the site
  9639. certificate must identify a host within the atlanta.com domain (such
  9640. as sip.atlanta.com). When it receives the TLS Certificate message,
  9641. the UA SHOULD verify the certificate and inspect the site identified
  9642. by the certificate. If the certificate is invalid, revoked, or if it
  9643. does not identify the appropriate party, the UA MUST NOT send the
  9644. REGISTER message and otherwise proceed with the registration.
  9645. When a valid certificate has been provided by the registrar, the
  9646. UA knows that the registrar is not an attacker who might redirect
  9647. the UA, steal passwords, or attempt any similar attacks.
  9648. Rosenberg, et. al. Standards Track [Page 242]
  9649. RFC 3261 SIP: Session Initiation Protocol June 2002
  9650. The UA then creates a REGISTER request that SHOULD be addressed to a
  9651. Request-URI corresponding to the site certificate received from the
  9652. registrar. When the UA sends the REGISTER request over the existing
  9653. TLS connection, the registrar SHOULD challenge the request with a 401
  9654. (Proxy Authentication Required) response. The "realm" parameter
  9655. within the Proxy-Authenticate header field of the response SHOULD
  9656. correspond to the domain previously given by the site certificate.
  9657. When the UAC receives the challenge, it SHOULD either prompt the user
  9658. for credentials or take an appropriate credential from a keyring
  9659. corresponding to the "realm" parameter in the challenge. The
  9660. username of this credential SHOULD correspond with the "userinfo"
  9661. portion of the URI in the To header field of the REGISTER request.
  9662. Once the Digest credentials have been inserted into an appropriate
  9663. Proxy-Authorization header field, the REGISTER should be resubmitted
  9664. to the registrar.
  9665. Since the registrar requires the user agent to authenticate
  9666. itself, it would be difficult for an attacker to forge REGISTER
  9667. requests for the user's address-of-record. Also note that since
  9668. the REGISTER is sent over a confidential TLS connection, attackers
  9669. will not be able to intercept the REGISTER to record credentials
  9670. for any possible replay attack.
  9671. Once the registration has been accepted by the registrar, the UA
  9672. SHOULD leave this TLS connection open provided that the registrar
  9673. also acts as the proxy server to which requests are sent for users in
  9674. this administrative domain. The existing TLS connection will be
  9675. reused to deliver incoming requests to the UA that has just completed
  9676. registration.
  9677. Because the UA has already authenticated the server on the other
  9678. side of the TLS connection, all requests that come over this
  9679. connection are known to have passed through the proxy server -
  9680. attackers cannot create spoofed requests that appear to have been
  9681. sent through that proxy server.
  9682. 26.3.2.2 Interdomain Requests
  9683. Now let's say that Alice's UA would like to initiate a session with a
  9684. user in a remote administrative domain, namely "bob@biloxi.com". We
  9685. will also say that the local administrative domain (atlanta.com) has
  9686. a local outbound proxy.
  9687. The proxy server that handles inbound requests for an administrative
  9688. domain MAY also act as a local outbound proxy; for simplicity's sake
  9689. we'll assume this to be the case for atlanta.com (otherwise the user
  9690. agent would initiate a new TLS connection to a separate server at
  9691. this point). Assuming that the client has completed the registration
  9692. Rosenberg, et. al. Standards Track [Page 243]
  9693. RFC 3261 SIP: Session Initiation Protocol June 2002
  9694. process described in the preceding section, it SHOULD reuse the TLS
  9695. connection to the local proxy server when it sends an INVITE request
  9696. to another user. The UA SHOULD reuse cached credentials in the
  9697. INVITE to avoid prompting the user unnecessarily.
  9698. When the local outbound proxy server has validated the credentials
  9699. presented by the UA in the INVITE, it SHOULD inspect the Request-URI
  9700. to determine how the message should be routed (see [4]). If the
  9701. "domainname" portion of the Request-URI had corresponded to the local
  9702. domain (atlanta.com) rather than biloxi.com, then the proxy server
  9703. would have consulted its location service to determine how best to
  9704. reach the requested user.
  9705. Had "alice@atlanta.com" been attempting to contact, say,
  9706. "alex@atlanta.com", the local proxy would have proxied to the
  9707. request to the TLS connection Alex had established with the
  9708. registrar when he registered. Since Alex would receive this
  9709. request over his authenticated channel, he would be assured that
  9710. Alice's request had been authorized by the proxy server of the
  9711. local administrative domain.
  9712. However, in this instance the Request-URI designates a remote domain.
  9713. The local outbound proxy server at atlanta.com SHOULD therefore
  9714. establish a TLS connection with the remote proxy server at
  9715. biloxi.com. Since both of the participants in this TLS connection
  9716. are servers that possess site certificates, mutual TLS authentication
  9717. SHOULD occur. Each side of the connection SHOULD verify and inspect
  9718. the certificate of the other, noting the domain name that appears in
  9719. the certificate for comparison with the header fields of SIP
  9720. messages. The atlanta.com proxy server, for example, SHOULD verify
  9721. at this stage that the certificate received from the remote side
  9722. corresponds with the biloxi.com domain. Once it has done so, and TLS
  9723. negotiation has completed, resulting in a secure channel between the
  9724. two proxies, the atlanta.com proxy can forward the INVITE request to
  9725. biloxi.com.
  9726. The proxy server at biloxi.com SHOULD inspect the certificate of the
  9727. proxy server at atlanta.com in turn and compare the domain asserted
  9728. by the certificate with the "domainname" portion of the From header
  9729. field in the INVITE request. The biloxi proxy MAY have a strict
  9730. security policy that requires it to reject requests that do not match
  9731. the administrative domain from which they have been proxied.
  9732. Such security policies could be instituted to prevent the SIP
  9733. equivalent of SMTP 'open relays' that are frequently exploited to
  9734. generate spam.
  9735. Rosenberg, et. al. Standards Track [Page 244]
  9736. RFC 3261 SIP: Session Initiation Protocol June 2002
  9737. This policy, however, only guarantees that the request came from the
  9738. domain it ascribes to itself; it does not allow biloxi.com to
  9739. ascertain how atlanta.com authenticated Alice. Only if biloxi.com
  9740. has some other way of knowing atlanta.com's authentication policies
  9741. could it possibly ascertain how Alice proved her identity.
  9742. biloxi.com might then institute an even stricter policy that forbids
  9743. requests that come from domains that are not known administratively
  9744. to share a common authentication policy with biloxi.com.
  9745. Once the INVITE has been approved by the biloxi proxy, the proxy
  9746. server SHOULD identify the existing TLS channel, if any, associated
  9747. with the user targeted by this request (in this case
  9748. "bob@biloxi.com"). The INVITE should be proxied through this channel
  9749. to Bob. Since the request is received over a TLS connection that had
  9750. previously been authenticated as the biloxi proxy, Bob knows that the
  9751. From header field was not tampered with and that atlanta.com has
  9752. validated Alice, although not necessarily whether or not to trust
  9753. Alice's identity.
  9754. Before they forward the request, both proxy servers SHOULD add a
  9755. Record-Route header field to the request so that all future requests
  9756. in this dialog will pass through the proxy servers. The proxy
  9757. servers can thereby continue to provide security services for the
  9758. lifetime of this dialog. If the proxy servers do not add themselves
  9759. to the Record-Route, future messages will pass directly end-to-end
  9760. between Alice and Bob without any security services (unless the two
  9761. parties agree on some independent end-to-end security such as
  9762. S/MIME). In this respect the SIP trapezoid model can provide a nice
  9763. structure where conventions of agreement between the site proxies can
  9764. provide a reasonably secure channel between Alice and Bob.
  9765. An attacker preying on this architecture would, for example, be
  9766. unable to forge a BYE request and insert it into the signaling
  9767. stream between Bob and Alice because the attacker has no way of
  9768. ascertaining the parameters of the session and also because the
  9769. integrity mechanism transitively protects the traffic between
  9770. Alice and Bob.
  9771. 26.3.2.3 Peer-to-Peer Requests
  9772. Alternatively, consider a UA asserting the identity
  9773. "carol@chicago.com" that has no local outbound proxy. When Carol
  9774. wishes to send an INVITE to "bob@biloxi.com", her UA SHOULD initiate
  9775. a TLS connection with the biloxi proxy directly (using the mechanism
  9776. described in [4] to determine how to best to reach the given
  9777. Request-URI). When her UA receives a certificate from the biloxi
  9778. proxy, it SHOULD be verified normally before she passes her INVITE
  9779. across the TLS connection. However, Carol has no means of proving
  9780. Rosenberg, et. al. Standards Track [Page 245]
  9781. RFC 3261 SIP: Session Initiation Protocol June 2002
  9782. her identity to the biloxi proxy, but she does have a CMS-detached
  9783. signature over a "message/sip" body in the INVITE. It is unlikely in
  9784. this instance that Carol would have any credentials in the biloxi.com
  9785. realm, since she has no formal association with biloxi.com. The
  9786. biloxi proxy MAY also have a strict policy that precludes it from
  9787. even bothering to challenge requests that do not have biloxi.com in
  9788. the "domainname" portion of the From header field - it treats these
  9789. users as unauthenticated.
  9790. The biloxi proxy has a policy for Bob that all non-authenticated
  9791. requests should be redirected to the appropriate contact address
  9792. registered against 'bob@biloxi.com', namely <sip:bob@192.0.2.4>.
  9793. Carol receives the redirection response over the TLS connection she
  9794. established with the biloxi proxy, so she trusts the veracity of the
  9795. contact address.
  9796. Carol SHOULD then establish a TCP connection with the designated
  9797. address and send a new INVITE with a Request-URI containing the
  9798. received contact address (recomputing the signature in the body as
  9799. the request is readied). Bob receives this INVITE on an insecure
  9800. interface, but his UA inspects and, in this instance, recognizes the
  9801. From header field of the request and subsequently matches a locally
  9802. cached certificate with the one presented in the signature of the
  9803. body of the INVITE. He replies in similar fashion, authenticating
  9804. himself to Carol, and a secure dialog begins.
  9805. Sometimes firewalls or NATs in an administrative domain could
  9806. preclude the establishment of a direct TCP connection to a UA. In
  9807. these cases, proxy servers could also potentially relay requests
  9808. to UAs in a way that has no trust implications (for example,
  9809. forgoing an existing TLS connection and forwarding the request
  9810. over cleartext TCP) as local policy dictates.
  9811. 26.3.2.4 DoS Protection
  9812. In order to minimize the risk of a denial-of-service attack against
  9813. architectures using these security solutions, implementers should
  9814. take note of the following guidelines.
  9815. When the host on which a SIP proxy server is operating is routable
  9816. from the public Internet, it SHOULD be deployed in an administrative
  9817. domain with defensive operational policies (blocking source-routed
  9818. traffic, preferably filtering ping traffic). Both TLS and IPSec can
  9819. also make use of bastion hosts at the edges of administrative domains
  9820. that participate in the security associations to aggregate secure
  9821. tunnels and sockets. These bastion hosts can also take the brunt of
  9822. denial-of-service attacks, ensuring that SIP hosts within the
  9823. administrative domain are not encumbered with superfluous messaging.
  9824. Rosenberg, et. al. Standards Track [Page 246]
  9825. RFC 3261 SIP: Session Initiation Protocol June 2002
  9826. No matter what security solutions are deployed, floods of messages
  9827. directed at proxy servers can lock up proxy server resources and
  9828. prevent desirable traffic from reaching its destination. There is a
  9829. computational expense associated with processing a SIP transaction at
  9830. a proxy server, and that expense is greater for stateful proxy
  9831. servers than it is for stateless proxy servers. Therefore, stateful
  9832. proxies are more susceptible to flooding than stateless proxy
  9833. servers.
  9834. UAs and proxy servers SHOULD challenge questionable requests with
  9835. only a single 401 (Unauthorized) or 407 (Proxy Authentication
  9836. Required), forgoing the normal response retransmission algorithm, and
  9837. thus behaving statelessly towards unauthenticated requests.
  9838. Retransmitting the 401 (Unauthorized) or 407 (Proxy Authentication
  9839. Required) status response amplifies the problem of an attacker
  9840. using a falsified header field value (such as Via) to direct
  9841. traffic to a third party.
  9842. In summary, the mutual authentication of proxy servers through
  9843. mechanisms such as TLS significantly reduces the potential for rogue
  9844. intermediaries to introduce falsified requests or responses that can
  9845. deny service. This commensurately makes it harder for attackers to
  9846. make innocent SIP nodes into agents of amplification.
  9847. 26.4 Limitations
  9848. Although these security mechanisms, when applied in a judicious
  9849. manner, can thwart many threats, there are limitations in the scope
  9850. of the mechanisms that must be understood by implementers and network
  9851. operators.
  9852. 26.4.1 HTTP Digest
  9853. One of the primary limitations of using HTTP Digest in SIP is that
  9854. the integrity mechanisms in Digest do not work very well for SIP.
  9855. Specifically, they offer protection of the Request-URI and the method
  9856. of a message, but not for any of the header fields that UAs would
  9857. most likely wish to secure.
  9858. The existing replay protection mechanisms described in RFC 2617 also
  9859. have some limitations for SIP. The next-nonce mechanism, for
  9860. example, does not support pipelined requests. The nonce-count
  9861. mechanism should be used for replay protection.
  9862. Another limitation of HTTP Digest is the scope of realms. Digest is
  9863. valuable when a user wants to authenticate themselves to a resource
  9864. with which they have a pre-existing association, like a service
  9865. Rosenberg, et. al. Standards Track [Page 247]
  9866. RFC 3261 SIP: Session Initiation Protocol June 2002
  9867. provider of which the user is a customer (which is quite a common
  9868. scenario and thus Digest provides an extremely useful function). By
  9869. way of contrast, the scope of TLS is interdomain or multirealm, since
  9870. certificates are often globally verifiable, so that the UA can
  9871. authenticate the server with no pre-existing association.
  9872. 26.4.2 S/MIME
  9873. The largest outstanding defect with the S/MIME mechanism is the lack
  9874. of a prevalent public key infrastructure for end users. If self-
  9875. signed certificates (or certificates that cannot be verified by one
  9876. of the participants in a dialog) are used, the SIP-based key exchange
  9877. mechanism described in Section 23.2 is susceptible to a man-in-the-
  9878. middle attack with which an attacker can potentially inspect and
  9879. modify S/MIME bodies. The attacker needs to intercept the first
  9880. exchange of keys between the two parties in a dialog, remove the
  9881. existing CMS-detached signatures from the request and response, and
  9882. insert a different CMS-detached signature containing a certificate
  9883. supplied by the attacker (but which seems to be a certificate for the
  9884. proper address-of-record). Each party will think they have exchanged
  9885. keys with the other, when in fact each has the public key of the
  9886. attacker.
  9887. It is important to note that the attacker can only leverage this
  9888. vulnerability on the first exchange of keys between two parties - on
  9889. subsequent occasions, the alteration of the key would be noticeable
  9890. to the UAs. It would also be difficult for the attacker to remain in
  9891. the path of all future dialogs between the two parties over time (as
  9892. potentially days, weeks, or years pass).
  9893. SSH is susceptible to the same man-in-the-middle attack on the first
  9894. exchange of keys; however, it is widely acknowledged that while SSH
  9895. is not perfect, it does improve the security of connections. The use
  9896. of key fingerprints could provide some assistance to SIP, just as it
  9897. does for SSH. For example, if two parties use SIP to establish a
  9898. voice communications session, each could read off the fingerprint of
  9899. the key they received from the other, which could be compared against
  9900. the original. It would certainly be more difficult for the man-in-
  9901. the-middle to emulate the voices of the participants than their
  9902. signaling (a practice that was used with the Clipper chip-based
  9903. secure telephone).
  9904. The S/MIME mechanism allows UAs to send encrypted requests without
  9905. preamble if they possess a certificate for the destination address-
  9906. of-record on their keyring. However, it is possible that any
  9907. particular device registered for an address-of-record will not hold
  9908. the certificate that has been previously employed by the device's
  9909. current user, and that it will therefore be unable to process an
  9910. Rosenberg, et. al. Standards Track [Page 248]
  9911. RFC 3261 SIP: Session Initiation Protocol June 2002
  9912. encrypted request properly, which could lead to some avoidable error
  9913. signaling. This is especially likely when an encrypted request is
  9914. forked.
  9915. The keys associated with S/MIME are most useful when associated with
  9916. a particular user (an address-of-record) rather than a device (a UA).
  9917. When users move between devices, it may be difficult to transport
  9918. private keys securely between UAs; how such keys might be acquired by
  9919. a device is outside the scope of this document.
  9920. Another, more prosaic difficulty with the S/MIME mechanism is that it
  9921. can result in very large messages, especially when the SIP tunneling
  9922. mechanism described in Section 23.4 is used. For that reason, it is
  9923. RECOMMENDED that TCP should be used as a transport protocol when
  9924. S/MIME tunneling is employed.
  9925. 26.4.3 TLS
  9926. The most commonly voiced concern about TLS is that it cannot run over
  9927. UDP; TLS requires a connection-oriented underlying transport
  9928. protocol, which for the purposes of this document means TCP.
  9929. It may also be arduous for a local outbound proxy server and/or
  9930. registrar to maintain many simultaneous long-lived TLS connections
  9931. with numerous UAs. This introduces some valid scalability concerns,
  9932. especially for intensive ciphersuites. Maintaining redundancy of
  9933. long-lived TLS connections, especially when a UA is solely
  9934. responsible for their establishment, could also be cumbersome.
  9935. TLS only allows SIP entities to authenticate servers to which they
  9936. are adjacent; TLS offers strictly hop-by-hop security. Neither TLS,
  9937. nor any other mechanism specified in this document, allows clients to
  9938. authenticate proxy servers to whom they cannot form a direct TCP
  9939. connection.
  9940. 26.4.4 SIPS URIs
  9941. Actually using TLS on every segment of a request path entails that
  9942. the terminating UAS must be reachable over TLS (perhaps registering
  9943. with a SIPS URI as a contact address). This is the preferred use of
  9944. SIPS. Many valid architectures, however, use TLS to secure part of
  9945. the request path, but rely on some other mechanism for the final hop
  9946. to a UAS, for example. Thus SIPS cannot guarantee that TLS usage
  9947. will be truly end-to-end. Note that since many UAs will not accept
  9948. incoming TLS connections, even those UAs that do support TLS may be
  9949. required to maintain persistent TLS connections as described in the
  9950. TLS limitations section above in order to receive requests over TLS
  9951. as a UAS.
  9952. Rosenberg, et. al. Standards Track [Page 249]
  9953. RFC 3261 SIP: Session Initiation Protocol June 2002
  9954. Location services are not required to provide a SIPS binding for a
  9955. SIPS Request-URI. Although location services are commonly populated
  9956. by user registrations (as described in Section 10.2.1), various other
  9957. protocols and interfaces could conceivably supply contact addresses
  9958. for an AOR, and these tools are free to map SIPS URIs to SIP URIs as
  9959. appropriate. When queried for bindings, a location service returns
  9960. its contact addresses without regard for whether it received a
  9961. request with a SIPS Request-URI. If a redirect server is accessing
  9962. the location service, it is up to the entity that processes the
  9963. Contact header field of a redirection to determine the propriety of
  9964. the contact addresses.
  9965. Ensuring that TLS will be used for all of the request segments up to
  9966. the target domain is somewhat complex. It is possible that
  9967. cryptographically authenticated proxy servers along the way that are
  9968. non-compliant or compromised may choose to disregard the forwarding
  9969. rules associated with SIPS (and the general forwarding rules in
  9970. Section 16.6). Such malicious intermediaries could, for example,
  9971. retarget a request from a SIPS URI to a SIP URI in an attempt to
  9972. downgrade security.
  9973. Alternatively, an intermediary might legitimately retarget a request
  9974. from a SIP to a SIPS URI. Recipients of a request whose Request-URI
  9975. uses the SIPS URI scheme thus cannot assume on the basis of the
  9976. Request-URI alone that SIPS was used for the entire request path
  9977. (from the client onwards).
  9978. To address these concerns, it is RECOMMENDED that recipients of a
  9979. request whose Request-URI contains a SIP or SIPS URI inspect the To
  9980. header field value to see if it contains a SIPS URI (though note that
  9981. it does not constitute a breach of security if this URI has the same
  9982. scheme but is not equivalent to the URI in the To header field).
  9983. Although clients may choose to populate the Request-URI and To header
  9984. field of a request differently, when SIPS is used this disparity
  9985. could be interpreted as a possible security violation, and the
  9986. request could consequently be rejected by its recipient. Recipients
  9987. MAY also inspect the Via header chain in order to double-check
  9988. whether or not TLS was used for the entire request path until the
  9989. local administrative domain was reached. S/MIME may also be used by
  9990. the originating UAC to help ensure that the original form of the To
  9991. header field is carried end-to-end.
  9992. If the UAS has reason to believe that the scheme of the Request-URI
  9993. has been improperly modified in transit, the UA SHOULD notify its
  9994. user of a potential security breach.
  9995. Rosenberg, et. al. Standards Track [Page 250]
  9996. RFC 3261 SIP: Session Initiation Protocol June 2002
  9997. As a further measure to prevent downgrade attacks, entities that
  9998. accept only SIPS requests MAY also refuse connections on insecure
  9999. ports.
  10000. End users will undoubtedly discern the difference between SIPS and
  10001. SIP URIs, and they may manually edit them in response to stimuli.
  10002. This can either benefit or degrade security. For example, if an
  10003. attacker corrupts a DNS cache, inserting a fake record set that
  10004. effectively removes all SIPS records for a proxy server, then any
  10005. SIPS requests that traverse this proxy server may fail. When a user,
  10006. however, sees that repeated calls to a SIPS AOR are failing, they
  10007. could on some devices manually convert the scheme from SIPS to SIP
  10008. and retry. Of course, there are some safeguards against this (if the
  10009. destination UA is truly paranoid it could refuse all non-SIPS
  10010. requests), but it is a limitation worth noting. On the bright side,
  10011. users might also divine that 'SIPS' would be valid even when they are
  10012. presented only with a SIP URI.
  10013. 26.5 Privacy
  10014. SIP messages frequently contain sensitive information about their
  10015. senders - not just what they have to say, but with whom they
  10016. communicate, when they communicate and for how long, and from where
  10017. they participate in sessions. Many applications and their users
  10018. require that this sort of private information be hidden from any
  10019. parties that do not need to know it.
  10020. Note that there are also less direct ways in which private
  10021. information can be divulged. If a user or service chooses to be
  10022. reachable at an address that is guessable from the person's name and
  10023. organizational affiliation (which describes most addresses-of-
  10024. record), the traditional method of ensuring privacy by having an
  10025. unlisted "phone number" is compromised. A user location service can
  10026. infringe on the privacy of the recipient of a session invitation by
  10027. divulging their specific whereabouts to the caller; an implementation
  10028. consequently SHOULD be able to restrict, on a per-user basis, what
  10029. kind of location and availability information is given out to certain
  10030. classes of callers. This is a whole class of problem that is
  10031. expected to be studied further in ongoing SIP work.
  10032. In some cases, users may want to conceal personal information in
  10033. header fields that convey identity. This can apply not only to the
  10034. From and related headers representing the originator of the request,
  10035. but also the To - it may not be appropriate to convey to the final
  10036. destination a speed-dialing nickname, or an unexpanded identifier for
  10037. a group of targets, either of which would be removed from the
  10038. Request-URI as the request is routed, but not changed in the To
  10039. Rosenberg, et. al. Standards Track [Page 251]
  10040. RFC 3261 SIP: Session Initiation Protocol June 2002
  10041. header field if the two were initially identical. Thus it MAY be
  10042. desirable for privacy reasons to create a To header field that
  10043. differs from the Request-URI.
  10044. 27 IANA Considerations
  10045. All method names, header field names, status codes, and option tags
  10046. used in SIP applications are registered with IANA through
  10047. instructions in an IANA Considerations section in an RFC.
  10048. The specification instructs the IANA to create four new sub-
  10049. registries under http://www.iana.org/assignments/sip-parameters:
  10050. Option Tags, Warning Codes (warn-codes), Methods and Response Codes,
  10051. added to the sub-registry of Header Fields that is already present
  10052. there.
  10053. 27.1 Option Tags
  10054. This specification establishes the Option Tags sub-registry under
  10055. http://www.iana.org/assignments/sip-parameters.
  10056. Option tags are used in header fields such as Require, Supported,
  10057. Proxy-Require, and Unsupported in support of SIP compatibility
  10058. mechanisms for extensions (Section 19.2). The option tag itself is a
  10059. string that is associated with a particular SIP option (that is, an
  10060. extension). It identifies the option to SIP endpoints.
  10061. Option tags are registered by the IANA when they are published in
  10062. standards track RFCs. The IANA Considerations section of the RFC
  10063. must include the following information, which appears in the IANA
  10064. registry along with the RFC number of the publication.
  10065. o Name of the option tag. The name MAY be of any length, but
  10066. SHOULD be no more than twenty characters long. The name MUST
  10067. consist of alphanum (Section 25) characters only.
  10068. o Descriptive text that describes the extension.
  10069. 27.2 Warn-Codes
  10070. This specification establishes the Warn-codes sub-registry under
  10071. http://www.iana.org/assignments/sip-parameters and initiates its
  10072. population with the warn-codes listed in Section 20.43. Additional
  10073. warn-codes are registered by RFC publication.
  10074. Rosenberg, et. al. Standards Track [Page 252]
  10075. RFC 3261 SIP: Session Initiation Protocol June 2002
  10076. The descriptive text for the table of warn-codes is:
  10077. Warning codes provide information supplemental to the status code in
  10078. SIP response messages when the failure of the transaction results
  10079. from a Session Description Protocol (SDP) (RFC 2327 [1]) problem.
  10080. The "warn-code" consists of three digits. A first digit of "3"
  10081. indicates warnings specific to SIP. Until a future specification
  10082. describes uses of warn-codes other than 3xx, only 3xx warn-codes may
  10083. be registered.
  10084. Warnings 300 through 329 are reserved for indicating problems with
  10085. keywords in the session description, 330 through 339 are warnings
  10086. related to basic network services requested in the session
  10087. description, 370 through 379 are warnings related to quantitative QoS
  10088. parameters requested in the session description, and 390 through 399
  10089. are miscellaneous warnings that do not fall into one of the above
  10090. categories.
  10091. 27.3 Header Field Names
  10092. This obsoletes the IANA instructions about the header sub-registry
  10093. under http://www.iana.org/assignments/sip-parameters.
  10094. The following information needs to be provided in an RFC publication
  10095. in order to register a new header field name:
  10096. o The RFC number in which the header is registered;
  10097. o the name of the header field being registered;
  10098. o a compact form version for that header field, if one is
  10099. defined;
  10100. Some common and widely used header fields MAY be assigned one-letter
  10101. compact forms (Section 7.3.3). Compact forms can only be assigned
  10102. after SIP working group review, followed by RFC publication.
  10103. 27.4 Method and Response Codes
  10104. This specification establishes the Method and Response-Code sub-
  10105. registries under http://www.iana.org/assignments/sip-parameters and
  10106. initiates their population as follows. The initial Methods table is:
  10107. Rosenberg, et. al. Standards Track [Page 253]
  10108. RFC 3261 SIP: Session Initiation Protocol June 2002
  10109. INVITE [RFC3261]
  10110. ACK [RFC3261]
  10111. BYE [RFC3261]
  10112. CANCEL [RFC3261]
  10113. REGISTER [RFC3261]
  10114. OPTIONS [RFC3261]
  10115. INFO [RFC2976]
  10116. The response code table is initially populated from Section 21, the
  10117. portions labeled Informational, Success, Redirection, Client-Error,
  10118. Server-Error, and Global-Failure. The table has the following
  10119. format:
  10120. Type (e.g., Informational)
  10121. Number Default Reason Phrase [RFC3261]
  10122. The following information needs to be provided in an RFC publication
  10123. in order to register a new response code or method:
  10124. o The RFC number in which the method or response code is
  10125. registered;
  10126. o the number of the response code or name of the method being
  10127. registered;
  10128. o the default reason phrase for that response code, if
  10129. applicable;
  10130. 27.5 The "message/sip" MIME type.
  10131. This document registers the "message/sip" MIME media type in order to
  10132. allow SIP messages to be tunneled as bodies within SIP, primarily for
  10133. end-to-end security purposes. This media type is defined by the
  10134. following information:
  10135. Media type name: message
  10136. Media subtype name: sip
  10137. Required parameters: none
  10138. Optional parameters: version
  10139. version: The SIP-Version number of the enclosed message (e.g.,
  10140. "2.0"). If not present, the version defaults to "2.0".
  10141. Encoding scheme: SIP messages consist of an 8-bit header
  10142. optionally followed by a binary MIME data object. As such, SIP
  10143. messages must be treated as binary. Under normal circumstances
  10144. SIP messages are transported over binary-capable transports, no
  10145. special encodings are needed.
  10146. Rosenberg, et. al. Standards Track [Page 254]
  10147. RFC 3261 SIP: Session Initiation Protocol June 2002
  10148. Security considerations: see below
  10149. Motivation and examples of this usage as a security mechanism
  10150. in concert with S/MIME are given in 23.4.
  10151. 27.6 New Content-Disposition Parameter Registrations
  10152. This document also registers four new Content-Disposition header
  10153. "disposition-types": alert, icon, session and render. The authors
  10154. request that these values be recorded in the IANA registry for
  10155. Content-Dispositions.
  10156. Descriptions of these "disposition-types", including motivation and
  10157. examples, are given in Section 20.11.
  10158. Short descriptions suitable for the IANA registry are:
  10159. alert the body is a custom ring tone to alert the user
  10160. icon the body is displayed as an icon to the user
  10161. render the body should be displayed to the user
  10162. session the body describes a communications session, for
  10163. example, as RFC 2327 SDP body
  10164. 28 Changes From RFC 2543
  10165. This RFC revises RFC 2543. It is mostly backwards compatible with
  10166. RFC 2543. The changes described here fix many errors discovered in
  10167. RFC 2543 and provide information on scenarios not detailed in RFC
  10168. 2543. The protocol has been presented in a more cleanly layered
  10169. model here.
  10170. We break the differences into functional behavior that is a
  10171. substantial change from RFC 2543, which has impact on
  10172. interoperability or correct operation in some cases, and functional
  10173. behavior that is different from RFC 2543 but not a potential source
  10174. of interoperability problems. There have been countless
  10175. clarifications as well, which are not documented here.
  10176. 28.1 Major Functional Changes
  10177. o When a UAC wishes to terminate a call before it has been answered,
  10178. it sends CANCEL. If the original INVITE still returns a 2xx, the
  10179. UAC then sends BYE. BYE can only be sent on an existing call leg
  10180. (now called a dialog in this RFC), whereas it could be sent at any
  10181. time in RFC 2543.
  10182. o The SIP BNF was converted to be RFC 2234 compliant.
  10183. Rosenberg, et. al. Standards Track [Page 255]
  10184. RFC 3261 SIP: Session Initiation Protocol June 2002
  10185. o SIP URL BNF was made more general, allowing a greater set of
  10186. characters in the user part. Furthermore, comparison rules were
  10187. simplified to be primarily case-insensitive, and detailed handling
  10188. of comparison in the presence of parameters was described. The
  10189. most substantial change is that a URI with a parameter with the
  10190. default value does not match a URI without that parameter.
  10191. o Removed Via hiding. It had serious trust issues, since it relied
  10192. on the next hop to perform the obfuscation process. Instead, Via
  10193. hiding can be done as a local implementation choice in stateful
  10194. proxies, and thus is no longer documented.
  10195. o In RFC 2543, CANCEL and INVITE transactions were intermingled.
  10196. They are separated now. When a user sends an INVITE and then a
  10197. CANCEL, the INVITE transaction still terminates normally. A UAS
  10198. needs to respond to the original INVITE request with a 487
  10199. response.
  10200. o Similarly, CANCEL and BYE transactions were intermingled; RFC 2543
  10201. allowed the UAS not to send a response to INVITE when a BYE was
  10202. received. That is disallowed here. The original INVITE needs a
  10203. response.
  10204. o In RFC 2543, UAs needed to support only UDP. In this RFC, UAs
  10205. need to support both UDP and TCP.
  10206. o In RFC 2543, a forking proxy only passed up one challenge from
  10207. downstream elements in the event of multiple challenges. In this
  10208. RFC, proxies are supposed to collect all challenges and place them
  10209. into the forwarded response.
  10210. o In Digest credentials, the URI needs to be quoted; this is unclear
  10211. from RFC 2617 and RFC 2069 which are both inconsistent on it.
  10212. o SDP processing has been split off into a separate specification
  10213. [13], and more fully specified as a formal offer/answer exchange
  10214. process that is effectively tunneled through SIP. SDP is allowed
  10215. in INVITE/200 or 200/ACK for baseline SIP implementations; RFC
  10216. 2543 alluded to the ability to use it in INVITE, 200, and ACK in a
  10217. single transaction, but this was not well specified. More complex
  10218. SDP usages are allowed in extensions.
  10219. Rosenberg, et. al. Standards Track [Page 256]
  10220. RFC 3261 SIP: Session Initiation Protocol June 2002
  10221. o Added full support for IPv6 in URIs and in the Via header field.
  10222. Support for IPv6 in Via has required that its header field
  10223. parameters allow the square bracket and colon characters. These
  10224. characters were previously not permitted. In theory, this could
  10225. cause interop problems with older implementations. However, we
  10226. have observed that most implementations accept any non-control
  10227. ASCII character in these parameters.
  10228. o DNS SRV procedure is now documented in a separate specification
  10229. [4]. This procedure uses both SRV and NAPTR resource records and
  10230. no longer combines data from across SRV records as described in
  10231. RFC 2543.
  10232. o Loop detection has been made optional, supplanted by a mandatory
  10233. usage of Max-Forwards. The loop detection procedure in RFC 2543
  10234. had a serious bug which would report "spirals" as an error
  10235. condition when it was not. The optional loop detection procedure
  10236. is more fully and correctly specified here.
  10237. o Usage of tags is now mandatory (they were optional in RFC 2543),
  10238. as they are now the fundamental building blocks of dialog
  10239. identification.
  10240. o Added the Supported header field, allowing for clients to indicate
  10241. what extensions are supported to a server, which can apply those
  10242. extensions to the response, and indicate their usage with a
  10243. Require in the response.
  10244. o Extension parameters were missing from the BNF for several header
  10245. fields, and they have been added.
  10246. o Handling of Route and Record-Route construction was very
  10247. underspecified in RFC 2543, and also not the right approach. It
  10248. has been substantially reworked in this specification (and made
  10249. vastly simpler), and this is arguably the largest change.
  10250. Backwards compatibility is still provided for deployments that do
  10251. not use "pre-loaded routes", where the initial request has a set
  10252. of Route header field values obtained in some way outside of
  10253. Record-Route. In those situations, the new mechanism is not
  10254. interoperable.
  10255. o In RFC 2543, lines in a message could be terminated with CR, LF,
  10256. or CRLF. This specification only allows CRLF.
  10257. Rosenberg, et. al. Standards Track [Page 257]
  10258. RFC 3261 SIP: Session Initiation Protocol June 2002
  10259. o Usage of Route in CANCEL and ACK was not well defined in RFC 2543.
  10260. It is now well specified; if a request had a Route header field,
  10261. its CANCEL or ACK for a non-2xx response to the request need to
  10262. carry the same Route header field values. ACKs for 2xx responses
  10263. use the Route values learned from the Record-Route of the 2xx
  10264. responses.
  10265. o RFC 2543 allowed multiple requests in a single UDP packet. This
  10266. usage has been removed.
  10267. o Usage of absolute time in the Expires header field and parameter
  10268. has been removed. It caused interoperability problems in elements
  10269. that were not time synchronized, a common occurrence. Relative
  10270. times are used instead.
  10271. o The branch parameter of the Via header field value is now
  10272. mandatory for all elements to use. It now plays the role of a
  10273. unique transaction identifier. This avoids the complex and bug-
  10274. laden transaction identification rules from RFC 2543. A magic
  10275. cookie is used in the parameter value to determine if the previous
  10276. hop has made the parameter globally unique, and comparison falls
  10277. back to the old rules when it is not present. Thus,
  10278. interoperability is assured.
  10279. o In RFC 2543, closure of a TCP connection was made equivalent to a
  10280. CANCEL. This was nearly impossible to implement (and wrong) for
  10281. TCP connections between proxies. This has been eliminated, so
  10282. that there is no coupling between TCP connection state and SIP
  10283. processing.
  10284. o RFC 2543 was silent on whether a UA could initiate a new
  10285. transaction to a peer while another was in progress. That is now
  10286. specified here. It is allowed for non-INVITE requests, disallowed
  10287. for INVITE.
  10288. o PGP was removed. It was not sufficiently specified, and not
  10289. compatible with the more complete PGP MIME. It was replaced with
  10290. S/MIME.
  10291. o Added the "sips" URI scheme for end-to-end TLS. This scheme is
  10292. not backwards compatible with RFC 2543. Existing elements that
  10293. receive a request with a SIPS URI scheme in the Request-URI will
  10294. likely reject the request. This is actually a feature; it ensures
  10295. that a call to a SIPS URI is only delivered if all path hops can
  10296. be secured.
  10297. Rosenberg, et. al. Standards Track [Page 258]
  10298. RFC 3261 SIP: Session Initiation Protocol June 2002
  10299. o Additional security features were added with TLS, and these are
  10300. described in a much larger and complete security considerations
  10301. section.
  10302. o In RFC 2543, a proxy was not required to forward provisional
  10303. responses from 101 to 199 upstream. This was changed to MUST.
  10304. This is important, since many subsequent features depend on
  10305. delivery of all provisional responses from 101 to 199.
  10306. o Little was said about the 503 response code in RFC 2543. It has
  10307. since found substantial use in indicating failure or overload
  10308. conditions in proxies. This requires somewhat special treatment.
  10309. Specifically, receipt of a 503 should trigger an attempt to
  10310. contact the next element in the result of a DNS SRV lookup. Also,
  10311. 503 response is only forwarded upstream by a proxy under certain
  10312. conditions.
  10313. o RFC 2543 defined, but did no sufficiently specify, a mechanism for
  10314. UA authentication of a server. That has been removed. Instead,
  10315. the mutual authentication procedures of RFC 2617 are allowed.
  10316. o A UA cannot send a BYE for a call until it has received an ACK for
  10317. the initial INVITE. This was allowed in RFC 2543 but leads to a
  10318. potential race condition.
  10319. o A UA or proxy cannot send CANCEL for a transaction until it gets a
  10320. provisional response for the request. This was allowed in RFC
  10321. 2543 but leads to potential race conditions.
  10322. o The action parameter in registrations has been deprecated. It was
  10323. insufficient for any useful services, and caused conflicts when
  10324. application processing was applied in proxies.
  10325. o RFC 2543 had a number of special cases for multicast. For
  10326. example, certain responses were suppressed, timers were adjusted,
  10327. and so on. Multicast now plays a more limited role, and the
  10328. protocol operation is unaffected by usage of multicast as opposed
  10329. to unicast. The limitations as a result of that are documented.
  10330. o Basic authentication has been removed entirely and its usage
  10331. forbidden.
  10332. Rosenberg, et. al. Standards Track [Page 259]
  10333. RFC 3261 SIP: Session Initiation Protocol June 2002
  10334. o Proxies no longer forward a 6xx immediately on receiving it.
  10335. Instead, they CANCEL pending branches immediately. This avoids a
  10336. potential race condition that would result in a UAC getting a 6xx
  10337. followed by a 2xx. In all cases except this race condition, the
  10338. result will be the same - the 6xx is forwarded upstream.
  10339. o RFC 2543 did not address the problem of request merging. This
  10340. occurs when a request forks at a proxy and later rejoins at an
  10341. element. Handling of merging is done only at a UA, and procedures
  10342. are defined for rejecting all but the first request.
  10343. 28.2 Minor Functional Changes
  10344. o Added the Alert-Info, Error-Info, and Call-Info header fields for
  10345. optional content presentation to users.
  10346. o Added the Content-Language, Content-Disposition and MIME-Version
  10347. header fields.
  10348. o Added a "glare handling" mechanism to deal with the case where
  10349. both parties send each other a re-INVITE simultaneously. It uses
  10350. the new 491 (Request Pending) error code.
  10351. o Added the In-Reply-To and Reply-To header fields for supporting
  10352. the return of missed calls or messages at a later time.
  10353. o Added TLS and SCTP as valid SIP transports.
  10354. o There were a variety of mechanisms described for handling failures
  10355. at any time during a call; those are now generally unified. BYE
  10356. is sent to terminate.
  10357. o RFC 2543 mandated retransmission of INVITE responses over TCP, but
  10358. noted it was really only needed for 2xx. That was an artifact of
  10359. insufficient protocol layering. With a more coherent transaction
  10360. layer defined here, that is no longer needed. Only 2xx responses
  10361. to INVITEs are retransmitted over TCP.
  10362. o Client and server transaction machines are now driven based on
  10363. timeouts rather than retransmit counts. This allows the state
  10364. machines to be properly specified for TCP and UDP.
  10365. o The Date header field is used in REGISTER responses to provide a
  10366. simple means for auto-configuration of dates in user agents.
  10367. o Allowed a registrar to reject registrations with expirations that
  10368. are too short in duration. Defined the 423 response code and the
  10369. Min-Expires for this purpose.
  10370. Rosenberg, et. al. Standards Track [Page 260]
  10371. RFC 3261 SIP: Session Initiation Protocol June 2002
  10372. 29 Normative References
  10373. [1] Handley, M. and V. Jacobson, "SDP: Session Description
  10374. Protocol", RFC 2327, April 1998.
  10375. [2] Bradner, S., "Key words for use in RFCs to Indicate Requirement
  10376. Levels", BCP 14, RFC 2119, March 1997.
  10377. [3] Resnick, P., "Internet Message Format", RFC 2822, April 2001.
  10378. [4] Rosenberg, J. and H. Schulzrinne, "SIP: Locating SIP Servers",
  10379. RFC 3263, June 2002.
  10380. [5] Berners-Lee, T., Fielding, R. and L. Masinter, "Uniform Resource
  10381. Identifiers (URI): Generic Syntax", RFC 2396, August 1998.
  10382. [6] Chown, P., "Advanced Encryption Standard (AES) Ciphersuites for
  10383. Transport Layer Security (TLS)", RFC 3268, June 2002.
  10384. [7] Yergeau, F., "UTF-8, a transformation format of ISO 10646", RFC
  10385. 2279, January 1998.
  10386. [8] Fielding, R., Gettys, J., Mogul, J., Frystyk, H., Masinter, L.,
  10387. Leach, P. and T. Berners-Lee, "Hypertext Transfer Protocol --
  10388. HTTP/1.1", RFC 2616, June 1999.
  10389. [9] Vaha-Sipila, A., "URLs for Telephone Calls", RFC 2806, April
  10390. 2000.
  10391. [10] Crocker, D. and P. Overell, "Augmented BNF for Syntax
  10392. Specifications: ABNF", RFC 2234, November 1997.
  10393. [11] Freed, F. and N. Borenstein, "Multipurpose Internet Mail
  10394. Extensions (MIME) Part Two: Media Types", RFC 2046, November
  10395. 1996.
  10396. [12] Eastlake, D., Crocker, S. and J. Schiller, "Randomness
  10397. Recommendations for Security", RFC 1750, December 1994.
  10398. [13] Rosenberg, J. and H. Schulzrinne, "An Offer/Answer Model with
  10399. SDP", RFC 3264, June 2002.
  10400. [14] Postel, J., "User Datagram Protocol", STD 6, RFC 768, August
  10401. 1980.
  10402. [15] Postel, J., "DoD Standard Transmission Control Protocol", RFC
  10403. 761, January 1980.
  10404. Rosenberg, et. al. Standards Track [Page 261]
  10405. RFC 3261 SIP: Session Initiation Protocol June 2002
  10406. [16] Stewart, R., Xie, Q., Morneault, K., Sharp, C., Schwarzbauer,
  10407. H., Taylor, T., Rytina, I., Kalla, M., Zhang, L. and V. Paxson,
  10408. "Stream Control Transmission Protocol", RFC 2960, October 2000.
  10409. [17] Franks, J., Hallam-Baker, P., Hostetler, J., Lawrence, S.,
  10410. Leach, P., Luotonen, A. and L. Stewart, "HTTP authentication:
  10411. Basic and Digest Access Authentication", RFC 2617, June 1999.
  10412. [18] Troost, R., Dorner, S. and K. Moore, "Communicating Presentation
  10413. Information in Internet Messages: The Content-Disposition Header
  10414. Field", RFC 2183, August 1997.
  10415. [19] Zimmerer, E., Peterson, J., Vemuri, A., Ong, L., Audet, F.,
  10416. Watson, M. and M. Zonoun, "MIME media types for ISUP and QSIG
  10417. Objects", RFC 3204, December 2001.
  10418. [20] Braden, R., "Requirements for Internet Hosts - Application and
  10419. Support", STD 3, RFC 1123, October 1989.
  10420. [21] Alvestrand, H., "IETF Policy on Character Sets and Languages",
  10421. BCP 18, RFC 2277, January 1998.
  10422. [22] Galvin, J., Murphy, S., Crocker, S. and N. Freed, "Security
  10423. Multiparts for MIME: Multipart/Signed and Multipart/Encrypted",
  10424. RFC 1847, October 1995.
  10425. [23] Housley, R., "Cryptographic Message Syntax", RFC 2630, June
  10426. 1999.
  10427. [24] Ramsdell B., "S/MIME Version 3 Message Specification", RFC 2633,
  10428. June 1999.
  10429. [25] Dierks, T. and C. Allen, "The TLS Protocol Version 1.0", RFC
  10430. 2246, January 1999.
  10431. [26] Kent, S. and R. Atkinson, "Security Architecture for the
  10432. Internet Protocol", RFC 2401, November 1998.
  10433. 30 Informative References
  10434. [27] R. Pandya, "Emerging mobile and personal communication systems,"
  10435. IEEE Communications Magazine, Vol. 33, pp. 44--52, June 1995.
  10436. [28] Schulzrinne, H., Casner, S., Frederick, R. and V. Jacobson,
  10437. "RTP: A Transport Protocol for Real-Time Applications", RFC
  10438. 1889, January 1996.
  10439. Rosenberg, et. al. Standards Track [Page 262]
  10440. RFC 3261 SIP: Session Initiation Protocol June 2002
  10441. [29] Schulzrinne, H., Rao, R. and R. Lanphier, "Real Time Streaming
  10442. Protocol (RTSP)", RFC 2326, April 1998.
  10443. [30] Cuervo, F., Greene, N., Rayhan, A., Huitema, C., Rosen, B. and
  10444. J. Segers, "Megaco Protocol Version 1.0", RFC 3015, November
  10445. 2000.
  10446. [31] Handley, M., Schulzrinne, H., Schooler, E. and J. Rosenberg,
  10447. "SIP: Session Initiation Protocol", RFC 2543, March 1999.
  10448. [32] Hoffman, P., Masinter, L. and J. Zawinski, "The mailto URL
  10449. scheme", RFC 2368, July 1998.
  10450. [33] E. M. Schooler, "A multicast user directory service for
  10451. synchronous rendezvous," Master's Thesis CS-TR-96-18, Department
  10452. of Computer Science, California Institute of Technology,
  10453. Pasadena, California, Aug. 1996.
  10454. [34] Donovan, S., "The SIP INFO Method", RFC 2976, October 2000.
  10455. [35] Rivest, R., "The MD5 Message-Digest Algorithm", RFC 1321, April
  10456. 1992.
  10457. [36] Dawson, F. and T. Howes, "vCard MIME Directory Profile", RFC
  10458. 2426, September 1998.
  10459. [37] Good, G., "The LDAP Data Interchange Format (LDIF) - Technical
  10460. Specification", RFC 2849, June 2000.
  10461. [38] Palme, J., "Common Internet Message Headers", RFC 2076,
  10462. February 1997.
  10463. [39] Franks, J., Hallam-Baker, P., Hostetler, J., Leach, P.,
  10464. Luotonen, A., Sink, E. and L. Stewart, "An Extension to HTTP:
  10465. Digest Access Authentication", RFC 2069, January 1997.
  10466. [40] Johnston, A., Donovan, S., Sparks, R., Cunningham, C., Willis,
  10467. D., Rosenberg, J., Summers, K. and H. Schulzrinne, "SIP Call
  10468. Flow Examples", Work in Progress.
  10469. [41] E. M. Schooler, "Case study: multimedia conference control in a
  10470. packet-switched teleconferencing system," Journal of
  10471. Internetworking: Research and Experience, Vol. 4, pp. 99--120,
  10472. June 1993. ISI reprint series ISI/RS-93-359.
  10473. Rosenberg, et. al. Standards Track [Page 263]
  10474. RFC 3261 SIP: Session Initiation Protocol June 2002
  10475. [42] H. Schulzrinne, "Personal mobility for multimedia services in
  10476. the Internet," in European Workshop on Interactive Distributed
  10477. Multimedia Systems and Services (IDMS), (Berlin, Germany), Mar.
  10478. 1996.
  10479. [43] Floyd, S., "Congestion Control Principles", RFC 2914, September
  10480. 2000.
  10481. Rosenberg, et. al. Standards Track [Page 264]
  10482. RFC 3261 SIP: Session Initiation Protocol June 2002
  10483. A Table of Timer Values
  10484. Table 4 summarizes the meaning and defaults of the various timers
  10485. used by this specification.
  10486. Timer Value Section Meaning
  10487. ----------------------------------------------------------------------
  10488. T1 500ms default Section 17.1.1.1 RTT Estimate
  10489. T2 4s Section 17.1.2.2 The maximum retransmit
  10490. interval for non-INVITE
  10491. requests and INVITE
  10492. responses
  10493. T4 5s Section 17.1.2.2 Maximum duration a
  10494. message will
  10495. remain in the network
  10496. Timer A initially T1 Section 17.1.1.2 INVITE request retransmit
  10497. interval, for UDP only
  10498. Timer B 64*T1 Section 17.1.1.2 INVITE transaction
  10499. timeout timer
  10500. Timer C > 3min Section 16.6 proxy INVITE transaction
  10501. bullet 11 timeout
  10502. Timer D > 32s for UDP Section 17.1.1.2 Wait time for response
  10503. 0s for TCP/SCTP retransmits
  10504. Timer E initially T1 Section 17.1.2.2 non-INVITE request
  10505. retransmit interval,
  10506. UDP only
  10507. Timer F 64*T1 Section 17.1.2.2 non-INVITE transaction
  10508. timeout timer
  10509. Timer G initially T1 Section 17.2.1 INVITE response
  10510. retransmit interval
  10511. Timer H 64*T1 Section 17.2.1 Wait time for
  10512. ACK receipt
  10513. Timer I T4 for UDP Section 17.2.1 Wait time for
  10514. 0s for TCP/SCTP ACK retransmits
  10515. Timer J 64*T1 for UDP Section 17.2.2 Wait time for
  10516. 0s for TCP/SCTP non-INVITE request
  10517. retransmits
  10518. Timer K T4 for UDP Section 17.1.2.2 Wait time for
  10519. 0s for TCP/SCTP response retransmits
  10520. Table 4: Summary of timers
  10521. Rosenberg, et. al. Standards Track [Page 265]
  10522. RFC 3261 SIP: Session Initiation Protocol June 2002
  10523. Acknowledgments
  10524. We wish to thank the members of the IETF MMUSIC and SIP WGs for their
  10525. comments and suggestions. Detailed comments were provided by Ofir
  10526. Arkin, Brian Bidulock, Jim Buller, Neil Deason, Dave Devanathan,
  10527. Keith Drage, Bill Fenner, Cedric Fluckiger, Yaron Goland, John
  10528. Hearty, Bernie Hoeneisen, Jo Hornsby, Phil Hoffer, Christian Huitema,
  10529. Hisham Khartabil, Jean Jervis, Gadi Karmi, Peter Kjellerstedt, Anders
  10530. Kristensen, Jonathan Lennox, Gethin Liddell, Allison Mankin, William
  10531. Marshall, Rohan Mahy, Keith Moore, Vern Paxson, Bob Penfield, Moshe
  10532. J. Sambol, Chip Sharp, Igor Slepchin, Eric Tremblay, and Rick
  10533. Workman.
  10534. Brian Rosen provided the compiled BNF.
  10535. Jean Mahoney provided technical writing assistance.
  10536. This work is based, inter alia, on [41,42].
  10537. Rosenberg, et. al. Standards Track [Page 266]
  10538. RFC 3261 SIP: Session Initiation Protocol June 2002
  10539. Authors' Addresses
  10540. Authors addresses are listed alphabetically for the editors, the
  10541. writers, and then the original authors of RFC 2543. All listed
  10542. authors actively contributed large amounts of text to this document.
  10543. Jonathan Rosenberg
  10544. dynamicsoft
  10545. 72 Eagle Rock Ave
  10546. East Hanover, NJ 07936
  10547. USA
  10548. EMail: jdrosen@dynamicsoft.com
  10549. Henning Schulzrinne
  10550. Dept. of Computer Science
  10551. Columbia University
  10552. 1214 Amsterdam Avenue
  10553. New York, NY 10027
  10554. USA
  10555. EMail: schulzrinne@cs.columbia.edu
  10556. Gonzalo Camarillo
  10557. Ericsson
  10558. Advanced Signalling Research Lab.
  10559. FIN-02420 Jorvas
  10560. Finland
  10561. EMail: Gonzalo.Camarillo@ericsson.com
  10562. Alan Johnston
  10563. WorldCom
  10564. 100 South 4th Street
  10565. St. Louis, MO 63102
  10566. USA
  10567. EMail: alan.johnston@wcom.com
  10568. Rosenberg, et. al. Standards Track [Page 267]
  10569. RFC 3261 SIP: Session Initiation Protocol June 2002
  10570. Jon Peterson
  10571. NeuStar, Inc
  10572. 1800 Sutter Street, Suite 570
  10573. Concord, CA 94520
  10574. USA
  10575. EMail: jon.peterson@neustar.com
  10576. Robert Sparks
  10577. dynamicsoft, Inc.
  10578. 5100 Tennyson Parkway
  10579. Suite 1200
  10580. Plano, Texas 75024
  10581. USA
  10582. EMail: rsparks@dynamicsoft.com
  10583. Mark Handley
  10584. International Computer Science Institute
  10585. 1947 Center St, Suite 600
  10586. Berkeley, CA 94704
  10587. USA
  10588. EMail: mjh@icir.org
  10589. Eve Schooler
  10590. AT&T Labs-Research
  10591. 75 Willow Road
  10592. Menlo Park, CA 94025
  10593. USA
  10594. EMail: schooler@research.att.com
  10595. Rosenberg, et. al. Standards Track [Page 268]
  10596. RFC 3261 SIP: Session Initiation Protocol June 2002
  10597. Full Copyright Statement
  10598. Copyright (C) The Internet Society (2002). All Rights Reserved.
  10599. This document and translations of it may be copied and furnished to
  10600. others, and derivative works that comment on or otherwise explain it
  10601. or assist in its implementation may be prepared, copied, published
  10602. and distributed, in whole or in part, without restriction of any
  10603. kind, provided that the above copyright notice and this paragraph are
  10604. included on all such copies and derivative works. However, this
  10605. document itself may not be modified in any way, such as by removing
  10606. the copyright notice or references to the Internet Society or other
  10607. Internet organizations, except as needed for the purpose of
  10608. developing Internet standards in which case the procedures for
  10609. copyrights defined in the Internet Standards process must be
  10610. followed, or as required to translate it into languages other than
  10611. English.
  10612. The limited permissions granted above are perpetual and will not be
  10613. revoked by the Internet Society or its successors or assigns.
  10614. This document and the information contained herein is provided on an
  10615. "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
  10616. TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
  10617. BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
  10618. HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
  10619. MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
  10620. Acknowledgement
  10621. Funding for the RFC Editor function is currently provided by the
  10622. Internet Society.
  10623. Rosenberg, et. al. Standards Track [Page 269]