def send_sms(request, to_number, body, callback_urlname="<STR_LIT>"):
client = TwilioRestClient(settings.TWILIO_ACCOUNT_SID, settings.TWILIO_AUTH_TOKEN)<EOL>from_number = settings.TWILIO_PHONE_NUMBER<EOL>message = OutgoingSMS.objects.create(<EOL>from_number=from_number,<EOL>to_number=to_number,<EOL>body=body,<EOL>)<EOL>status_callback = None<EOL>if callback_urlname:<EOL><INDENT>status_callback = build_callback_url(request, callback_urlname, message)<EOL><DEDENT>logger.debug("<STR_LIT>",<EOL>to_number, status_callback, body)<EOL>if not getattr(settings, "<STR_LIT>", False):<EOL><INDENT>sent = client.sms.messages.create(<EOL>to=to_number,<EOL>from_=from_number,<EOL>body=body,<EOL>status_callback=status_callback<EOL>)<EOL>logger.debug("<STR_LIT>", sent.__dict__)<EOL>message.sms_sid = sent.sid<EOL>message.account_sid = sent.account_sid<EOL>message.status = sent.status<EOL>message.to_parsed = sent.to<EOL>if sent.price:<EOL><INDENT>message.price = Decimal(force_text(sent.price))<EOL>message.price_unit = sent.price_unit<EOL><DEDENT>message.sent_at = sent.date_created<EOL>message.save(update_fields=[<EOL>"<STR_LIT>", "<STR_LIT>", "<STR_LIT:status>", "<STR_LIT>",<EOL>"<STR_LIT>", "<STR_LIT>", "<STR_LIT>"<EOL>])<EOL><DEDENT>else:<EOL><INDENT>logger.info("<STR_LIT>", from_number, to_number, body)<EOL><DEDENT>return message<EOL>
Create :class:`OutgoingSMS` object and send SMS using Twilio.