[reSIProcate] Sending INVITE over TCP

Mehul Jain Mehul at ingenio.com
Fri Oct 21 12:08:47 CDT 2005


Hi Scott,
The trace at STACK level is in the enclosed file "TCP_INVITE_Log".
 
The section of the code is :
const char *SIP_TRANSPORT = "tcp";
SipStack* g_sipStack;
    g_sipStack = new SipStack();
    g_sipStack->addTransport(TCP, g_sipPort);
    g_sipStack->addTransport(UDP, g_sipPort);

    NameAddr dest;
    dest.uri().scheme() = "sip";
    dest.uri().user() = pData->dnis;
    dest.uri().host() = pData->toHost;
    dest.uri().port() = pData->toPort;
    dest.param(p_transport) = SIP_TRANSPORT;
 
    NameAddr contact;
    contact.uri().scheme() = "sip";
    contact.uri().user() = pData->ani;
    contact.uri().host() = g_IPAddress;
    contact.uri().port() = g_sipPort;
    contact.param(p_transport) = SIP_TRANSPORT;
 
    NameAddr from = dest;
    from.uri().port() = g_sipPort;
    from.uri().user() = pData->ani;
    from.uri().host() = g_IPAddress;
    from.param(p_transport) = SIP_TRANSPORT;
    
    SharedPtr<SipMessage> message(Helper::makeInvite( dest, from,
contact));
 
Mehul.
 

________________________________

From: Scott Godin [mailto:slgodin at icescape.com] 
Sent: Friday, October 21, 2005 6:01 AM
To: Mehul Jain; resiprocate-devel at list.sipfoundry.org
Subject: RE: [reSIProcate] Sending INVITE over TCP



This should work.  Can you provide a code sample and a trace at STACK
level?

 

 

________________________________

From: resiprocate-devel-bounces at list.sipfoundry.org
[mailto:resiprocate-devel-bounces at list.sipfoundry.org] On Behalf Of
Mehul Jain
Sent: Thursday, October 20, 2005 8:02 PM
To: resiprocate-devel at list.sipfoundry.org
Subject: [reSIProcate] Sending INVITE over TCP

 

I am trying to use the resiprocate stack to send INVITE's over TCP.

The transport type is determined on the basis of the value set in the
Request-URI.  The default transport is scheme dependent. For sip:, it is
UDP. For sips:, it is TCP.  Im using sip, so need to explicitly set
transport=TCP in the request-uri.

 

The steps Ive followed are :

a.    Add TCP transport to the stack.

        g_sipStack->addTransport(TCP, g_sipPort);

b.    Use TCP as the transport type in the required headers (To, From,
Contact)

c.    I ve used Helper::makeInvite to build the INVITE.

        Helper::makeInvite( dest, from, contact)

 

The stack still tries to send the message via UDP.

 

Debugging

---------------

*    Helper::MakeInvite uses Helper::MakeRequest in which the
RequestLine is determined using the target.uri.

*    When I send the message, the TransportSelector calls
"mDns.lookup(result, msg->header(h_RequestLine).uri());" that further
calls "DnsResult::lookup" which returns UDP since the condition "if
(uri.exists(p_transport))" in that member function evaluates to false
and it therefore uses the default type of UDP.

 

I can send the sample code as well. Any pointers as to what Im missing.

 

The log output is as follows :

DEBUG | 20051020-143206.511 | UAC | RESIP:TRANSPORT | 6124 |
ConnectionBase.cxx:29 | ConnectionBase::ConnectionBase, no params:
00FD7E08
DEBUG | 20051020-143206.527 | UAC | RESIP:TRANSPORT | 6124 |
InternalTransport.cxx:85 | Creating fd=3804 V4/TCP
DEBUG | 20051020-143206.527 | UAC | RESIP:TRANSPORT | 6124 |
InternalTransport.cxx:93 | Binding to 0.0.0.0
INFO | 20051020-143206.543 | UAC | RESIP:TRANSPORT | 6124 |
TcpTransport.cxx:27 | Creating TCP transport host= port=5060 ipv4=1
INFO | 20051020-143206.558 | UAC | RESIP:TRANSPORT | 6124 |
UdpTransport.cxx:30 | Creating UDP transport host= port=5060 ipv4=1
DEBUG | 20051020-143206.558 | UAC | RESIP:TRANSPORT | 6124 |
InternalTransport.cxx:85 | Creating fd=3784 V4/UDP
DEBUG | 20051020-143206.558 | UAC | RESIP:TRANSPORT | 6124 |
InternalTransport.cxx:93 | Binding to 0.0.0.0
DEBUG | 20051020-143217.496 | UAC | RESIP | 4468 | SipStack.cxx:267 |
SEND: SipReq:  INVITE 8665722037 at 10.10.1.14:5060
<mailto:8665722037 at 10.10.1.14:5060>  tid=fb36831df16a5517 cseq=INVITE 
contact=0 at 10.10.1.151:5060 <mailto:contact=0 at 10.10.1.151:5060>  / 1
from(tu)
DEBUG | 20051020-143217.511 | UAC | RESIP:TRANSACTION | 6124 |
TimerQueue.cxx:85 | Adding timer: Timer B tid=fb36831df16a5517 ms=32000
DEBUG | 20051020-143217.511 | UAC | RESIP:TRANSPORT | 6124 |
TransportSelector.cxx:243 | Looking up dns entries for
sip:8665722037 at 10.10.1.14:5060
DEBUG | 20051020-143217.511 | UAC | RESIP:DNS | 6124 | DnsResult.cxx:183
| DnsResult::lookup sip:8665722037 at 10.10.1.14:5060
DEBUG | 20051020-143217.511 | UAC | RESIP:DNS | 6124 | DnsResult.cxx:291
| Numeric result so return immediately: [ V4 10.10.1.14:5060 UDP
connectionId=0 ]
DEBUG | 20051020-143217.527 | UAC | RESIP:TRANSACTION | 6124 |
TimerQueue.cxx:85 | Adding timer: Timer A tid=fb36831df16a5517 ms=500
DEBUG | 20051020-143217.527 | UAC | RESIP:TRANSPORT | 6124 |
TransportSelector.cxx:479 | Looked up source for destination: [ V4
10.10.1.14:5060 UDP connectionId=0 ] -> [ V4 10.10.1.151:5060 UDP
connectionId=0 ] sent-by= sent-port=5060

 

 

Thanks,

Mehul.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.resiprocate.org/pipermail/resiprocate-devel/attachments/20051021/6727215f/attachment.htm>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: TCP_INVITE_Log.txt
URL: <http://list.resiprocate.org/pipermail/resiprocate-devel/attachments/20051021/6727215f/attachment.txt>


More information about the resiprocate-devel mailing list