Menu

#3 Buddy methods need extra headers/body capability

sipunit
open
Becky Mc
SipUnit (23)
5
2012-12-17
2008-08-30
Becky Mc
No

The SipPhone.addBuddy() method sends the SUBSCRIBE message and
it DOES NEED A SIMPLE ENHANCEMENT to allow you to optionally include additional
or replacement headers and/or message body like all the SipCall message sending
methods have. The SipPhone refresh subscription method may also need it (and any other SUBSCRIBE sending method). SipCall.sendInviteOkAck() is a good example to see what needs to be done for this, and the same concept needs to be applied to SipPhone.addBuddy()
so one can control the SUBSCRIBE message contents that get sent out. Actually,
I just looked and can tell exactly what to do for this. Add one new method
to SipPhone :

public Subscription addBuddy(String uri, int duration, String eventId,
long timeout, ArrayList<Header> additionalHeaders,
ArrayList<Header> replaceHeaders, String body)

and make the current addBuddy method that does the work - addBuddy(String uri,
int duration, String eventId, long timeout) - call the new method with 3 nulls
as the last 3 parameters, and move this method body to the new method (let it
do the work). After the line in that method that creates the subscribe message:
Request req = sub.createSubscribeMessage(duration, eventId);
add a line to incorporate the additional/replace headers/body that may have
been passed in:
super.putElements(req, additionalHeaders, replaceHeaders, body);

Add a unit test to validate it.

So the same for refreshBuddy() and any other SipPhone methods that send SUBSCRIBE.

Discussion

MongoDB Logo MongoDB