Login Form






Lost Password?
No account yet? Register
Home arrow Forums
ECharts
Welcome, Guest
altering header content (0 viewing) 
Go to bottom Post Reply Favoured: 0
TOPIC: altering header content
#310
Russell Roy (User)
Junior Boarder
Posts: 39
graphgraph
User Offline Click here to see the profile of this user
altering header content 1 Year, 1 Month ago  
I need to add NOTIFY to the Allow header of this SUBSCRIBE message. It seems the HeaderAddHelper obj is intended to add user-defined headers. How do I alter the existing Allow header?

Code: :

  5331 [mainINFO  KitCAT.SipStack  - <message from="192.168.32.116:23456"  to="172.16.0.28:6060"  time="1248384876764" isSender="true"  transactionId="z9hg4bkad89bc02a5483339774a3ac804cb2d4f"  callId=" This e-mail address is being protected from spam bots, you need JavaScript enabled to view it firstLine="SUBSCRIBE sip: This e-mail address is being protected from spam bots, you need JavaScript enabled to view it  SIP/2.0"  > <![CDATA[SUBSCRIBE sip:alice@sweng.com SIP/2.0 Call-ID6ebaa3bdb2df8c9c47a673d83bc7f423@192.168.32.116 CSeq1 SUBSCRIBE From"alice" <sip:alice@sweng.com>;tag=aliceSipPort31248384872204 To: <sip:alice@sweng.com> ViaSIP/2.0/UDP 192.168.32.116:23456;branch=z9hG4bKad89bc02a5483339774a3ac804cb2d4f Max-Forwards70 Contact: <sip:alice@192.168.32.116:23456> User-Agentmytest.MyTest.runBeforeEachTest.alice Thu Jul 23 17:34:31 EDT 2009 <strong>AllowINVITE,BYE,CANCEL,ACK,PRACK,INFO</strong> Route: <sip:orig@scscf.sweng.com:6060;lr> Eventmessage-summary Expires300 Content-Length0 ]]> </message>

 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#311
Venkita Subramonian (Admin)
Admin
Posts: 60
graphgraph
User Offline Click here to see the profile of this user
Re:altering header content 1 Year, 1 Month ago  
Hi Russ,

Here is a code snippet that I used recently to modify some message headers. You basically use the MessageModifier class to do this. You can use the addMessageModifier() method on the agent. You have to use the JAIN SIP API to do the actual modification. hope this helps.

Code: :

  MessageModifier myMsgModifier;     void addMsgModifier(SIPAgent agentthrows Exception {             myMsgModifier =                 new MessageModifier() {                     public void modify(javax.sip.message.Message messagethrows Exception {                         if (message instanceof javax.sip.message.Request) {                             javax.sip.message.Request req = (javax.sip.message.Requestmessage;                             if (req.getMethod().equals("INVITE")) {                                 javax.sip.SipFactory sipFactory javax.sip.SipFactory.getInstance();                                 javax.sip.header.HeaderFactory headerFactory sipFactory.createHeaderFactory();                                 message.removeHeader("Allow");                                 message.addLast(headerFactory.createHeader("Allow""INVITE"));                                 message.addLast(headerFactory.createHeader("Allow""ACK"));                                 message.addLast(headerFactory.createHeader("Allow""PRACK"));                                 message.addLast(headerFactory.createHeader("Allow""SUBSCRIBE"));                                 message.addLast(headerFactory.createHeader("Allow""BYE"));                                 message.addLast(headerFactory.createHeader("Allow""CANCEL"));                                 message.addLast(headerFactory.createHeader("Allow""NOTIFY"));                                 message.addLast(headerFactory.createHeader("Allow""INFO"));                                 message.addLast(headerFactory.createHeader("Allow""REFER"));                                 message.addLast(headerFactory.createHeader("Allow""UPDATE"));                                 message.addLast(headerFactory.createHeader("Min-SE""2147483"));                                 message.addLast(headerFactory.createHeader("Session-Expires""2147483"));                                 message.addLast(headerFactory.createHeader("Supported""timer"));                             }                         }                     }                 };             agent.addMessageModifier(myMsgModifier);      }     void removeMsgModifier(SIPAgent agentthrows Exception {         agent.removeMessageModifier(myMsgModifier);     }

 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#312
Russell Roy (User)
Junior Boarder
Posts: 39
graphgraph
User Offline Click here to see the profile of this user
Re:altering header content 1 Year, 1 Month ago  
Venkita,
Ok, thanks, that works. Actually I'd come across a similar instance of this in the sample code which accompanies the distribution ... but somehow failed to recognize it for what it was.
Russ
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
Go to top Post Reply
Powered by FireBoardget the latest posts directly to your desktop
Copyright © 2006-2009 echarts.org