Пример #1
0
 def dispatch_inbound_message(self, msg):
     log.msg("Dispatch inbound %r" % msg)
     route_mapping = False
     try:
         names = self.config['route_mappings'][msg['transport_name']]
         for name in names:
             log.msg("Dispatch inbound to %s" % name)
             self.dispatcher.publish_outbound_message(name, msg.copy())
             route_mapping = True
     except:
         pass
     if route_mapping:
         return
     toaddr = msg['to_addr']
     for name, regex in self.toaddr_mappings:
         if regex.match(toaddr):
             log.msg("Dispatch outbound %s to %s" % (toaddr, name))
             self.dispatcher.publish_outbound_message(name, msg.copy())
             return
     if 'toaddr_fallback' in self.config and self.config[
             'toaddr_fallback'] is not None:
         log.msg("Dispatch outbound %s to fallback" % toaddr)
         self.dispatcher.publish_outbound_message(
             self.config['toaddr_fallback'], msg.copy())
         return
     log.err("No route for %s" % repr(msg))
Пример #2
0
 def dispatch_inbound_message(self, msg):
     log.msg("Dispatch inbound %r" % msg)
     route_mapping = False
     try:
         names = self.config['route_mappings'][msg['transport_name']]
         for name in names:
             log.msg("Dispatch inbound to %s" % name)
             self.dispatcher.publish_outbound_message(name, msg.copy())
             route_mapping = True
     except:
         pass
     if route_mapping:
         return
     toaddr = msg['to_addr']
     for name, regex in self.toaddr_mappings:
         if regex.match(toaddr):
             log.msg("Dispatch outbound %s to %s" % (toaddr, name))
             self.dispatcher.publish_outbound_message(name, msg.copy())
             return
     if 'toaddr_fallback' in self.config and self.config['toaddr_fallback'] is not None:
         log.msg("Dispatch outbound %s to fallback" % toaddr)
         self.dispatcher.publish_outbound_message(self.config['toaddr_fallback'], msg.copy())
         return
     log.err("No route for %s" % repr(msg))
Пример #3
0
 def dispatch_outbound_message(self, msg):
     log.err("No route for outbound %s" % repr(msg))
Пример #4
0
 def dispatch_outbound_message(self, msg):
     log.err("No route for outbound %s" % repr(msg))