<s> from SipConf import SipConf <EOL> from time import time <EOL> from random import random <EOL> class SdpOrigin ( object ) : <EOL> _session_id = int ( random ( ) * time ( ) * <NUM_LIT> ) <EOL> username = None <EOL> session_id = None <EOL> version = None <EOL> network_type = None <EOL> address_type = None <EOL> address = None <EOL> session_id = None <EOL> def __init__ ( self , body = None , cself = None ) : <EOL> if body != None : <EOL> self . username , self . session_id , self . version , self . network_type , self . address_type , self . address = body . split ( ) <EOL> elif cself == None : <EOL> self . username = '<STR_LIT:->' <EOL> self . session_id = SdpOrigin . _session_id <EOL> SdpOrigin . _session_id += <NUM_LIT:1> <EOL> self . version = self . session_id <EOL> self . network_type = '<STR_LIT>' <EOL> self . address_type = '<STR_LIT>' <EOL> self . address = SipConf . my_address <EOL> else : <EOL> self . username = cself . username <EOL> self . session_id = cself . session_id <EOL> self . version = cself . version <EOL> self . network_type = cself . network_type <EOL> self . address_type = cself . address_type <EOL> self . address = cself . address <EOL> def __str__ ( self ) : <EOL> return '<STR_LIT>' % ( self . username , self . session_id , self . version , self . network_type , self . address_type , self . address ) <EOL> def localStr ( self , local_addr = None , local_port = None ) : <EOL> if local_addr != None and '<STR_LIT>' in dir ( self . address ) : <EOL> if local_addr . startswith ( '<STR_LIT:[>' ) : <EOL> address_type = '<STR_LIT>' <EOL> local_addr = local_addr [ <NUM_LIT:1> : - <NUM_LIT:1> ] <EOL> else : <EOL> address_type = '<STR_LIT>' <EOL> return '<STR_LIT>' % ( self . username , self . session_id , self . version , self . network_type , address_type , local_addr ) <EOL> return '<STR_LIT>' % ( self . username , self . session_id , self . version , self . network_type , self . address_type , self . address ) <EOL> def getCopy ( self ) : <EOL> return self . __class__ ( cself = self ) </s>
