@defer.inlineCallbacks
    def perspective_submit_sm(self, cid, SubmitSmPDU, submit_sm_bill, priority=1, validity_period=None,
                              pickled=True, dlr_url=None, dlr_level=1, dlr_method='POST',
                              source_connector='httpapi'):
        connector = self.getConnector(cid)
        if connector is None:
            self.log.error('Trying to enqueue a SUBMIT_SM to a connector with an unknown cid: %s', cid)
            defer.returnValue(False)
        if self.amqpBroker is None:
            self.log.error('AMQP Broker is not added')
            defer.returnValue(False)
        if self.amqpBroker is None:
            self.log.error('Trying to enqueue a SUBMIT_SM when no broker were added')
            defer.returnValue(False)

        # TODO: Future implementation, submitting a sm to a disconnected broker would be possible
        #    through a local in memory queue
        if self.amqpBroker.connected == False:
            self.log.error('AMQP Broker is not connected')
            defer.returnValue(False)

        # Define the destination and response queue names
        pubQueueName = "submit.sm.%s" % cid
        responseQueueName = "submit.sm.resp.%s" % cid

        # Pickle SubmitSmPDU if it's not pickled
        if not pickled:
            # Remove schedule_delivery_time / not supported right now
            if SubmitSmPDU.params['schedule_delivery_time'] is not None:
                SubmitSmPDU.params['schedule_delivery_time'] = None
                self.log.warn('Removing schedule_delivery_time from SubmitSmPDU.')

            PickledSubmitSmPDU = pickle.dumps(SubmitSmPDU, self.pickleProtocol)
            submit_sm_bill = pickle.dumps(submit_sm_bill, self.pickleProtocol)
        else:
            PickledSubmitSmPDU = SubmitSmPDU
            SubmitSmPDU = pickle.loads(PickledSubmitSmPDU)

        # Publishing a pickled PDU
        self.log.debug('Publishing SubmitSmPDU with routing_key=%s, priority=%s', pubQueueName, priority)
        c = SubmitSmContent(
            body=PickledSubmitSmPDU,
            replyto=responseQueueName,
            submit_sm_bill=submit_sm_bill,
            priority=priority,
            expiration=validity_period,
            source_connector='httpapi' if source_connector == 'httpapi' else 'smppsapi')
        yield self.amqpBroker.publish(exchange='messaging', routing_key=pubQueueName, content=c)

        if source_connector == 'httpapi' and dlr_url is not None:
            # Enqueue DLR request in redis 'dlr' key if it is a httpapi request
            if self.redisClient is None or str(self.redisClient) == '<Redis Connection: Not connected>':
                self.log.warn("DLR is not enqueued for SubmitSmPDU [msgid:%s], RC is not connected.",
                              c.properties['message-id'])
            else:
                self.log.debug('Setting DLR url (%s) and level (%s) for message id:%s, expiring in %s',
                               dlr_url,
                               dlr_level,
                               c.properties['message-id'],
                               connector['config'].dlr_expiry)
                # Set values and callback expiration setting
                hashKey = "dlr:%s" % (c.properties['message-id'])
                hashValues = {'sc': 'httpapi',
                              'url': dlr_url,
                              'level': dlr_level,
                              'method': dlr_method,
                              'expiry': connector['config'].dlr_expiry}
                self.redisClient.hmset(hashKey, hashValues).addCallback(
                    lambda response: self.redisClient.expire(
                        hashKey, connector['config'].dlr_expiry))
        elif (isinstance(source_connector, SMPPServerProtocol) and
              SubmitSmPDU.params['registered_delivery'].receipt != RegisteredDeliveryReceipt.NO_SMSC_DELIVERY_RECEIPT_REQUESTED):
            # If submit_sm is successfully sent from a SMPPServerProtocol connector and DLR is
            # requested, then map message-id to the source_connector to permit related deliver_sm
            # messages holding further receipts to be sent back to the right connector
            if self.redisClient is None or str(self.redisClient) == '<Redis Connection: Not connected>':
                self.log.warn("SMPPs mapping is not done for SubmitSmPDU [msgid:%s], RC is not connected.",
                              c.properties['message-id'])
            else:
                self.log.debug(
                    'Setting SMPPs connector (%s) mapping for msgid:%s, registered_dlr: %s, expiring in %s',
                    source_connector.system_id,
                    c.properties['message-id'],
                    SubmitSmPDU.params['registered_delivery'],
                    source_connector.factory.config.dlr_expiry)
                # Set values and callback expiration setting
                hashKey = "dlr:%s" % (c.properties['message-id'])
                hashValues = {'sc': 'smppsapi',
                              'system_id': source_connector.system_id,
                              'source_addr': SubmitSmPDU.params['source_addr'],
                              'destination_addr': SubmitSmPDU.params['destination_addr'],
                              'sub_date': datetime.datetime.now(),
                              'rd_receipt': '%s' % SubmitSmPDU.params['registered_delivery'].receipt,
                              'expiry': source_connector.factory.config.dlr_expiry}
                self.redisClient.hmset(hashKey, hashValues).addCallback(
                    lambda response: self.redisClient.expire(
                        hashKey, source_connector.factory.config.dlr_expiry))

        defer.returnValue(c.properties['message-id'])
This will enqueue a submit_sm to a connector
dataset/ETHPy150Open jookies/jasmin/jasmin/managers/clients.py/SMPPClientManagerPB.perspective_submit_sm