當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。