/** * Get the contact header ( the first contact header) which is all we need for the most part. * */ public Contact getContactHeader() { ContactList clist = this.getContactHeaders(); if (clist != null) { return (Contact) clist.getFirst(); } else { return null; } }
/** * Do taget refresh dialog state updates. * * RFC 3261: Requests within a dialog MAY contain Record-Route and Contact * header fields. However, these requests do not cause the dialog's route * set to be modified, although they may modify the remote target URI. * Specifically, requests that are not target refresh requests do not modify * the dialog's remote target URI, and requests that are target refresh * requests do. For dialogs that have been established with an * * INVITE, the only target refresh request defined is re-INVITE (see Section * 14). Other extensions may define different target refresh requests for * dialogs established in other ways. */ private void doTargetRefresh(SIPMessage sipMessage) { ContactList contactList = sipMessage.getContactHeaders(); /* * INVITE is the target refresh for INVITE dialogs. SUBSCRIBE is the * target refresh for subscribe dialogs from the client side. This * modifies the remote target URI potentially */ if (contactList != null) { Contact contact = (Contact) contactList.getFirst(); this.setRemoteTarget(contact); } }
/** * Log a response received at this message channel. This is used for processing incoming * responses to a client transaction. * * @param receptionTime is the time at which the response was received. * @param status is the processing status of the message. * */ public void logResponse(SIPResponse sipResponse, long receptionTime, String status) { int peerport = getPeerPort(); if (peerport == 0 && sipResponse.getContactHeaders() != null) { ContactHeader contact = (ContactHeader) sipResponse.getContactHeaders().getFirst(); peerport = ((AddressImpl) contact.getAddress()).getPort(); } String from = getPeerAddress().toString() + ":" + peerport; String to = this.getHost() + ":" + getPort(); this.getSIPStack().serverLogger.logMessage(sipResponse, from, to, status, false, receptionTime); }
this.setRemoteTarget((ContactHeader) contactList.getFirst());