#NEWLINE# def trigger_DLR( self , _id = None , pdu_type = 'deliver_sm' , stat = 'DELIVRD' ) : #NEWLINE# #INDENT# if ( self . lastSubmitSmRestPDU is None ) : #NEWLINE# #INDENT# raise Exception ( 'A submit_sm must be sent to this SMSC before requesting sendDeliverSM !' ) #NEWLINE# #UNINDENT# if ( _id is None ) : #NEWLINE# #INDENT# _id = self . lastSubmitSmRestPDU . params [ 'message_id' ] #NEWLINE# #UNINDENT# if ( pdu_type == 'deliver_sm' ) : #NEWLINE# #INDENT# pdu = DeliverSM ( source_addr = self . lastSubmitSmPDU . params [ 'source_addr' ] , destination_addr = self . lastSubmitSmPDU . params [ 'destination_addr' ] , short_message = ( 'id:%s sub:001 dlvrd:001 submit date:1305050826 done date:1305050826 stat:%s err:000 text:%s' % ( str ( _id ) , stat , pdu . lastSubmitSmPDU . params [ 'short_message' ] [ : 20 ] ) ) , message_state = message_state_map [ stat ] , receipted_message_id = str ( _id ) ) #NEWLINE# self . trigger_deliver_sm ( pdu ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( pdu_type == 'data_sm' ) : #NEWLINE# #INDENT# pdu = DataSM ( source_addr = self . lastSubmitSmPDU . params [ 'source_addr' ] , destination_addr = self . lastSubmitSmPDU . params [ 'destination_addr' ] , message_state = message_state_map [ stat ] , receipted_message_id = str ( _id ) ) #NEWLINE# self . trigger_data_sm ( pdu ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise Exception ( ( 'Unknown pdu_type (%s) when calling trigger_DLR()' % pdu_type ) )