question: public SIPResponse createResponse ( int statusCode , String reasonPhrase ) { SIPResponse newResponse ; newResponse = new SIPResponse ( ) ; try { newResponse . setStatusCode ( statusCode ) ; } catch ( ParseException ex ) { throw new IllegalArgumentException ( "Bad code " + statusCode ) ; } if ( reasonPhrase != null ) newResponse . setReasonPhrase ( reasonPhrase ) ; else newResponse . setReasonPhrase ( SIPResponse . getReasonPhrase ( statusCode ) ) ; for ( String headerName : headersToIncludeInResponse ) { SIPHeader nextHeader = headerTable . get ( headerName ) ; if ( nextHeader != null ) { if ( ! ( nextHeader instanceof RecordRouteList ) || ( nextHeader instanceof RecordRouteList && mustCopyRR ( statusCode ) ) ) { try { newResponse . attachHeader ( ( SIPHeader ) nextHeader . clone ( ) , false ) ; } catch ( SIPDuplicateHeaderException e ) { e . printStackTrace ( ) ; } } } } if ( MessageFactoryImpl . getDefaultServerHeader ( ) != null ) { newResponse . setHeader ( MessageFactoryImpl . getDefaultServerHeader ( ) ) ; } ServerHeader server = MessageFactoryImpl . getDefaultServerHeader ( ) ; if ( server != null ) { newResponse . setHeader ( server ) ; } return newResponse ; }
target:  Creates a default SIPResponse message for this request. Note You must add the necessary tags to outgoing responses if need be. For efficiency, this method does not clone the incoming request. If you want to modify the outgoing response, be sure to clone the incoming request as the headers are shared and any modification to the headers of the outgoing response will result in a modification of the incoming request. Tag fields are just copied from the incoming request. Contact headers are removed from the incoming request. Added by Jeff Keyser. Route headers are not added to the response.