001    /**
002     * Licensed to the Apache Software Foundation (ASF) under one or more
003     * contributor license agreements.  See the NOTICE file distributed with
004     * this work for additional information regarding copyright ownership.
005     * The ASF licenses this file to You under the Apache License, Version 2.0
006     * (the "License"); you may not use this file except in compliance with
007     * the License.  You may obtain a copy of the License at
008     *
009     *      http://www.apache.org/licenses/LICENSE-2.0
010     *
011     * Unless required by applicable law or agreed to in writing, software
012     * distributed under the License is distributed on an "AS IS" BASIS,
013     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014     * See the License for the specific language governing permissions and
015     * limitations under the License.
016     */
017    package org.apache.camel.component.sip;
018    
019    import java.net.URI;
020    import java.text.ParseException;
021    import java.util.ArrayList;
022    import java.util.Map;
023    import java.util.Properties;
024    
025    import javax.sip.ClientTransaction;
026    import javax.sip.Dialog;
027    import javax.sip.InvalidArgumentException;
028    import javax.sip.ListeningPoint;
029    import javax.sip.SipFactory;
030    import javax.sip.SipStack;
031    import javax.sip.address.Address;
032    import javax.sip.address.AddressFactory;
033    import javax.sip.address.SipURI;
034    import javax.sip.header.CSeqHeader;
035    import javax.sip.header.CallIdHeader;
036    import javax.sip.header.ContactHeader;
037    import javax.sip.header.ContentTypeHeader;
038    import javax.sip.header.EventHeader;
039    import javax.sip.header.ExpiresHeader;
040    import javax.sip.header.ExtensionHeader;
041    import javax.sip.header.FromHeader;
042    import javax.sip.header.HeaderFactory;
043    import javax.sip.header.MaxForwardsHeader;
044    import javax.sip.header.ToHeader;
045    import javax.sip.header.ViaHeader;
046    import javax.sip.message.MessageFactory;
047    import javax.sip.message.Request;
048    
049    import org.apache.camel.util.ObjectHelper;
050    import org.apache.camel.util.URISupport;
051    import org.apache.commons.logging.Log;
052    import org.apache.commons.logging.LogFactory;
053    
054    @SuppressWarnings("unchecked")
055    public class SipConfiguration {    
056        private static final transient Log LOG = LogFactory.getLog(SipConfiguration.class);
057        private static final String IMPLEMENTATION = "gov.nist";
058        private URI uri;
059        private Map<String, Object> parameters;
060        private SipComponent component;
061        private AddressFactory addressFactory;
062        private MessageFactory messageFactory;
063        private HeaderFactory headerFactory;
064        private SipStack sipStack;
065        private ListeningPoint listeningPoint;
066        private String protocol;
067        private SipURI sipUri;
068        private String stackName;
069        private String transport;
070        private int maxForwards;
071        private boolean consumer;
072        private String eventHeaderName;
073        private String eventId;
074        private int msgExpiration;
075        private String useRouterForAllUris;
076        private long receiveTimeoutMillis;
077        private String maxMessageSize;
078        private String cacheConnections;
079        private String contentType;
080        private String contentSubType;
081        private String automaticDialogSupport;
082        private String nistServerLog;
083        private String nistDebugLog;
084        private String nistTraceLevel;
085        private SipFactory sipFactory;
086        private String fromUser;
087        private String fromHost;
088        private int fromPort;
089        private String toUser;
090        private String toHost;
091        private int toPort;
092        private boolean presenceAgent;
093        
094        private FromHeader fromHeader;
095        private ToHeader toHeader;
096        private ArrayList<ViaHeader> viaHeaders;
097        private ContentTypeHeader contentTypeHeader;
098        private CallIdHeader callIdHeader;
099        private MaxForwardsHeader maxForwardsHeader;
100        private ContactHeader contactHeader;
101        private EventHeader eventHeader;
102        private ExtensionHeader extensionHeader;
103        private ExpiresHeader expiresHeader;
104        private ClientTransaction clientTransactionId;
105        private Dialog dialog;
106        
107        public SipConfiguration() {
108            sipFactory = SipFactory.getInstance();
109            sipFactory.setPathName(IMPLEMENTATION);
110            
111            setStackName("NAME_NOT_SET");
112            setTransport("tcp");
113            setMaxMessageSize("1048576");
114            setCacheConnections("false");
115            setAutomaticDialogSupport("off");
116            setContentType("text");
117            setContentSubType("plain");   
118            setReceiveTimeoutMillis(10000);
119            setConsumer(false);
120            setUseRouterForAllUris("false");
121            setMsgExpiration(3600);
122            setPresenceAgent(false);
123        }
124        
125        public void initialize(URI uri, Map<String, Object> parameters,
126                SipComponent component) {
127            this.setParameters(parameters);
128            this.setComponent(component);
129            this.setUri(uri);
130        }
131    
132        public void parseURI() throws Exception {
133            protocol = uri.getScheme();
134            
135            if ((!protocol.equalsIgnoreCase("sip")) && (!protocol.equalsIgnoreCase("sips"))) {
136                throw new IllegalArgumentException("Unrecognized SIP protocol: " + protocol + " for uri: " + uri);
137            }
138    
139            Map<String, Object> settings = URISupport.parseParameters(uri);        
140    
141            if (settings.containsKey("stackName")) {
142                setStackName((String) settings.get("stackName"));
143            }
144            if (settings.containsKey("transport")) {
145                setTransport((String) settings.get("transport"));
146            } 
147            if (settings.containsKey("maxMessageSize")) {
148                setMaxMessageSize((String) settings.get("maxMessageSize"));
149            } 
150            if (settings.containsKey("cacheConnections")) {
151                setCacheConnections((String) settings.get("cacheConnections"));
152            }
153            if (settings.containsKey("contentType")) {
154                setContentType((String) settings.get("contentType"));
155            }
156            if (settings.containsKey("contentSubType")) {
157                setContentSubType((String) settings.get("contentSubType"));
158            }
159            if (settings.containsKey("maxForwards")) {
160                setMaxForwards(Integer.valueOf((String) settings.get("maxForwards")));
161            }
162            if (settings.containsKey("receiveTimeoutMillis")) {
163                setReceiveTimeoutMillis(Long.valueOf((String) settings.get("receiveTimeoutMillis")));
164            }
165            if (settings.containsKey("eventHeaderName")) {
166                setEventHeaderName((String) settings.get("eventHeaderName"));
167            } 
168            if (settings.containsKey("eventId")) {
169                setEventId((String) settings.get("eventId"));
170            }
171            if (settings.containsKey("useRouterForAllUris")) {
172                setUseRouterForAllUris((String) settings.get("useRouterForAllUris"));
173            }
174            if (settings.containsKey("msgExpiration")) {
175                setMsgExpiration(Integer.valueOf((String) settings.get("msgExpiration")));
176            }
177            if (settings.containsKey("presenceAgent")) {
178                setPresenceAgent(Boolean.valueOf((String) settings.get("presenceAgent")));
179            }
180    
181            if (!consumer) {
182                if (settings.containsKey("fromUser")) {
183                    setFromUser((String) settings.get("fromUser"));
184                }
185                if (settings.containsKey("fromHost")) {
186                    setFromHost((String) settings.get("fromHost"));
187                } 
188                if (settings.containsKey("fromPort")) {
189                    setFromPort(Integer.valueOf((String) settings.get("fromPort")));
190                } 
191                setToUser(uri.getUserInfo());
192                setToHost(uri.getHost());
193                setToPort(uri.getPort());
194            } else {
195                setFromUser(uri.getUserInfo());
196                setFromHost(uri.getHost());
197                setFromPort(uri.getPort());
198                if (!presenceAgent) {
199                    if (settings.containsKey("toUser")) {
200                        setToUser((String) settings.get("toUser"));
201                    }
202                    if (settings.containsKey("toHost")) {
203                        setToHost((String) settings.get("toHost"));
204                    } 
205                    if (settings.containsKey("toPort")) {
206                        setToPort(Integer.valueOf((String) settings.get("toPort")));
207                    } 
208                }
209            }
210            nistDebugLog = component.getAndRemoveParameter(parameters, "implementationDebugLogFile", String.class, null);
211            nistServerLog = component.getAndRemoveParameter(parameters, "implementationServerLogFile", String.class, null);
212            nistTraceLevel = component.getAndRemoveParameter(parameters, "implementationTraceLevel", String.class, "0");
213            
214            LOG.trace("Consumer:" + consumer + " StackName:" + stackName);
215            LOG.trace("From User: " + getFromUser() + " From host: " + getFromHost() + " From Port: " + getFromPort());
216             
217            createFactoriesAndHeaders(parameters, component);
218            
219            sipUri = component.resolveAndRemoveReferenceParameter(parameters, "sipUri", SipURI.class, null);
220            if (sipUri == null) {
221                sipUri = addressFactory.createSipURI(getToUser(), getToHost() + ":" + getToPort());
222            }
223    
224            ObjectHelper.notNull(fromUser, "From User");
225            ObjectHelper.notNull(fromHost, "From Host");
226            ObjectHelper.notNull(fromPort, "From Port");
227            ObjectHelper.notNull(eventHeader, "Event Header");
228            ObjectHelper.notNull(eventHeaderName, "Event Header Name");        
229            ObjectHelper.notNull(eventId, "Event Id");        
230        }    
231    
232        private void createFactoriesAndHeaders(Map<String, Object> parameters, SipComponent component) throws Exception {
233            headerFactory = sipFactory.createHeaderFactory();
234            addressFactory = sipFactory.createAddressFactory();
235            setMessageFactory(sipFactory.createMessageFactory());
236            
237            fromHeader = component.resolveAndRemoveReferenceParameter(parameters, "fromHeader", FromHeader.class, null);
238            if (fromHeader == null) { 
239                createFromHeader();
240            }
241            if (!presenceAgent) {
242                toHeader = component.resolveAndRemoveReferenceParameter(parameters, "toHeader", ToHeader.class, null);
243                if (toHeader == null) {
244                    createToHeader();
245                }
246            }
247            viaHeaders = component.resolveAndRemoveReferenceParameter(parameters, "viaHeaders", ArrayList.class, null);
248            if (viaHeaders == null) {        
249                createViaHeaders();
250            }
251            contentTypeHeader = component.resolveAndRemoveReferenceParameter(parameters, "contentTypeHeader", ContentTypeHeader.class, null);
252            if (contentTypeHeader == null) {
253                createContentTypeHeader();
254            }
255    
256            callIdHeader = component.resolveAndRemoveReferenceParameter(parameters, "callIdHeader", CallIdHeader.class, null);
257            
258            maxForwardsHeader = component.resolveAndRemoveReferenceParameter(parameters, "maxForwardsHeader", MaxForwardsHeader.class, null);
259            if (maxForwardsHeader == null) {        
260                createMaxForwardsHeader();
261            }
262            
263            // Optional Headers
264            eventHeader = component.resolveAndRemoveReferenceParameter(parameters, "eventHeader", EventHeader.class, null);
265            if (eventHeader == null) {
266                createEventHeader();
267            }        
268            contactHeader = component.resolveAndRemoveReferenceParameter(parameters, "contactHeader", ContactHeader.class, null);
269            if (contactHeader == null) {
270                createContactHeader();
271            }
272            expiresHeader = component.resolveAndRemoveReferenceParameter(parameters, "expiresHeader", ExpiresHeader.class, null);
273            if (expiresHeader == null) {
274                createExpiresHeader();
275            }
276            extensionHeader = component.resolveAndRemoveReferenceParameter(parameters, "extensionHeader", ExtensionHeader.class, null);
277        }
278    
279        public Request createSipRequest(long sequenceNumber, String requestMethod, Object body) throws ParseException, InvalidArgumentException {
280            //SipConfiguration configuration = sipPublisher.getConfiguration();
281            CSeqHeader cSeqHeader = getHeaderFactory().createCSeqHeader(sequenceNumber, requestMethod);
282    
283            // Create the request.
284            Request request = getMessageFactory().createRequest(
285                getSipUri(), 
286                requestMethod, 
287                getCallIdHeader(), 
288                cSeqHeader, 
289                getFromHeader(),
290                getToHeader(), 
291                getViaHeaders(), 
292                getMaxForwardsHeader());
293            
294            if (getEventHeader() != null) {
295                request.addHeader(getEventHeader());
296            }
297            if (getExpiresHeader() != null) {
298                request.addHeader(getExpiresHeader());
299            }
300            if (getContactHeader() != null) {
301                request.addHeader(getContactHeader());
302            }
303            if (getExtensionHeader() != null) {
304                request.addHeader(getExtensionHeader());
305            }
306            request.setContent(body, getContentTypeHeader());
307            
308            return request;       
309        }
310        
311        private void createFromHeader() throws ParseException {
312            SipURI fromAddress = getAddressFactory().createSipURI(getFromUser(), getFromHost());
313            fromAddress.setPort(Integer.valueOf(getFromPort()).intValue());
314            Address fromNameAddress = addressFactory.createAddress(fromAddress);
315            fromNameAddress.setDisplayName(getFromUser());
316            
317            setFromHeader(headerFactory.createFromHeader(fromNameAddress, getFromUser() + "_Header"));        
318        }
319        
320        private void createToHeader() throws ParseException {
321            SipURI toAddress = getAddressFactory().createSipURI(getToUser(), getToHost());
322            toAddress.setPort(getToPort());
323            Address toNameAddress = addressFactory.createAddress(toAddress);
324            toNameAddress.setDisplayName(getToUser());
325            
326            setToHeader(headerFactory.createToHeader(toNameAddress, getToUser() + "_Header"));
327        }
328    
329        private void createViaHeaders() throws ParseException, InvalidArgumentException {
330            viaHeaders = new ArrayList();
331            ViaHeader viaHeader = headerFactory.createViaHeader(getFromHost(), getFromPort(),
332                    getTransport(), null);
333    
334            viaHeaders.add(viaHeader);       
335        }
336    
337        private void createContentTypeHeader() throws ParseException {
338            setContentTypeHeader(headerFactory.createContentTypeHeader(getContentType(), getContentSubType()));   
339        }
340        
341        private void createMaxForwardsHeader() throws ParseException, InvalidArgumentException {
342            setMaxForwardsHeader(headerFactory.createMaxForwardsHeader(getMaxForwards()));   
343        }
344    
345        private void createEventHeader() throws ParseException {
346            eventHeader = getHeaderFactory().createEventHeader(getEventHeaderName());
347            eventHeader.setEventId(getEventId());        
348        }
349        
350        private void createContactHeader() throws ParseException {
351            SipURI contactURI = addressFactory.createSipURI(getFromUser(), getFromHost());
352            contactURI.setTransportParam(getTransport());
353            contactURI.setPort(Integer.valueOf(getFromPort()).intValue());
354            Address contactAddress = addressFactory.createAddress(contactURI);
355    
356            // Add the contact address.
357            contactAddress.setDisplayName(getFromUser());
358    
359            contactHeader = headerFactory.createContactHeader(contactAddress);
360        }
361    
362        private void createExpiresHeader() throws ParseException, InvalidArgumentException {
363            expiresHeader = getHeaderFactory().createExpiresHeader(getMsgExpiration());        
364        }
365        
366        Properties createInitialProperties() {
367            Properties properties = new Properties();
368            properties.setProperty("javax.sip.STACK_NAME", getStackName());
369            properties.setProperty("gov.nist.javax.sip.MAX_MESSAGE_SIZE", getMaxMessageSize());
370            properties.setProperty("gov.nist.javax.sip.CACHE_CLIENT_CONNECTIONS", getCacheConnections());
371            properties.setProperty("javax.sip.USE_ROUTER_FOR_ALL_URIS", getUseRouterForAllUris());
372            if ((nistDebugLog != null) && (nistServerLog != null)) {
373                properties.setProperty("gov.nist.javax.sip.DEBUG_LOG", nistDebugLog);
374                properties.setProperty("gov.nist.javax.sip.SERVER_LOG", nistServerLog);
375                properties.setProperty("gov.nist.javax.sip.TRACE_LEVEL", nistTraceLevel);
376            }
377            
378            return properties;
379        }
380    
381        public AddressFactory getAddressFactory() {
382            return addressFactory;
383        }
384    
385        public void setAddressFactory(AddressFactory addressFactory) {
386            this.addressFactory = addressFactory;
387        }
388    
389        public MessageFactory getMessageFactory() {
390            return messageFactory;
391        }
392    
393        public void setMessageFactory(MessageFactory messageFactory) {
394            this.messageFactory = messageFactory;
395        }
396    
397        public HeaderFactory getHeaderFactory() {
398            return headerFactory;
399        }
400    
401        public void setHeaderFactory(HeaderFactory headerFactory) {
402            this.headerFactory = headerFactory;
403        }
404    
405        public SipStack getSipStack() {
406            return sipStack;
407        }
408    
409        public void setSipStack(SipStack sipStack) {
410            this.sipStack = sipStack;
411        }
412    
413        public String getProtocol() {
414            return protocol;
415        }
416    
417        public void setProtocol(String protocol) {
418            this.protocol = protocol;
419        }
420    
421        public SipURI getSipUri() {
422            return sipUri;
423        }
424    
425        public void setSipUri(SipURI sipUri) {
426            this.sipUri = sipUri;
427        }
428    
429        public String getStackName() {
430            return stackName;
431        }
432    
433        public void setStackName(String stackName) {
434            this.stackName = stackName;
435        }
436    
437        public String getTransport() {
438            return transport;
439        }
440    
441        public void setTransport(String transport) {
442            this.transport = transport;
443        }
444    
445        public String getMaxMessageSize() {
446            return maxMessageSize;
447        }
448    
449        public void setMaxMessageSize(String maxMessageSize) {
450            this.maxMessageSize = maxMessageSize;
451        }
452    
453        public String getAutomaticDialogSupport() {
454            return automaticDialogSupport;
455        }
456    
457        public void setAutomaticDialogSupport(String automaticDialogSupport) {
458            this.automaticDialogSupport = automaticDialogSupport;
459        }
460    
461        public String getCacheConnections() {
462            return cacheConnections;
463        }
464    
465        public void setCacheConnections(String cacheConnections) {
466            this.cacheConnections = cacheConnections;
467        }
468    
469        public ListeningPoint getListeningPoint() {
470            return listeningPoint;
471        }
472    
473        public void setListeningPoint(ListeningPoint listeningPoint) {
474            this.listeningPoint = listeningPoint;
475        }
476    
477        public void setContentType(String contentType) {
478            this.contentType = contentType;
479        }
480    
481        public String getContentType() {
482            return contentType;
483        }
484    
485        public void setContentSubType(String contentSubType) {
486            this.contentSubType = contentSubType;
487        }
488    
489        public String getContentSubType() {
490            return contentSubType;
491        }
492    
493        public void setMaxForwards(int maxForwards) {
494            this.maxForwards = maxForwards;
495        }
496    
497        public int getMaxForwards() {
498            return maxForwards;
499        }
500    
501        public void setReceiveTimeoutMillis(long receiveTimeoutMillis) {
502            this.receiveTimeoutMillis = receiveTimeoutMillis;
503        }
504    
505        public long getReceiveTimeoutMillis() {
506            return receiveTimeoutMillis;
507        }
508    
509        public void setParameters(Map<String, Object> parameters) {
510            this.parameters = parameters;
511        }
512    
513        public Map<String, Object> getParameters() {
514            return parameters;
515        }
516    
517        public void setComponent(SipComponent component) {
518            this.component = component;
519        }
520    
521        public SipComponent getComponent() {
522            return component;
523        }
524    
525        public String getNistServerLog() {
526            return nistServerLog;
527        }
528    
529        public void setNistServerLog(String nistServerLog) {
530            this.nistServerLog = nistServerLog;
531        }
532    
533        public String getNistDebugLog() {
534            return nistDebugLog;
535        }
536    
537        public void setNistDebugLog(String nistDebugLog) {
538            this.nistDebugLog = nistDebugLog;
539        }
540    
541        public String getNistTraceLevel() {
542            return nistTraceLevel;
543        }
544    
545        public void setNistTraceLevel(String nistTraceLevel) {
546            this.nistTraceLevel = nistTraceLevel;
547        }
548    
549        public SipFactory getSipFactory() {
550            return sipFactory;
551        }
552    
553        public void setSipFactory(SipFactory sipFactory) {
554            this.sipFactory = sipFactory;
555        }
556    
557        public String getFromUser() {
558            return fromUser;
559        }
560    
561        public void setFromUser(String fromUser) {
562            this.fromUser = fromUser;
563        }
564    
565        public String getFromHost() {
566            return fromHost;
567        }
568    
569        public void setFromHost(String fromHost) {
570            this.fromHost = fromHost;
571        }
572    
573        public int getFromPort() {
574            return fromPort;
575        }
576    
577        public void setFromPort(int fromPort) {
578            this.fromPort = fromPort;
579        }
580    
581        public String getToUser() {
582            return toUser;
583        }
584    
585        public void setToUser(String toUser) {
586            this.toUser = toUser;
587        }
588    
589        public String getToHost() {
590            return toHost;
591        }
592    
593        public void setToHost(String toHost) {
594            this.toHost = toHost;
595        }
596    
597        public int getToPort() {
598            return toPort;
599        }
600    
601        public void setToPort(int toPort) {
602            this.toPort = toPort;
603        }
604    
605        public FromHeader getFromHeader() {
606            return fromHeader;
607        }
608    
609        public void setFromHeader(FromHeader fromHeader) {
610            this.fromHeader = fromHeader;
611        }
612    
613        public ToHeader getToHeader() {
614            return toHeader;
615        }
616    
617        public void setToHeader(ToHeader toHeader) {
618            this.toHeader = toHeader;
619        }
620    
621        public ArrayList<ViaHeader> getViaHeaders() {
622            return viaHeaders;
623        }
624    
625        public void setViaHeaders(ArrayList<ViaHeader> viaHeaders) {
626            this.viaHeaders = viaHeaders;
627        }
628    
629        public ContentTypeHeader getContentTypeHeader() {
630            return contentTypeHeader;
631        }
632    
633        public void setContentTypeHeader(ContentTypeHeader contentTypeHeader) {
634            this.contentTypeHeader = contentTypeHeader;
635        }
636    
637        public CallIdHeader getCallIdHeader() {
638            return callIdHeader;
639        }
640    
641        public void setCallIdHeader(CallIdHeader callIdHeader) {
642            this.callIdHeader = callIdHeader;
643        }
644    
645        public MaxForwardsHeader getMaxForwardsHeader() {
646            return maxForwardsHeader;
647        }
648    
649        public void setMaxForwardsHeader(MaxForwardsHeader maxForwardsHeader) {
650            this.maxForwardsHeader = maxForwardsHeader;
651        }
652    
653        public ContactHeader getContactHeader() {
654            return contactHeader;
655        }
656    
657        public void setContactHeader(ContactHeader contactHeader) {
658            this.contactHeader = contactHeader;
659        }
660    
661        public ExtensionHeader getExtensionHeader() {
662            return extensionHeader;
663        }
664    
665        public void setExtensionHeader(ExtensionHeader extensionHeader) {
666            this.extensionHeader = extensionHeader;
667        }
668    
669        public void setUri(URI uri) {
670            this.uri = uri;
671        }
672    
673        public URI getUri() {
674            return uri;
675        }
676    
677        public void setConsumer(boolean consumer) {
678            this.consumer = consumer;
679        }
680    
681        public boolean isConsumer() {
682            return consumer;
683        }
684    
685        public void setClientTransactionId(ClientTransaction clientTransactionId) {
686            this.clientTransactionId = clientTransactionId;
687        }
688    
689        public ClientTransaction getClientTransactionId() {
690            return clientTransactionId;
691        }
692    
693        public void setDialog(Dialog dialog) {
694            this.dialog = dialog;
695        }
696    
697        public Dialog getDialog() {
698            return dialog;
699        }
700    
701        public void setEventHeader(EventHeader eventHeader) {
702            this.eventHeader = eventHeader;
703        }
704    
705        public EventHeader getEventHeader() {
706            return eventHeader;
707        }
708    
709        public void setEventHeaderName(String eventHeaderName) {
710            this.eventHeaderName = eventHeaderName;
711        }
712    
713        public String getEventHeaderName() {
714            return eventHeaderName;
715        }
716    
717        public void setEventId(String eventId) {
718            this.eventId = eventId;
719        }
720    
721        public String getEventId() {
722            return eventId;
723        }
724    
725        public void setUseRouterForAllUris(String useRouterForAllUris) {
726            this.useRouterForAllUris = useRouterForAllUris;
727        }
728    
729        public String getUseRouterForAllUris() {
730            return useRouterForAllUris;
731        }
732    
733        public int getMsgExpiration() {
734            return msgExpiration;
735        }
736    
737        public void setMsgExpiration(int msgExpiration) {
738            this.msgExpiration = msgExpiration;
739        }
740    
741        public ExpiresHeader getExpiresHeader() {
742            return expiresHeader;
743        }
744    
745        public void setExpiresHeader(ExpiresHeader expiresHeader) {
746            this.expiresHeader = expiresHeader;
747        }
748    
749        public boolean isPresenceAgent() {
750            return presenceAgent;
751        }
752    
753        public void setPresenceAgent(boolean presenceAgent) {
754            this.presenceAgent = presenceAgent;
755        }
756        
757    }