protected NgnPublicationSession(NgnSipStack sipStack, String toUri) {
    super(sipStack);
    mSession = new PublicationSession(sipStack);

    super.init();
    super.setSigCompId(sipStack.getSigCompId());
    super.setToUri(toUri);
    super.setFromUri(toUri);

    // default
    mSession.addHeader("Event", "presence");
    mSession.addHeader("Content-Type", NgnContentType.PIDF);
  }
 public boolean publish(byte[] bytes, String event, String contentType) {
   if (bytes != null) {
     final java.nio.ByteBuffer byteBuffer = java.nio.ByteBuffer.allocateDirect(bytes.length);
     byteBuffer.put(bytes);
     ActionConfig config = new ActionConfig();
     if (event != null) {
       config.addHeader("Event", event);
     }
     if (contentType != null) {
       config.addHeader("Content-Type", contentType);
     }
     final boolean ret = mSession.publish(byteBuffer, byteBuffer.capacity(), config);
     config.delete();
     return ret;
   } else {
     Log.e(TAG, "Null content");
   }
   return false;
 }
 public boolean setContentType(String contentType) {
   return mSession.addHeader("Content-Type", contentType);
 }
 public boolean setEvent(String event) {
   return mSession.addHeader("Event", event);
 }