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


Java SipMessage.MESSAGE_TYPE_FAILED属性代码示例

本文整理汇总了Java中com.csipsimple.api.SipMessage.MESSAGE_TYPE_FAILED属性的典型用法代码示例。如果您正苦于以下问题:Java SipMessage.MESSAGE_TYPE_FAILED属性的具体用法?Java SipMessage.MESSAGE_TYPE_FAILED怎么用?Java SipMessage.MESSAGE_TYPE_FAILED使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.csipsimple.api.SipMessage的用法示例。


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

示例1: on_pager_status

@Override
public void on_pager_status(int callId, pj_str_t to, pj_str_t body, pjsip_status_code status,
        pj_str_t reason) {
    lockCpu();
    // TODO : treat error / acknowledge of messages
    int messageType = (status.equals(pjsip_status_code.PJSIP_SC_OK)
            || status.equals(pjsip_status_code.PJSIP_SC_ACCEPTED)) ? SipMessage.MESSAGE_TYPE_SENT
            : SipMessage.MESSAGE_TYPE_FAILED;
    String toStr = SipUri.getCanonicalSipContact(PjSipService.pjStrToString(to));
    String reasonStr = PjSipService.pjStrToString(reason);
    String bodyStr = PjSipService.pjStrToString(body);
    int statusInt = status.swigValue();
    Log.d(THIS_FILE, "SipMessage in on pager status " + status.toString() + " / " + reasonStr);

    // Update the db
    ContentResolver cr = pjService.service.getContentResolver();
    ContentValues args = new ContentValues();
    args.put(SipMessage.FIELD_TYPE, messageType);
    args.put(SipMessage.FIELD_STATUS, statusInt);
    if (statusInt != StatusCode.OK
            && statusInt != StatusCode.ACCEPTED) {
        args.put(SipMessage.FIELD_BODY, bodyStr + " // " + reasonStr);
    }
    cr.update(SipMessage.MESSAGE_URI, args,
            SipMessage.FIELD_TO + "=? AND " +
                    SipMessage.FIELD_BODY + "=? AND " +
                    SipMessage.FIELD_TYPE + "=" + SipMessage.MESSAGE_TYPE_QUEUED,
            new String[] {
                    toStr, bodyStr
            });

    // Broadcast the information
    Intent intent = new Intent(SipManager.ACTION_SIP_MESSAGE_RECEIVED);
    intent.putExtra(SipMessage.FIELD_FROM, toStr);
    pjService.service.sendBroadcast(intent, SipManager.PERMISSION_USE_SIP);
    unlockCpu();
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:37,代码来源:UAStateReceiver.java


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