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

Re: [reSIProcate] Newbe question about sending sip packets


On 10/8/05, Lorenzo <webmaster@xxxxxxxxxxxxx> wrote:
> Hi all,
> I want to make a simple (maybe the simplest!) program to send a simple
> sipmessage using resiprocate stack and a simple udp trasport.
> I compile it on linux and windows and it's correct but it doesn't send
> any packet!!
> Does someone know what's wrong with this code?
>

The SipStack needs to be given a chance to run. The call to sendTo is
not syncronous. Take a look at 
http://scm.sipfoundry.org/rep/resiprocate/main/resip/stack/test/testStack.cxx
for a basic example of how to use the stack.



> Thank you,
>
> Lorenzo
> ------------------------------------------------------------
>
> #include "resiprocate/SipStack.hxx"
> #include "resiprocate/Helper.hxx"
> #include "resiprocate/SipMessage.hxx"
> #include "resiprocate/Uri.hxx"
> #include "resiprocate/os/Data.hxx"
> #include "resiprocate/os/DnsUtil.hxx"
> #include "resiprocate/os/Logger.hxx"
> #include "resiprocate/os/DataStream.hxx"
>
> using namespace resip;
> using namespace std;
>
> int main()
> {
>         resip::SipStack* stack(new SipStack());
>         Uri outboundProxy = Uri("sip:192.168.0.1:5060:trasport=UDP");
>         stack->addTransport(UDP, 5060, V4 );
>
>         NameAddr target;
>         target.uri().scheme() = "sip";
>         target.uri().user() = "Lorenzo";
>         target.uri().host() = "192.168.0.1";
>         target.uri().port() = 5060;
>
>         NameAddr from = target;
>         from.uri().user() = "192.168.0.100";
>         NameAddr contact = from;
>         SipMessage* next = Helper::makeRegister( target, from, contact);
>         stack->sendTo(next,outboundProxy);
>         delete stack;
>         return 0;
> }
> -------------------------------
>
> _______________________________________________
> resiprocate-devel mailing list
> resiprocate-devel@xxxxxxxxxxxxxxxxxxx
> https://list.sipfoundry.org/mailman/listinfo/resiprocate-devel
>