Esempio n. 1
0
  /** 默认收据 */
  public SipcReceipt createDefaultReceipt(String callId, String sequence) {
    SipcReceipt receipt = new SipcReceipt(200, "OK");
    receipt.addHeader(SipcHeader.CALLID, callId);
    receipt.addHeader(SipcHeader.SEQUENCE, sequence);

    return receipt;
  }
Esempio n. 2
0
  public SipcReceipt createHttpInviteReceipt(
      String uri, String callId, String sequence, Port local) {
    SipcReceipt receipt = this.createDefaultReceipt(callId, sequence);
    receipt.addHeader(SipcHeader.FROM, uri);
    receipt.addHeader(SipcHeader.SUPPORTED, "text/html-fragment");
    receipt.addHeader(SipcHeader.SUPPORTED, "text/plain");
    // receipt.addHeader(SipcHeader.SUPPORTED,"multiparty");
    // receipt.addHeader(SipcHeader.SUPPORTED,"nudge");
    // receipt.addHeader(SipcHeader.SUPPORTED,"share-background");
    // receipt.addHeader(SipcHeader.SUPPORTED,"fetion-show");

    // 正文是一些固定的参数
    StringBuffer buffer = new StringBuffer();
    buffer.append("v=0\r\n");
    buffer.append("o=-0 0 IN " + local.toString() + "\r\n");
    buffer.append("s=session\r\n");
    buffer.append("c=IN IP4 " + local.toString() + "\r\n");
    buffer.append("t=0 0\r\n");
    buffer.append("m=message " + Integer.toString(local.getPort()) + " sip " + uri);

    receipt.setBody(new SipcBody(buffer.toString()));

    return receipt;
  }
Esempio n. 3
0
  /** 信息收到收据 */
  public SipcReceipt createDefaultReceipt(String fromUri, String callId, String sequence) {
    SipcReceipt receipt = this.createDefaultReceipt(callId, sequence);
    receipt.addHeader(SipcHeader.FROM, fromUri);

    return receipt;
  }