当前位置: 首页>>代码示例>>Python>>正文


Python CallLog.error方法代码示例

本文整理汇总了Python中corehq.apps.sms.models.CallLog.error方法的典型用法代码示例。如果您正苦于以下问题:Python CallLog.error方法的具体用法?Python CallLog.error怎么用?Python CallLog.error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在corehq.apps.sms.models.CallLog的用法示例。


在下文中一共展示了CallLog.error方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: initiate_outbound_call

# 需要导入模块: from corehq.apps.sms.models import CallLog [as 别名]
# 或者: from corehq.apps.sms.models.CallLog import error [as 别名]
def initiate_outbound_call(recipient, form_unique_id, submit_partial_form,
    include_case_side_effects, max_question_retries, verified_number=None,
    unverified_number=None, case_id=None, case_for_case_submission=False,
    timestamp=None):
    """
    Returns True if the call was queued successfully, or False if an error
    occurred.
    """
    call_log_entry = None
    try:
        if not verified_number and not unverified_number:
            return False
        phone_number = (verified_number.phone_number if verified_number
            else unverified_number)
        call_log_entry = CallLog(
            couch_recipient_doc_type=recipient.doc_type,
            couch_recipient=recipient.get_id,
            phone_number="+%s" % str(phone_number),
            direction=OUTGOING,
            date=timestamp or datetime.utcnow(),
            domain=recipient.domain,
            form_unique_id=form_unique_id,
            submit_partial_form=submit_partial_form,
            include_case_side_effects=include_case_side_effects,
            max_question_retries=max_question_retries,
            current_question_retry_count=0,
            case_id=case_id,
            case_for_case_submission=case_for_case_submission,
        )
        backend = get_ivr_backend(recipient, verified_number, unverified_number)
        if not backend:
            return False
        kwargs = backend.get_cleaned_outbound_params()
        module = __import__(backend.outbound_module,
            fromlist=["initiate_outbound_call"])
        call_log_entry.backend_api = module.API_ID
        call_log_entry.save()
        return module.initiate_outbound_call(call_log_entry, **kwargs)
    except Exception:
        if call_log_entry:
            call_log_entry.error = True
            call_log_entry.error_message = "Internal Server Error"
            call_log_entry.save()
        raise
开发者ID:jmaina,项目名称:commcare-hq,代码行数:46,代码来源:api.py


注:本文中的corehq.apps.sms.models.CallLog.error方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。