示例#1
0
    def send_sms(self, to_addr, content, message_id, linkid=None):
        """
        Send an SMS.
        """
        def _extractRequestIdentifier((body, header)):
            return gettext(body, './/' + str(SEND_NS.result), default='')

        body = SEND_NS.sendSms(
            SEND_NS.addresses(format_address(to_addr)),
            SEND_NS.message(content),
            SEND_NS.receiptRequest(
                L.endpoint(self.endpoint),
                L.interfaceName(u'SmsNotification'),
                L.correlator(message_id)))
        header = self._make_header(
            service_subscription_address=to_addr,
            linkid=linkid)
        d = self.perform_soap_request(
            uri=self.send_uri,
            action='',
            body=body,
            header=header,
            expected_faults=[PolicyException, ServiceException])
        d.addCallback(_extractRequestIdentifier)
        return d
示例#2
0
文件: client.py 项目: musabaloyi/vumi
 def stop_sms_notification(self):
     """
     Deregister notification delivery with the remote ParlayX service.
     """
     body = NOTIFICATION_MANAGER_NS.stopSmsNotification(
         L.correlator(self._service_correlator))
     header = self._make_header()
     return self.perform_soap_request(uri=self.notification_uri,
                                      action='',
                                      body=body,
                                      header=header,
                                      expected_faults=[ServiceException])
示例#3
0
 def stop_sms_notification(self):
     """
     Deregister notification delivery with the remote ParlayX service.
     """
     body = NOTIFICATION_MANAGER_NS.stopSmsNotification(
         L.correlator(self._service_correlator))
     header = self._make_header()
     return self.perform_soap_request(
         uri=self.notification_uri,
         action='',
         body=body,
         header=header,
         expected_faults=[ServiceException])
示例#4
0
文件: client.py 项目: musabaloyi/vumi
 def start_sms_notification(self):
     """
     Register a notification delivery endpoint with the remote ParlayX
     service.
     """
     body = NOTIFICATION_MANAGER_NS.startSmsNotification(
         NOTIFICATION_MANAGER_NS.reference(
             L.endpoint(self.endpoint),
             L.interfaceName('notifySmsReception'),
             L.correlator(self._service_correlator)),
         NOTIFICATION_MANAGER_NS.smsServiceActivationNumber(
             self.short_code))
     header = self._make_header()
     return self.perform_soap_request(uri=self.notification_uri,
                                      action='',
                                      body=body,
                                      header=header,
                                      expected_faults=[ServiceException])
示例#5
0
 def start_sms_notification(self):
     """
     Register a notification delivery endpoint with the remote ParlayX
     service.
     """
     body = NOTIFICATION_MANAGER_NS.startSmsNotification(
         NOTIFICATION_MANAGER_NS.reference(
             L.endpoint(self.endpoint),
             L.interfaceName('notifySmsReception'),
             L.correlator(self._service_correlator)),
         NOTIFICATION_MANAGER_NS.smsServiceActivationNumber(
             self.short_code))
     header = self._make_header()
     return self.perform_soap_request(
         uri=self.notification_uri,
         action='',
         body=body,
         header=header,
         expected_faults=[ServiceException])
示例#6
0
文件: client.py 项目: musabaloyi/vumi
    def send_sms(self, to_addr, content, message_id, linkid=None):
        """
        Send an SMS.
        """
        def _extractRequestIdentifier((body, header)):
            return gettext(body, './/' + str(SEND_NS.result), default='')

        body = SEND_NS.sendSms(
            SEND_NS.addresses(format_address(to_addr)),
            SEND_NS.message(content),
            SEND_NS.receiptRequest(L.endpoint(self.endpoint),
                                   L.interfaceName(u'SmsNotification'),
                                   L.correlator(message_id)))
        header = self._make_header(service_subscription_address=to_addr,
                                   linkid=linkid)
        d = self.perform_soap_request(
            uri=self.send_uri,
            action='',
            body=body,
            header=header,
            expected_faults=[PolicyException, ServiceException])
        d.addCallback(_extractRequestIdentifier)
        return d