<s> from Timeout import TimeoutAbs <EOL> from UaStateGeneric import UaStateGeneric <EOL> from CCEvents import CCEventTry , CCEventFail , CCEventRedirect , CCEventDisconnect <EOL> from SipContact import SipContact <EOL> from SipAddress import SipAddress <EOL> from SipURL import SipURL <EOL> from SipTo import SipTo <EOL> from SipFrom import SipFrom <EOL> from SipCallId import SipCallId <EOL> class UacStateIdle ( UaStateGeneric ) : <EOL> sname = '<STR_LIT>' <EOL> def recvEvent ( self , event ) : <EOL> if isinstance ( event , CCEventTry ) : <EOL> if self . ua . setup_ts == None : <EOL> self . ua . setup_ts = event . rtime <EOL> self . ua . origin = '<STR_LIT>' <EOL> cId , cGUID , callingID , calledID , body , auth , callingName = event . getData ( ) <EOL> if body != None : <EOL> if self . ua . on_local_sdp_change != None and body . needs_update : <EOL> self . ua . on_local_sdp_change ( body , lambda x : self . ua . recvEvent ( event ) ) <EOL> return None <EOL> else : <EOL> self . ua . late_media = True <EOL> if cId == None : <EOL> self . ua . cId = SipCallId ( ) <EOL> else : <EOL> self . ua . cId = cId . getCopy ( ) <EOL> self . ua . global_config [ '<STR_LIT>' ] . regConsumer ( self . ua , str ( self . ua . cId ) , compact = self . ua . compact_sip ) <EOL> self . ua . rTarget = SipURL ( username = calledID , host = self . ua . rAddr0 [ <NUM_LIT:0> ] , port = self . ua . rAddr0 [ <NUM_LIT:1> ] ) <EOL> self . ua . rUri = SipTo ( address = SipAddress ( url = self . ua . rTarget . getCopy ( ) , hadbrace = True ) ) <EOL> if self . ua . ruri_userparams != None : <EOL> self . ua . rTarget . userparams = self . ua . ruri_userparams <EOL> self . ua . rUri . getUrl ( ) . port = None <EOL> if self . ua . to_username != None : <EOL> self . ua . rUri . getUrl ( ) . username = self . ua . to_username <EOL> self . ua . lUri = SipFrom ( address = SipAddress ( url = SipURL ( username = callingID ) , hadbrace = True , name = callingName ) ) <EOL> self . ua . lUri . getUrl ( ) . port = None <EOL> if self . ua . from_domain != None : <EOL> self . ua . lUri . getUrl ( ) . host = self . ua . from_domain <EOL> self . ua . lUri . setTag ( self . ua . lTag ) <EOL> self . ua . lCSeq = <NUM_LIT:200> <EOL> if self . ua . lContact == None : <EOL> self . ua . lContact = SipContact ( ) <EOL> self . ua . lContact . getUrl ( ) . username = callingID <EOL> self . ua . routes = [ ] <EOL> self . ua . cGUID = cGUID <EOL> self . ua . lSDP = body <EOL> req = self . ua . genRequest ( '<STR_LIT>' , body , reason = event . reason ) <EOL> self . ua . lCSeq += <NUM_LIT:1> <EOL> self . ua . tr = self . ua . global_config [ '<STR_LIT>' ] . newTransaction ( req , self . ua . recvResponse , laddress = self . ua . source_address , cb_ifver = <NUM_LIT:2> , compact = self . ua . compact_sip ) <EOL> self . ua . auth = None <EOL> if self . ua . expire_time != None : <EOL> self . ua . expire_time += event . rtime <EOL> if self . ua . no_progress_time != None : <EOL> self . ua . no_progress_time += event . rtime <EOL> if self . ua . expire_time != None and self . ua . no_progress_time >= self . ua . expire_time : <EOL> self . ua . no_progress_time = None <EOL> if self . ua . no_reply_time != None : <EOL> if self . ua . no_reply_time < <NUM_LIT:32> : <EOL> self . ua . no_reply_time += event . rtime <EOL> if self . ua . expire_time != None and self . ua . no_reply_time >= self . ua . expire_time : <EOL> self . ua . no_reply_time = None <EOL> elif self . ua . no_progress_time != None and self . ua . no_reply_time >= self . ua . no_progress_time : <EOL> self . ua . no_reply_time = None <EOL> else : <EOL> self . ua . no_reply_time = None <EOL> if self . ua . no_reply_time != None : <EOL> self . ua . no_reply_timer = TimeoutAbs ( self . ua . no_reply_expires , self . ua . no_reply_time ) <EOL> elif self . ua . no_progress_time != None : <EOL> self . ua . no_progress_timer = TimeoutAbs ( self . ua . no_progress_expires , self . ua . no_progress_time ) <EOL> elif self . ua . expire_time != None : <EOL> self . ua . expire_timer = TimeoutAbs ( self . ua . expires , self . ua . expire_time ) <EOL> return ( UacStateTrying , ) <EOL> if isinstance ( event , CCEventFail ) or isinstance ( event , CCEventRedirect ) or isinstance ( event , CCEventDisconnect ) : <EOL> return ( UaStateDead , self . ua . disc_cbs , event . rtime , event . origin ) <EOL> return None <EOL> if not globals ( ) . has_key ( '<STR_LIT>' ) : <EOL> from UacStateTrying import UacStateTrying <EOL> if not globals ( ) . has_key ( '<STR_LIT>' ) : <EOL> from UaStateDead import UaStateDead </s>
