(verified_number, text, metadata=None,
        logged_subevent=None, events=[])
return queue_outgoing_sms(msg)
Sends an sms using the given verified phone number entry.

    verified_number The PhoneNumber entry to use when sending.
    text            The text of the message to send.

    return  True on success, False on failure
Sends an sms using the given verified phone number entry.
Sends an sms using the given verified phone number entry .
def send_sms_to_verified_number(verified_number, text, metadata=None,
        logged_subevent=None, events=[]):
    """
    Sends an sms using the given verified phone number entry.

    verified_number The PhoneNumber entry to use when sending.
    text            The text of the message to send.

    return  True on success, False on failure
    """
    try:
        backend = verified_number.backend
    except BadSMSConfigException as e:
        if logged_subevent:
            logged_subevent.error(MessagingEvent.ERROR_GATEWAY_NOT_FOUND,
                additional_error_text=str(e))
            return False
        raise

    msg = get_sms_class()(
        couch_recipient_doc_type = verified_number.owner_doc_type,
        couch_recipient = verified_number.owner_id,
        phone_number = "+" + str(verified_number.phone_number),
        direction = OUTGOING,
        date=get_utcnow(),
        domain = verified_number.domain,
        backend_id=backend.couch_id,
        location_id=get_location_id_by_verified_number(verified_number),
        text = text
    )
    add_msg_tags(msg, metadata)

    msg.custom_metadata = {}
    for event in events:
        multimedia_fields = ('caption_image', 'caption_audio', 'caption_video')
        for field in multimedia_fields:
            value = getattr(event, field, None)
            if value is not None:
                msg.custom_metadata[field] = value
    msg.save()

    return queue_outgoing_sms(msg)
def send_sms_to_verified_number ( verified_number , text , metadata = None , logged_subevent = None , events = [ ] ) : try : backend = verified_number . backend except BadSMSConfigException as e : if logged_subevent : logged_subevent . error ( MessagingEvent . ERROR_GATEWAY_NOT_FOUND , additional_error_text = str ( e ) ) return False raise msg = get_sms_class ( ) ( couch_recipient_doc_type = verified_number . owner_doc_type , couch_recipient = verified_number . owner_id , phone_number = "+" + str ( verified_number . phone_number ) , direction = OUTGOING , date = get_utcnow ( ) , domain = verified_number . domain , backend_id = backend . couch_id , location_id = get_location_id_by_verified_number ( verified_number ) , text = text ) add_msg_tags ( msg , metadata ) msg . custom_metadata = { } for event in events : multimedia_fields = ( 'caption_image' , 'caption_audio' , 'caption_video' ) for field in multimedia_fields : value = getattr ( event , field , None ) if value is not None : msg . custom_metadata [ field ] = value msg . save ( ) return queue_outgoing_sms ( msg )