<s> from SipMsg import SipMsg <EOL> from SipHeader import SipHeader <EOL> class SipResponse ( SipMsg ) : <EOL> scode = None <EOL> reason = None <EOL> sipver = None <EOL> def __init__ ( self , buf = None , scode = None , reason = None , sipver = None , to = None , fr0m = None , callid = None , vias = None , <EOL> cseq = None , body = None , rrs = ( ) ) : <EOL> SipMsg . __init__ ( self , buf ) <EOL> if buf != None : <EOL> return <EOL> self . scode , self . reason , self . sipver = scode , reason , sipver <EOL> self . appendHeaders ( [ SipHeader ( name = '<STR_LIT>' , body = x ) for x in vias ] ) <EOL> self . appendHeaders ( [ SipHeader ( name = '<STR_LIT>' , body = x ) for x in rrs ] ) <EOL> self . appendHeader ( SipHeader ( name = '<STR_LIT>' , body = fr0m ) ) <EOL> self . appendHeader ( SipHeader ( name = '<STR_LIT:to>' , body = to ) ) <EOL> self . appendHeader ( SipHeader ( name = '<STR_LIT>' , body = callid ) ) <EOL> self . appendHeader ( SipHeader ( name = '<STR_LIT>' , body = cseq ) ) <EOL> self . appendHeader ( SipHeader ( name = '<STR_LIT>' ) ) <EOL> if body != None : <EOL> self . setBody ( body ) <EOL> def setSL ( self , startline ) : <EOL> sstartline = startline . split ( None , <NUM_LIT:2> ) <EOL> if len ( sstartline ) == <NUM_LIT:2> : <EOL> self . sipver , scode = sstartline <EOL> self . reason = '<STR_LIT>' <EOL> else : <EOL> self . sipver , scode , self . reason = startline . split ( None , <NUM_LIT:2> ) <EOL> self . scode = int ( scode ) <EOL> if self . scode == <NUM_LIT:100> or self . scode >= <NUM_LIT> : <EOL> self . ignorebody = True <EOL> def setSCode ( self , scode , reason ) : <EOL> self . scode = scode <EOL> self . reason = reason <EOL> def getSL ( self ) : <EOL> return self . sipver + '<STR_LIT:U+0020>' + str ( self . scode ) + '<STR_LIT:U+0020>' + self . reason <EOL> def getSCode ( self ) : <EOL> return ( self . scode , self . reason ) </s>
