< Previous by Date Date Index Next by Date >
< Previous in Thread Thread Index  

Re: [reSIProcate-users] Why SipMessage.getDestination is empty


You probably bound your transport to all interfaces (0.0.0.0), so
that's what it's returning.  Unless you bind your transport to a
specific interface, I don't think you can get this information for
inbound messages.

However there is a way to get that information for the outbound
messaging.  For example you can find out what IP address the stack
used for sending the outbound Register request, by using the Outbound
decorator feature.  I suspect this will satisfy your requirements,
since a response is supposed to be routed back the same ip addr and
port that the request was sent from.  You need to derive your own
class from MessgeDecorator and set it on the DUM profile with
setOutboundDecorator.  Using this, you can view the SIP message after
the stack stamped the via and contact headers with the sending ip and
port.


Scott

On Sat, Nov 14, 2009 at 11:25 AM, maodong hu <hhmmdd@xxxxxxx> wrote:
> hi, scott,
> I want to know the ip address dum used because  I use addTransport with ip
> interface = Data::Empty
> I tried SipMessage::getReceivedTransport. like this:
> onSuccess(ClientRegistrationHandle h, const SipMessage& response)
> {
>     ...
>     addr = response.getReceivedTransport()->getTuple().getSockaddr();
> or
>     addr = response.getReceivedTransport()->boundInterface();
> }
> but the ip of addr is zero
> any idea ?
>
> 2009/11/13 Scott Godin <slgodin@xxxxxxxxx>
>>
>> setDestination is mainly used to force an outbound SIP message to
>> ignore the require URI and route directly to that destination - it is
>> not intended to be used to query the destination socket information of
>> inbound requests (this is documented in the SipMessage header file).
>> If you want to get a pointer to the transport that received the
>> message use SipMessage::getReceivedTransport.
>>
>> Scott
>>
>> On Fri, Nov 13, 2009 at 2:08 AM, maodong hu <hhmmdd@xxxxxxx> wrote:
>> > hi, all
>> > in my ClientRegistrationHandler::onSuccess(ClientRegistrationHandle h,
>> > const
>> > SipMessage& response), I want get the destination address of the
>> > response
>> > message, but failed, it is empty,
>> > I use ((SipMessage&)response).getDestination().getSockaddr() , the addr
>> > is
>> > zero
>> > but if I get Source addr, it is success to get
>> > response.getSource().getSockaddr() , it can get correct value
>> > anyone can help to explain if it is bug for the getDestination() or not
>> >
>> > --
>> > Best Regards
>> >
>> > Maodong Hu
>> >
>> > _______________________________________________
>> > resiprocate-users mailing list
>> > resiprocate-users@xxxxxxxxxxxxxxx
>> > List Archive: http://list.resiprocate.org/archive/resiprocate-users/
>> >
>>
>
>
>
> --
> Best Regards
>
> Maodong Hu
>