@celery.task
def receive_async(text, connection_id, message_id, fields):
 from rapidsms.models import Connection
 from rapidsms.router import get_router
 logger.debug('receive_async: %s', text)
 router = get_router()
 connection = Connection.objects.select_related().get(pk=connection_id)
 message = router.new_incoming_message(text=text, connections=[connection], id_=message_id, fields=fields)
 try:
  router.process_incoming(message)
 except Exception:
  logger.exception('Exception processing incoming message')
  raise

@ celery . task def receive_async ( text , connection_id , message_id , fields ) : from rapidsms . models import Connection from rapidsms . router import get_router logger . debug ( 'receive_async: %s' , text ) router = get_router ( ) connection = Connection . objects . select_related ( ) . get ( pk = connection_id ) message = router . new_incoming_message ( text = text , connections = [ connection ] , id_ = message_id , fields = fields ) try : router . process_incoming ( message ) except Exception : logger . exception ( 'Exception processing incoming message' ) raise
task used to send inbound message through router phases .