Beispiel #1
0
 /** When the delivery fails. */
 private void onDeliveryFailure(TransactionClient tc, String result) {
   printLog("Message delivery failed (" + result + ").");
   Message req = tc.getRequestMessage();
   NameAddress recipient = req.getToHeader().getNameAddress();
   String subject = null;
   if (req.hasSubjectHeader()) subject = req.getSubjectHeader().getSubject();
   if (listener != null) listener.onMaDeliveryFailure(this, recipient, subject, result);
 }
Beispiel #2
0
 /** When a new Message is received by the SipInterface. */
 public void onReceivedMessage(SipInterface sip, Message msg) { // printLog("Message received:
   // "+msg.getFirstLine().substring(0,msg.toString().indexOf('\r')));
   if (msg.isRequest()) {
     (new TransactionServer(sip_provider, msg, null))
         .respondWith(MessageFactory.createResponse(msg, 200, SipResponses.reasonOf(200), null));
     NameAddress sender = msg.getFromHeader().getNameAddress();
     NameAddress recipient = msg.getToHeader().getNameAddress();
     String subject = null;
     if (msg.hasSubjectHeader()) subject = msg.getSubjectHeader().getSubject();
     String content_type = msg.getContentTypeHeader().getContentType();
     String content = msg.getBody();
     if (listener != null)
       listener.onMaReceivedMessage(this, sender, recipient, subject, content_type, content);
   }
 }