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

RE: [reSIProcate] Unable to use "getTimeTillNextProcessMS" as anargument for fdset.selectMilliSeconds


In order to implement a fully blocking process loop - You will need to use the SelectInterruptor (pass into SipStack constructor as an AsyncProcessHandler) object in order to get the select loop to wake up, when you are calling stack->send from another thread.

 


From: resiprocate-devel-bounces@xxxxxxxxxxxxxxxxxxx [mailto:resiprocate-devel-bounces@xxxxxxxxxxxxxxxxxxx] On Behalf Of Mehul Jain
Sent: Tuesday, June 06, 2006 3:50 PM
To: resiprocate-devel@xxxxxxxxxxxxxxxxxxx
Subject: [reSIProcate] Unable to use "getTimeTillNextProcessMS" as anargument for fdset.selectMilliSeconds

 

Im using the resip stack (without dum) to build a sip app on Windows 2003 Server.

 

The app runs fine when the stack initialization is of the form :

SipStack* g_sipStack;

unsigned int __stdcall foo(void* arg)
{
 g_sipStack = new SipStack();
 g_sipStack->addTransport(UDP, 5060);

 

 while (true)
 {
  FdSet fdset;
  g_sipStack->buildFdSet(fdset);
  int err = fdset.selectMilliSeconds(20);
  assert (err != -1);
  g_sipStack->process(fdset);
  SharedPtr<SipMessage> receivedMsg(g_sipStack->receive());

  .....
}

 

The reSip log for this app when I send an INVITE are :

INFO | 20060606-121330.218 | b2bua | RESIP:TRANSPORT | 5736 | UdpTransport.cxx:34 | Creating UDP transport host= port=5060 ipv4=1
DEBUG | 20060606-121330.218 | b2bua | RESIP:TRANSPORT | 5736 | InternalTransport.cxx:86 | Creating fd=1732 V4/UDP
DEBUG | 20060606-121330.218 | b2bua | RESIP:TRANSPORT | 5736 | InternalTransport.cxx:94 | Binding to 0.0.0.0
DEBUG | 20060606-121330.250 | b2bua | RESIP:TRANSPORT | 5736 | TransportSelector.cxx:121 | Adding transport: [ V4 0.0.0.0:5060 UDP target domain=unspecified connectionId=0 ]
DEBUG | 20060606-121340.187 | b2bua | RESIP | 1012 | SipStack.cxx:278 | SEND: SipReq:  INVITE
8777105885@xxxxxxxxxxx:5060 tid=ca046d02d330853e cseq=INVITE contact=4152484001@xxxxxxxxxxx:5060 / 1 from(tu)
STACK | 20060606-121340.187 | b2bua | RESIP:TRANSACTION | 5736 | TransactionState.cxx:218 | No matching transaction for SipReq:  INVITE
8777105885@xxxxxxxxxxx:5060 tid=ca046d02d330853e cseq=INVITE contact=4152484001@xxxxxxxxxxx:5060 / 1 from(tu)
STACK | 20060606-121340.187 | b2bua | RESIP:TRANSACTION | 5736 | TransactionState.cxx:51 | Creating new TransactionState: tid=ca046d02d330853e [ ClientInvite/Calling reliable target=[ V4 0.0.0.0:0 UNKNOWN_TRANSPORT target domain=unspecified connectionId=0 ]]
STACK | 20060606-121340.187 | b2bua | RESIP:TRANSACTION | 5736 | TransactionState.cxx:606 | TransactionState::processClientInvite: SipReq:  INVITE
8777105885@xxxxxxxxxxx:5060 tid=ca046d02d330853e cseq=INVITE contact=4152484001@xxxxxxxxxxx:5060 / 1 from(tu) tid=ca046d02d330853e [ ClientInvite/Calling reliable target=[ V4 0.0.0.0:0 UNKNOWN_TRANSPORT target domain=unspecified connectionId=0 ]]
DEBUG | 20060606-121340.187 | b2bua | RESIP:TRANSACTION | 5736 | TimerQueue.cxx:85 | Adding timer: Timer B tid=ca046d02d330853e ms=32000
STACK | 20060606-121340.187 | b2bua | RESIP:TRANSACTION | 5736 | TransactionState.cxx:1564 | sendToWire with no dns result: tid=ca046d02d330853e [ ClientInvite/Calling reliable target=[ V4 0.0.0.0:0 UNKNOWN_TRANSPORT target domain=unspecified connectionId=0 ]]
DEBUG | 20060606-121340.187 | b2bua | RESIP:TRANSPORT | 5736 | TransportSelector.cxx:247 | Looking up dns entries for sip:8777105885@xxxxxxxxxxx:5060;transport=udp
DEBUG | 20060606-121340.187 | b2bua | RESIP:DNS | 5736 | DnsResult.cxx:184 | DnsResult::lookup sip:8777105885@xxxxxxxxxxx:5060;transport=udp
DEBUG | 20060606-121340.187 | b2bua | RESIP:DNS | 5736 | DnsResult.cxx:221 | Found immediate result: [ V4 10.10.1.170:5060 UDP target domain=10.10.1.170 connectionId=0 ]
STACK | 20060606-121340.187 | b2bua | RESIP:TRANSACTION | 5736 | TransactionState.cxx:1396 | tid=ca046d02d330853e [ ClientInvite/Calling reliable target=[ V4 0.0.0.0:0 UNKNOWN_TRANSPORT target domain=unspecified connectionId=0 ]] got DNS result: 10.10.1.170 --> [[ V4 10.10.1.170:5060 UDP target domain=10.10.1.170 connectionId=0 ]]
STACK | 20060606-121340.187 | b2bua | RESIP:DNS | 5736 | DnsResult.cxx:141 | Returning next dns entry: [ V4 10.10.1.170:5060 UDP target domain=10.10.1.170 connectionId=0 ]
STACK | 20060606-121340.187 | b2bua | RESIP:TRANSACTION | 5736 | TransactionState.cxx:1439 | Unreliable transport: tid=ca046d02d330853e [ ClientInvite/Calling unreliable target=[ V4 0.0.0.0:0 UNKNOWN_TRANSPORT target domain=unspecified connectionId=0 ]]
DEBUG | 20060606-121340.187 | b2bua | RESIP:TRANSACTION | 5736 | TimerQueue.cxx:85 | Adding timer: Timer A tid=ca046d02d330853e ms=500
DEBUG | 20060606-121340.187 | b2bua | RESIP:TRANSPORT | 5736 | TransportSelector.cxx:483 | Looked up source for destination: [ V4 10.10.1.170:5060 UDP target domain=10.10.1.170 connectionId=0 ] -> [ V4 10.10.1.173:5060 UDP target domain=10.10.1.170 connectionId=0 ] sent-by= sent-port=5060
DEBUG | 20060606-121340.187 | b2bua | RESIP:TRANSPORT | 5736 | TransportSelector.cxx:753 | findTransport([ V4 10.10.1.173:5060 UDP target domain=10.10.1.170 connectionId=0 ])
DEBUG | 20060606-121340.187 | b2bua | RESIP:TRANSPORT | 5736 | TransportSelector.cxx:772 | findTransport (any interface) => Transport: [ V4 0.0.0.0:5060 UDP target domain=unspecified connectionId=0 ]
DEBUG | 20060606-121340.203 | b2bua | RESIP:TRANSPORT | 5736 | TransportSelector.cxx:671 | Transmitting to [ V4 10.10.1.170:5060 UDP target domain=10.10.1.170 received on: Transport: [ V4 0.0.0.0:5060 UDP target domain=unspecified connectionId=0 ] connectionId=0 ] tlsDomain= via [ V4 10.10.1.173:5060 UDP target domain=10.10.1.170 connectionId=0 ]INVITE sip:8777105885@xxxxxxxxxxx:5060;transport=udp SIP/2.0

 

Via: SIP/2.0/UDP 10.10.1.173:5060;branch=z9hG4bK-d87543-ca046d02d330853e-1--d87543-;rport

....

 

 

 

 

 

When I try to run the app using "getTimeTillNextProcessMS", i.e. "int err = fdset.selectMilliSeconds(g_sipStack->getTimeTillNextProcessMS());" the INVITE is not sent (no messages on the ethereal trace).

The source code for the app is :

SipStack* g_sipStack;

unsigned int __stdcall foo(void* arg)
{
 g_sipStack = new SipStack();
 g_sipStack->addTransport(UDP, 5060);

 

 while (true)
 {
  FdSet fdset;
  g_sipStack->buildFdSet(fdset);
  int err = fdset.selectMilliSeconds((g_sipStack->getTimeTillNextProcessMS());
  assert (err != -1);
  g_sipStack->process(fdset);
  SharedPtr<SipMessage> receivedMsg(g_sipStack->receive());

  .....
}

 

The only difference is in the "fdset.selectMilliSeconds" function's parameters. Initially, I was using a hardcoded value of 20. Now Im using the sipStack's function getTimeTillNextProcessMS().

The complete reSip log for this app when I send an INVITE are :

INFO | 20060606-121544.497 | b2bua | RESIP:TRANSPORT | 2852 | UdpTransport.cxx:34 | Creating UDP transport host= port=5060 ipv4=1
DEBUG | 20060606-121544.513 | b2bua | RESIP:TRANSPORT | 2852 | InternalTransport.cxx:86 | Creating fd=1728 V4/UDP
DEBUG | 20060606-121544.513 | b2bua | RESIP:TRANSPORT | 2852 | InternalTransport.cxx:94 | Binding to 0.0.0.0
DEBUG | 20060606-121544.528 | b2bua | RESIP:TRANSPORT | 2852 | TransportSelector.cxx:121 | Adding transport: [ V4 0.0.0.0:5060 UDP target domain=unspecified connectionId=0 ]
DEBUG | 20060606-121554.528 | b2bua | RESIP | 1400 | SipStack.cxx:278 | SEND: SipReq:  INVITE
8777105885@xxxxxxxxxxx:5060 tid=060bf6711c1fbb02 cseq=INVITE contact=4152484001@xxxxxxxxxxx:5060 / 1 from(tu)

 

Any pointers as to what's missing ?

 

Regards,

Mehul.