Closed gaaf closed 2 years ago
Hi,
The way to do it is to get that header within the CallMap.OnNewDialog() by using req.GetHFs("X-MyHeader''). After that you may put the retrieved value into newly created CallController object so it is already available before the CallController::RecvEvent() is called.
Thanks, I'll try that.
I think it is still weird that CCEventTry.GetExtraHeaders()
does return an empty list. IMHO, it should return all (non-standard or unparsed) headers.
And I have the same question for reading a header in an incoming BYE.
The only way to take a header from BYE is to inherit your own class from the sippy.Ua class and override the RecvRequest() method. It's a bit tricky however because golang does not support virtual class methods and which is why the NewUA() constructor has that heir
parameter:
type MyUA struct {
sippy.Ua
}
func NewMyUA() *MyUA {
self := &MyUA{}
self.Ua = *sippy.NewUA(sip_tm, config, nh_address, cc, cc.lock, self)
return self
}
func (self *MyUA) RecvRequest(req sippy_types.SipRequest, t sippy_types.ServerTransaction) *sippy_types.Ua_context {
if req.Method() == "BYE" {
hfs := req.GetHFs(...)
}
return self.Ua.RecvRequest(req, t)
}
Hi,
In the call controller's RecvEvent function, I'd like to be able to read the value of a custom SIP header (like
X-MyHeader:
) from the INVITE. I've been unable to find a way to do that. How to access these?I tried
CCEventTry.GetExtraHeaders()
, but that returns an empty list.